[PATCH] D52227: LLVM: Expose SimplifyCFGPass (as used in PassBuilder::buildModuleOptimizationPipeline) in PassRegistry.def
George van den Driessche via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 18 04:04:32 PDT 2018
georgevdd created this revision.
Herald added subscribers: llvm-commits, Prazek.
This makes it possible to write a pipeline string for opt that does the same thing as the hard-coded optimization pipeline. c.f. early-cse and early-cse-memssa.
Repository:
rL LLVM
https://reviews.llvm.org/D52227
Files:
include/llvm/Transforms/Scalar/SimplifyCFG.h
lib/Passes/PassBuilder.cpp
lib/Passes/PassRegistry.def
Index: lib/Passes/PassRegistry.def
===================================================================
--- lib/Passes/PassRegistry.def
+++ lib/Passes/PassRegistry.def
@@ -203,6 +203,7 @@
FUNCTION_PASS("reassociate", ReassociatePass())
FUNCTION_PASS("sccp", SCCPPass())
FUNCTION_PASS("simplify-cfg", SimplifyCFGPass())
+FUNCTION_PASS("simplify-cfg-opt", SimplifyCFGPass(true))
FUNCTION_PASS("sink", SinkingPass())
FUNCTION_PASS("slp-vectorizer", SLPVectorizerPass())
FUNCTION_PASS("speculative-execution", SpeculativeExecutionPass())
Index: lib/Passes/PassBuilder.cpp
===================================================================
--- lib/Passes/PassBuilder.cpp
+++ lib/Passes/PassBuilder.cpp
@@ -796,11 +796,7 @@
// convert to more optimized IR using more aggressive simplify CFG options.
// The extra sinking transform can create larger basic blocks, so do this
// before SLP vectorization.
- OptimizePM.addPass(SimplifyCFGPass(SimplifyCFGOptions().
- forwardSwitchCondToPhi(true).
- convertSwitchToLookupTable(true).
- needCanonicalLoops(false).
- sinkCommonInsts(true)));
+ OptimizePM.addPass(SimplifyCFGPass(/*optimizing=*/true));
// Optimize parallel scalar instruction chains into SIMD instructions.
OptimizePM.addPass(SLPVectorizerPass());
Index: include/llvm/Transforms/Scalar/SimplifyCFG.h
===================================================================
--- include/llvm/Transforms/Scalar/SimplifyCFG.h
+++ include/llvm/Transforms/Scalar/SimplifyCFG.h
@@ -35,13 +35,14 @@
/// rather than optimal IR. That is, by default we bypass transformations that
/// are likely to improve performance but make analysis for other passes more
/// difficult.
- SimplifyCFGPass()
- : SimplifyCFGPass(SimplifyCFGOptions()
- .forwardSwitchCondToPhi(false)
- .convertSwitchToLookupTable(false)
- .needCanonicalLoops(true)
- .sinkCommonInsts(false)) {}
+ SimplifyCFGPass() : SimplifyCFGPass(false) {}
+ explicit SimplifyCFGPass(bool optimizing) : SimplifyCFGPass(
+ SimplifyCFGOptions()
+ .forwardSwitchCondToPhi(optimizing)
+ .convertSwitchToLookupTable(optimizing)
+ .needCanonicalLoops(!optimizing)
+ .sinkCommonInsts(optimizing)) {}
/// Construct a pass with optional optimizations.
SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52227.165930.patch
Type: text/x-patch
Size: 2576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/8ef2b5e8/attachment.bin>
More information about the llvm-commits
mailing list