From b13c91f159fa9b631cb15dc02ea0b72b2802ac4d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 19 Jan 2016 14:55:02 +0000 Subject: [PATCH] [WebAssembly] Disable some WebAssembly-specific optimization passes at -O0. llvm-svn: 258127 --- llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index b290b4bf7440..9228ecb87cf5 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -140,7 +140,8 @@ void WebAssemblyPassConfig::addIRPasses() { addPass(createAtomicExpandPass(TM)); // Optimize "returned" function attributes. - addPass(createWebAssemblyOptimizeReturned()); + if (getOptLevel() != CodeGenOpt::None) + addPass(createWebAssemblyOptimizeReturned()); TargetPassConfig::addIRPasses(); } @@ -165,7 +166,8 @@ void WebAssemblyPassConfig::addPreRegAlloc() { TargetPassConfig::addPreRegAlloc(); // Prepare store instructions for register stackifying. - addPass(createWebAssemblyStoreResults()); + if (getOptLevel() != CodeGenOpt::None) + addPass(createWebAssemblyStoreResults()); } void WebAssemblyPassConfig::addPostRegAlloc() { @@ -206,5 +208,6 @@ void WebAssemblyPassConfig::addPreEmitPass() { addPass(createWebAssemblyRegNumbering()); // Perform the very last peephole optimizations on the code. - addPass(createWebAssemblyPeephole()); + if (getOptLevel() != CodeGenOpt::None) + addPass(createWebAssemblyPeephole()); }