[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
Chris Lattner
lattner at persephone.cs.uiuc.edu
Sun Aug 28 18:01:32 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PPC32ISelDAGToDAG.cpp updated: 1.49 -> 1.50
---
Log message:
A hack to fix a problem folding immedaites. This fixes Olden/power.
---
Diffs of the changes: (+8 -4)
PPC32ISelDAGToDAG.cpp | 12 ++++++++----
1 files changed, 8 insertions, 4 deletions
Index: llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.49 llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.50
--- llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp:1.49 Sun Aug 28 19:26:57 2005
+++ llvm/lib/Target/PowerPC/PPC32ISelDAGToDAG.cpp Sun Aug 28 20:01:01 2005
@@ -685,16 +685,20 @@
unsigned v = (unsigned)cast<ConstantSDNode>(N)->getValue();
unsigned Hi = HA16(v);
unsigned Lo = Lo16(v);
+
+ // NOTE: This doesn't use SelectNodeTo, because doing that will prevent
+ // folding shared immediates into other the second instruction that
+ // uses it.
if (Hi && Lo) {
SDOperand Top = CurDAG->getTargetNode(PPC::LIS, MVT::i32,
getI32Imm(v >> 16));
- CurDAG->SelectNodeTo(N, PPC::ORI, MVT::i32, Top, getI32Imm(v & 0xFFFF));
+ return CurDAG->getTargetNode(PPC::ORI, MVT::i32, Top,
+ getI32Imm(v & 0xFFFF));
} else if (Lo) {
- CurDAG->SelectNodeTo(N, PPC::LI, MVT::i32, getI32Imm(v));
+ return CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(v));
} else {
- CurDAG->SelectNodeTo(N, PPC::LIS, MVT::i32, getI32Imm(v >> 16));
+ return CurDAG->getTargetNode(PPC::LIS, MVT::i32, getI32Imm(v >> 16));
}
- break;
}
case ISD::UNDEF:
if (N->getValueType(0) == MVT::i32)
More information about the llvm-commits
mailing list