Yingwei Zheng
554feb0058
[InstSimplify] Simplify select cond, undef, val to val if val = poison implies cond = poison (#76465)
This patch folds:
```
select cond, undef, val -> val
select cond, val, undef -> val
```
iff `impliesPoison(val, cond)` returns true.
Example:
```
define i32 @src1(i32 %retval.0.i.i) {
%cmp.i = icmp sgt i32 %retval.0.i.i, -1
%spec.select.i = select i1 %cmp.i, i32 %retval.0.i.i, i32 undef
ret i32 %spec.select.i
}
define i32 @tgt1(i32 %retval.0.i.i) {
ret i32 %retval.0.i.i
}
```
Alive2: https://alive2.llvm.org/ce/z/okJW3G
Compile-time impact:
http://llvm-compile-time-tracker.com/compare.php?from=38c9390b59c4d2b9181614d6a909887497d3692f&to=e146f51ba278aa3bb6879a9ec651831ac8938e91&stat=instructions%3Au
2023-12-28 23:37:19 +08:00
..
2023-09-03 09:00:27 -04:00
2023-12-14 09:58:14 +01:00
2023-11-06 21:42:56 -08:00
2023-12-13 12:15:09 +01:00
2023-11-27 15:09:18 -08:00
2023-11-21 14:34:02 +01:00
2023-11-28 14:31:16 +01:00
2023-11-29 11:18:42 +01:00
2023-10-05 18:26:50 -07:00
2023-10-24 20:27:39 -07:00
2023-12-02 13:01:48 -08:00
2023-11-25 15:39:59 -08:00
2023-06-25 15:42:22 +01:00
2023-12-05 10:09:52 +01:00
2023-11-26 01:46:31 -08:00
2023-09-01 18:25:16 -07:00
2023-12-06 14:17:18 +01:00
2023-04-11 09:03:01 +01:00
2023-11-21 16:36:45 +01:00
2023-12-28 15:22:23 +00:00
2023-11-21 00:52:23 -08:00
2023-07-12 12:31:42 +05:30
2023-03-15 18:06:32 -07:00
2023-11-21 00:57:37 -08:00
2023-10-16 14:04:09 +02:00
2023-10-11 08:04:04 -07:00
2023-12-08 10:25:04 +01:00
2023-10-10 19:58:03 -07:00
2023-07-28 12:13:35 -07:00
2023-09-20 11:27:54 +02:00
2023-06-25 15:42:22 +01:00
2023-10-31 10:28:40 +00:00
2023-10-24 09:25:32 -07:00
2023-11-21 00:51:52 -08:00
2023-03-15 18:06:32 -07:00
2023-12-28 23:37:19 +08:00
2023-03-29 23:01:11 -07:00
2023-12-07 22:15:32 -08:00
2023-07-20 14:56:19 +01:00
2023-12-19 14:32:43 +01:00
2023-08-14 14:11:17 +02:00
2023-06-30 12:31:32 -04:00
2023-11-22 08:52:53 +00:00
2023-12-18 09:41:54 +00:00
2023-04-10 19:40:52 -07:00
2023-12-11 21:01:36 -08:00
2023-10-24 23:03:13 -07:00
2023-06-13 13:18:48 -07:00
2023-10-19 16:35:02 +02:00
2023-12-24 15:13:15 -08:00
2023-05-24 12:40:10 -07:00
2023-05-08 10:34:53 -07:00
2023-08-10 09:57:32 -07:00
2023-10-04 21:20:00 -07:00
2023-06-13 13:18:48 -07:00
2023-12-06 08:41:44 -08:00
2023-06-13 13:18:48 -07:00
2023-07-28 12:13:35 -07:00
2023-02-27 12:57:59 +03:00
2023-09-30 18:51:28 -07:00
2023-10-22 12:15:46 -07:00
2023-12-22 14:16:54 +00:00
2023-10-26 10:37:18 +02:00
2023-03-02 13:14:07 +00:00
2023-07-05 18:11:44 +01:00
2023-07-28 12:13:35 -07:00
2023-03-14 00:32:40 -07:00
2023-11-07 17:26:26 +01:00
2023-08-29 18:59:52 -07:00
2023-12-21 11:02:54 +00:00
2023-12-28 05:04:04 -08:00
2023-10-11 08:04:04 -07:00
2023-11-16 12:50:46 -08:00
2023-07-28 12:13:35 -07:00
2023-06-29 08:33:45 -07:00
2023-07-27 09:54:50 +05:30
2023-12-23 04:41:32 +08:00
2023-12-19 12:05:28 +00:00
2023-12-21 12:37:57 +00:00