diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 08:22:40 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 08:22:40 +0000 |
commit | 9e620952617b90992e50dcf9bca8078c535cbaef (patch) | |
tree | 55622df64e023aeb241f470cbd9bcaebcb99e424 /lib/Transforms | |
parent | c61bc7a90c65bf220a113f31ea26f45e0f4c1413 (diff) | |
download | external_llvm-9e620952617b90992e50dcf9bca8078c535cbaef.zip external_llvm-9e620952617b90992e50dcf9bca8078c535cbaef.tar.gz external_llvm-9e620952617b90992e50dcf9bca8078c535cbaef.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 21d156d..fc84c4a 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/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; |