diff options
author | Dan Gohman <sunfish@mozilla.com> | 2014-03-04 21:27:34 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@mozilla.com> | 2014-03-04 21:28:10 -0800 |
commit | ba1f9a0611a385a9e43daae5765abb2eb3511c01 (patch) | |
tree | 1cedce085b16112349314a8a04e34db212cb5a3e | |
parent | b0180f577b7fd17af324781bfd2ab5b2d66cb204 (diff) |
Don't run SimplifyAllocas at -O1 and higher.
-rw-r--r-- | lib/Target/JSBackend/JSBackend.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 9bc1764042..56e125c3f3 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -2339,8 +2339,16 @@ bool JSTargetMachine::addPassesToEmitFile(PassManagerBase &PM, assert(FileType == TargetMachine::CGFT_AssemblyFile); PM.add(createExpandI64Pass()); - PM.add(createSimplifyAllocasPass()); - PM.add(new JSWriter(o, getOptLevel())); + + CodeGenOpt::Level OptLevel = getOptLevel(); + + // When optimizing, there shouldn't be any opportunities for SimplifyAllocas + // because the regular optimizer should have taken them all (GVN, and possibly + // also SROA). + if (OptLevel == CodeGenOpt::None) + PM.add(createSimplifyAllocasPass()); + + PM.add(new JSWriter(o, OptLevel)); return false; } |