[llvm-commits] [llvm] r74082 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Dale Johannesen dalej at apple.com
Wed Jun 24 10:11:33 PDT 2009


Author: johannes
Date: Wed Jun 24 12:11:31 2009
New Revision: 74082

URL: http://llvm.org/viewvc/llvm-project?rev=74082&view=rev
Log:
Rewrite 73900 per Duncan's suggestion.


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=74082&r1=74081&r2=74082&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 24 12:11:31 2009
@@ -3181,27 +3181,17 @@
     } else {
       // The type might not be legal for the target.  This should only happen
       // if the type is smaller than a legal type, as on PPC, so the right
-      // thing to do is generate a LoadExt/StoreTrunc pair.
+      // thing to do is generate a LoadExt/StoreTrunc pair.  These simplify
+      // to Load/Store if NVT==VT.
       // FIXME does the case above also need this?
-      if (TLI.isTypeLegal(VT)) {
-        Value = DAG.getLoad(VT, dl, Chain,
-                            getMemBasePlusOffset(Src, SrcOff, DAG),
-                            SrcSV, SrcSVOff + SrcOff, false, Align);
-        Store = DAG.getStore(Chain, dl, Value,
+      MVT NVT = TLI.getTypeToTransformTo(VT);
+      assert(NVT.bitsGE(VT));
+      Value = DAG.getExtLoad(ISD::EXTLOAD, dl, NVT, Chain,
+                             getMemBasePlusOffset(Src, SrcOff, DAG),
+                             SrcSV, SrcSVOff + SrcOff, VT, false, Align);
+      Store = DAG.getTruncStore(Chain, dl, Value,
                              getMemBasePlusOffset(Dst, DstOff, DAG),
-                             DstSV, DstSVOff + DstOff, false, DstAlign);
-      } else {
-        MVT NVT = VT;
-        while (!TLI.isTypeLegal(NVT)) {
-          NVT = (MVT::SimpleValueType(NVT.getSimpleVT() + 1));
-        }
-        Value = DAG.getExtLoad(ISD::EXTLOAD, dl, NVT, Chain,
-                               getMemBasePlusOffset(Src, SrcOff, DAG),
-                               SrcSV, SrcSVOff + SrcOff, VT, false, Align);
-        Store = DAG.getTruncStore(Chain, dl, Value,
-                               getMemBasePlusOffset(Dst, DstOff, DAG),
-                               DstSV, DstSVOff + DstOff, VT, false, DstAlign);
-      }
+                             DstSV, DstSVOff + DstOff, VT, false, DstAlign);
     }
     OutChains.push_back(Store);
     SrcOff += VTSize;





More information about the llvm-commits mailing list