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

Nate Begeman natebegeman at mac.com
Tue Apr 12 16:12:28 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.73 -> 1.74
SelectionDAGISel.cpp updated: 1.40 -> 1.41
---
Log message:

Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes


---
Diffs of the changes:  (+5 -19)

 SelectionDAG.cpp     |   15 ++++-----------
 SelectionDAGISel.cpp |    9 +--------
 2 files changed, 5 insertions(+), 19 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.73 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.74
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.73	Mon Apr 11 21:54:39 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Tue Apr 12 18:12:17 2005
@@ -755,19 +755,12 @@
 
     case ISD::SHL:
     case ISD::SRL:
-      // If the shift amount is bigger than the size of the data, simplify.
+    case ISD::SRA:
+      // If the shift amount is bigger than the size of the data, then all the
+      // bits are shifted out.  Simplify to loading constant zero.
       if (C2 >= MVT::getSizeInBits(N1.getValueType())) {
-        if (TLI.getShiftAmountFlavor() == TargetLowering::Mask) {
-          unsigned NewAmt =
-            C2 & ((1 << MVT::getSizeInBits(N1.getValueType()))-1);
-          return getNode(Opcode, VT, N1, getConstant(NewAmt,N2.getValueType()));
-        } else if (TLI.getShiftAmountFlavor() == TargetLowering::Extend) {
-          // Shifting all of the bits out?
-          return getConstant(0, N1.getValueType());
-        }
+        return getNode(ISD::UNDEF, N1.getValueType());
       }
-      // FALL THROUGH.
-    case ISD::SRA:
       if (C2 == 0) return N1;
       break;
 


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.40 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.41
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.40	Fri Apr  8 22:30:29 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Tue Apr 12 18:12:17 2005
@@ -266,14 +266,7 @@
       } else if (isa<ConstantPointerNull>(C)) {
         return N = DAG.getConstant(0, TLI.getPointerTy());
       } else if (isa<UndefValue>(C)) {
-	/// FIXME: Implement UNDEFVALUE better.
-        if (MVT::isInteger(VT))
-          return N = DAG.getConstant(0, VT);
-        else if (MVT::isFloatingPoint(VT))
-          return N = DAG.getConstantFP(0, VT);
-        else
-          assert(0 && "Unknown value type!");
-
+        return N = DAG.getNode(ISD::UNDEF, VT);
       } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
         return N = DAG.getConstantFP(CFP->getValue(), VT);
       } else {






More information about the llvm-commits mailing list