Skip to content

Commit 2de4c92

Browse files
[LLVM][LangRef] Remove "n > 0" restriction from get.active.lanes.mask.
The specification for get.active.lanes.mask says a limit value of zero results in poison. This seems like an artificial restriction and means you cannot use the intrinsic to create minimal loops of the form: foo(int count, ....) { int i = 0; while (mask = get.active.lane.mask(i, count)) { ; do work i += count_bits(mask); } } I cannot see any code that generates poison in this case, in fact ConstantFoldFixedVectorCall returns the logical result (i.e. an all false vector). There are also cases like `can_overflow_i64_induction_var` in sve-tail-folding-overflow-checks.ll that look broken by the current definition? for the case when "%N <= vscale * 4". For these reasons I'm asking if we can simply remove the restriction?
1 parent 9b2b5bf commit 2de4c92

File tree

3 files changed

+1
-48
lines changed

3 files changed

+1
-48
lines changed

llvm/docs/LangRef.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24014,8 +24014,7 @@ indexed by ``i``, and ``%base``, ``%n`` are the two arguments to
2401424014
``llvm.get.active.lane.mask.*``, ``%icmp`` is an integer compare and ``ult``
2401524015
the unsigned less-than comparison operator. Overflow cannot occur in
2401624016
``(%base + i)`` and its comparison against ``%n`` as it is performed in integer
24017-
numbers and not in machine numbers. If ``%n`` is ``0``, then the result is a
24018-
poison value. The above is equivalent to:
24017+
numbers and not in machine numbers. The above is equivalent to:
2401924018

2402024019
::
2402124020

llvm/lib/Analysis/Lint.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,6 @@ void Lint::visitCallBase(CallBase &I) {
374374
visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI),
375375
std::nullopt, nullptr, MemRef::Read | MemRef::Write);
376376
break;
377-
case Intrinsic::get_active_lane_mask:
378-
if (auto *TripCount = dyn_cast<ConstantInt>(I.getArgOperand(1)))
379-
Check(!TripCount->isZero(),
380-
"get_active_lane_mask: operand #2 "
381-
"must be greater than 0",
382-
&I);
383-
break;
384377
}
385378
}
386379

llvm/test/Analysis/Lint/get-active-lane-mask.ll

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)