llvm-project/llvm/test
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
..
Analysis [TargetTransformInfo] Add pow2 analysis for scalar constants 2018-07-11 17:51:27 +00:00
Assembler ConstantFold: Don't fold global address vs. null for addrspace != 0 2018-06-26 18:55:43 +00:00
Bindings
Bitcode [FileCheck] Add -allow-deprecated-dag-overlap to failing llvm tests 2018-07-11 20:25:49 +00:00
BugPoint
CodeGen finish: [FileCheck] Add -allow-deprecated-dag-overlap to failing llvm tests 2018-07-11 20:31:51 +00:00
DebugInfo [Debugify] Allow unsigned values narrower than their variables 2018-07-06 17:32:40 +00:00
Examples
ExecutionEngine Revert "Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code models"" 2018-06-28 17:56:43 +00:00
Feature
FileCheck [FileCheck] Don't permit overlapping CHECK-DAG 2018-07-11 20:27:27 +00:00
Instrumentation [FileCheck] Add -allow-deprecated-dag-overlap to failing llvm tests 2018-07-11 20:25:49 +00:00
Integer
JitListener
LTO [ThinLTO] Add per-module indexes to combined index consistently 2018-06-26 01:32:58 +00:00
Linker
MC Quick fix for some Windows bots 2018-07-11 18:51:15 +00:00
Object [ELF] Change isSectionData to exclude SHF_EXECINSTR 2018-06-23 00:15:33 +00:00
ObjectYAML
Other [PGOMemOPSize] Preserve the DominatorTree 2018-07-09 08:07:21 +00:00
SafepointIRVerifier
SymbolRewriter
TableGen [TableGen] Add a general-purpose JSON backend. 2018-07-11 08:40:19 +00:00
ThinLTO/X86 [FileCheck] Add -allow-deprecated-dag-overlap to failing llvm tests 2018-07-11 20:25:49 +00:00
Transforms [LoopIdiomRecognize] Don't convert a do while loop to ctlz. 2018-07-11 22:35:28 +00:00
Unit
Verifier Revert "Add support for generating a call graph profile from Branch Frequency Info." 2018-06-28 13:15:03 +00:00
YAMLParser
tools Revert "[llvm-objdump] Add -demangle (-C) option" 2018-07-11 18:09:52 +00:00
.clang-format
CMakeLists.txt
TestRunner.sh
lit.cfg.py [LIT] Enable testing of LLVM gold plugin on Mac OS X 2018-06-20 15:32:47 +00:00
lit.site.cfg.py.in