Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

SelectionDAGBuilder produces vector nodes without vector support (results in crash) #31453

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR32481
Status RESOLVED FIXED
Importance P normal
Reported by Jonas Paulsson (paulsson@linux.vnet.ibm.com)
Reported on 2017-03-30 23:48:32 -0700
Last modified on 2017-03-31 06:34:21 -0700
Version trunk
Hardware PC Linux
CC craig.topper@gmail.com, efriedma@quicinc.com, llvm-bugs@lists.llvm.org, uweigand@de.ibm.com
Fixed by commit(s)
Attachments v1i8_zEC12_crash.ll (708 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 18201
reduced test case

A small test case that includes the type <1 x i8>, causes SelectionDAG to crash
on an older subtarget which does not have vector support.

Should this vector type with one element not be converted to i8 during
SelectionDAG construction, if the target has no vector support? Or is target
required to handle also these types of vector values regardless of vector
support?

Initial selection DAG: BB#1 'autogen_SD18500:CF244'
SelectionDAG has 24 nodes:
  t0: ch = EntryToken
  t16: f32 = ConstantFP<5.720826e-10>
  t17: f32 = ConstantFP<1.107380e+14>
  t18: ch = setune
            t3: i1 = setcc undef:i1, undef:i1, setule:ch
                  t5: i32,ch = CopyFromReg t0, Register:i32 %vreg0
                t7: i32 = AssertSext t5, ValueType:ch:i8
              t8: i8 = truncate t7
            t9: v1i8 = BUILD_VECTOR t8
          t11: v1i8 = select t3, t9, undef:v1i8
        t13: i32 = extract_vector_elt t11, Constant:i32<0>
      t15: ch = CopyToReg t0, Register:i32 %vreg1, t13
    t21: ch = brcond t15, Constant:i1<-1>, BasicBlock:ch<CF244 0x58627f8>
  t23: ch = br t21, BasicBlock:ch<CF241.preheader 0x58628a8>

The SystemZ target then tries to emit an illegal truncate, as it was not
expecting this for zEC12.

Run with
bin/llc -mtriple=s390x-linux-gnu -mcpu=zEC12

(zEC12 is the previous version, which did not have vector support.)
Quuxplusone commented 7 years ago

Attached v1i8_zEC12_crash.ll (708 bytes, text/plain): reduced test case

Quuxplusone commented 7 years ago

SelectionDAG construction won't convert it. Construction is just a dumb transformation from IR to SelectionDAG. It should get converted during LegalizeTypes after the first DAG combine.

Quuxplusone commented 7 years ago

Thanks. Fixed in r299213.