[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 31 23:10:19 PST 2005



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelPattern.cpp updated: 1.28 -> 1.29
---
Log message:

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.


---
Diffs of the changes:  (+3 -2)

 PPC32ISelPattern.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.28 llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.29
--- llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp:1.28	Thu Mar 31 23:57:17 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelPattern.cpp	Fri Apr  1 01:10:02 2005
@@ -1365,6 +1365,9 @@
   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 @@
     //   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 @@
     //   %FalseValue = ...
     //   # fallthrough to sinkMBB
     BB = copy0MBB;
-    unsigned FalseValue = SelectExpr(N.getOperand(2)); //Use if FALSE
     // Update machine-CFG edges
     BB->addSuccessor(sinkMBB);
 






More information about the llvm-commits mailing list