summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2012-01-05 22:54:35 +0000
committerDan Gohman <gohman@apple.com>2012-01-05 22:54:35 +0000
commit52672118990fbe2621dbdc2094b91c475e7ae871 (patch)
treeaf55687140f2430cfa4eea6d89148abaa1da0ea4 /llvm/lib/Transforms
parent0c2c90b1ad5e4ac703a3d817c69ec87419ccf551 (diff)
downloadbcm5719-llvm-52672118990fbe2621dbdc2094b91c475e7ae871.tar.gz
bcm5719-llvm-52672118990fbe2621dbdc2094b91c475e7ae871.zip
Revert r56315. When the instruction to speculate is a load, this
code can incorrectly move the load across a store. This never happens in practice today, but only because the current heuristics accidentally preclude it. llvm-svn: 147623
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 421156cdf9b..28d3988acc1 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1063,32 +1063,8 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
return false;
}
- // If we get here, we can hoist the instruction. Try to place it
- // before the icmp instruction preceding the conditional branch.
- BasicBlock::iterator InsertPos = BI;
- if (InsertPos != BIParent->begin())
- --InsertPos;
- // Skip debug info between condition and branch.
- while (InsertPos != BIParent->begin() && isa<DbgInfoIntrinsic>(InsertPos))
- --InsertPos;
- if (InsertPos == BrCond && !isa<PHINode>(BrCond)) {
- SmallPtrSet<Instruction *, 4> BB1Insns;
- for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end();
- BB1I != BB1E; ++BB1I)
- BB1Insns.insert(BB1I);
- for(Value::use_iterator UI = BrCond->use_begin(), UE = BrCond->use_end();
- UI != UE; ++UI) {
- Instruction *Use = cast<Instruction>(*UI);
- if (!BB1Insns.count(Use)) continue;
-
- // If BrCond uses the instruction that place it just before
- // branch instruction.
- InsertPos = BI;
- break;
- }
- } else
- InsertPos = BI;
- BIParent->getInstList().splice(InsertPos, BB1->getInstList(), HInst);
+ // If we get here, we can hoist the instruction.
+ BIParent->getInstList().splice(BI, BB1->getInstList(), HInst);
// Create a select whose true value is the speculatively executed value and
// false value is the previously determined FalseV.
OpenPOWER on IntegriCloud