Do not assume the value passed to memset is an i32.
authorJob Noorman <jobnoorman@gmail.com>
Fri, 29 Aug 2014 08:23:53 +0000 (08:23 +0000)
committerJob Noorman <jobnoorman@gmail.com>
Fri, 29 Aug 2014 08:23:53 +0000 (08:23 +0000)
commitd2323fc295b301f056561fb6f120ba656f1e46c0
treee4c7a2af8005163f515223c124470e811ea13ae0
parent95f7e2d2fd4428bfecf269f216ee20a4b749a18e
Do not assume the value passed to memset is an i32.

The code in SelectionDAG::getMemset for some reason assumes the value passed to
memset is an i32. This breaks the generated code for targets that only have
registers smaller than 32 bits because the value might get split into multiple
registers by the calling convention. See the test for the MSP430 target included
in the patch for an example.

This patch ensures that nothing is assumed about the type of the value. Instead,
the type is taken from the selected overload of the llvm.memset intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216716 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/MSP430/memset.ll [new file with mode: 0644]