[llvm-commits] [llvm] r52703 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Evan Cheng
evan.cheng at apple.com
Wed Jun 25 00:50:13 PDT 2008
Author: evancheng
Date: Wed Jun 25 02:50:12 2008
New Revision: 52703
URL: http://llvm.org/viewvc/llvm-project?rev=52703&view=rev
Log:
- Use O(1) check of basic block size limit.
- Avoid speculatively execute vector ops.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=52703&r1=52702&r2=52703&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Jun 25 02:50:12 2008
@@ -965,8 +965,11 @@
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 @@
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.
}
More information about the llvm-commits
mailing list