llvm-project/llvm/test/Transforms/LoopIdiom
Craig Topper ed6acde8cf [LoopIdiomRecognize] Don't convert a do while loop to ctlz.
This commit suppresses turning loops like this into "(bitwidth - ctlz(input))".

unsigned foo(unsigned input) {
  unsigned num = 0;
  do {
    ++num;
    input >>= 1;
  } while (input != 0);
  return num;
}

The loop version returns a value of 1 for both an input of 0 and an input of 1. Converting to a naive ctlz does not preserve that.

Theoretically we could do better if we checked isKnownNonZero or we could insert a select to handle the divergence. But until we have motivating cases for that, this is the easiest solution.

llvm-svn: 336864
2018-07-11 22:35:28 +00:00
..
AMDGPU
ARM [ValueTracking] Match select abs pattern when there's an sext involved 2018-06-04 16:53:57 +00:00
X86 [LoopIdiomRecognize] Don't convert a do while loop to ctlz. 2018-07-11 22:35:28 +00:00
basic-address-space.ll
basic.ll [LoopIdiom] Be more aggressive when setting alignment in memcpy 2018-02-08 17:33:08 +00:00
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 llvm: Add support for "-fno-delete-null-pointer-checks" 2018-07-09 22:27:23 +00:00
pr33114.ll
scev-invalidation.ll
struct-custom-dl.ll Adding a width of the GEP index to the Data Layout. 2018-02-14 06:58:08 +00:00
struct.ll
struct_pattern.ll
unordered-atomic-memcpy-noarch.ll
unroll-custom-dl.ll Adding a width of the GEP index to the Data Layout. 2018-02-14 06:58:08 +00:00
unroll.ll
unsafe.ll
unwind.ll