1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

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
This commit is contained in:
Chandler Carruth 2013-01-24 08:22:40 +00:00
parent 9287b19a2a
commit 71dd2ccc87

View File

@ -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;