[IR] Replace `isa<TerminatorInst>` with `isTerminator()`.
This is a bit awkward in a handful of places where we didn't even have
an instruction and now we have to see if we can build one. But on the
whole, this seems like a win and at worst a reasonable cost for removing
`TerminatorInst`.
All of this is part of the removal of `TerminatorInst` from the
`Instruction` type hierarchy.
git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@340701 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScopBuilder.cpp b/lib/Analysis/ScopBuilder.cpp
index 48d8b20..c1918f5 100644
--- a/lib/Analysis/ScopBuilder.cpp
+++ b/lib/Analysis/ScopBuilder.cpp
@@ -685,7 +685,7 @@
}
bool ScopBuilder::shouldModelInst(Instruction *Inst, Loop *L) {
- return !isa<TerminatorInst>(Inst) && !isIgnoredIntrinsic(Inst) &&
+ return !Inst->isTerminator() && !isIgnoredIntrinsic(Inst) &&
!canSynthesize(Inst, *scop, &SE, L);
}
@@ -1399,7 +1399,7 @@
continue;
// Branch conditions are encoded in the statement domains.
- if (isa<TerminatorInst>(&Inst) && Stmt->isBlockStmt())
+ if (Inst.isTerminator() && Stmt->isBlockStmt())
continue;
// Verify all uses.
diff --git a/lib/Analysis/ScopDetection.cpp b/lib/Analysis/ScopDetection.cpp
index 41b9aaf..666ac34 100644
--- a/lib/Analysis/ScopDetection.cpp
+++ b/lib/Analysis/ScopDetection.cpp
@@ -1214,7 +1214,8 @@
auto *PHI = dyn_cast<PHINode>(OpInst);
if (PHI) {
for (User *U : PHI->users()) {
- if (!isa<TerminatorInst>(U))
+ auto *UI = dyn_cast<Instruction>(U);
+ if (!UI || !UI->isTerminator())
return false;
}
} else {
diff --git a/lib/Support/VirtualInstruction.cpp b/lib/Support/VirtualInstruction.cpp
index a1fa03e..f779368 100644
--- a/lib/Support/VirtualInstruction.cpp
+++ b/lib/Support/VirtualInstruction.cpp
@@ -178,7 +178,7 @@
// Terminator instructions (in region statements) are required for control
// flow.
- if (isa<TerminatorInst>(Inst))
+ if (Inst->isTerminator())
return true;
// Writes to memory must be honored.