summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-13 06:36:51 +0000
committerChris Lattner <sabre@nondot.org>2010-12-13 06:36:51 +0000
commit1d05761df445b6986eed1bc0131952cbd2bff00b (patch)
tree31ef6515c2bb562d85f9031a4eed99c64c07de87 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent25c3af35d84e56a8206908d447f4050898d678e1 (diff)
downloadbcm5719-llvm-1d05761df445b6986eed1bc0131952cbd2bff00b.tar.gz
bcm5719-llvm-1d05761df445b6986eed1bc0131952cbd2bff00b.zip
make this logic a bit simpler.
llvm-svn: 121689
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index e1c9611f9d2..503e5bcb23f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2200,7 +2200,7 @@ bool SimplifyCFGOpt::SimplifySwitch(SwitchInst *SI) {
// see if that predecessor totally determines the outcome of this switch.
if (BasicBlock *OnlyPred = BB->getSinglePredecessor())
if (SimplifyEqualityComparisonWithOnlyPredecessor(SI, OnlyPred))
- return SimplifyCFG(BB) || 1;
+ return SimplifyCFG(BB) | true;
// If the block only contains the switch, see if we can fold the block
// away into any preds.
@@ -2210,7 +2210,7 @@ bool SimplifyCFGOpt::SimplifySwitch(SwitchInst *SI) {
++BBI;
if (SI == &*BBI)
if (FoldValueComparisonIntoPredecessors(SI))
- return SimplifyCFG(BB) || 1;
+ return SimplifyCFG(BB) | true;
return false;
}
@@ -2397,27 +2397,26 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
Changed |= FoldTwoEntryPHINode(PN);
if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) {
- if (BI->isUnconditional())
- return SimplifyUncondBranch(BI) | Changed;
-
- return SimplifyCondBranch(BI) | Changed;
+ if (BI->isUnconditional()) {
+ if (SimplifyUncondBranch(BI)) return true;
+ } else {
+ if (SimplifyCondBranch(BI))
+ return true;
+ }
+ } else if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
+ if (SimplifyReturn(RI)) return true;
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator())) {
+ if (SimplifySwitch(SI)) return true;
+ } else if (UnreachableInst *UI =
+ dyn_cast<UnreachableInst>(BB->getTerminator())) {
+ if (SimplifyUnreachable(UI)) return true;
+ } else if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
+ if (SimplifyUnwind(UI)) return true;
+ } else if (IndirectBrInst *IBI =
+ dyn_cast<IndirectBrInst>(BB->getTerminator())) {
+ if (SimplifyIndirectBr(IBI)) return true;
}
- if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()))
- return SimplifyReturn(RI) | Changed;
-
- if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator()))
- return SimplifySwitch(SI) | Changed;
-
- if (UnreachableInst *UI = dyn_cast<UnreachableInst>(BB->getTerminator()))
- return SimplifyUnreachable(UI) | Changed;
-
- if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator()))
- return SimplifyUnwind(UI) | Changed;
-
- if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(BB->getTerminator()))
- return SimplifyIndirectBr(IBI) | Changed;
-
return Changed;
}
OpenPOWER on IntegriCloud