summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-01-08 01:25:12 +0000
committerHeejin Ahn <aheejin@gmail.com>2019-01-08 01:25:12 +0000
commite95056d69c636ee3d8a6297e838526adf3b92eea (patch)
tree5f6c4058383c0d50700c3b87188788e6a281022e /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parentadc40baa29a1c16cde63c4bf857afea0eb7b476e (diff)
downloadbcm5719-llvm-e95056d69c636ee3d8a6297e838526adf3b92eea.tar.gz
bcm5719-llvm-e95056d69c636ee3d8a6297e838526adf3b92eea.zip
[WebAssembly] Move CFG-changing passes before RegStackify
Summary: FixIrreducibleControlFlow and LateEHPrepare both possibly modify CFG and create new registers. There seems to be no reason these passes go after register-related optimization passes (PrepareForLiveIntervals, OptimizeLiveIntervals, StoreResults, RegStackify, and RegColoring), and this also possibly create new optimization opportunities. I think we should put all current and future optimization passes before RegStackify (and related passes) unless there's a reason not to. Reviewers: kripken Subscribers: dschuff, sbc100, sunfish, jgravelle-google, llvm-commits Differential Revision: https://reviews.llvm.org/D56356 llvm-svn: 350596
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index a6fb78280da..05bd5926ef9 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -298,6 +298,12 @@ void WebAssemblyPassConfig::addPreEmitPass() {
// order of the arguments.
addPass(createWebAssemblyCallIndirectFixup());
+ // Eliminate multiple-entry loops.
+ addPass(createWebAssemblyFixIrreducibleControlFlow());
+
+ // Do various transformations for exception handling.
+ addPass(createWebAssemblyLateEHPrepare());
+
if (getOptLevel() != CodeGenOpt::None) {
// LiveIntervals isn't commonly run this late. Re-establish preconditions.
addPass(createWebAssemblyPrepareForLiveIntervals());
@@ -320,17 +326,9 @@ void WebAssemblyPassConfig::addPreEmitPass() {
addPass(createWebAssemblyRegColoring());
}
- // Eliminate multiple-entry loops. Do this before inserting explicit get_local
- // and set_local operators because we create a new variable that we want
- // converted into a local.
- addPass(createWebAssemblyFixIrreducibleControlFlow());
-
// Insert explicit get_local and set_local operators.
addPass(createWebAssemblyExplicitLocals());
- // Do various transformations for exception handling
- addPass(createWebAssemblyLateEHPrepare());
-
// Sort the blocks of the CFG into topological order, a prerequisite for
// BLOCK and LOOP markers.
addPass(createWebAssemblyCFGSort());
OpenPOWER on IntegriCloud