[llvm-commits] [llvm] r51696 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/memmove-4.ll

Chris Lattner clattner at apple.com
Thu May 29 18:49:55 PDT 2008


On May 29, 2008, at 12:42 PM, Dan Gohman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=51696&view=rev
> Log:
> Expand small memmovs using inline code. Set the X86 threshold for  
> expanding
> memmove to a more plausible value, now that it's actually being used.

Nice.

>
> +static SDOperand getMemmoveLoadsAndStores(SelectionDAG &DAG,
> +                                          SDOperand Chain,  
> SDOperand Dst,
> +                                          SDOperand Src, uint64_t  
> Size,
> +                                          unsigned Align, bool  
> AlwaysInline,
> +                                          const Value *DstSV,  
> uint64_t DstSVOff,
> +                                          const Value *SrcSV,  
> uint64_t SrcSVOff){
> +
> +  std::string Str;

Str is dead.

>
> +  uint64_t SrcOff = 0, DstOff = 0;
> +
> +  SmallVector<SDOperand, 8> LoadValues;
> +  SmallVector<SDOperand, 8> LoadChains;
> +  SmallVector<SDOperand, 8> OutChains;
> +  unsigned NumMemOps = MemOps.size();
> +  for (unsigned i = 0; i < NumMemOps; i++) {
> +    MVT::ValueType VT = MemOps[i];
> +    unsigned VTSize = MVT::getSizeInBits(VT) / 8;
> +    SDOperand Value, Store;
> +
> +    Value = DAG.getLoad(VT, Chain,
> +                        getMemBasePlusOffset(Src, SrcOff, DAG),
> +                        SrcSV, SrcSVOff + SrcOff, false, Align);
> +    LoadValues.push_back(Value);
> +    LoadChains.push_back(Value.getValue(1));
> +    SrcOff += VTSize;
> +  }

NumMemOps can never be zero here, right?  How about an assert?

-Chris




More information about the llvm-commits mailing list