File tree Expand file tree Collapse file tree 2 files changed +9
-17
lines changed
lib/Target/SPIRV/Analysis Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -1873,13 +1873,13 @@ class ConvergenceControlInst : public IntrinsicInst {
1873
1873
return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
1874
1874
}
1875
1875
1876
- bool isAnchor () {
1876
+ bool isAnchor () const {
1877
1877
return getIntrinsicID () == Intrinsic::experimental_convergence_anchor;
1878
1878
}
1879
- bool isEntry () {
1879
+ bool isEntry () const {
1880
1880
return getIntrinsicID () == Intrinsic::experimental_convergence_entry;
1881
1881
}
1882
- bool isLoop () {
1882
+ bool isLoop () const {
1883
1883
return getIntrinsicID () == Intrinsic::experimental_convergence_loop;
1884
1884
}
1885
1885
};
Original file line number Diff line number Diff line change @@ -56,20 +56,12 @@ getConvergenceTokenInternal(BasicBlockType *BB) {
56
56
" Output type must be an intrinsic instruction." );
57
57
58
58
for (auto &I : *BB) {
59
- if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
60
- switch (II->getIntrinsicID ()) {
61
- case Intrinsic::experimental_convergence_entry:
62
- case Intrinsic::experimental_convergence_loop:
63
- return II;
64
- case Intrinsic::experimental_convergence_anchor: {
65
- auto Bundle = II->getOperandBundle (LLVMContext::OB_convergencectrl);
66
- assert (Bundle->Inputs .size () == 1 &&
67
- Bundle->Inputs [0 ]->getType ()->isTokenTy ());
68
- auto TII = dyn_cast<IntrinsicInst>(Bundle->Inputs [0 ].get ());
69
- assert (TII != nullptr );
70
- return TII;
71
- }
72
- }
59
+ if (auto *CI = dyn_cast<ConvergenceControlInst>(&I)) {
60
+ // Make sure that the anchor or entry intrinsics did not reach here with a
61
+ // parent token. This should have failed the verifier.
62
+ assert (CI->isLoop () ||
63
+ !CI->getOperandBundle (LLVMContext::OB_convergencectrl));
64
+ return CI;
73
65
}
74
66
75
67
if (auto *CI = dyn_cast<CallInst>(&I)) {
You can’t perform that action at this time.
0 commit comments