[SDAG] Handle non-integer preferred memset types for non-constant values
authorHal Finkel <hfinkel@anl.gov>
Tue, 31 Mar 2015 20:35:26 +0000 (20:35 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 31 Mar 2015 20:35:26 +0000 (20:35 +0000)
commit20fc6ac99ee24a6901b71a5464c73affb31d2db5
tree070602f4b9fdb1d4e40c86eb26ae9d899d2e7df0
parent83b5f345b27253598ecef7c10a6f4cae825d6b42
[SDAG] Handle non-integer preferred memset types for non-constant values

The existing code in getMemsetValue only handled integer-preferred types when
the fill value was not a constant. Make this more robust in two ways:

  1. If the preferred type is a floating-point value, do the mul-splat trick on
     the corresponding integer type and then bitcast.
  2. If the preferred type is a vector, do the mul-splat trick on one vector
     element, and then build a vector out of them.

Fixes PR22754 (although, we should also turn off use of vector types at -O0).

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