From 07e6e56f57e8781a8d7bc601cc9034a3741d84c2 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Wed, 20 Feb 2008 11:26:25 +0000 Subject: Make Transforms to be 4.3 warnings-clean git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47371 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/SimplifyCFG.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp') diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index c89ec60d69..2092c8b58a 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -391,7 +391,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB, // icmp_eq instructions that compare a value against a constant, return the // value being compared, and stick the constant into the Values vector. static Value *GatherConstantSetEQs(Value *V, std::vector &Values){ - if (Instruction *Inst = dyn_cast(V)) + if (Instruction *Inst = dyn_cast(V)) { if (Inst->getOpcode() == Instruction::ICmp && cast(Inst)->getPredicate() == ICmpInst::ICMP_EQ) { if (ConstantInt *C = dyn_cast(Inst->getOperand(1))) { @@ -407,6 +407,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector &Values){ if (LHS == RHS) return LHS; } + } return 0; } @@ -414,7 +415,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector &Values){ // setne instructions that compare a value against a constant, return the value // being compared, and stick the constant into the Values vector. static Value *GatherConstantSetNEs(Value *V, std::vector &Values){ - if (Instruction *Inst = dyn_cast(V)) + if (Instruction *Inst = dyn_cast(V)) { if (Inst->getOpcode() == Instruction::ICmp && cast(Inst)->getPredicate() == ICmpInst::ICMP_NE) { if (ConstantInt *C = dyn_cast(Inst->getOperand(1))) { @@ -430,6 +431,7 @@ static Value *GatherConstantSetNEs(Value *V, std::vector &Values){ if (LHS == RHS) return LHS; } + } return 0; } @@ -658,11 +660,12 @@ static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI, ConstantInt *TIV = 0; BasicBlock *TIBB = TI->getParent(); for (unsigned i = 0, e = PredCases.size(); i != e; ++i) - if (PredCases[i].second == TIBB) + if (PredCases[i].second == TIBB) { if (TIV == 0) TIV = PredCases[i].first; else return false; // Cannot handle multiple values coming to this block. + } assert(TIV && "No edge from pred to succ?"); // Okay, we found the one constant that our value can be if we get into TI's @@ -1190,8 +1193,8 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { "Can't Simplify entry block!"); // Remove basic blocks that have no predecessors... which are unreachable. - if (pred_begin(BB) == pred_end(BB) || - *pred_begin(BB) == BB && ++pred_begin(BB) == pred_end(BB)) { + if ((pred_begin(BB) == pred_end(BB)) || + (*pred_begin(BB) == BB && ++pred_begin(BB) == pred_end(BB))) { DOUT << "Removing BB: \n" << *BB; // Loop through all of our successors and make sure they know that one @@ -1235,11 +1238,12 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { SmallVector CondBranchPreds; for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { TerminatorInst *PTI = (*PI)->getTerminator(); - if (BranchInst *BI = dyn_cast(PTI)) + if (BranchInst *BI = dyn_cast(PTI)) { if (BI->isUnconditional()) UncondBranchPreds.push_back(*PI); else CondBranchPreds.push_back(BI); + } } // If we found some, do the transformation! -- cgit v1.2.3