crash: remark: <unknown>:0:0: unable to legalize instruction: N:_(f32) = G_EXTRACT_VECTOR_ELT N:_(<4 x f32>), N:_(i32)

Run:explore-b577f07195-20261129-105236
Kind:crash
Category:remark: <unknown>:0:0: unable to legalize instruction: N:_(f32) = G_EXTRACT_VECTOR_ELT N:_(<4 x f32>), N:_(i32)
Occurrences:3 in 3 configs, 1 test files, 23 more counted only
Snippet from:zext-with-load-is-free.1ae3b0ba.b9179da142.ll (mutant of zext-with-load-is-free.1ae3b0ba.ll) via full input
Config:-mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium
Local check:reproduces at b577f07195
Compiler Explorer:https://godbolt.org/z/MExja597f (llc-assertions-trunk, checked 2026-11-29 14:48 UTC): G crashes differently

Snippet:

; ModuleID = '<stdin>'
source_filename = "<stdin>"

@bytes = dso_local global [5 x i8] zeroinitializer, align 1
@shorts = dso_local global [5 x i16] zeroinitializer, align 2
@G = global i1 true
@G.1 = global float f0x7F7FFFFF
@G.2 = global half 0.000000e+00
@G.3 = global i1 true
@G.4 = global i64 1

; Function Attrs: nounwind
define dso_local i32 @test_zext_i8() #0 {
entry:
  %0 = load i8, ptr @bytes, align 1
  %cmp = icmp eq i8 %0, -120
  %1 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @bytes, i32 0, i32 1), align 1
  %cmp3 = icmp eq i8 %1, 7
  %or.cond = and i1 %cmp, %cmp3
  br i1 %or.cond, label %if.end, label %if.then

if.then:                                          ; preds = %entry
  %E = extractelement <4 x float> zeroinitializer, i1 %cmp3
  store float %E, ptr @G.1, align 4
  %C = icmp slt i8 %0, 42
  store i1 %C, ptr @G, align 1
  ret i32 1

if.end:                                           ; preds = %entry
  %LGV = load i1, ptr @G, align 1
  br i1 %LGV, label %T, label %F

BB:                                               ; preds = %T
  %LGV2 = load i1, ptr @G.3, align 1
  %B = ashr i1 %LGV, %LGV2
  store i1 %B, ptr @G.3, align 1
  ret i32 0

T:                                                ; preds = %if.end
  %C3 = icmp sgt i16 256, -1
  store i1 %C3, ptr poison, align 1
  br label %BB

F:                                                ; preds = %if.end
  ret i32 1
}

; Function Attrs: nounwind
define dso_local i32 @test_zext_i16() #0 {
entry:
  %LGV = load half, ptr @G.2, align 2
  %0 = load i16, ptr @shorts, align 2
  %cmp = icmp eq i16 %0, -120
  %B = udiv i64 42, 42
  %C = fcmp false half 4.200000e+01, %LGV
  %or.cond = and i1 %cmp, %C
  store i64 %B, ptr @G.4, align 4
  br i1 %or.cond, label %if.end, label %if.then

if.then:                                          ; preds = %entry
  %C4 = icmp ugt i128 -1, -170141183460469231731687303715884105728
  store i1 %C4, ptr @G, align 1
  ret i32 1

if.end:                                           ; preds = %entry
  ret i32 0
}

attributes #0 = { nounwind }

Compiler Explorer panes:

PaneOptionsExitInstsstderr
GlobalISel-mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.*1340remark: <unknown>:0:0: unable to legalize instruction: %13:_(f32) = G_EXTRACT_VECTOR_ELT %14:_(<4 x f32>), %16:_(i32) (in function: test_zext_i8)
warning: Instruction selection used fallback path for test_zext_i8
Unhandled predicate
SelectionDAG (control)-mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium -global-isel=0051-

Reproduce:

llc -mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium -global-isel=0 snippet.ll -o -

Local llc output:

remark: <unknown>:0:0: unable to legalize instruction: %13:_(f32) = G_EXTRACT_VECTOR_ELT %14:_(<4 x f32>), %16:_(i32) (in function: test_zext_i8)
warning: Instruction selection used fallback path for test_zext_i8
Unhandled predicate
UNREACHABLE executed at /home/runner/work/llvm-fuzz/llvm-fuzz/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp:2295!
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=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* -o -
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'InstructionSelect' on function '@test_zext_i16'
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       0x000055b9f29ff9eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  llc       0x000055b9f29fc9c1 llvm::sys::RunSignalHandlers() + 369
2  llc       0x000055b9f2a0046b
3  libc.so.6 0x00007f18f5c45330
4  libc.so.6 0x00007f18f5c9ebec pthread_kill + 284
5  libc.so.6 0x00007f18f5c4527e gsignal + 30
6  libc.so.6 0x00007f18f5c288ff abort + 223
7  llc       0x000055b9f295825f
8  llc       0x000055b9f107965e
9  llc       0x000055b9f106da63
10 llc       0x000055b9f32f85b7 llvm::InstructionSelectImpl::selectMachineFunction(llvm::MachineFunction&) + 1255
11 llc       0x000055b9f32f9d51 llvm::InstructionSelectLegacy::runOnMachineFunction(llvm::MachineFunction&) + 417
12 llc       0x000055b9f16796b1 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 513
13 llc       0x000055b9f1c14b37 llvm::FPPassManager::runOnFunction(llvm::Function&) + 871
14 llc       0x000055b9f1c1d052 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
15 llc       0x000055b9f1c158e0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2000
16 llc       0x000055b9f0e70149
17 llc       0x000055b9f0e6d2d3 main + 1747
18 libc.so.6 0x00007f18f5c2a1ca
19 libc.so.6 0x00007f18f5c2a28b __libc_start_main + 139
20 llc       0x000055b9f0e6c3e5 _start + 37

Occurrences (3):

InputFunctionConfig
zext-with-load-is-free.1ae3b0ba.441e9c76e0.ll (mutant of zext-with-load-is-free.1ae3b0ba.ll)-mtriple=riscv32 -verify-machineinstrs -mattr=+v -O3
zext-with-load-is-free.1ae3b0ba.b9179da142.ll (mutant of zext-with-load-is-free.1ae3b0ba.ll)-mtriple=riscv32 -verify-machineinstrs -mattr=+v,+zihintpause,+zicond -O3 -code-model=medium
zext-with-load-is-free.1ae3b0ba.ll-mtriple=riscv32 -verify-machineinstrs -mattr=+v -O0

Generated 2026-11-29 14:49 UTC.