summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-01-24 08:22:40 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-01-24 08:22:40 +0000
commit1d20c02f55f5cba7591362de4c5078309fb57be0 (patch)
tree2ad321c2ac7312c4fd21a3add03f346312fe1919 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parente00c986897ea6e52e1119adecee361433eed13e7 (diff)
downloadbcm5719-llvm-1d20c02f55f5cba7591362de4c5078309fb57be0.tar.gz
bcm5719-llvm-1d20c02f55f5cba7591362de4c5078309fb57be0.zip
Lift a cheap early exit test above loops and other complex early exit
tests. No need to pay the high cost when we're never going to do anything. No functionality changed. llvm-svn: 173331
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 21d156d1cc6..fc84c4ab28f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1370,6 +1370,11 @@ static bool SinkThenElseCodeToEnd(BranchInst *BI1) {
///
/// \returns true if the conditional block is removed.
static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
+ // Be conservative for now. FP select instruction can often be expensive.
+ Value *BrCond = BI->getCondition();
+ if (isa<FCmpInst>(BrCond))
+ return false;
+
// Only speculatively execution a single instruction (not counting the
// terminator) for now.
Instruction *HInst = NULL;
@@ -1409,11 +1414,6 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
}
}
- // Be conservative for now. FP select instruction can often be expensive.
- Value *BrCond = BI->getCondition();
- if (isa<FCmpInst>(BrCond))
- return false;
-
// If BB1 is actually on the false edge of the conditional branch, remember
// to swap the select operands later.
bool Invert = false;
OpenPOWER on IntegriCloud