From d3b94f9cfab9ee0710cd624388181ed7bd067c00 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 26 Aug 2018 09:51:22 +0000 Subject: [PATCH] [IR] Replace `isa` 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 --- lib/Analysis/ScopBuilder.cpp | 4 ++-- lib/Analysis/ScopDetection.cpp | 3 ++- lib/Support/VirtualInstruction.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Analysis/ScopBuilder.cpp b/lib/Analysis/ScopBuilder.cpp index 48d8b20c..c1918f5b 100644 --- a/lib/Analysis/ScopBuilder.cpp +++ b/lib/Analysis/ScopBuilder.cpp @@ -685,7 +685,7 @@ void ScopBuilder::buildAccessFunctions() { } bool ScopBuilder::shouldModelInst(Instruction *Inst, Loop *L) { - return !isa(Inst) && !isIgnoredIntrinsic(Inst) && + return !Inst->isTerminator() && !isIgnoredIntrinsic(Inst) && !canSynthesize(Inst, *scop, &SE, L); } @@ -1399,7 +1399,7 @@ static void verifyUses(Scop *S, LoopInfo &LI, DominatorTree &DT) { continue; // Branch conditions are encoded in the statement domains. - if (isa(&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 41b9aaf3..666ac34e 100644 --- a/lib/Analysis/ScopDetection.cpp +++ b/lib/Analysis/ScopDetection.cpp @@ -1214,7 +1214,8 @@ bool ScopDetection::isValidInstruction(Instruction &Inst, auto *PHI = dyn_cast(OpInst); if (PHI) { for (User *U : PHI->users()) { - if (!isa(U)) + auto *UI = dyn_cast(U); + if (!UI || !UI->isTerminator()) return false; } } else { diff --git a/lib/Support/VirtualInstruction.cpp b/lib/Support/VirtualInstruction.cpp index a1fa03e7..f779368a 100644 --- a/lib/Support/VirtualInstruction.cpp +++ b/lib/Support/VirtualInstruction.cpp @@ -178,7 +178,7 @@ static bool isRoot(const Instruction *Inst) { // Terminator instructions (in region statements) are required for control // flow. - if (isa(Inst)) + if (Inst->isTerminator()) return true; // Writes to memory must be honored. -- 2.11.4.GIT