LLVM 18 regression: SelectionDAG/LegalizeDAG.cpp:991: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed #90356
Closed
Closed
Description
version: LLVM 18.x branch (commit 78b99c7)
The Zig compiler fails to build from source after updating to LLVM 18.
reduced.ll
:
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define fastcc void @"fmt.parse_float.decimal.Decimal(f16).leftShift"() #0 {
br label %1
1: ; preds = %7, %2, %0
%.sroa.02.0 = phi i64 [ 0, %0 ], [ -1, %7 ], [ %4, %2 ]
%.sroa.0.0 = phi i64 [ 1, %0 ], [ %3, %7 ], [ %3, %2 ]
%.not = icmp eq i64 %.sroa.0.0, 0
br i1 %.not, label %6, label %2
2: ; preds = %1
%3 = add i64 %.sroa.0.0, 1
%4 = add i64 %.sroa.02.0, -1
%5 = icmp eq i64 %.sroa.02.0, 0
br i1 %5, label %7, label %1
6: ; preds = %1
ret void
7: ; preds = %2
%8 = getelementptr [768 x i8], ptr null, i64 0, i64 %4
store i8 0, ptr %8, align 1
br label %1
; uselistorder directives
uselistorder i64 %3, { 1, 0 }
}
attributes #0 = { "target-features"="-16bit-mode,-32bit-mode,-3dnow,-3dnowa,+64bit,+adx,+aes,+allow-light-256-bit,-amx-bf16,-amx-complex,-amx-fp16,-amx-int8,-amx-tile,+avx,-avx10.1-256,-avx10.1-512,+avx2,+avx512bf16,+avx512bitalg,+avx512bw,+avx512cd,+avx512dq,-avx512er,+avx512f,-avx512fp16,+avx512ifma,-avx512pf,+avx512vbmi,+avx512vbmi2,+avx512vl,+avx512vnni,-avx512vp2intersect,+avx512vpopcntdq,-avxifma,-avxneconvert,-avxvnni,-avxvnniint16,-avxvnniint8,+bmi,+bmi2,+branchfusion,-ccmp,-cf,-cldemote,+clflushopt,+clwb,+clzero,+cmov,-cmpccxadd,+crc32,+cx16,+cx8,-egpr,-enqcmd,-ermsb,-evex512,+f16c,-false-deps-getmant,-false-deps-lzcnt-tzcnt,-false-deps-mulc,-false-deps-mullq,-false-deps-perm,-false-deps-popcnt,-false-deps-range,-fast-11bytenop,+fast-15bytenop,-fast-7bytenop,+fast-bextr,-fast-gather,-fast-hops,+fast-lzcnt,+fast-movbe,+fast-scalar-fsqrt,+fast-scalar-shift-masks,-fast-shld-rotate,-fast-variable-crosslane-shuffle,+fast-variable-perlane-shuffle,+fast-vector-fsqrt,-fast-vector-shift-masks,-faster-shift-than-shuffle,+fma,-fma4,+fsgsbase,+fsrm,+fxsr,+gfni,-harden-sls-ijmp,-harden-sls-ret,-hreset,-idivl-to-divb,-idivq-to-divl,+invpcid,-kl,-lea-sp,-lea-uses-ag,-lvi-cfi,-lvi-load-hardening,-lwp,+lzcnt,+macrofusion,+mmx,+movbe,-movdir64b,-movdiri,+mwaitx,-ndd,-no-bypass-delay,-no-bypass-delay-blend,-no-bypass-delay-mov,-no-bypass-delay-shuffle,+nopl,-pad-short-functions,+pclmul,-pconfig,+pku,+popcnt,-ppx,-prefer-128-bit,-prefer-256-bit,-prefer-mask-registers,-prefer-movmsk-over-vtest,-prefer-no-gather,-prefer-no-scatter,-prefetchi,-prefetchwt1,+prfchw,-ptwrite,-push2pop2,-raoint,+rdpid,+rdpru,+rdrnd,+rdseed,-retpoline,-retpoline-external-thunk,-retpoline-indirect-branches,-retpoline-indirect-calls,-rtm,+sahf,+sbb-dep-breaking,-serialize,-seses,-sgx,+sha,-sha512,+shstk,-slow-3ops-lea,-slow-incdec,-slow-lea,-slow-pmaddwd,-slow-pmulld,+slow-shld,-slow-two-mem-ops,-slow-unaligned-mem-16,-slow-unaligned-mem-32,-sm3,-sm4,-soft-float,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+sse4a,-sse-unaligned-mem,+ssse3,-tagged-globals,-tbm,-tsxldtrk,-tuning-fast-imm-vector-shift,-uintr,-use-glm-div-sqrt-costs,-use-slm-arith-costs,-usermsr,+vaes,+vpclmulqdq,+vzeroupper,-waitpkg,+wbnoinvd,-widekl,+x87,-xop,+xsave,+xsavec,+xsaveopt,+xsaves" }
[nix-shell:~/src/zig/build-llvm18-release]$ ~/local/llvm18-assert/bin/clang -c reduced.ll -O3
clang: /home/andy/dev/llvm-project-18/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:991: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/andy/local/llvm18-assert/bin/clang -c reduced.ll -O3
1. Code generation
2. Running pass 'Function Pass Manager' on module 'reduced.ll'.
3. Running pass 'X86 DAG->DAG Instruction Selection' on function '@"fmt.parse_float.decimal.Decimal(f16).leftShift"'
#0 0x000000000387f4db llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/andy/local/llvm18-assert/bin/clang+0x387f4db)
#1 0x000000000387c83b llvm::sys::RunSignalHandlers() (/home/andy/local/llvm18-assert/bin/clang+0x387c83b)
#2 0x00000000037c1508 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f2075454a70 __restore_rt (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x3da70)
#4 0x00007f20754a3ddc __pthread_kill_implementation (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x8cddc)
#5 0x00007f20754549c6 gsignal (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x3d9c6)
#6 0x00007f207543d8fa abort (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x268fa)
#7 0x00007f207543d819 _nl_load_domain.cold (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x26819)
#8 0x00007f207544d3c6 (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x363c6)
#9 0x00000000048a69fa (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#10 0x00000000048b3100 llvm::SelectionDAG::Legalize() (/home/andy/local/llvm18-assert/bin/clang+0x48b3100)
#11 0x000000000499c826 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/andy/local/llvm18-assert/bin/clang+0x499c826)
#12 0x00000000049a06ac llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/andy/local/llvm18-assert/bin/clang+0x49a06ac)
#13 0x00000000049a2257 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#14 0x0000000002409ff5 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#15 0x0000000002c30325 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x0000000003213619 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/andy/local/llvm18-assert/bin/clang+0x3213619)
#17 0x0000000003213751 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3213751)
#18 0x0000000003214057 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3214057)
#19 0x0000000003aedb33 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/andy/local/llvm18-assert/bin/clang+0x3aedb33)
#20 0x00000000040cd0fa clang::CodeGenAction::ExecuteAction() (/home/andy/local/llvm18-assert/bin/clang+0x40cd0fa)
#21 0x000000000434b2c9 clang::FrontendAction::Execute() (/home/andy/local/llvm18-assert/bin/clang+0x434b2c9)
#22 0x00000000042d0c02 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/andy/local/llvm18-assert/bin/clang+0x42d0c02)
#23 0x000000000441906f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/andy/local/llvm18-assert/bin/clang+0x441906f)
#24 0x0000000000b7b6ca cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/andy/local/llvm18-assert/bin/clang+0xb7b6ca)
#25 0x0000000000b736a7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x000000000410e509 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#27 0x00000000037c1962 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/andy/local/llvm18-assert/bin/clang+0x37c1962)
#28 0x000000000410fbf4 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#29 0x00000000040d6ae5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d6ae5)
#30 0x00000000040d75dd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d75dd)
#31 0x00000000040e1bb4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/andy/local/llvm18-assert/bin/clang+0x40e1bb4)
#32 0x0000000000b78d69 clang_main(int, char**, llvm::ToolContext const&) (/home/andy/local/llvm18-assert/bin/clang+0xb78d69)
#33 0x0000000000a6feb3 main (/home/andy/local/llvm18-assert/bin/clang+0xa6feb3)
#34 0x00007f207543efce __libc_start_call_main (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x27fce)
#35 0x00007f207543f089 __libc_start_main@GLIBC_2.2.5 (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x28089)
#36 0x0000000000b72315 _start (/home/andy/local/llvm18-assert/bin/clang+0xb72315)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.1.5 (https://github.com/llvm/llvm-project 78b99c73ee4b96fe9ce0e294d4632326afb2db42)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/andy/local/llvm18-assert/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
Metadata
Metadata
Assignees
Type
Projects
Status
Done