[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Dec 22 21:38:02 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.71 -> 1.72
SelectionDAG.cpp updated: 1.231 -> 1.232
---
Log message:
Fold bitconv(bitconv(x)) -> x. We now compile this:
void foo(double);
void bar(double X) { foo(X); }
to this:
bar:
save -96, %o6, %o6
or %g0, %i0, %o0
or %g0, %i1, %o1
call foo
nop
restore %g0, %g0, %g0
retl
nop
instead of this:
bar:
save -112, %o6, %o6
st %i1, [%i6+-4]
st %i0, [%i6+-8]
ldd [%i6+-8], %f0
std %f0, [%i6+-16]
ld [%i6+-12], %o1
ld [%i6+-16], %o0
call foo
nop
restore %g0, %g0, %g0
retl
nop
on V8.
---
Diffs of the changes: (+5 -0)
DAGCombiner.cpp | 3 +++
SelectionDAG.cpp | 2 ++
2 files changed, 5 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.71 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.72
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.71 Thu Dec 22 23:30:37 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Dec 22 23:37:50 2005
@@ -1757,6 +1757,9 @@
if (Res.Val != N) return Res;
}
+ if (N0.getOpcode() == ISD::BIT_CONVERT) // conv(conv(x,t1),t2) -> conv(x,t2)
+ return DAG.getNode(ISD::BIT_CONVERT, VT, N0.getOperand(0));
+
return SDOperand();
}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.231 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.232
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.231 Thu Dec 22 23:30:37 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Dec 22 23:37:50 2005
@@ -916,6 +916,8 @@
assert(MVT::getSizeInBits(VT)==MVT::getSizeInBits(Operand.getValueType()) &&
"Cannot BIT_CONVERT between two different types!");
if (VT == Operand.getValueType()) return Operand; // noop conversion.
+ if (OpOpcode == ISD::BIT_CONVERT) // bitconv(bitconv(x)) -> bitconv(x)
+ return getNode(ISD::BIT_CONVERT, VT, Operand.getOperand(0));
break;
case ISD::FNEG:
if (OpOpcode == ISD::FSUB) // -(X-Y) -> (Y-X)
More information about the llvm-commits
mailing list