[PATCH] D134427: [Verifier] Allow undef token argument to llvm.experimental.gc.result
Dmitry Bakunevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 28 06:25:52 PDT 2022
dbakunevich updated this revision to Diff 463529.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134427/new/
https://reviews.llvm.org/D134427
Files:
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/gc_result_token.ll
Index: llvm/test/Verifier/gc_result_token.ll
===================================================================
--- /dev/null
+++ llvm/test/Verifier/gc_result_token.ll
@@ -0,0 +1,22 @@
+; 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()
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -5233,8 +5233,13 @@
case Intrinsic::experimental_gc_result: {
Check(Call.getParent()->getParent()->hasGC(),
"Enclosing function does not use GC.", Call);
+
+ auto *Statepoint = Call.getArgOperand(0);
+ if (isa<UndefValue>(Statepoint))
+ break;
+
// Are we tied to a statepoint properly?
- const auto *StatepointCall = dyn_cast<CallBase>(Call.getArgOperand(0));
+ const auto *StatepointCall = dyn_cast<CallBase>(Statepoint);
const Function *StatepointFn =
StatepointCall ? StatepointCall->getCalledFunction() : nullptr;
Check(StatepointFn && StatepointFn->isDeclaration() &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134427.463529.patch
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220928/0eb37c8c/attachment.bin>
More information about the llvm-commits
mailing list