Skip to content

[X86-backend] fptrunc fp128 %x to bfloat failed! #115710

Closed
@DigOrDog

Description

@DigOrDog

Description

The following code crashes X86 backend with "LLVM ERROR: Unsupported library call operation!"

Minimal Reproduction

https://godbolt.org/z/M6WE541vK

Code

@G.1 = global bfloat 0xR7F80

define void @f(fp128 %x) {
  %CastFPTrunc = fptrunc fp128 %x to bfloat
  store bfloat %CastFPTrunc, ptr @G.1, align 2
  ret void
}

Stack Trace

LLVM ERROR: Unsupported library call operation!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O2 -mtriple=x86_64-linux-android -mattr=+mmx -enable-legalize-types-checking <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@f'
 #0 0x000000000391df98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x391df98)
 #1 0x000000000391bb5c SignalHandler(int) Signals.cpp:0:0
 #2 0x000077ce84842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000077ce848969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000077ce84842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000077ce848287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000075696c llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
 #7 0x00000000038740b8 (/opt/compiler-explorer/clang-trunk/bin/llc+0x38740b8)
 #8 0x0000000003744e97 llvm::TargetLowering::makeLibCall(llvm::SelectionDAG&, llvm::RTLIB::Libcall, llvm::EVT, llvm::ArrayRef<llvm::SDValue>, llvm::TargetLowering::MakeLibCallOptions, llvm::SDLoc const&, llvm::SDValue) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x3744e97)
 #9 0x0000000001dcab1e llvm::X86TargetLowering::LowerFP_TO_BF16(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1dcab1e)
#10 0x0000000001eb8957 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1eb8957)
#11 0x00000000035d6ca5 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#12 0x00000000035db42e llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-trunk/bin/llc+0x35db42e)
#13 0x00000000036db80b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x36db80b)
#14 0x00000000036de3fc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36de3fc)
#15 0x00000000036e005f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36e005f)
#16 0x00000000036cc411 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36cc411)
#17 0x00000000029b498b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002f09492 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f09492)
#19 0x0000000002f09721 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f09721)
#20 0x0000000002f0b0c6 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f0b0c6)
#21 0x000000000087d334 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x000000000076aca6 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x76aca6)
#23 0x000077ce84829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x000077ce84829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x00000000008750fe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x8750fe)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions