diff options
author | Austin Theriault <github@cutedogs.org> | 2023-10-18 15:51:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 15:51:59 -0700 |
commit | 85b8958b56623cbe69be5cfcbb6c796ae48aff56 (patch) | |
tree | 5bc557d683e8990dd2364901942b5f3d2c4a028f /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | |
parent | 3745e7080746b73377a479b6ceba2dbf25f245e2 (diff) | |
download | llvm-85b8958b56623cbe69be5cfcbb6c796ae48aff56.zip llvm-85b8958b56623cbe69be5cfcbb6c796ae48aff56.tar.gz llvm-85b8958b56623cbe69be5cfcbb6c796ae48aff56.tar.bz2 |
[WebAssembly] add: hidden option to disable slow wasm pass (#67715)
Currently for any wasm target, llvm will make a pass that removes
irreducible control flow. (See
[here](https://llvm.org/doxygen/WebAssemblyFixIrreducibleControlFlow_8cpp.html)).
This can result in O(NumBlocks * NumNestedLoops * NumIrreducibleLoops +
NumLoops * NumLoops) build time, which has resulted in exceedingly long
build times when testing. This PR introduces a hidden flag to skip this
pass, which brings some of our build times down from 30 minutes to ~6
seconds.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 88c7277..2db1b64 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -48,6 +48,12 @@ static cl::opt<bool> WasmDisableExplicitLocals( " instruction output for test purposes only."), cl::init(false)); +static cl::opt<bool> WasmDisableFixIrreducibleControlFlowPass( + "wasm-disable-fix-irreducible-control-flow-pass", cl::Hidden, + cl::desc("webassembly: disables the fix " + " irreducible control flow optimization pass"), + cl::init(false)); + extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyTarget() { // Register the target. RegisterTargetMachine<WebAssemblyTargetMachine> X( @@ -538,7 +544,8 @@ void WebAssemblyPassConfig::addPreEmitPass() { addPass(createWebAssemblyNullifyDebugValueLists()); // Eliminate multiple-entry loops. - addPass(createWebAssemblyFixIrreducibleControlFlow()); + if (!WasmDisableFixIrreducibleControlFlowPass) + addPass(createWebAssemblyFixIrreducibleControlFlow()); // Do various transformations for exception handling. // Every CFG-changing optimizations should come before this. |