[llvm] [AMDGPU] Improve amdgcn_kill verification (PR #208220)
Robert Imschweiler via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 09:21:03 PDT 2026
================
@@ -144,9 +144,13 @@ void llvm::verifyAMDGPUIntrinsicCall(VerifierSupport &VS, Intrinsic::ID ID,
if (auto *CBI = dyn_cast<CallBrInst>(&Call)) {
Check(CBI->getNumIndirectDests() == 1,
"callbr amdgcn_kill only supports one indirect dest");
- bool Unreachable = isa<UnreachableInst>(CBI->getIndirectDest(0)->begin());
- CallInst *CI = dyn_cast<CallInst>(CBI->getIndirectDest(0)->begin());
- Check(Unreachable ||
+ // We assume that amdgcn_unreachable is only introduced by
+ // AMDGPUUnifyDivergentExitNodes, which replaces the block's original
+ // unreachable terminator by a call to amdgcn_unreachable + a return.
+ const Instruction *Term = CBI->getIndirectDest(0)->getTerminator();
+ const CallInst *CI =
+ Term ? dyn_cast_if_present<CallInst>(Term->getPrevNode()) : nullptr;
+ Check(isa_and_nonnull<UnreachableInst>(Term) ||
----------------
ro-i wrote:
> But the special was already here. I'm not sure I see what this actually changes
It fixes the verification. Because AMDGPUUnifyDivergentExitNodes isn't inserting amdgcn_unreachable as the first instruction, but rather as the first before the new return (both replace the unreachable)
https://github.com/llvm/llvm-project/pull/208220
More information about the llvm-commits
mailing list