Skip to content

Commit 61b5cc6

Browse files
authored
[LLVM] ConvergenceControlInst as a derived class of IntrinsicInst (#76230)
1 parent 63c3148 commit 61b5cc6

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "llvm/ADT/GenericConvergenceVerifier.h"
3030
#include "llvm/ADT/PostOrderIterator.h"
3131
#include "llvm/ADT/Twine.h"
32-
#include "llvm/IR/Intrinsics.h"
32+
#include "llvm/IR/IntrinsicInst.h"
3333

3434
#define Check(C, ...) \
3535
do { \
@@ -48,17 +48,6 @@
4848
} while (false)
4949

5050
namespace llvm {
51-
static bool isConvergenceControlIntrinsic(unsigned IntrinsicID) {
52-
switch (IntrinsicID) {
53-
default:
54-
return false;
55-
case Intrinsic::experimental_convergence_anchor:
56-
case Intrinsic::experimental_convergence_entry:
57-
case Intrinsic::experimental_convergence_loop:
58-
return true;
59-
}
60-
}
61-
6251
template <class ContextT> void GenericConvergenceVerifier<ContextT>::clear() {
6352
Tokens.clear();
6453
CI.clear();

llvm/include/llvm/IR/IntrinsicInst.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,30 @@ class AssumeInst : public IntrinsicInst {
17241724
}
17251725
};
17261726

1727+
/// Check if \p ID corresponds to a convergence control intrinsic.
1728+
static inline bool isConvergenceControlIntrinsic(unsigned IntrinsicID) {
1729+
switch (IntrinsicID) {
1730+
default:
1731+
return false;
1732+
case Intrinsic::experimental_convergence_anchor:
1733+
case Intrinsic::experimental_convergence_entry:
1734+
case Intrinsic::experimental_convergence_loop:
1735+
return true;
1736+
}
1737+
}
1738+
1739+
/// Represents calls to the llvm.experimintal.convergence.* intrinsics.
1740+
class ConvergenceControlInst : public IntrinsicInst {
1741+
public:
1742+
static bool classof(const IntrinsicInst *I) {
1743+
return isConvergenceControlIntrinsic(I->getIntrinsicID());
1744+
}
1745+
1746+
static bool classof(const Value *V) {
1747+
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
1748+
}
1749+
};
1750+
17271751
} // end namespace llvm
17281752

17291753
#endif // LLVM_IR_INTRINSICINST_H

0 commit comments

Comments
 (0)