Noah Goldstein
9ef829097b
[InstCombine] Fix buggy transform in foldNestedSelects; PR 71330
...
The bug is that `IsAndVariant` is used to assume which arm in the
select the output `SelInner` should be placed but match the inner
select condition with `m_c_LogicalOp`. With fully simplified ops, this
works fine, but its possible if the select condition is not
simplified, for it match both `LogicalAnd` and `LogicalOr` i.e `select
true, true, false`.
In PR71330 for example, the issue occurs in the following IR:
```
define i32 @bad() {
%..i.i = select i1 false, i32 0, i32 3
%brmerge = select i1 true, i1 true, i1 false
%not.cmp.i.i.not = xor i1 true, true
%.mux = zext i1 %not.cmp.i.i.not to i32
%retval.0.i.i = select i1 %brmerge, i32 %.mux, i32 %..i.i
ret i32 %retval.0.i.i
}
```
When simplifying:
```
%retval.0.i.i = select i1 %brmerge, i32 %.mux, i32 %..i.i
```
We end up matching `%brmerge` as `LogicalAnd` for `IsAndVariant`, but
the inner select (`%..i.i`) condition which is `false` with
`LogicalOr`.
Closes #71489
2023-11-09 16:36:49 -06:00
..
2023-10-26 09:58:54 +02:00
2023-08-15 16:12:53 +02:00
2023-09-18 16:15:16 +02:00
2023-10-26 12:07:37 -07:00
2023-10-21 12:31:06 -07:00
2023-08-21 12:25:15 +01:00
2023-10-24 20:27:39 -07:00
2023-10-26 12:07:37 -07:00
2023-10-24 20:27:39 -07:00
2023-11-08 14:07:28 +00:00
2023-11-09 14:42:07 +08:00
2023-11-08 14:49:24 +01:00
2023-07-12 14:35:55 +02:00
2023-11-02 20:23:38 +00:00
2023-11-04 03:32:20 +08:00
2023-10-26 12:07:37 -07:00
2023-09-14 11:02:31 -07:00
2023-09-24 21:23:00 +08:00
2023-06-28 21:37:50 +00:00
2023-11-03 08:34:15 +09:00
2023-11-03 14:23:30 +09:00
2023-10-30 18:40:48 +00:00
2023-10-25 09:24:36 +08:00
2023-09-07 18:39:19 -04:00
2023-11-01 10:46:31 +01:00
2023-06-08 06:44:06 -07:00
2023-09-19 14:40:31 +01:00
2023-05-25 10:13:52 +08:00
2023-11-03 10:46:07 +01:00
2023-11-03 10:46:07 +01:00
2023-09-12 14:49:14 +02:00
2023-10-24 18:18:51 +01:00
2023-08-09 18:33:11 -04:00
2023-08-03 11:35:45 +01:00
2023-11-07 07:25:47 -08:00
2023-10-12 11:26:48 +01:00
2023-10-03 09:55:38 -07:00
2023-11-08 11:16:23 +00:00
2023-11-01 23:50:35 -05:00
2023-10-26 10:19:06 +02:00
2023-10-26 12:07:37 -07:00
2023-10-31 10:28:40 +00:00
2023-11-09 16:36:49 -06:00
2023-11-08 17:02:10 +00:00
2023-11-07 08:08:49 +00:00
2023-11-07 07:25:47 -08:00
2023-11-03 10:46:07 +01:00
2023-06-12 19:43:34 +00:00
2023-11-01 10:46:31 +01:00
2023-07-12 14:35:55 +02:00
2023-10-24 20:27:39 -07:00
2023-06-30 06:24:56 +01:00
2023-10-24 20:27:39 -07:00
2023-11-03 11:19:14 -07:00
2023-10-31 09:33:07 -07:00
2023-07-12 14:35:55 +02:00
2023-09-20 11:27:54 +02:00
2023-10-24 20:27:39 -07:00
2023-10-10 10:55:57 +02:00
2023-10-31 11:43:57 -07:00
2023-10-31 14:33:53 +00:00
2023-07-05 09:54:28 +02:00
2023-11-08 09:34:40 +01:00
2023-06-20 17:23:56 +02:00
2023-09-15 10:30:45 +02:00
2023-10-23 10:08:08 -07:00
2023-10-06 12:29:06 +01:00
2023-10-20 18:20:47 +08:00
2023-07-12 14:35:55 +02:00
2023-11-09 15:55:44 +01:00
2023-07-28 14:45:30 +02:00
2023-10-19 13:59:57 -07:00
2023-10-26 12:07:37 -07:00
2023-07-04 11:11:14 -04:00
2023-08-15 16:21:25 +02:00
2023-05-17 17:03:15 +02:00
2023-10-26 17:41:05 -07:00
2023-08-09 18:33:11 -04:00
2023-11-06 11:50:41 -08:00
2023-05-17 17:03:15 +02:00
2023-11-03 21:01:07 -07:00
2023-11-08 09:22:55 +08:00
2023-11-06 11:10:59 -08:00
2023-07-03 10:05:40 +01:00
2023-07-12 14:35:55 +02:00
2023-11-02 20:19:40 -04:00
2023-10-26 12:07:37 -07:00
2023-10-24 20:27:39 -07:00
2023-10-23 15:08:53 +02:00
2023-11-06 18:49:49 +00:00
2023-11-03 10:46:07 +01:00
2023-10-26 12:07:37 -07:00
2023-10-30 12:09:43 -07:00
2023-11-09 12:33:24 +08:00
2023-10-09 22:34:44 +08:00
2023-11-06 18:49:49 +00:00
2023-07-07 09:49:38 -04:00
2023-11-09 16:38:52 +01:00
2023-05-17 17:03:15 +02:00
2023-06-29 07:51:49 +02:00
2023-07-31 16:00:02 -07:00
2023-10-25 09:24:36 +08:00
2023-08-09 07:07:47 +08:00
2023-10-24 04:29:53 +07:00
2023-10-26 12:07:37 -07:00
2023-07-22 22:38:10 +01:00
2023-10-16 12:17:24 +02:00
2023-10-31 11:24:30 +01:00
2023-06-29 08:33:45 -07:00