<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/120621>120621</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [GlobalISel][AArch64] LLVM ERROR: unable to legalize instruction: %37:_(s32) = G_ZEXT %11:_(s1)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            llvm:globalisel,
            llvm:crash,
            crash-on-valid
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fhahn
      </td>
    </tr>
</table>

<pre>
    `llc -global-isel` on the IR below crashes with `LLVM ERROR: unable to legalize instruction: %37:_(s32) = G_ZEXT %11:_(s1) `

https://llvm.godbolt.org/z/bYKo9eTvc


```
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx15.0.0"

define fastcc i32 @foo(<4 x double> %x) {
entry:
  %0 = fcmp ogt <4 x double> %x, zeroinitializer
  %1 = bitcast <4 x i1> %0 to i4
  %2 = zext i4 %1 to i32
  ret i32 %2
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0U12P6yYQ_TXjF-QIBn_ED35gN5urq96qUnZVtX1ZYZvYtMREgLPZ_PoKkux2q75WQphhztFhZnyk93qclWqhfIByk8klTNa1-0lOc9bZ4b2FihrTk3w0tpMm114ZqCixMwmTIt93pFPGvpHeST8pT950mAhU9MePX38mT7vdLzvggiyz7IwiwRKjRmn0RRE9--CWPmg7RwRgyWvg4hVw7TkCNgT4hnx7_ePpt5eYZeyeZSlZUaACqJhCOHrgAnALuDXmdFiNduisCSvrRsDtBXDb_f6TbdTLqb9y4qrobVERpBtVIIMM0sh3u4QkDYgqPwAXNj9iTYELjmmLIfsaxlNVpC3XHweGa-CC4Tqf-RWRP8doG0PET-Xg9NGou6p0h6rI5fFoVH6QvfVnVq7oil4pQMWg9npWZC996HuiORIo6N5aiHqPBTmTwS6dUcCfYufOqV_1A1Ch5uDeY7OoIDFFk-a-PxyJHWPZ_8l-JBflrJ510Gl27k5nid7p0Ev_wdbsxqRx3rq4gzGBL-ociC6u7JjnmABOhWslWKYq680_h5QNLR8a3shMtazmRcVLWtFsaquK1qyr6rqStO6avuZUFeUgUbIB97TMdIsUC4asYQ0t2HolVVPXOPQKa4l030FB1UFqs0q_jnVjpr1fVMuQVsgyIztlfLIHYif7v9Q8ABdCuH6qijgSfATESAYuriZJHvlXJvnj4zJFuZ3zkzR6iNflJnNtxObdMnooqNE--M9HBR1Mcum3JPH9WRkoN1A-3F9Sbsj_7Llscab9ardRh2npVr093Lx3--RHZ_9UfQDcpm56wO2toacW_w4AAP__AJdFxA">