1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/lib/Transforms/Scalar
Haicheng Wu 139c3be6db [JumpThreading] Don't select an edge that we know we can't thread
In r312664 (D36404), JumpThreading stopped threading edges into
loop headers. Unfortunately, I observed a significant performance
regression as a result of this change. Upon further investigation,
the problematic pattern looked something like this (after
many high level optimizations):

while (true) {
    bool cond = ...;
    if (!cond) {
        <body>
    }
    if (cond)
        break;
}

Now, naturally we want jump threading to essentially eliminate the
second if check and hook up the edges appropriately. However, the
above mentioned change, prevented it from doing this because it would
have to thread an edge into the loop header.

Upon further investigation, what is happening is that since both branches
are threadable, JumpThreading picks one of them at arbitrarily. In my
case, because of the way that the IR ended up, it tended to pick
the one to the loop header, bailing out immediately after. However,
if it had picked the one to the exit block, everything would have
worked out fine (because the only remaining branch would then be folded,
not thraded which is acceptable).

Thus, to fix this problem, we can simply eliminate loop headers from
consideration as possible threading targets earlier, to make sure that
if there are multiple eligible branches, we can still thread one of
the ones that don't target a loop header.

Patch by Keno Fischer!
Differential Revision: https://reviews.llvm.org/D42260

llvm-svn: 328798
2018-03-29 16:01:26 +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
CallSiteSplitting.cpp [CallSiteSplitting] Preserve DominatorTreeAnalysis. 2018-03-22 15:23:33 +00:00
CMakeLists.txt Remove the LoopInstSimplify pass (-loop-instsimplify) 2018-03-12 20:49:42 +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
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
GuardWidening.cpp [GuardWidening] Group code by class [NFC] 2018-03-23 23:41:47 +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
InductiveRangeCheckElimination.cpp [IRCE] Enable decreasing loops of non-const bound 2018-03-27 08:24:53 +00:00
IndVarSimplify.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
InferAddressSpaces.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
IVUsersPrinter.cpp
JumpThreading.cpp [JumpThreading] Don't select an edge that we know we can't thread 2018-03-29 16:01:26 +00:00
LICM.cpp Fix a block copying problem in LICM 2018-03-23 17:36:18 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopAccessAnalysisPrinter.cpp
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 Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopLoadElimination.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopPassManager.cpp
LoopPredication.cpp [LoopPredication] Add profitability check based on BPI 2018-03-22 16:03:59 +00:00
LoopRerollPass.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopRotation.cpp [LoopRotate] Restructuring LoopRotation.cpp to create Loop Rotation Pass with Loop Rotation Utility Interface 2018-03-29 08:48:15 +00:00
LoopSimplifyCFG.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopSink.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopStrengthReduce.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopUnrollPass.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LoopUnswitch.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
LoopVersioningLICM.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LowerExpectIntrinsic.cpp
LowerGuardIntrinsic.cpp
MemCpyOptimizer.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
MergedLoadStoreMotion.cpp Mark MergedLoadStoreMotion as not preserving MemDep results 2018-02-23 10:41:57 +00:00
MergeICmps.cpp 80-line wrap. NFC 2018-03-27 19:43:02 +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 Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
RewriteStatepointsForGC.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
Scalar.cpp Oops - moved slightly too many things from Scalar to Utils. Move LoopSimplifyCFG things back 2018-03-28 18:03:25 +00:00
Scalarizer.cpp
SCCP.cpp Revert r328307: [IPSCCP] Use constant range information for comparisons of parameters. 2018-03-23 12:49:39 +00:00
SeparateConstOffsetFromGEP.cpp Plumb useAA through TargetTransformInfo to remove Transforms->CodeGen header dependency 2018-03-28 22:28:50 +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
SROA.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
StraightLineStrengthReduce.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
StructurizeCFG.cpp Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h 2018-03-28 17:44:36 +00:00
TailRecursionElimination.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00