[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 15 16:18:03 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.35 -> 1.36
---
Log message:

Eliminate unneeded extensions.


---
Diffs of the changes:  (+9 -0)

Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.35 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.36
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.35	Sat Jan 15 15:11:37 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Sat Jan 15 18:17:20 2005
@@ -855,6 +855,15 @@
            "Cannot *_EXTEND_INREG FP types");
     if (EVT == VT) return N1;  // Not actually extending
     assert(EVT < VT && "Not extending!");
+
+    // If we are sign extending an extension, use the original source.
+    if (N1.getOpcode() == ISD::ZERO_EXTEND_INREG ||
+        N1.getOpcode() == ISD::SIGN_EXTEND_INREG) {
+      if (N1.getOpcode() == Opcode &&
+          cast<MVTSDNode>(N1)->getExtraValueType() <= EVT)
+        return N1;
+    }
+
     break;
   }
 






More information about the llvm-commits mailing list