Skip to content

Commit 0257ab3

Browse files
committed
visit each basic block once to reset the first convergent op
1 parent 9c22a62 commit 0257ab3

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

llvm/include/llvm/ADT/GenericConvergenceVerifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ template <typename ContextT> class GenericConvergenceVerifier {
4040
}
4141

4242
void clear();
43+
void visit(const BlockT &BB);
4344
void visit(const InstructionT &I);
4445
void verify(const DominatorTreeT &DT);
4546

llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ template <class ContextT> void GenericConvergenceVerifier<ContextT>::clear() {
6767
ConvergenceKind = NoConvergence;
6868
}
6969

70+
template <class ContextT>
71+
void GenericConvergenceVerifier<ContextT>::visit(const BlockT &BB) {
72+
SeenFirstConvOp = false;
73+
}
74+
7075
template <class ContextT>
7176
void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
7277
auto ID = ContextT::getIntrinsicID(I);
7378
auto *TokenDef = findAndCheckConvergenceTokenUsed(I);
7479
bool IsCtrlIntrinsic = true;
7580

76-
// If this is the first instruction in the block, then we have not seen a
77-
// convergent op yet.
78-
if (!I.getPrevNode())
79-
SeenFirstConvOp = false;
80-
8181
switch (ID) {
8282
case Intrinsic::experimental_convergence_entry:
8383
Check(isInsideConvergentFunction(I),

llvm/lib/IR/Verifier.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,7 @@ void Verifier::visitFunction(const Function &F) {
28752875
//
28762876
void Verifier::visitBasicBlock(BasicBlock &BB) {
28772877
InstsInThisBlock.clear();
2878+
CV.visit(BB);
28782879

28792880
// Ensure that basic blocks have terminators!
28802881
Check(BB.getTerminator(), "Basic Block does not have terminator!", &BB);
@@ -3576,6 +3577,8 @@ void Verifier::visitCallBase(CallBase &Call) {
35763577
if (Call.isInlineAsm())
35773578
verifyInlineAsmCall(Call);
35783579

3580+
CV.visit(Call);
3581+
35793582
visitInstruction(Call);
35803583
}
35813584

@@ -4803,8 +4806,6 @@ void Verifier::visitInstruction(Instruction &I) {
48034806
BasicBlock *BB = I.getParent();
48044807
Check(BB, "Instruction not embedded in basic block!", &I);
48054808

4806-
CV.visit(I);
4807-
48084809
if (!isa<PHINode>(I)) { // Check that non-phi nodes are not self referential
48094810
for (User *U : I.users()) {
48104811
Check(U != (User *)&I || !DT.isReachableFromEntry(BB),

0 commit comments

Comments
 (0)