[PATCH] Fix illegal DAG produced by SelectionDAG::getConstant() for v2i64 type

Daniel Sanders daniel.sanders at imgtec.com
Fri Oct 18 02:59:37 PDT 2013


When getConstant() is called for an expanded vector type, it is split into
two scalar constants which are then combined using appropriate build_vector and
bitcast operations.

In addition to the usual big/little endian differences, the case where the
element-order of the vector does not have the same endianness as the elements
themselves is also accounted for (using the recently added
isVectorEltOrderLittleEndian()). For example, for v4i32 on big-endian MIPS, the
byte-order of the vector is <3210,7654,BA98,FEDC>. For little-endian, it is
<0123,4567,89AB,CDEF>.

This fixes a number of cases in MIPS MSA where calling getConstant() during
operation legalization introduces illegal types (e.g. to legalize v2i64 UNDEF
into a v2i64 BUILD_VECTOR of illegal i64 zeros).

lowerMSASplatImm() in the MIPS backend no longer needs to avoid calling
getConstant() so this function has been updated in the same patch.

Depends on D1374.
Depends on D1971.
Depends on D1972.

http://llvm-reviews.chandlerc.com/D1973

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/Target/Mips/MipsSEISelLowering.cpp
  test/CodeGen/Mips/msa/bit.ll
  test/CodeGen/Mips/msa/elm_shift_slide.ll
  test/CodeGen/Mips/msa/i5-a.ll
  test/CodeGen/Mips/msa/i5-c.ll
  test/CodeGen/Mips/msa/i5-m.ll
  test/CodeGen/Mips/msa/i5-s.ll
  test/CodeGen/Mips/msa/llvm-stress-s1704963983.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1973.1.patch
Type: text/x-patch
Size: 13768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131018/b36c1190/attachment.bin>


More information about the llvm-commits mailing list