[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
sabre at nondot.org
Thu Oct 12 13:23:34 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.216 -> 1.217
---
Log message:
add a minor dag combine noticed when looking at PR945: http://llvm.org/PR945
---
Diffs of the changes: (+7 -0)
DAGCombiner.cpp | 7 +++++++
1 files changed, 7 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.216 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.217
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.216 Thu Oct 12 10:22:24 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Oct 12 15:23:19 2006
@@ -1664,6 +1664,13 @@
return DAG.getNode(ISD::ANY_EXTEND, VT, SmallShift);
}
+ // fold (srl (sra X, Y), 31) -> (srl X, 31). This srl only looks at the sign
+ // bit, which is unmodified by sra.
+ if (N1C && N1C->getValue()+1 == MVT::getSizeInBits(VT)) {
+ if (N0.getOpcode() == ISD::SRA)
+ return DAG.getNode(ISD::SRL, VT, N0.getOperand(0), N1);
+ }
+
// fold (srl (ctlz x), "5") -> x iff x has one bit set (the low bit).
if (N1C && N0.getOpcode() == ISD::CTLZ &&
N1C->getValue() == Log2_32(MVT::getSizeInBits(VT))) {
More information about the llvm-commits
mailing list