llvm-6502/include/llvm
Andrea Di Biagio 70a7cda495 [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz.
If the control flow is modelling an if-statement where the only instruction in
the 'then' basic block (excluding the terminator) is a call to cttz/ctlz,
CodeGenPrepare can try to speculate the cttz/ctlz call and simplify the control
flow graph.

Example:
\code
entry:
  %cmp = icmp eq i64 %val, 0
  br i1 %cmp, label %end.bb, label %then.bb

then.bb:
  %c = tail call i64 @llvm.cttz.i64(i64 %val, i1 true)
  br label %end.bb

end.bb:
  %cond = phi i64 [ %c, %then.bb ], [ 64, %entry]
\code

In this example, basic block %then.bb is taken if value %val is not zero.
Also, the phi node in %end.bb would propagate the size-of in bits of %val
only if %val is equal to zero.

With this patch, CodeGenPrepare will try to hoist the call to cttz from %then.bb
into basic block %entry only if cttz is cheap to speculate for the target.

Added two new hooks in TargetLowering.h to let targets customize the behavior
(i.e. decide whether it is cheap or not to speculate calls to cttz/ctlz). The
two new methods are 'isCheapToSpeculateCtlz' and 'isCheapToSpeculateCttz'.
By default, both methods return 'false'.
On X86, method 'isCheapToSpeculateCtlz' returns true only if the target has
LZCNT. Method 'isCheapToSpeculateCttz' only returns true if the target has BMI.

Differential Revision: http://reviews.llvm.org/D6728


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224899 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-28 11:07:35 +00:00
..
ADT Update SmallPtrSet::insert's doc comment to match the new return type 2014-12-19 21:45:11 +00:00
Analysis Sink store based on alias analysis 2014-12-15 14:09:53 +00:00
AsmParser
Bitcode Modernize the getStreamedBitcodeModule interface a bit. NFC. 2014-12-18 05:08:43 +00:00
CodeGen LiveInterval: Introduce createMainRangeFromSubranges(). 2014-12-24 02:11:51 +00:00
Config Adding a new option to CMake to disable C++ atexit on llvm-shlib. 2014-12-09 18:49:55 +00:00
DebugInfo [DebugInfo] Move all DWARF headers to the public include directory. 2014-12-19 18:26:33 +00:00
ExecutionEngine [MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC. 2014-12-03 00:51:19 +00:00
IR Masked Load/Store - Changed the order of parameters in intrinsics. 2014-12-25 07:49:20 +00:00
IRReader
LineEditor
Linker Turn some DenseMaps that are only used for set operations into DenseSets. 2014-12-06 19:22:54 +00:00
LTO Remove StringMap::GetOrCreateValue in favor of StringMap::insert 2014-11-19 05:49:42 +00:00
MC MC: Label definitions are permitted after .set directives 2014-12-24 10:27:50 +00:00
Object Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers. 2014-12-23 22:56:39 +00:00
Option
ProfileData llvm-cov: Sink some reporting logic into CoverageMapping 2014-11-14 01:50:32 +00:00
Support Another attempt to fix the LLVM Windows build bot lld-x86_64-win7, one last place to fix I think. 2014-12-24 00:16:51 +00:00
TableGen Make MultiClass::DefPrototypes own their Records to fix memory leaks. 2014-12-11 05:25:33 +00:00
Target [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz. 2014-12-28 11:07:35 +00:00
Transforms [LCSSA] Handle PHI insertion in disjoint loops 2014-12-22 22:35:46 +00:00
CMakeLists.txt
InitializePasses.h InstrProf: An intrinsic and lowering for instrumentation based profiling 2014-12-08 18:02:35 +00:00
LinkAllIR.h
LinkAllPasses.h InstrProf: An intrinsic and lowering for instrumentation based profiling 2014-12-08 18:02:35 +00:00
module.modulemap Update the modules build to match r223802. 2014-12-12 02:25:18 +00:00
module.modulemap.build
Pass.h
PassAnalysisSupport.h
PassInfo.h
PassManager.h
PassRegistry.h
PassSupport.h Defining a new API for debug options that doesn't rely on static global cl::opts. 2014-10-15 21:54:35 +00:00