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 {
18731873 return isa<IntrinsicInst>(V) && classof (cast<IntrinsicInst>(V));
18741874 }
18751875
1876- bool isAnchor () {
1876+ bool isAnchor () const {
18771877 return getIntrinsicID () == Intrinsic::experimental_convergence_anchor;
18781878 }
1879- bool isEntry () {
1879+ bool isEntry () const {
18801880 return getIntrinsicID () == Intrinsic::experimental_convergence_entry;
18811881 }
1882- bool isLoop () {
1882+ bool isLoop () const {
18831883 return getIntrinsicID () == Intrinsic::experimental_convergence_loop;
18841884 }
18851885};
Original file line number Diff line number Diff line change @@ -56,20 +56,12 @@ getConvergenceTokenInternal(BasicBlockType *BB) {
5656 " Output type must be an intrinsic instruction." );
5757
5858 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;
7365 }
7466
7567 if (auto *CI = dyn_cast<CallInst>(&I)) {
You can’t perform that action at this time.
0 commit comments