Issue 61524
Summary [X86] Illegal type for i4->v4i1 bitcast
Labels bug, backend:X86
Assignees
Reporter dcaballe
    The following reproducer crashes when compiling with `llc repro.ll -mcpu=cascadelake`:

```
define <3 x i1> @repro(i1 %cond) local_unnamed_addr {
  %select = select i1 %cond, <3 x i1> <i1 true, i1 true, i1 true>, <3 x i1> zeroinitializer
  ret <3 x i1> %select
}
```

Error:
```
LegalizeDAG.cpp:979: void (anonymous namespace)::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.
```

This is what I can see:
```
t63: ch = CopyToReg t0, Register:v4i1 %25, t284, -:67:11 @[ -:2:3 ]       
          t230: i8 = setcc t13, Constant:i64<10>, setgt:ch, -:67:11 @[ -:2:3 ]
        t281: i4 = select t230, Constant:i4<7>, Constant:i4<0>, -:67:11 @[ -:2:3 ] 
      t282: v4i1 = bitcast t281, -:67:11 @[ -:2:3 ] 
```

If I change the IR to use `<4 x i1>` instead of `<3 x i1>` it seems to work:

```
define <4 x i1> @repro(i1 %cond) local_unnamed_addr {
  %select = select i1 %cond, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> zeroinitializer
  ret <4 x i1> %select
}
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to