[AMDGPU] Improve amdgcn_kill verification#208220
Open
ro-i wants to merge 2 commits into
Open
Conversation
|
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-amdgpu Author: Robert Imschweiler (ro-i) ChangesFull diff: https://github.com/llvm/llvm-project/pull/208220.diff 1 Files Affected:
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");
|
Contributor
Author
|
verifier has only negative tests, iirc? Could probably make a test in CodeGen/ |
Contributor
Yes. I thought this PR is to capture something that might be missing before? |
Contributor
Author
|
yeah, makes sense. This also led me to relax the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.