1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/include/llvm/Transforms/Scalar
Alexey Zhikhartsev 6516543c4b Add jump-threading optimization for deterministic finite automata
The current JumpThreading pass does not jump thread loops since it can
result in irreducible control flow that harms other optimizations. This
prevents switch statements inside a loop from being optimized to use
unconditional branches.

This code pattern occurs in the core_state_transition function of
Coremark. The state machine can be implemented manually with goto
statements resulting in a large runtime improvement, and this transform
makes the switch implementation match the goto version in performance.

This patch specifically targets switch statements inside a loop that
have the opportunity to be threaded. Once it identifies an opportunity,
it creates new paths that branch directly to the correct code block.
For example, the left CFG could be transformed to the right CFG:

```
          sw.bb                        sw.bb
        /   |   \                    /   |   \
   case1  case2  case3          case1  case2  case3
        \   |   /                /       |       \
        latch.bb             latch.2  latch.3  latch.1
         br sw.bb              /         |         \
                           sw.bb.2     sw.bb.3     sw.bb.1
                            br case2    br case3    br case1
```

Co-author: Justin Kreiner @jkreiner
Co-author: Ehsan Amiri @amehsan

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D99205
2021-07-27 14:34:04 -04:00
..
ADCE.h
AlignmentFromAssumptions.h Reland [AssumeBundles] Use operand bundles to encode alignment assumptions 2020-09-12 15:36:06 +02:00
AnnotationRemarks.h [AnnotationRemarks] Remove unneeded Function.h include (NFC). 2021-03-15 21:09:35 +00:00
BDCE.h
CallSiteSplitting.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
ConstantHoisting.h [ConstantHoisting] Remove unused declaration optimizeConstants (NFC) 2020-12-05 16:22:12 -08:00
ConstraintElimination.h [NewPM] Port ConstraintElimination to the new pass manager 2020-09-27 11:12:26 -07:00
CorrelatedValuePropagation.h
DCE.h [DCE] Port -redundant-dbg-inst-elim to NPM 2020-11-14 16:55:20 -08:00
DeadStoreElimination.h
DFAJumpThreading.h Add jump-threading optimization for deterministic finite automata 2021-07-27 14:34:04 -04:00
DivRemPairs.h
EarlyCSE.h
Float2Int.h [Float2Int] Make iteration over Roots deterministic 2020-04-17 21:40:12 +02:00
GuardWidening.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
GVN.h [NFC] MemoryDependenceAnalysis cleanup. 2021-05-31 18:07:55 +03:00
GVNExpression.h Replace uses of std::iterator with explicit using 2021-04-12 10:47:14 -07:00
InductiveRangeCheckElimination.h
IndVarSimplify.h [NFC] Add flag to disable IV widening in indvar instance 2020-11-10 15:10:44 +07:00
InferAddressSpaces.h [NewPM] Port infer-address-spaces 2020-12-28 19:58:12 -08:00
InstSimplifyPass.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
IVUsersPrinter.h
JumpThreading.h ABI breaking changes fixes. 2021-06-15 11:08:13 +01:00
LICM.h [LICM] Create LoopNest Invariant Code Motion (LNICM) pass 2021-07-20 00:31:18 +09:00
LoopAccessAnalysisPrinter.h
LoopBoundSplit.h [SimpleLoopBoundSplit] Split Bound of Loop which has conditional branch with IV 2021-06-07 10:55:25 +01:00
LoopDataPrefetch.h
LoopDeletion.h
LoopDistribute.h
LoopFlatten.h [LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass 2021-05-28 15:43:12 +00:00
LoopFuse.h
LoopIdiomRecognize.h [LoopIdiomRecognizePass] Options to disable part or the entire Loop Idiom Recognize Pass 2020-09-01 13:59:24 +00:00
LoopInstSimplify.h
LoopInterchange.h [NFC] Refactor LoopInterchange into a loop-nest pass 2021-02-18 00:55:38 +08:00
LoopLoadElimination.h
LoopPassManager.h [NewPM] Fix wrong perfect forwardings 2021-07-19 17:21:32 +01:00
LoopPredication.h
LoopReroll.h [LoopReroll][NewPM] Port -loop-reroll to NPM 2020-09-25 12:09:06 -07:00
LoopRotation.h [LoopRotate] Add PrepareForLTO stage, avoid rotating with inline cands. 2021-01-19 10:15:29 +00:00
LoopSimplifyCFG.h
LoopSink.h
LoopStrengthReduce.h
LoopUnrollAndJamPass.h [LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass 2021-06-08 20:30:02 +09:00
LoopUnrollPass.h [Passes] Run peeling as part of simple/full loop unrolling. 2021-01-26 13:52:30 +00:00
LoopVersioningLICM.h [NPM] Port -loop-versioning-licm to NPM 2020-10-24 21:51:18 +08:00
LowerAtomic.h [NVPTX] Enable lowering of atomics on local memory 2021-04-26 20:12:12 -04:00
LowerConstantIntrinsics.h
LowerExpectIntrinsic.h [clang][CodeGen] Lower Likelihood attributes to @llvm.expect intrin instead of branch weights 2021-03-21 22:50:21 +03:00
LowerGuardIntrinsic.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
LowerMatrixIntrinsics.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
LowerWidenableCondition.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
MakeGuardsExplicit.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
MemCpyOptimizer.h Revert "[MemCpyOpt] Enable memcpy optimizations unconditionally." 2021-07-19 14:27:41 -07:00
MergedLoadStoreMotion.h
MergeICmps.h
NaryReassociate.h [NARY-REASSOCIATE] Support reassociation of min/max 2021-04-02 15:30:13 +07:00
NewGVN.h
PartiallyInlineLibCalls.h
Reassociate.h Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI." 2020-07-24 13:02:33 +01:00
Reg2Mem.h [Reg2Mem] add support for the new pass manager 2020-11-08 11:14:05 +00:00
RewriteStatepointsForGC.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
ScalarizeMaskedMemIntrin.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
Scalarizer.h
SCCP.h Function Specialization Pass 2021-06-11 09:11:29 +01:00
SeparateConstOffsetFromGEP.h [NewPM] Port -separate-const-offset-from-gep 2020-11-09 17:42:36 -08:00
SimpleLoopUnswitch.h [NewPM][SimpleLoopUnswitch] Add option to not trivially unswitch 2021-07-13 16:09:42 -07:00
SimplifyCFG.h [SimplifyCFG] Override options in default constructor 2020-09-21 16:33:01 -07:00
Sink.h
SpeculativeExecution.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
SROA.h [SROA] Remove Dead Instructions while creating speculative instructions 2020-12-18 11:47:02 -05:00
StraightLineStrengthReduce.h [NPM] Port -slsr to NPM 2020-10-27 09:21:40 +08:00
StructurizeCFG.h [StructurizeCFG][NewPM] Port -structurizecfg to NPM 2020-10-23 15:54:03 -07:00
TailRecursionElimination.h
WarnMissedTransforms.h