[all-commits] [llvm/llvm-project] c921ac: [WebAssembly] Enable multivalue return when multiv...
Heejin Ahn via All-commits
all-commits at lists.llvm.org
Tue Apr 23 01:49:20 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c921ac724ff06997bab25715786c98d4926b0c0e
https://github.com/llvm/llvm-project/commit/c921ac724ff06997bab25715786c98d4926b0c0e
Author: Heejin Ahn <aheejin at gmail.com>
Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths:
M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h
M llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h
M llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll
M llvm/test/CodeGen/WebAssembly/multivalue-dont-move-def-past-use.mir
M llvm/test/CodeGen/WebAssembly/multivalue-stackify.ll
M llvm/test/CodeGen/WebAssembly/multivalue.ll
M llvm/test/CodeGen/WebAssembly/multivalue_libcall.ll
Log Message:
-----------
[WebAssembly] Enable multivalue return when multivalue ABI is used (#88492)
Multivalue feature of WebAssembly has been standardized for several
years now. I think it makes sense to be able to enable it in the feature
section by default for our clang/llvm-produced binaries so that the
multivalue feature can be used as necessary when necessary within our
toolchain and also when running other optimizers (e.g. wasm-opt) after
the LLVM code generation.
But some WebAssembly toolchains, such as Emscripten, do not provide both
mulvalue-returning and not-multivalue-returning versions of libraries.
Also allowing the uses of multivalue in the features section does not
necessarily mean we generate them whenever we can to the fullest, which
is a different code generation / optimization option.
So this makes the lowering of multivalue returns conditional on the use
of 'experimental-mv' target ABI. This ABI is turned off by default and
turned on by passing `-Xclang -target-abi -Xclang experimental-mv` to
`clang`, or `-target-abi experimental-mv` to `clang -cc1` or `llc`.
But the purpose of this PR is not tying the multivalue lowering to this
specific 'experimental-mv'. 'experimental-mv' is just one multivalue ABI
we currently have, and it is still experimental, meaning it is not very
well optimized or tuned for performance. (e.g. it does not have the
limitation of the max number of multivalue-lowered values, which can be
detrimental to performance.) We may change the name of this ABI, or
improve it, or add a new multivalue ABI in the future. Also I heard that
WASI is planning to add their multivalue ABI soon. So the plan is,
whenever any one of multivalue ABIs is enabled, we enable the lowering
of multivalue returns in the backend. We currently have only
'experimental-mv' in the repo so we only check for that in this PR.
Related past discussions:
#82714
https://github.com/WebAssembly/tool-conventions/pull/223#issuecomment-2008298652
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list