llvm-project/llvm/test/Transforms/LoopIdiom
Roman Lebedev 25aebe2ccf
[LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next
While `%x.curr` is always safe to compute, because `LoopBackedgeTakenCount`
will always be smaller than `bitwidth(X)`, i.e. we never get poison,
rewriting `%x.next` is more complicated, however, because `X << LoopTripCount`
will be poison iff `LoopTripCount == bitwidth(X)` (which will happen
iff `BitPos` is `bitwidth(x) - 1` and `X` is `1`).

So unless we know that isn't the case (as alive2 notes, we know it's safe
to do iff shift had no-wrap flags, or bitpos does not indicate signbit,
or we know that %x is never `1`), we'll need to emit an alternative,
safe IR, by either just shifting the `%x.curr`, or conditionally selecting
between the computed `%x.next` and `0`..
Former IR looks better so let's do that.

While there, ensure that we don't drop no-wrap flags from said shift.
2020-12-24 21:20:52 +03:00
..
AMDGPU
ARM
X86 [LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next 2020-12-24 21:20:52 +03:00
basic-address-space.ll
basic.ll [InferAttrs] Add nocapture/writeonly to string/mem libcalls 2020-10-29 20:06:43 +01:00
crash.ll
ctpop-multiple-users-crash.ll
dbginfo-cost.ll
debug-line.ll
disable-options.ll [LoopIdiomRecognizePass] Options to disable part or the entire Loop Idiom Recognize Pass 2020-09-01 13:59:24 +00:00
expander-do-not-delete-reused-values.ll [LoopIdiom,LSR] Add additional tests for SCEVExpander cleanups. 2020-08-21 13:48:31 +01:00
int_sideeffect.ll
lir-heurs-multi-block-loop.ll
memcpy-debugify-remarks.ll
memcpy-vectors.ll [SVE] In LoopIdiomRecognize::isLegalStore bail out for scalable vectors 2020-09-14 11:28:31 +01:00
memset-debugify-remarks.ll
memset_noidiom.ll
non-canonical-loop.ll
non-integral-pointers.ll Fix a bug in memset formation with vectors of non-integral pointers 2020-10-01 16:11:11 -07:00
nontemporal_store.ll
phi-insertion.ll
pr28196.ll
pr33114.ll
reuse-cast.ll [SCEVExpander] Avoid re-using existing casts if it means updating users. 2020-08-09 13:25:17 +01:00
scev-invalidation.ll
scev-invalidation_topmostloop.ll [NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such 2020-12-17 01:03:49 +03:00
struct-custom-dl.ll
struct.ll
struct_pattern.ll
unordered-atomic-memcpy-noarch.ll
unroll-custom-dl.ll
unroll.ll
unsafe.ll
unwind.ll