[llvm] [AMDGPU] Improve amdgcn_kill verification (PR #208220)
Robert Imschweiler via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 09:06:42 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:
how would you solve the issue that AMDGPUUnifyDivergentExitNodes solves using it? Would you relax the guarantees that this pass provides?
https://github.com/llvm/llvm-project/pull/208220
More information about the llvm-commits
mailing list