aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorCarl Ritson <carl.ritson@amd.com>2025-05-14 12:34:27 +0900
committerGitHub <noreply@github.com>2025-05-14 12:34:27 +0900
commit036d637a1dc7be4af6178d4a4df32adaffbd9015 (patch)
tree87bf68a28f92cd9bebed7e7eb5a5f40b21ee9361 /llvm/lib/IR/Verifier.cpp
parent62a6218adb42557099da06c57edca0713c0dd700 (diff)
downloadllvm-036d637a1dc7be4af6178d4a4df32adaffbd9015.zip
llvm-036d637a1dc7be4af6178d4a4df32adaffbd9015.tar.gz
llvm-036d637a1dc7be4af6178d4a4df32adaffbd9015.tar.bz2
[AMDGPU][Verifier] Allow llvm.amdgcn.unreachable after cs.chain (#139494)
Unreachable is transformed to llvm.amdgcn.unreachable() during exit unification. Make sure the verifier tolerates this.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 81cf53f..7979e19 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6418,7 +6418,12 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
"SGPR arguments must have the `inreg` attribute", &Call);
Check(!Call.paramHasAttr(3, Attribute::InReg),
"VGPR arguments must not have the `inreg` attribute", &Call);
- Check(isa_and_present<UnreachableInst>(Call.getNextNode()),
+
+ auto *Next = Call.getNextNonDebugInstruction();
+ bool IsAMDUnreachable = Next && isa<IntrinsicInst>(Next) &&
+ cast<IntrinsicInst>(Next)->getIntrinsicID() ==
+ Intrinsic::amdgcn_unreachable;
+ Check(Next && (isa<UnreachableInst>(Next) || IsAMDUnreachable),
"llvm.amdgcn.cs.chain must be followed by unreachable", &Call);
break;
}