llvm-project/llvm/lib/Transforms/Scalar
Anna Thomas 9b1176b0ef [LoopPredication] Add profitability check based on BPI
Summary:
LoopPredication is not profitable when the loop is known to always exit
through some block other than the latch block.
A coarse grained latch check can cause loop predication to predicate the
loop, and unconditionally deoptimize.

However, without predicating the loop, the guard may never fail within the
loop during the dynamic execution because the non-latch loop termination
condition exits the loop before the latch condition causes the loop to
exit.
We teach LP about this using BranchProfileInfo pass.

Reviewers: apilipenko, skatkov, mkazantsev, reames

Reviewed by: skatkov

Subscribers: llvm-commits

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

llvm-svn: 328210
2018-03-22 16:03:59 +00:00
..
ADCE.cpp [ADCE] Use MapVector for BlockInfo to make iteration order deterministic 2017-11-03 14:15:08 +00:00
AlignmentFromAssumptions.cpp [AlignmentFromAssumptions] Set source and dest alignments of memory intrinsiscs separately 2018-02-22 18:55:59 +00:00
BDCE.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
CMakeLists.txt Remove the LoopInstSimplify pass (-loop-instsimplify) 2018-03-12 20:49:42 +00:00
CallSiteSplitting.cpp [CallSiteSplitting] Preserve DominatorTreeAnalysis. 2018-03-22 15:23:33 +00:00
ConstantHoisting.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
ConstantProp.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
CorrelatedValuePropagation.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
DCE.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
DeadStoreElimination.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
DivRemPairs.cpp [DivRempairs] add a pass to optimize div/rem pairs (PR31028) 2017-09-09 13:38:18 +00:00
EarlyCSE.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
FlattenCFGPass.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +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 Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
GVNHoist.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
GVNSink.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +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 Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
InductiveRangeCheckElimination.cpp [New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager 2018-03-15 11:01:19 +00:00
InferAddressSpaces.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
JumpThreading.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LICM.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopAccessAnalysisPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
LoopDataPrefetch.cpp [NFC] fix trivial typos in comments 2018-01-19 10:55:29 +00:00
LoopDeletion.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopDistribute.cpp [Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees 2018-02-28 11:00:08 +00:00
LoopIdiomRecognize.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopInterchange.cpp DA: remove uses of GEP, only ask SCEV 2018-03-06 21:55:59 +00:00
LoopLoadElimination.cpp Add MemorySSA as loop dependency, disabled by default [NFC]. 2017-11-21 15:45:46 +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] Add profitability check based on BPI 2018-03-22 16:03:59 +00:00
LoopRerollPass.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopRotation.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopSimplifyCFG.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopSink.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopStrengthReduce.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopUnrollPass.cpp [LoopUnroll] Peel off iterations if it makes conditions true/false. 2018-03-15 21:34:43 +00:00
LoopUnswitch.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopVersioningLICM.cpp This change add's optimization remark in LoopVersioning LICM pass. 2018-01-23 09:47:28 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +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 Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
MergeICmps.cpp [MergeICmps] Break eargerly out of loop 2018-03-20 12:03:25 +00:00
MergedLoadStoreMotion.cpp Mark MergedLoadStoreMotion as not preserving MemDep results 2018-02-23 10:41:57 +00:00
NaryReassociate.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
NewGVN.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
PartiallyInlineLibCalls.cpp [PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg rather than result 2017-11-27 21:15:43 +00:00
PlaceSafepoints.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
Reassociate.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
Reg2Mem.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
RewriteStatepointsForGC.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
SCCP.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
SROA.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
Scalar.cpp [New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager 2018-03-15 11:01:19 +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 Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
SimpleLoopUnswitch.cpp [Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees 2018-02-28 11:00:08 +00:00
SimplifyCFGPass.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
Sink.cpp [Sink] Really really fix predicate in legality check 2018-01-11 21:28:57 +00:00
SpeculateAroundPHIs.cpp Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
SpeculativeExecution.cpp Revert r301950: SpeculativeExecution: Stop using whitelist for costs 2017-05-10 12:30:07 +00:00
StraightLineStrengthReduce.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
StructurizeCFG.cpp Revert "StructurizeCFG: Test for branch divergence correctly" 2018-02-24 17:29:09 +00:00
TailRecursionElimination.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00