summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-02-20 11:26:25 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-02-20 11:26:25 +0000
commit07e6e56f57e8781a8d7bc601cc9034a3741d84c2 (patch)
tree2242da177cc122083043828a10ab51785d5e6b03 /lib/Transforms/Utils/SimplifyCFG.cpp
parentd28b57569de19511f63a010a209a08a4e24bfac3 (diff)
downloadllvm-07e6e56f57e8781a8d7bc601cc9034a3741d84c2.tar.gz
llvm-07e6e56f57e8781a8d7bc601cc9034a3741d84c2.tar.bz2
llvm-07e6e56f57e8781a8d7bc601cc9034a3741d84c2.tar.xz
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
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp16
1 files changed, 10 insertions, 6 deletions
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<ConstantInt*> &Values){
- if (Instruction *Inst = dyn_cast<Instruction>(V))
+ if (Instruction *Inst = dyn_cast<Instruction>(V)) {
if (Inst->getOpcode() == Instruction::ICmp &&
cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_EQ) {
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
@@ -407,6 +407,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
if (LHS == RHS)
return LHS;
}
+ }
return 0;
}
@@ -414,7 +415,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &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<ConstantInt*> &Values){
- if (Instruction *Inst = dyn_cast<Instruction>(V))
+ if (Instruction *Inst = dyn_cast<Instruction>(V)) {
if (Inst->getOpcode() == Instruction::ICmp &&
cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_NE) {
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
@@ -430,6 +431,7 @@ static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &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<BranchInst*, 8> CondBranchPreds;
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
TerminatorInst *PTI = (*PI)->getTerminator();
- if (BranchInst *BI = dyn_cast<BranchInst>(PTI))
+ if (BranchInst *BI = dyn_cast<BranchInst>(PTI)) {
if (BI->isUnconditional())
UncondBranchPreds.push_back(*PI);
else
CondBranchPreds.push_back(BI);
+ }
}
// If we found some, do the transformation!