llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[LLVM][Verifier] Crash in unreachable code on the token that is poisoned or undef.

Open dbakunevich opened this issue 4 years ago • 2 comments

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:

  1. Disable verifier on this intrinsic;
  2. Add exceptions for poison and undef tokens in the verifier.

dbakunevich avatar Sep 21 '22 12:09 dbakunevich

Fix of this bug: https://reviews.llvm.org/D134427

dbakunevich avatar Oct 19 '22 13:10 dbakunevich

Link on fix commit: https://github.com/llvm/llvm-project/commit/fecfd012523f963666caeb7e65cca3cd0ec1c159

dbakunevich avatar Oct 19 '22 13:10 dbakunevich