[llvm] [AMDGPU] Improve amdgcn_kill verification (PR #208220)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 06:28:30 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
@llvm/pr-subscribers-backend-amdgpu
Author: Robert Imschweiler (ro-i)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/208220.diff
1 Files Affected:
- (modified) llvm/lib/IR/VerifierAMDGPU.cpp (+6-1)
``````````diff
diff --git a/llvm/lib/IR/VerifierAMDGPU.cpp b/llvm/lib/IR/VerifierAMDGPU.cpp
index 04cb214ef2520..ab63307570b28 100644
--- a/llvm/lib/IR/VerifierAMDGPU.cpp
+++ b/llvm/lib/IR/VerifierAMDGPU.cpp
@@ -145,7 +145,12 @@ void llvm::verifyAMDGPUIntrinsicCall(VerifierSupport &VS, Intrinsic::ID ID,
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());
+ // 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(Unreachable ||
(CI && CI->getIntrinsicID() == Intrinsic::amdgcn_unreachable),
"callbr amdgcn_kill indirect dest needs to be unreachable");
``````````
</details>
https://github.com/llvm/llvm-project/pull/208220
More information about the llvm-commits
mailing list