Skip to content

Conversation

@yamt
Copy link
Contributor

@yamt yamt commented May 15, 2025

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=lime1 to wasm-ld.

I couldn't find an existing way to pass -mcpu=lime1 equivalent
to LTO codegen. This commit would privide one.
@llvmbot
Copy link
Member

llvmbot commented May 15, 2025

@llvm/pr-subscribers-lld-wasm

@llvm/pr-subscribers-lld

Author: YAMAMOTO Takashi (yamt)

Changes

I 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:

  • (modified) lld/wasm/LTO.cpp (+1)
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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried removing this line from the ELF linker and all the tests still passed.. so maybe testing is not easy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i noticed this while building an application. i don't have smaller test cases right now.

@sbc100
Copy link
Collaborator

sbc100 commented May 20, 2025

With this added how are you actually passing -mcpu=lime1? i.e. are you doing something like -mllvm,-mcpu=lime1? Can you mention that in the PR description?

@yamt
Copy link
Contributor Author

yamt commented May 21, 2025

With this added how are you actually passing -mcpu=lime1? i.e. are you doing something like -mllvm,-mcpu=lime1? Can you mention that in the PR description?

done.

i confirmed that toywasm wasm module built with https://github.com/yamt/toywasm/blob/master/build-wasm32-wasi.sh
doesn't get reference-types enabled if i did all of the following modifications.

@sbc100 sbc100 merged commit 80f0ffb into llvm:main May 21, 2025
14 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 21, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-windows running on premerge-windows-1 while building lld at step 5 "clean-build-dir".

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
Step 5 (clean-build-dir) failure: Delete failed. (failure)
Step 8 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'lit :: timeout-hang.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 13
not env -u FILECHECK_OPTS "C:\Python39\python.exe" C:\ws\buildbot\premerge-monolithic-windows\llvm-project\llvm\utils\lit\lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt  --timeout=1 --param external=0 | "C:\Python39\python.exe" C:\ws\buildbot\premerge-monolithic-windows\build\utils\lit\tests\timeout-hang.py 1
# executed command: not env -u FILECHECK_OPTS 'C:\Python39\python.exe' 'C:\ws\buildbot\premerge-monolithic-windows\llvm-project\llvm\utils\lit\lit.py' -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0
# .---command stderr------------
# | lit.py: C:\ws\buildbot\premerge-monolithic-windows\llvm-project\llvm\utils\lit\lit\main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds.
# `-----------------------------
# executed command: 'C:\Python39\python.exe' 'C:\ws\buildbot\premerge-monolithic-windows\build\utils\lit\tests\timeout-hang.py' 1
# .---command stdout------------
# | Testing took as long or longer than timeout
# `-----------------------------
# error: command failed with exit status: 1

--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants