summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-06-25 07:50:12 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-06-25 07:50:12 +0000
commit5fd28b54c7680b21b43c474d92d1328fc7ecd035 (patch)
tree04b999f6865a00140836851aabd5bd730cfc53a5 /llvm/lib/Transforms
parentc9c81fb0dffe65be15907d2f9756698e22ded8a9 (diff)
downloadbcm5719-llvm-5fd28b54c7680b21b43c474d92d1328fc7ecd035.tar.gz
bcm5719-llvm-5fd28b54c7680b21b43c474d92d1328fc7ecd035.zip
- Use O(1) check of basic block size limit.
- Avoid speculatively execute vector ops. llvm-svn: 52703
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index a993784cd25..c215b91259c 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -965,8 +965,11 @@ HoistTerminator:
static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
// Only speculatively execution a single instruction (not counting the
// terminator) for now.
- if (BB1->size() != 2)
- return false;
+ BasicBlock::iterator BBI = BB1->begin();
+ ++BBI; // must have at least a terminator
+ if (BBI == BB1->end()) return false; // only one inst
+ ++BBI;
+ if (BBI != BB1->end()) return false; // more than 2 insts.
// Be conservative for now. FP select instruction can often be expensive.
Value *BrCond = BI->getCondition();
@@ -1006,8 +1009,9 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
- if (I->getOperand(0)->getType()->isFPOrFPVector())
- return false; // FP arithmetic might trap.
+ if (!I->getOperand(0)->getType()->isInteger())
+ // FP arithmetic might trap. Not worth doing for vector ops.
+ return false;
break; // These are all cheap and non-trapping instructions.
}
OpenPOWER on IntegriCloud