llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.09k stars 11.59k forks source link

RISCV asserts on v2f64 argument for some ABI options #64645

Closed arsenm closed 1 year ago

arsenm commented 1 year ago
; RUN: llc -mtriple=riscv32 -mattr=+zdinx \
; RUN:   -verify-machineinstrs -target-abi=ilp32 < %s

define <2 x double> @v2f64(<2 x double> %x) {
  ret <2 x double> %x
}
llc: /home/matt/src/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp:15121: bool llvm::RISCV::CC_RISCV(const DataLayout &, RISCVABI::ABI, unsigned int, MVT, MVT, CCValAssign::LocInfo, ISD::ArgFlagsTy, CCState &, bool, bool, Type *, const RISCVTargetLowering &, std::optional<unsigned int>): Assertion `!ArgFlags.isSplit() && PendingLocs.empty() && "Can't lower f64 if it is split"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /home/matt/src/llvm-project/build_release/bin/llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs -target-abi=ilp32
1.  Running pass 'Function Pass Manager' on module '<stdin>'.
2.  Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@v2f64'
 #0 0x0000000005f8c928 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/matt/src/llvm-project/build_release/bin/llc+0x5f8c928)
 #1 0x0000000005f8a65e llvm::sys::RunSignalHandlers() (/home/matt/src/llvm-project/build_release/bin/llc+0x5f8a65e)
 #2 0x0000000005f8cfb8 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fc7e94cf520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007fc7e9523a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007fc7e9523a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007fc7e9523a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007fc7e94cf476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007fc7e94b57f3 abort ./stdlib/abort.c:81:7
 #9 0x00007fc7e94b571b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007fc7e94c6e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000000000483d811 llvm::RISCV::CC_RISCV(llvm::DataLayout const&, llvm::RISCVABI::ABI, unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&, bool, bool, llvm::Type*, llvm::RISCVTargetLowering const&, std::optional<unsigned int>) RISCVISelLowering.cpp:0:0
#12 0x000000000483df0f llvm::RISCVTargetLowering::analyzeInputArgs(llvm::MachineFunction&, llvm::CCState&, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, bool, bool (*)(llvm::DataLayout const&, llvm::RISCVABI::ABI, unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&, bool, bool, llvm::Type*, llvm::RISCVTargetLowering const&, std::optional<unsigned int>)) const RISCVISelLowering.cpp:0:0
#13 0x000000000483f70e llvm::RISCVTargetLowering::LowerFormalArguments(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, llvm::SDLoc const&, llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&) const RISCVISelLowering.cpp:0:0
#14 0x0000000005d39c66 llvm::SelectionDAGISel::LowerArguments(llvm::Function const&) (/home/matt/src/llvm-project/build_release/bin/llc+0x5d39c66)
llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-risc-v

asb commented 1 year ago

Thanks for the report. @wangpc-pp posted D157847 as a candidate patch. As I noted there, it looks like with this issue fixed the generated code for some simple zdinx on rv32 examples is pretty poor. @arsenm if you're actively looking to use zdinx I think you'll probably need to spend some time looking at this and perhaps other issues unfortunately. I don't think it's seen many users.