forked from OSchip/llvm-project
a3f39ee33d
We currently recognize this idiom where x is signed and thus the shift in an ashr. int cnt = 0; while (x) { x >>= 1; // arithmetic shift right ++cnt; } and turn it into (bitwidth - ctlz(x)). And if there is anything else in the loop we will create a new loop that runs that many times. If x is initially negative, the shift result will never be 0 and thus the loop is infinite. If you put something with side effects in the loop, that side effect will now only happen bitwidth times instead of an infinite number of times. So this transform is only safe for logical shift right (which we don't currently recognize) or if we can prove that x cannot be negative before the loop. llvm-svn: 331493 |
||
---|---|---|
.. | ||
AMDGPU | ||
ARM | ||
X86 | ||
basic-address-space.ll | ||
basic.ll | ||
crash.ll | ||
ctpop-multiple-users-crash.ll | ||
debug-line.ll | ||
int_sideeffect.ll | ||
lir-heurs-multi-block-loop.ll | ||
memset_noidiom.ll | ||
non-canonical-loop.ll | ||
non-integral-pointers.ll | ||
nontemporal_store.ll | ||
pr28196.ll | ||
pr33114.ll | ||
scev-invalidation.ll | ||
struct-custom-dl.ll | ||
struct.ll | ||
struct_pattern.ll | ||
unordered-atomic-memcpy-noarch.ll | ||
unroll-custom-dl.ll | ||
unroll.ll | ||
unsafe.ll | ||
unwind.ll |