[llvm-bugs] [Bug 40457] New: Asserts in SelectionDAGISel::LowerArguments erroneously (?) hidden behind "-debug" flag, hiding "bugs" in at least two backends

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 25 00:55:02 PST 2019


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

            Bug ID: 40457
           Summary: Asserts in SelectionDAGISel::LowerArguments
                    erroneously (?) hidden behind "-debug" flag, hiding
                    "bugs" in at least two backends
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Reproduce with:
 llc test/CodeGen/AArch64/aarch-multipart.ll -o - -debug

which yields

Creating new node: t27: v2i64,ch = load<(load 16 from %fixed-stack.0)> t0,
FrameIndex:i64<-1>, undef:i64
Creating new node: t29: v2i64,ch = load<(load 16 from %fixed-stack.0)> t0,
FrameIndex:i64<-2>, undef:i64
llc: ../lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:9110: void
llvm::SelectionDAGISel::LowerArguments(const llvm::Function &): Assertion
`EVT(Ins[i].VT) == InVals[i].getValueType() && "LowerFormalArguments emitted a
value with the wrong type!"' failed.
Stack dump:
0.      Program arguments: /data/repo/master/llvm-master/build-all/bin/llc
test/CodeGen/AArch64/aarch-multipart.ll -o - -debug 
1.      Running pass 'Function Pass Manager' on module
'test/CodeGen/AArch64/aarch-multipart.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function
'@caller_function'
 #0 0x0000000002223fd4 PrintStackTraceSignalHandler(void*)
(/data/repo/master/llvm-master/build-all/bin/llc+0x2223fd4)
 #1 0x0000000002221fe0 llvm::sys::RunSignalHandlers()
(/data/repo/master/llvm-master/build-all/bin/llc+0x2221fe0)
 #2 0x0000000002224338 SignalHandler(int)
(/data/repo/master/llvm-master/build-all/bin/llc+0x2224338)
 #3 0x00007f05c9fc8330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
 #4 0x00007f05c8bb7c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
 #5 0x00007f05c8bbb028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
 #6 0x00007f05c8bb0bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
 #7 0x00007f05c8bb0ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
 #8 0x0000000002066ab5 llvm::SelectionDAGISel::LowerArguments(llvm::Function
const&) (/data/repo/master/llvm-master/build-all/bin/llc+0x2066ab5)
 #9 0x00000000020cb9f1
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x20cb9f1)
#10 0x00000000020c9bcc
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x20c9bcc)
#11 0x00000000018d004d
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x18d004d)
#12 0x0000000001c137cd llvm::FPPassManager::runOnFunction(llvm::Function&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x1c137cd)
#13 0x0000000001c13a88 llvm::FPPassManager::runOnModule(llvm::Module&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x1c13a88)
#14 0x0000000001c13eea llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x1c13eea)
#15 0x0000000000747d0b compileModule(char**, llvm::LLVMContext&)
(/data/repo/master/llvm-master/build-all/bin/llc+0x747d0b)
#16 0x0000000000745400 main
(/data/repo/master/llvm-master/build-all/bin/llc+0x745400)
#17 0x00007f05c8ba2f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#18 0x000000000074325a _start
(/data/repo/master/llvm-master/build-all/bin/llc+0x74325a)
Abort

while just
  llc test/CodeGen/AArch64/aarch-multipart.ll -o - 
passes succesfully.

The assertion that fails is the second one of

  LLVM_DEBUG({
    for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
      assert(InVals[i].getNode() &&
             "LowerFormalArguments emitted a null value!");
      assert(EVT(Ins[i].VT) == InVals[i].getValueType() &&
             "LowerFormalArguments emitted a value with the wrong type!");
    }
  });

in SelectionDAGISel::LowerArguments and I suppose someone rather wanted to do
something like
 #ifndef NDEBUG
 ...
 #endif
around the loop rather than hiding it behind -debug.

Note that if we always activate the asserts the following lit tests fail:
    LLVM :: CodeGen/AArch64/aarch-multipart.ll
    LLVM :: CodeGen/AArch64/argument-blocks.ll
    LLVM :: CodeGen/AArch64/arm64-aapcs.ll
    LLVM :: CodeGen/AMDGPU/function-args.ll

The problem seems to be types that are handled with CCBitConvertToType in the
calling convention, like

  CCIfType<[v2f64, v4f32], CCBitConvertToType<v2i64>>,

but then lack a corresponding bitcast in the target's LowerFormalArguments
method.

-- 
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/20190125/424624f7/attachment.html>


More information about the llvm-bugs mailing list