Skip to content

Commit ed502f2

Browse files
nikicIanWood1
authored andcommitted
[IR] Convert check to assertion in PredIterator (NFC) (llvm#137931)
After llvm#137799 and llvm#137816, instruction uses of BasicBlocks are always terminators, so assert that instead of checking it.
1 parent a3efaa2 commit ed502f2

File tree

1 file changed

+4
-3
lines changed
  • llvm/include/llvm/IR

1 file changed

+4
-3
lines changed

llvm/include/llvm/IR/CFG.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ class PredIterator {
5454
inline void advancePastNonTerminators() {
5555
// Loop to ignore non-terminator uses (for example BlockAddresses).
5656
while (!It.atEnd()) {
57-
if (auto *Inst = dyn_cast<Instruction>(*It))
58-
if (Inst->isTerminator())
59-
break;
57+
if (auto *Inst = dyn_cast<Instruction>(*It)) {
58+
assert(Inst->isTerminator() && "BasicBlock used in non-terminator");
59+
break;
60+
}
6061

6162
++It;
6263
}

0 commit comments

Comments
 (0)