[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 25 12:32:48 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PPCISelDAGToDAG.cpp updated: 1.116 -> 1.117
---
Log message:
Fix a couple of minor bugs. The first fixes povray, the second fixes things
if the dag combiner isn't run
---
Diffs of the changes: (+9 -3)
PPCISelDAGToDAG.cpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.116 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.117
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.116 Fri Oct 21 16:17:10 2005
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Oct 25 14:32:37 2005
@@ -898,8 +898,11 @@
Tmp = CurDAG->getTargetNode(PPC::ADDIS, MVT::i32, getGlobalBaseReg(),CPI);
else
Tmp = CurDAG->getTargetNode(PPC::LIS, MVT::i32, CPI);
- CurDAG->SelectNodeTo(N, PPC::LA, MVT::i32, Tmp, CPI);
- return SDOperand(N, 0);
+ if (N->hasOneUse()) {
+ CurDAG->SelectNodeTo(N, PPC::LA, MVT::i32, Tmp, CPI);
+ return SDOperand(N, 0);
+ }
+ return CurDAG->getTargetNode(PPC::LA, MVT::i32, Tmp, CPI);
}
case ISD::GlobalAddress: {
GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
@@ -1035,7 +1038,10 @@
unsigned SH, MB, ME;
if (isRotateAndMask(N->getOperand(0).Val, Imm, false, SH, MB, ME)) {
Val = Select(N->getOperand(0).getOperand(0));
- } else {
+ } else if (Imm == 0) {
+ // AND X, 0 -> 0, not "rlwinm 32".
+ return Select(N->getOperand(1));
+ } else {
Val = Select(N->getOperand(0));
isRunOfOnes(Imm, MB, ME);
SH = 0;
More information about the llvm-commits
mailing list