Skip to content

Commit d18eca0

Browse files
[LLVM][LangRef] Remove "n > 0" restriction from get.active.lanes.mask. (#152140)
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".
1 parent 619d36f commit d18eca0

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
@@ -24033,8 +24033,7 @@ indexed by ``i``, and ``%base``, ``%n`` are the two arguments to
2403324033
``llvm.get.active.lane.mask.*``, ``%icmp`` is an integer compare and ``ult``
2403424034
the unsigned less-than comparison operator. Overflow cannot occur in
2403524035
``(%base + i)`` and its comparison against ``%n`` as it is performed in integer
24036-
numbers and not in machine numbers. If ``%n`` is ``0``, then the result is a
24037-
poison value. The above is equivalent to:
24036+
numbers and not in machine numbers. The above is equivalent to:
2403824037

2403924038
::
2404024039

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)