crash: Assertion failed: (TypeSize::isKnownLT(DstTy.getSizeInBits(), SrcTy.getSizeInBits()) && "invalid widening trunc"), function validateTruncExt, file MachineIRBuilder.cpp

Run:main-db12fc36f6-20261127-110859
Kind:crash
Category:Assertion failed: (TypeSize::isKnownLT(DstTy.getSizeInBits(), SrcTy.getSizeInBits()) && "invalid widening trunc"), function validateTruncExt, file MachineIRBuilder.cpp
Occurrences:18 in 5 configs, 3 test files
Snippet from:fastcc-without-f-reg.ll @callee_double_32 via llvm-extract
Config:-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs
Local check:reproduces at db12fc36f6
Compiler Explorer:https://godbolt.org/z/ejGozdYd3 (llc-assertions-trunk, checked 2026-11-18 14:46 UTC): G no crash on trunk

Snippet:

; Function Attrs: nounwind
define fastcc double @callee_double_32(<32 x double> %A) #0 {
  %B = extractelement <32 x double> %A, i32 0
  ret double %B
}

attributes #0 = { nounwind }

Compiler Explorer panes:

PaneOptionsExitInstsstderr
GlobalISel-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.*01remark: <unknown>:0:0: unable to translate instruction: extractelement: ' %B = extractelement <32 x double> %A, i32 0' (in function: callee_double_32)
warning: Instruction selection used fallback path for callee_double_32
SelectionDAG (control)-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs -global-isel=001-

Reproduce:

llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs -global-isel=0 snippet.ll -o -

Local llc output:

llc: /home/runner/work/llvm-fuzz/llvm-fuzz/llvm-project/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:1293: void llvm::MachineIRBuilder::validateTruncExt(const LLT, const LLT, bool): Assertion `TypeSize::isKnownLT(DstTy.getSizeInBits(), SrcTy.getSizeInBits()) && "invalid widening trunc"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /home/runner/work/llvm-fuzz/llvm-fuzz/llvm-project/build/bin/llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* -o -
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'IRTranslator' on function '@callee_double_32'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  llc       0x000055aed56a0c1b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  llc       0x000055aed569dbf1 llvm::sys::RunSignalHandlers() + 369
2  llc       0x000055aed56a169b
3  libc.so.6 0x00007fc94a845330
4  libc.so.6 0x00007fc94a89ebec pthread_kill + 284
5  libc.so.6 0x00007fc94a84527e gsignal + 30
6  libc.so.6 0x00007fc94a8288ff abort + 223
7  libc.so.6 0x00007fc94a82881b
8  libc.so.6 0x00007fc94a83b517
9  llc       0x000055aed6016f87
10 llc       0x000055aed6017df2 llvm::MachineIRBuilder::buildInstr(unsigned int, llvm::ArrayRef<llvm::DstOp>, llvm::ArrayRef<llvm::SrcOp>, std::optional<unsigned int>) + 3314
11 llc       0x000055aed5f265e1 llvm::CSEMIRBuilder::buildInstr(unsigned int, llvm::ArrayRef<llvm::DstOp>, llvm::ArrayRef<llvm::SrcOp>, std::optional<unsigned int>) + 3089
12 llc       0x000055aed6015871 llvm::MachineIRBuilder::buildTrunc(llvm::DstOp const&, llvm::SrcOp const&, std::optional<unsigned int>) + 33
13 llc       0x000055aed5f1936f llvm::CallLowering::buildCopyFromRegs(llvm::MachineIRBuilder&, llvm::ArrayRef<llvm::Register>, llvm::ArrayRef<llvm::Register>, llvm::LLT, llvm::LLT, llvm::ISD::ArgFlagsTy) + 6111
14 llc       0x000055aed5f1d1ed llvm::CallLowering::handleAssignments(llvm::CallLowering::ValueHandler&, llvm::SmallVectorImpl<llvm::CallLowering::ArgInfo>&, llvm::CCState&, llvm::SmallVectorImpl<llvm::CCValAssign>&, llvm::MachineIRBuilder&, llvm::ArrayRef<llvm::Register>) const + 5261
15 llc       0x000055aed3d07f9c
16 llc       0x000055aed5f90483 llvm::IRTranslatorImpl::runOnMachineFunction(llvm::MachineFunction&, llvm::function_ref<llvm::GISelCSEInfo* ()>, bool, llvm::function_ref<llvm::AAResults* ()>, llvm::function_ref<llvm::BranchProbabilityInfo* ()>, llvm::function_ref<llvm::AssumptionCache* ()>, llvm::TargetLibraryInfo*, llvm::LibcallLoweringInfo const*, llvm::SSPLayoutInfo*) + 3523
17 llc       0x000055aed5f9171d llvm::IRTranslatorLegacy::runOnMachineFunction(llvm::MachineFunction&) + 733
18 llc       0x000055aed4319761 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 513
19 llc       0x000055aed48b5a77 llvm::FPPassManager::runOnFunction(llvm::Function&) + 871
20 llc       0x000055aed48bdf92 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
21 llc       0x000055aed48b6820 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2000
22 llc       0x000055aed3b10689
23 llc       0x000055aed3b0d813 main + 1747
24 libc.so.6 0x00007fc94a82a1ca
25 libc.so.6 0x00007fc94a82a28b __libc_start_main + 139
26 llc       0x000055aed3b0c925 _start + 37

Occurrences (18) (first 15):

InputFunctionConfig
fastcc-float.ll-mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs
fastcc-without-f-reg.ll-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs
fastcc-without-f-reg.ll-mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs
fp-fcanonicalize.ll--mtriple=riscv32
fp-fcanonicalize.ll--mtriple=riscv64
fp-fcanonicalize.ll-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs
fp-fcanonicalize.ll-mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs
fastcc-float.55e1bed46b.ll (mutant of fastcc-float.ll)-mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs
fastcc-float.91a462280b.ll (mutant of fastcc-float.ll)-mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs
fastcc-float.cf1eec160c.ll (mutant of fastcc-float.ll)-mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs
fastcc-float.ebc3df94c3.ll (mutant of fastcc-float.ll)-mtriple=riscv32 -mattr=+f,+d -target-abi=ilp32 -verify-machineinstrs
fp-fcanonicalize.3bbff38863.ll (mutant of fp-fcanonicalize.ll)--mtriple=riscv64
fp-fcanonicalize.53043798fb.ll (mutant of fp-fcanonicalize.ll)--mtriple=riscv64
fp-fcanonicalize.a3e5a66152.ll (mutant of fp-fcanonicalize.ll)-mtriple=riscv64 -mattr=+zhinx -verify-machineinstrs
fp-fcanonicalize.a996e5a744.ll (mutant of fp-fcanonicalize.ll)-mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs

Generated 2026-11-29 14:49 UTC.