Issue 239550
Summary [Hexagon] select of <2/4/8 x i1> crashes
Labels new issue
Assignees
Reporter ttm02
    ## Reproducer

```llvm
target triple = "hexagon"

define <8 x i1> @f(i1 %c, <8 x i1> %a, <8 x i1> %b) #0 {
  %r = select i1 %c, <8 x i1> %a, <8 x i1> %b
  ret <8 x i1> %r
}

attributes #0 = { "target-cpu"="hexagonv79" "target-features"="+hvxv79,+hvx-length128b" }
```

```
llc -O3 repro.ll -o -
```
With assertions enabled:

```
llc: llvm/include/llvm/Support/Casting.h:656: decltype(auto) llvm::dyn_cast(From *) [To = llvm::IntegerType, From = llvm::Type]:
Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' failed.
...
2.	Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@f'
...
#11 llvm::EVT::getSizeInBits() const
#12 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags)
#13 (anonymous namespace)::VectorLegalizer::Promote(llvm::SDNode*, llvm::SmallVectorImpl<llvm::SDValue>&)
#14 (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue)
#15 llvm::SelectionDAG::LegalizeVectors()
```

Without assertions, it segfaults in `EVT::isExtendedVector()` under `SelectionDAG::LegalizeVectors()`.

Reproduced on `main` at a59b5eb65e5c (2026-11-06). It crashes at `-O0` and `-O3`, for
`<2 x i1>`, `<4 x i1>` and `<8 x i1>` with or without HVX. Without HVX, `<16 x i1>` crashes as well.


### **Expected:** compiles.


## AI Usage

Drafting this report was assisted with Claude Code.
The reproducer was reduced by the AI tool with `llvm-reduce` from a masked f32 reduction kernel generated by IREE.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to