[llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su

Bill Wendling isanbard at gmail.com
Tue Sep 30 16:08:25 PDT 2008


On Tue, Sep 30, 2008 at 3:55 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>
> Actually, I think it'd be better to do this the right way.

Bah! :-)

> The correct
> way to handle this option is to convert all memcpy / memset (and
> other) intrinsic calls to normal calls. Perhaps in
> SelectionDAGBuild.cpp? e.g.
>
>   case Intrinsic::memcpy_i32:
>   case Intrinsic::memcpy_i64: {
>     SDValue Op1 = getValue(I.getOperand(1));
>     SDValue Op2 = getValue(I.getOperand(2));
>     SDValue Op3 = getValue(I.getOperand(3));
>     unsigned Align = cast<ConstantInt>(I.getOperand(4))-
>  >getZExtValue();
>     DAG.setRoot(DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Align, false,
>                               I.getOperand(1), 0, I.getOperand(2), 0));
>     return 0;
>   }
>
> We can lower it to a call to memcpy with -fno-builtin.
>
That's basically what I suggested in another email. So I think it's a
brilliant idea. ;-)

-bw



More information about the llvm-commits mailing list