[lld][WebAssembly] Set the target-cpu in LTO config#140010
Conversation
I couldn't find an existing way to pass -mcpu=lime1 equivalent to LTO codegen. This commit would privide one.
|
@llvm/pr-subscribers-lld-wasm @llvm/pr-subscribers-lld Author: YAMAMOTO Takashi (yamt) ChangesI couldn't find an existing way to pass -mcpu=lime1 equivalent to LTO codegen. This commit would privide one. Full diff: https://github.com/llvm/llvm-project/pull/140010.diff 1 Files Affected:
diff --git a/lld/wasm/LTO.cpp b/lld/wasm/LTO.cpp
index a877f067603e5..581104745b8ba 100644
--- a/lld/wasm/LTO.cpp
+++ b/lld/wasm/LTO.cpp
@@ -59,6 +59,7 @@ static lto::Config createConfig() {
c.DisableVerify = ctx.arg.disableVerify;
c.DiagHandler = diagnosticHandler;
c.OptLevel = ctx.arg.ltoo;
+ c.CPU = getCPUStr();
c.MAttrs = getMAttrs();
c.CGOptLevel = ctx.arg.ltoCgo;
c.DebugPassManager = ctx.arg.ltoDebugPassManager;
|
| c.DisableVerify = ctx.arg.disableVerify; | ||
| c.DiagHandler = diagnosticHandler; | ||
| c.OptLevel = ctx.arg.ltoo; | ||
| c.CPU = getCPUStr(); |
There was a problem hiding this comment.
Yup this looks like this is already present in the ELF version of createConfig .. I wonder why we didn't have it here before.
Can we write a test for this?
There was a problem hiding this comment.
I tried removing this line from the ELF linker and all the tests still passed.. so maybe testing is not easy?
There was a problem hiding this comment.
i noticed this while building an application. i don't have smaller test cases right now.
|
With this added how are you actually passing |
done. i confirmed that toywasm wasm module built with https://github.com/yamt/toywasm/blob/master/build-wasm32-wasi.sh
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/35/builds/10251 Here is the relevant piece of the build log for the reference |
I couldn't find an existing way to pass -mcpu=lime1 equivalent to LTO codegen.
This commit would privide one. With this commit, you can do so by passing
-mllvm -mcpu=lime1to wasm-ld.