summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-01 07:10:02 +0000
committerChris Lattner <sabre@nondot.org>2005-04-01 07:10:02 +0000
commitffc7f243fe3f4143e184853c89f0676faedef3a6 (patch)
tree1c5eef823e1e8da993a45ffc88958568a815ce6e /llvm/lib
parent329c14a8bce9249b2da6d5203d4762cf343834bf (diff)
downloadbcm5719-llvm-ffc7f243fe3f4143e184853c89f0676faedef3a6.tar.gz
bcm5719-llvm-ffc7f243fe3f4143e184853c89f0676faedef3a6.zip
Move the selection of the arms of the select operation up to the conditional
part to make sure we get the side effects and to avoid confusing the CFG. llvm-svn: 20977
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp b/llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
index 9b70f3d23a1..26b1955b3a2 100644
--- a/llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
+++ b/llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
@@ -1365,6 +1365,9 @@ unsigned ISel::SelectExpr(SDOperand N) {
case ISD::SELECT: {
Opc = SelectSetCR0(N.getOperand(0));
+ unsigned TrueValue = SelectExpr(N.getOperand(1)); //Use if TRUE
+ unsigned FalseValue = SelectExpr(N.getOperand(2)); //Use if FALSE
+
// Create an iterator with which to insert the MBB for copying the false
// value and the MBB to hold the PHI instruction for this SetCC.
MachineBasicBlock *thisMBB = BB;
@@ -1380,7 +1383,6 @@ unsigned ISel::SelectExpr(SDOperand N) {
// fallthrough --> copy0MBB
MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB);
MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB);
- unsigned TrueValue = SelectExpr(N.getOperand(1)); //Use if TRUE
BuildMI(BB, Opc, 2).addReg(PPC::CR0).addMBB(sinkMBB);
MachineFunction *F = BB->getParent();
F->getBasicBlockList().insert(It, copy0MBB);
@@ -1393,7 +1395,6 @@ unsigned ISel::SelectExpr(SDOperand N) {
// %FalseValue = ...
// # fallthrough to sinkMBB
BB = copy0MBB;
- unsigned FalseValue = SelectExpr(N.getOperand(2)); //Use if FALSE
// Update machine-CFG edges
BB->addSuccessor(sinkMBB);
OpenPOWER on IntegriCloud