llvm-project
llvm-project copied to clipboard
[LLVM][Verifier] Crash in unreachable code on the token that is poisoned or undef.
Godbolt link: https://godbolt.org/z/c1eK43ehY
Run opt -passes=verify
on the following test:
define void @foo() gc "statepoint_example" personality ptr @P {
entry:
br i1 true, label %label_1, label %label_2
label_1:
ret void
label_2:
%a = call noundef i32 @llvm.experimental.gc.result.i32(token poison)
unreachable
}
declare i32 @llvm.experimental.gc.result.i32(token)
declare ptr @P()
The bug was found using FuzzGen (https://github.com/AzulSystems/FuzzGen) Description: The verifier checks that the token of “experimental_gc_result” intrinsic is some kind of call. Therefore, checks that the token is not poison or undef.
Possible fixes:
- Disable verifier on this intrinsic;
- Add exceptions for poison and undef tokens in the verifier.
Fix of this bug: https://reviews.llvm.org/D134427
Link on fix commit: https://github.com/llvm/llvm-project/commit/fecfd012523f963666caeb7e65cca3cd0ec1c159