llvm-project/llvm/lib/Transforms/Scalar
Florian Hahn d0208b4b1c Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.

Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to ret i32 2 with
this change

    source_filename = "sccp.c"
    target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    ; Function Attrs: norecurse nounwind readnone uwtable
    define i32 @main() local_unnamed_addr #0 {
    entry:
      %call = tail call fastcc i32 @f(i32 1)
      %call1 = tail call fastcc i32 @f(i32 47)
      %add3 = add nsw i32 %call, %call1
      ret i32 %add3
    }

    ; Function Attrs: noinline norecurse nounwind readnone uwtable
    define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
    entry:
      %c1 = icmp sle i32 %x, 100

      %cmp = icmp sgt i32 %x, 300
      %. = select i1 %cmp, i32 1, i32 2
      ret i32 %.
    }

    attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

Differential Revision: https://reviews.llvm.org/D36656

llvm-svn: 316891
2017-10-30 10:07:42 +00:00
..
ADCE.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-13 21:17:07 +00:00
AlignmentFromAssumptions.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
BDCE.cpp [BDCE] Don't check demanded bits on unsized types 2017-08-16 16:09:22 +00:00
CMakeLists.txt [DivRempairs] add a pass to optimize div/rem pairs (PR31028) 2017-09-09 13:38:18 +00:00
ConstantHoisting.cpp [Transforms] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-09-13 21:43:53 +00:00
ConstantProp.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CorrelatedValuePropagation.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-13 21:17:07 +00:00
DCE.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
DeadStoreElimination.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-13 21:17:07 +00:00
DivRemPairs.cpp [DivRempairs] add a pass to optimize div/rem pairs (PR31028) 2017-09-09 13:38:18 +00:00
EarlyCSE.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-13 21:17:07 +00:00
FlattenCFGPass.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Float2Int.cpp [Float2Int] Replace a ConstantRange copy with a move. Remove an extra call to MapVector::find. 2017-05-05 17:09:29 +00:00
GVN.cpp [GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE 2017-10-30 04:48:34 +00:00
GVNHoist.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-13 21:17:07 +00:00
GVNSink.cpp [GVNSink] Fix failing GVNSink tests in the reverse iteration bot 2017-10-23 19:56:52 +00:00
GuardWidening.cpp Guard print() functions only used by dump() functions. 2017-07-31 10:07:49 +00:00
IVUsersPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
IndVarSimplify.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
InductiveRangeCheckElimination.cpp [IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value 2017-10-30 09:35:16 +00:00
InferAddressSpaces.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
JumpThreading.cpp [JumpThreading] Move two PredValueInfoTy vectors to a scope closer to their usage. NFCI 2017-10-16 21:54:13 +00:00
LICM.cpp [LICM] Restructure implicit exit handling to be more clear [NFCI] 2017-10-26 21:00:15 +00:00
LLVMBuild.txt
LoopAccessAnalysisPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
LoopDataPrefetch.cpp [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00
LoopDeletion.cpp [LoopDeletion] Move deleteDeadLoop to to LoopUtils. NFC 2017-10-04 20:42:46 +00:00
LoopDistribute.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
LoopIdiomRecognize.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
LoopInstSimplify.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
LoopInterchange.cpp [LoopInterchange] Fix phi node ordering miscompile. 2017-10-21 13:58:37 +00:00
LoopLoadElimination.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
LoopPassManager.cpp [PM] Teach LoopUnroll to update the LPM infrastructure as it unrolls 2017-01-25 02:49:01 +00:00
LoopPredication.cpp [LoopPredication] Handle the case when the guard and the latch IV have different offsets 2017-10-27 14:46:17 +00:00
LoopRerollPass.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-18 21:46:47 +00:00
LoopRotation.cpp [LoopRotate][Dominators] Use the incremental API to update DomTree 2017-08-17 21:48:19 +00:00
LoopSimplifyCFG.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
LoopSink.cpp [PM] Port LoopSink to the new pass manager. 2017-01-20 08:42:19 +00:00
LoopStrengthReduce.cpp Revert "[ScalarEvolution] Handling for ICmp occuring in the evolution chain." 2017-10-18 22:00:57 +00:00
LoopUnrollPass.cpp Fix MSVC signed/unsigned comparison warning 2017-10-19 15:00:31 +00:00
LoopUnswitch.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
LoopVersioningLICM.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-26 00:55:39 +00:00
LowerAtomic.cpp LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020) 2017-08-23 15:43:28 +00:00
LowerExpectIntrinsic.cpp Fix builin_expect lowering bug 2017-06-07 18:32:24 +00:00
LowerGuardIntrinsic.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemCpyOptimizer.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-18 21:46:47 +00:00
MergeICmps.cpp [Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build bots (NFC). 2017-10-26 01:25:14 +00:00
MergedLoadStoreMotion.cpp [IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC 2017-07-09 07:04:00 +00:00
NaryReassociate.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-17 21:27:42 +00:00
NewGVN.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-20 21:47:29 +00:00
PartiallyInlineLibCalls.cpp [PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has 2017-10-28 00:36:58 +00:00
PlaceSafepoints.cpp All libcalls should be considered to be GC-leaf functions. 2017-07-27 16:49:39 +00:00
Reassociate.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-18 21:46:47 +00:00
Reg2Mem.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
RewriteStatepointsForGC.cpp [RS4GC] Look through vector bitcasts when looking for base pointer 2017-10-13 15:59:13 +00:00
SCCP.cpp Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP. 2017-10-30 10:07:42 +00:00
SROA.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
Scalar.cpp [SimplifyCFG] use pass options and remove the latesimplifycfg pass 2017-10-28 18:43:07 +00:00
Scalarizer.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-20 21:47:29 +00:00
SeparateConstOffsetFromGEP.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-26 00:55:39 +00:00
SimpleLoopUnswitch.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
SimplifyCFGPass.cpp [SimplifyCFG] use pass options and remove the latesimplifycfg pass 2017-10-28 18:43:07 +00:00
Sink.cpp [Sink] Fix predicate in legality check 2017-06-09 19:31:10 +00:00
SpeculativeExecution.cpp Revert r301950: SpeculativeExecution: Stop using whitelist for costs 2017-05-10 12:30:07 +00:00
StraightLineStrengthReduce.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
StructurizeCFG.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-20 21:47:29 +00:00
TailRecursionElimination.cpp [NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure 2017-10-11 17:12:59 +00:00