-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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 backend assertion failure with unreachable #68770
Comments
@llvm/issue-subscribers-backend-webassembly Author: Matt Harding (majaha)
This code:
```llvm
target triple = "wasm32-unknown-unknown"
declare void @llvm.trap() cold noreturn nounwind define void @assert_fail() {
llc: /root/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp:168: void query(const llvm::MachineInstr&, bool&, bool&, bool&, bool&): Assertion `!MI.isTerminator()' failed.
|
Possibly the solution is to have two kinds of |
`llvm.trap` will be convert as `unreachable` which is termiantor. But we cannot append any instruction after terminator wihch will casue llir's validation failed. This PR introduces a pass to clean instruction after terminator. Fixes: llvm#68770
`llvm.trap` will be convert as `unreachable` which is termiantor. But we cannot append any instruction after terminator wihch will casue llir's validation failed. This PR introduces a pass to clean instruction after terminator. Fixes: llvm#68770
`llvm.trap` will be convert as `unreachable` which is terminator. Instruction after terminator will cause validation failed. This PR introduces a pass to clean instruction after terminator. Fixes: #68770.
This code:
causes an assertion failure:
Godbolt link
It seems like this line in WebAssemblyRegStackify::runOnMachineFunction calls isSafeToMove()
which calls query() in two places
which has the line
assert(!MI.isTerminator());
which trips over the fact that unreachable (what
@llvm.trap()
is compiled to) is defined as a terminatorThe text was updated successfully, but these errors were encountered: