[llvm] 77e6f43 - [SPIRV] convergence anchor intrinsic does not have a parent token (#122230)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 12 20:25:01 PST 2025
Author: Sameer Sahasrabuddhe
Date: 2025-01-13T09:54:57+05:30
New Revision: 77e6f434ec79db025aa9c7d193179727f1d63714
URL: https://github.com/llvm/llvm-project/commit/77e6f434ec79db025aa9c7d193179727f1d63714
DIFF: https://github.com/llvm/llvm-project/commit/77e6f434ec79db025aa9c7d193179727f1d63714.diff
LOG: [SPIRV] convergence anchor intrinsic does not have a parent token (#122230)
Added:
Modified:
llvm/include/llvm/IR/IntrinsicInst.h
llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 3436216d478e38..6ccbb6b185c7d9 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -1873,13 +1873,13 @@ class ConvergenceControlInst : public IntrinsicInst {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
- bool isAnchor() {
+ bool isAnchor() const {
return getIntrinsicID() == Intrinsic::experimental_convergence_anchor;
}
- bool isEntry() {
+ bool isEntry() const {
return getIntrinsicID() == Intrinsic::experimental_convergence_entry;
}
- bool isLoop() {
+ bool isLoop() const {
return getIntrinsicID() == Intrinsic::experimental_convergence_loop;
}
};
diff --git a/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp b/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
index cc6daf7ef34426..c23a6c3e8bbe85 100644
--- a/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
@@ -56,20 +56,12 @@ getConvergenceTokenInternal(BasicBlockType *BB) {
"Output type must be an intrinsic instruction.");
for (auto &I : *BB) {
- if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
- switch (II->getIntrinsicID()) {
- case Intrinsic::experimental_convergence_entry:
- case Intrinsic::experimental_convergence_loop:
- return II;
- case Intrinsic::experimental_convergence_anchor: {
- auto Bundle = II->getOperandBundle(LLVMContext::OB_convergencectrl);
- assert(Bundle->Inputs.size() == 1 &&
- Bundle->Inputs[0]->getType()->isTokenTy());
- auto TII = dyn_cast<IntrinsicInst>(Bundle->Inputs[0].get());
- assert(TII != nullptr);
- return TII;
- }
- }
+ if (auto *CI = dyn_cast<ConvergenceControlInst>(&I)) {
+ // Make sure that the anchor or entry intrinsics did not reach here with a
+ // parent token. This should have failed the verifier.
+ assert(CI->isLoop() ||
+ !CI->getOperandBundle(LLVMContext::OB_convergencectrl));
+ return CI;
}
if (auto *CI = dyn_cast<CallInst>(&I)) {
More information about the llvm-commits
mailing list