-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WebAssembly] stacksave
leads machine code verification failure after wasm-replace-phys-regs
#62235
Labels
Comments
@llvm/issue-subscribers-backend-webassembly |
kateinoigakukun
changed the title
WebAssembly:
[WebAssembly] Apr 19, 2023
stacksave
leads machine code verification failure after wasm-replace-phys-regs
stacksave
leads machine code verification failure after wasm-replace-phys-regs
kateinoigakukun
added a commit
to kateinoigakukun/swift
that referenced
this issue
Sep 14, 2023
The LLVM backend generates bad code for some code using `llvm.stacksave` intrinsics. This patch works around the issue by avoiding such code generation. See llvm/llvm-project#62235
dschuff
pushed a commit
that referenced
this issue
Oct 3, 2023
Usually `llvm.stacksave/stackrestore` are used together with `alloca` but they can appear without it (e.g. `alloca` can be optimized away). WebAssembly's function local physical user sp register, which is referenced by `llvm.stacksave` is created while frame lowering and replaced with virtual register. However the sp register was not created when `llvm.stacksave` is used without `alloca`, and it led MIR verification failure about use-before-def of sp virtual register. Resolves #62235
kateinoigakukun
added a commit
to swiftlang/llvm-project
that referenced
this issue
Oct 9, 2023
Usually `llvm.stacksave/stackrestore` are used together with `alloca` but they can appear without it (e.g. `alloca` can be optimized away). WebAssembly's function local physical user sp register, which is referenced by `llvm.stacksave` is created while frame lowering and replaced with virtual register. However the sp register was not created when `llvm.stacksave` is used without `alloca`, and it led MIR verification failure about use-before-def of sp virtual register. Resolves llvm#62235
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LLVM version: llvmorg-16.0.0
Minimum reproducible code:
Stack trace
It looks like
$sp32
read bystacksave
is replaced with a virtual reg bywasm-replace-phys-regs
, but it results in violating the domination principle for virtual registers.Result of `-stop-before=wasm-replace-phys-regs`
I'm not sure the
stacksave
/stackrestore
are supported on WebAssembly target or not 🤷 But it seems that it somehow succeeds with LLVM 14: https://godbolt.org/z/7Mx45GqK6The text was updated successfully, but these errors were encountered: