Don't loop unswitch vector selects
authorValentin Churavy <v.churavy@gmail.com>
Sun, 30 Apr 2023 23:19:17 +0000 (19:19 -0400)
committerValentin Churavy <v.churavy@gmail.com>
Sun, 30 Apr 2023 23:19:29 +0000 (19:19 -0400)
commitbf089732775520624cb4983bfed6c341e1b4c405
tree755b64db6dac96bb2bebfff7d7a15742ee5704f5
parent4134f836103ebc70cc23a80c7a966d1d5f3a6353
Don't loop unswitch vector selects

Otherwise we could produce `br <2x i1>` which are of course not legal.

```
Branch condition is not 'i1' type!
  br <2 x i1> %cond.fr1, label %entry.split.us, label %entry.split
  %cond.fr1 = freeze <2 x i1> %cond
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/vchuravy/builds/llvm/bin/opt -passes=simple-loop-unswitch<nontrivial> -S
```

Fixes change introduced by https://reviews.llvm.org/D138526

Reviewed By: caojoshua

Differential Revision: https://reviews.llvm.org/D149560
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll