Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/include/llvm/IR/IntrinsicInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down
20 changes: 6 additions & 14 deletions llvm/lib/Target/SPIRV/Analysis/SPIRVConvergenceRegionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Copy link
Collaborator Author

@ssahasra ssahasra Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert is wrong. The only valid assert here is to say assert(!Bundle), because the bundle cannot exist. At that point, the only thing that can be returned is II itself, because TII cannot exist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed this assert is wrong, but the question I have is if the analysis will do the correct thing if II is returned. I'm guessing we do not test that.

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)) {
Expand Down
Loading