mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
6516543c4b
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
100 lines
2.0 KiB
CMake
100 lines
2.0 KiB
CMake
add_llvm_component_library(LLVMScalarOpts
|
|
ADCE.cpp
|
|
AlignmentFromAssumptions.cpp
|
|
AnnotationRemarks.cpp
|
|
BDCE.cpp
|
|
CallSiteSplitting.cpp
|
|
ConstantHoisting.cpp
|
|
ConstraintElimination.cpp
|
|
CorrelatedValuePropagation.cpp
|
|
DCE.cpp
|
|
DeadStoreElimination.cpp
|
|
DFAJumpThreading.cpp
|
|
DivRemPairs.cpp
|
|
EarlyCSE.cpp
|
|
FlattenCFGPass.cpp
|
|
Float2Int.cpp
|
|
GuardWidening.cpp
|
|
GVN.cpp
|
|
GVNHoist.cpp
|
|
GVNSink.cpp
|
|
IVUsersPrinter.cpp
|
|
InductiveRangeCheckElimination.cpp
|
|
IndVarSimplify.cpp
|
|
InferAddressSpaces.cpp
|
|
InstSimplifyPass.cpp
|
|
JumpThreading.cpp
|
|
LICM.cpp
|
|
LoopAccessAnalysisPrinter.cpp
|
|
LoopBoundSplit.cpp
|
|
LoopSink.cpp
|
|
LoopDeletion.cpp
|
|
LoopDataPrefetch.cpp
|
|
LoopDistribute.cpp
|
|
LoopFuse.cpp
|
|
LoopIdiomRecognize.cpp
|
|
LoopInstSimplify.cpp
|
|
LoopInterchange.cpp
|
|
LoopFlatten.cpp
|
|
LoopLoadElimination.cpp
|
|
LoopPassManager.cpp
|
|
LoopPredication.cpp
|
|
LoopRerollPass.cpp
|
|
LoopRotation.cpp
|
|
LoopSimplifyCFG.cpp
|
|
LoopStrengthReduce.cpp
|
|
LoopUnrollPass.cpp
|
|
LoopUnrollAndJamPass.cpp
|
|
LoopUnswitch.cpp
|
|
LoopVersioningLICM.cpp
|
|
LowerAtomic.cpp
|
|
LowerConstantIntrinsics.cpp
|
|
LowerExpectIntrinsic.cpp
|
|
LowerGuardIntrinsic.cpp
|
|
LowerMatrixIntrinsics.cpp
|
|
LowerWidenableCondition.cpp
|
|
MakeGuardsExplicit.cpp
|
|
MemCpyOptimizer.cpp
|
|
MergeICmps.cpp
|
|
MergedLoadStoreMotion.cpp
|
|
NaryReassociate.cpp
|
|
NewGVN.cpp
|
|
PartiallyInlineLibCalls.cpp
|
|
PlaceSafepoints.cpp
|
|
Reassociate.cpp
|
|
Reg2Mem.cpp
|
|
RewriteStatepointsForGC.cpp
|
|
SCCP.cpp
|
|
SROA.cpp
|
|
Scalar.cpp
|
|
Scalarizer.cpp
|
|
ScalarizeMaskedMemIntrin.cpp
|
|
SeparateConstOffsetFromGEP.cpp
|
|
SimpleLoopUnswitch.cpp
|
|
SimplifyCFGPass.cpp
|
|
Sink.cpp
|
|
SpeculativeExecution.cpp
|
|
StraightLineStrengthReduce.cpp
|
|
StructurizeCFG.cpp
|
|
TailRecursionElimination.cpp
|
|
WarnMissedTransforms.cpp
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/Scalar
|
|
|
|
DEPENDS
|
|
intrinsics_gen
|
|
|
|
COMPONENT_NAME
|
|
Scalar
|
|
|
|
LINK_COMPONENTS
|
|
AggressiveInstCombine
|
|
Analysis
|
|
Core
|
|
InstCombine
|
|
Support
|
|
TransformUtils
|
|
)
|