[llvm-bugs] [Bug 42905] New: X86TargetLowering::LowerTRUNCATE(llvm::SDValue, llvm::SelectionDAG &) const: Assertion `VT.is128BitVector() && InVT.is256BitVector() && "Unexpected types!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 6 12:34:43 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42905

            Bug ID: 42905
           Summary: X86TargetLowering::LowerTRUNCATE(llvm::SDValue,
                    llvm::SelectionDAG &) const: Assertion
                    `VT.is128BitVector() && InVT.is256BitVector() &&
                    "Unexpected types!"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: bjorn.a.pettersson at ericsson.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Created attachment 22346
  --> https://bugs.llvm.org/attachment.cgi?id=22346&action=edit
reproducer (can probably be reduced further)

When running

  llc -march=x86-64 -mcpu=corei7 -o /dev/null stress-size-300-seed-30452.ll

we hit an assertion in X86TargetLowering::LowerTRUNCATE

llc: ../lib/Target/X86/X86ISelLowering.cpp:19161: llvm::SDValue
llvm::X86TargetLowering::LowerTRUNCATE(llvm::SDValue, llvm::SelectionDAG &)
const: Assertion `VT.is128BitVector() && InVT.is256BitVector() && "Unexpected
types!"' failed.
Stack dump:
0.      Program arguments: bin/llc -march=x86-64 -mcpu=corei7 -o /dev/null
stress.ll -x86-experimental-vector-widening-legalization=1 
1.      Running pass 'Function Pass Manager' on module 'stress.ll'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@autogen_SD30452'
 #0 0x0000000002345914 PrintStackTraceSignalHandler(void*) (bin/llc+0x2345914)
 #1 0x00000000023435fe llvm::sys::RunSignalHandlers() (bin/llc+0x23435fe)
 #2 0x0000000002345d18 SignalHandler(int) (bin/llc+0x2345d18)
 #3 0x0000003ba280f7e0 __restore_rt (/lib64/libpthread.so.0+0x3ba280f7e0)
 #4 0x0000003ba24324f5 raise (/lib64/libc.so.6+0x3ba24324f5)
 #5 0x0000003ba2433cd5 abort (/lib64/libc.so.6+0x3ba2433cd5)
 #6 0x0000003ba242b66e __assert_fail_base (/lib64/libc.so.6+0x3ba242b66e)
 #7 0x0000003ba242b730 __assert_perror_fail (/lib64/libc.so.6+0x3ba242b730)
 #8 0x0000000001255826 llvm::X86TargetLowering::LowerTRUNCATE(llvm::SDValue,
llvm::SelectionDAG&) const (bin/llc+0x1255826)
 #9 0x0000000001270c63 llvm::X86TargetLowering::LowerOperation(llvm::SDValue,
llvm::SelectionDAG&) const (bin/llc+0x1270c63)
#10 0x000000000222cb44 (anonymous
namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) (bin/llc+0x222cb44)
#11 0x000000000222b31e llvm::SelectionDAG::LegalizeVectors()
(bin/llc+0x222b31e)
#12 0x00000000021c6f38 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(bin/llc+0x21c6f38)
#13 0x00000000021c581c
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(bin/llc+0x21c581c)
#14 0x00000000021c21b6
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(bin/llc+0x21c21b6)
#15 0x0000000001210bf6 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(bin/llc+0x1210bf6)
#16 0x000000000197d919
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (bin/llc+0x197d919)
#17 0x0000000001cec553 llvm::FPPassManager::runOnFunction(llvm::Function&)
(bin/llc+0x1cec553)
#18 0x0000000001cec863 llvm::FPPassManager::runOnModule(llvm::Module&)
(bin/llc+0x1cec863)
#19 0x0000000001cececd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(bin/llc+0x1cececd)
#20 0x00000000007890ce compileModule(char**, llvm::LLVMContext&)
(bin/llc+0x7890ce)
#21 0x000000000078682d main (bin/llc+0x78682d)
#22 0x0000003ba241ed20 __libc_start_main (/lib64/libc.so.6+0x3ba241ed20)
#23 0x00000000007844c9 _start (bin/llc+0x7844c9)
Abort (core dumped)


This problem turned up after -x86-experimental-vector-widening-legalization was
set to true by default in this commit:


commit 3de33245d2c992c9e0af60372043540b60f3a810
Author: Craig Topper <craig.topper at intel.com>
Date:   Mon Aug 5 18:25:36 2019 +0000

    [X86] Enable -x86-experimental-vector-widening-legalization by default.

    This patch changes our defualt legalization behavior for 16, 32, and
    64 bit vectors with i8/i16/i32/i64 scalar types from promotion to
    widening. For example, v8i8 will now be widened to v16i8 instead of
    promoted to v8i16. This keeps the elements widths the same and pads
    with undef elements. We believe this is a better legalization strategy.
    But it carries some issues due to the fragmented vector ISA. For
    example, i8 shifts and multiplies get widened and then later have
    to be promoted/split into vXi16 vectors.

    This has the potential to cause regressions so we wanted to get
    it in early in the 10.0 cycle so we have plenty of time to
    address them.

    Next steps will be to merge tests that explicitly test the command
    line option. And then we can remove the option and its associated
    code.

    llvm-svn: 367901


Adding -debug gives the following DAG being legalized when hitting the assert:

Optimized type-legalized selection DAG: %bb.24 'autogen_SD30452:CF259'
SelectionDAG has 35 nodes:
  t0: ch = EntryToken
  t32: v2i64,ch = CopyFromReg t0, Register:v2i64 %8
        t49: ch = CopyToReg t0, Register:f32 %110, ConstantFP:f32<8.193822e+16>
          t55: i8,ch = CopyFromReg t0, Register:i8 %22
          t51: i64,ch = CopyFromReg t0, Register:i64 %135
        t56: ch = store<(store 1 into %ir.0)> t0, t55, t51, undef:i64
          t68: v2f64 = sint_to_fp t32
        t42: ch = CopyToReg t0, Register:v2f64 %108, t68
                t34: v2i64,ch = CopyFromReg t32:1, Register:v2i64 %9
              t35: v2i64 = AssertZext t34, ValueType:ch:i18
            t78: v2i32 = truncate t35
          t79: v2f64 = sint_to_fp t78
        t44: ch = CopyToReg t0, Register:v2f64 %109, t79
      t67: ch = TokenFactor t49, t56, t42, t44
            t58: v4i32,ch = CopyFromReg t0, Register:v4i32 %93
          t75: v16i8 = bitcast t58
        t77: i8 = extract_vector_elt t75, Constant:i64<8>
      t74: i8 = and t77, Constant:i8<1>
    t64: ch = brcond t67, t74, BasicBlock:ch<CF242 0x579b298>
  t66: ch = br t64, BasicBlock:ch<CF245.preheader 0x579b428>


Legalizing vector op: t78: v2i32 = truncate t35
Trying custom legalization
llc: ../lib/Target/X86/X86ISelLowering.cpp:19161: llvm::SDValue
llvm::X86TargetLowering::LowerTRUNCATE(llvm::SDValue, llvm::SelectionDAG &)
const: Assertion `VT.is128BitVector() && InVT.is256BitVector() && "Unexpected
types!"' failed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190806/625ee96f/attachment.html>


More information about the llvm-bugs mailing list