[lld] Ensure NoTrapAfterNoreturn is false for the wasm backend (PR #65876)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 16:27:18 PDT 2023


aheejin wrote:

I'm a little confused about https://github.com/llvm/llvm-project/pull/65876#issuecomment-1714681125 again. Why do we ned `NoTrapAfterNoreturn`? Can you provide me a counterexample LLVM bitcode that we produce invalid code without this?

```ll
define void @test() {
  call i32 @never_return_i32()
  ret void
}
```
This becomes
```wast
call @never_return_i32
drop
return
```

And
```ll
define i32 @test() {
  call void @never_return_void()
  ret i32 0
}
```
this becomes
```wast
call @never_return_i32
i32.const 0
return
```

What would be an example of invalid code that can be created if we don't have `NoTrapAfterNoreturn`?

Also what is the case in which it is safe to remove, as I asked in https://github.com/llvm/llvm-project/pull/65876#discussion_r1332296556?

https://github.com/llvm/llvm-project/pull/65876


More information about the llvm-commits mailing list