mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Do not hoist instruction above branch condition. The instruction may use branch condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1046,15 +1046,8 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, we can hoist the instruction. Try to place it before the
|
// If we get here, we can hoist the instruction.
|
||||||
// icmp instruction preceeding the conditional branch.
|
BIParent->getInstList().splice(BI, BB1->getInstList(), I);
|
||||||
BasicBlock::iterator InsertPos = BI;
|
|
||||||
if (InsertPos != BIParent->begin())
|
|
||||||
--InsertPos;
|
|
||||||
if (InsertPos == BrCond && !isa<PHINode>(BrCond))
|
|
||||||
BIParent->getInstList().splice(InsertPos, BB1->getInstList(), I);
|
|
||||||
else
|
|
||||||
BIParent->getInstList().splice(BI, BB1->getInstList(), I);
|
|
||||||
|
|
||||||
// Create a select whose true value is the speculatively executed value and
|
// Create a select whose true value is the speculatively executed value and
|
||||||
// false value is the previously determined FalseV.
|
// false value is the previously determined FalseV.
|
||||||
|
18
test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
Normal file
18
test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
; RUN: llvm-as < %s | opt -simplifycfg -disable-output
|
||||||
|
; PR 2800
|
||||||
|
|
||||||
|
define void @foo() {
|
||||||
|
start:
|
||||||
|
%tmp = call i1 @bar( ) ; <i1> [#uses=4]
|
||||||
|
br i1 %tmp, label %brtrue, label %brfalse
|
||||||
|
|
||||||
|
brtrue: ; preds = %start
|
||||||
|
%tmpnew = and i1 %tmp, %tmp ; <i1> [#uses=1]
|
||||||
|
br label %brfalse
|
||||||
|
|
||||||
|
brfalse: ; preds = %brtrue, %start
|
||||||
|
%andandtmp.0 = phi i1 [ %tmp, %start ], [ %tmpnew, %brtrue ] ; <i1> [#uses=0]
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i1 @bar()
|
Reference in New Issue
Block a user