llvm-project/llvm/test/Verifier/gc_result_token.ll
dbakunevich fecfd01252 [Verifier] Allow undef/poison token argument to llvm.experimental.gc.result
As part of the optimization in the unreachable code, we remove
tokens, thereby replacing them with undef/poison in intrinsics.
But the verifier falls on the assertion, within of what it sees
token poison in unreachable code, which in turn is incorrect.

bug: 57871, https://github.com/llvm/llvm-project/issues/57871
Differential Revision: https://reviews.llvm.org/D134427
2022-10-19 20:51:21 +07:00

22 lines
498 B
LLVM

; RUN: opt -S -passes=verify < %s | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
define void @foo() gc "statepoint_example" personality ptr @P {
; CHECK-NOT: gc.result operand #1 must be from a statepoint
entry:
br label %label_1
label_1:
; CHECK: ret void
ret void
label_2:
; CHECK: token poison
%call = call noundef i32 @llvm.experimental.gc.result.i32(token poison)
unreachable
}
declare i32 @llvm.experimental.gc.result.i32(token)
declare ptr @P()