diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2018-08-26 09:51:22 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2018-08-26 09:51:22 +0000 |
commit | ebc28c56121e9813bee4e94f43e9380c91b1a256 (patch) | |
tree | 5246bf6ea56ccd48e5c5cc478cb17315113cfa80 /polly | |
parent | 1045d78f93e4ce467e54d44153414356b630d317 (diff) |
[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.
Diffstat (limited to 'polly')
-rw-r--r-- | polly/lib/Analysis/ScopBuilder.cpp | 4 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 3 | ||||
-rw-r--r-- | polly/lib/Support/VirtualInstruction.cpp | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index 48d8b20cd85..c1918f5b866 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -685,7 +685,7 @@ void ScopBuilder::buildAccessFunctions() { } 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 @@ static void verifyUses(Scop *S, LoopInfo &LI, DominatorTree &DT) { 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/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 41b9aaf3099..666ac34ea57 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1214,7 +1214,8 @@ bool ScopDetection::isValidInstruction(Instruction &Inst, 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/polly/lib/Support/VirtualInstruction.cpp b/polly/lib/Support/VirtualInstruction.cpp index a1fa03e7019..f779368ab72 100644 --- a/polly/lib/Support/VirtualInstruction.cpp +++ b/polly/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<TerminatorInst>(Inst)) + if (Inst->isTerminator()) return true; // Writes to memory must be honored. |