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 | 9ae926b973e42633f7bc7db39b33241dbb9f2158 (patch) | |
tree | 032f0dabf8a90e9c14cd3f96b32ec6cc117609e0 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | d38d9505d1bf380a67bccc6f5a29019394c1fd43 (diff) | |
download | bcm5719-llvm-9ae926b973e42633f7bc7db39b33241dbb9f2158.tar.gz bcm5719-llvm-9ae926b973e42633f7bc7db39b33241dbb9f2158.zip |
[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.
llvm-svn: 340701
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index d0f7be228d2..0d5a522ace3 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1270,7 +1270,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, do { // If we are hoisting the terminator instruction, don't move one (making a // broken BB), instead clone it, and remove BI. - if (isa<TerminatorInst>(I1)) + if (I1->isTerminator()) goto HoistTerminator; // If we're going to hoist a call, make sure that the two instructions we're @@ -2336,8 +2336,7 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI, IfBlock1 = nullptr; } else { DomBlock = *pred_begin(IfBlock1); - for (BasicBlock::iterator I = IfBlock1->begin(); !isa<TerminatorInst>(I); - ++I) + for (BasicBlock::iterator I = IfBlock1->begin(); !I->isTerminator(); ++I) if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) { // This is not an aggressive instruction that we can promote. // Because of this, we won't be able to get rid of the control flow, so @@ -2350,8 +2349,7 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI, IfBlock2 = nullptr; } else { DomBlock = *pred_begin(IfBlock2); - for (BasicBlock::iterator I = IfBlock2->begin(); !isa<TerminatorInst>(I); - ++I) + for (BasicBlock::iterator I = IfBlock2->begin(); !I->isTerminator(); ++I) if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) { // This is not an aggressive instruction that we can promote. // Because of this, we won't be able to get rid of the control flow, so @@ -2922,7 +2920,7 @@ static bool mergeConditionalStoreToAddress(BasicBlock *PTB, BasicBlock *PFB, isa<StoreInst>(I)) ++N; // Free instructions. - else if (isa<TerminatorInst>(I) || IsaBitcastOfPointerType(I)) + else if (I.isTerminator() || IsaBitcastOfPointerType(I)) continue; else return false; |