From 9ae926b973e42633f7bc7db39b33241dbb9f2158 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 26 Aug 2018 09:51:22 +0000 Subject: [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. llvm-svn: 340701 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') 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(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(I); - ++I) + for (BasicBlock::iterator I = IfBlock1->begin(); !I->isTerminator(); ++I) if (!AggressiveInsts.count(&*I) && !isa(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(I); - ++I) + for (BasicBlock::iterator I = IfBlock2->begin(); !I->isTerminator(); ++I) if (!AggressiveInsts.count(&*I) && !isa(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(I)) ++N; // Free instructions. - else if (isa(I) || IsaBitcastOfPointerType(I)) + else if (I.isTerminator() || IsaBitcastOfPointerType(I)) continue; else return false; -- cgit v1.2.3