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

Duncan Sands baldrick at free.fr
Tue Jun 23 01:39:00 PDT 2009


Hi Dale,

> +      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,
> +                             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);
> +      }

rather than looping over simple value types, how about using
getTypeToTransformTo?  This also allows you to unify the two
cases: if VT is legal then NVT = getTypeToTransformTo(VT) will
return VT, and in this case getExtLoad and getTruncStore will
create an ordinary load and store.  I think you should also add
an assertion that NVT.bitsGE(VT).

Ciao,

Duncan.



More information about the llvm-commits mailing list