Roman Lebedev
3cb87e905c
[InstCombine] Re-commit: Fold 'check for [no] signed truncation' pattern
...
Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]
As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.
The DAGCombine will reverse this transform, see
https://reviews.llvm.org/D49266
This transform is surprisingly frustrating.
This does not deal with non-splat shift amounts, or with undef shift amounts.
I've outlined what i think the solution should be:
```
// Potential handling of non-splats: for each element:
// * if both are undef, replace with constant 0.
// Because (1<<0) is OK and is 1, and ((1<<0)>>1) is also OK and is 0.
// * if both are not undef, and are different, bailout.
// * else, only one is undef, then pick the non-undef one.
```
This is a re-commit, as the original patch, committed in rL337190
was reverted in rL337344 as it broke chromium build:
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832
Proofs that the fixed folds are ok: https://rise4fun.com/Alive/VYM
Differential Revision: https://reviews.llvm.org/D49320
llvm-svn: 337376
2018-07-18 10:55:17 +00:00
..
2018-05-30 14:38:50 +00:00
2018-07-05 17:05:36 +00:00
2018-05-31 12:19:18 +00:00
2018-07-12 00:29:56 +00:00
2018-05-24 20:16:43 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-02-01 13:05:25 +00:00
2017-11-28 19:07:28 +00:00
2018-05-09 02:40:45 +00:00
2018-07-16 02:23:00 +00:00
2018-07-11 01:07:21 +00:00
2018-04-26 20:07:17 +00:00
2018-04-26 20:52:28 +00:00
2018-07-01 13:42:57 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-07-06 17:32:39 +00:00
2018-01-19 17:13:12 +00:00
2018-03-25 17:48:20 +00:00
2018-02-03 16:51:03 +00:00
2018-07-13 01:18:07 +00:00
2018-05-31 06:00:36 +00:00
2018-04-14 13:39:02 +00:00
2018-01-17 14:39:28 +00:00
2018-02-08 14:10:01 +00:00
2018-02-08 14:10:01 +00:00
2018-04-24 21:06:06 +00:00
2018-04-21 16:58:00 +00:00
2018-02-13 23:02:12 +00:00
2018-06-20 13:22:26 +00:00
2018-07-09 22:27:23 +00:00
2017-12-30 03:13:00 +00:00
2018-05-01 12:25:46 +00:00
2017-12-16 01:26:25 +00:00
2017-12-16 01:26:25 +00:00
2018-05-22 23:29:40 +00:00
2018-05-09 22:56:32 +00:00
2018-01-19 17:13:12 +00:00
2018-01-03 13:35:43 +00:00
2018-06-10 20:10:13 +00:00
2018-07-14 12:19:56 +00:00
2018-07-14 12:19:56 +00:00
2018-07-14 20:08:37 +00:00
2018-07-14 20:08:16 +00:00
2018-07-14 20:08:26 +00:00
2018-07-14 20:08:47 +00:00
2018-07-14 12:20:06 +00:00
2018-07-14 16:44:43 +00:00
2018-07-14 16:44:54 +00:00
2018-07-14 12:20:16 +00:00
2018-07-18 10:55:17 +00:00
2018-07-11 19:05:04 +00:00
2018-07-12 14:56:12 +00:00
2018-06-10 20:10:13 +00:00
2018-06-15 09:56:52 +00:00
2018-07-18 10:55:17 +00:00
2017-11-13 01:47:52 +00:00
2017-12-01 12:34:16 +00:00
2018-04-22 17:07:44 +00:00
2018-07-06 17:32:39 +00:00
2018-05-31 00:16:58 +00:00
2018-07-06 17:32:39 +00:00
2018-04-22 17:07:44 +00:00
2018-06-06 16:53:56 +00:00
2018-03-22 14:08:16 +00:00
2018-06-06 12:46:02 +00:00
2018-06-26 18:55:43 +00:00
2017-11-13 01:47:52 +00:00
2018-02-20 23:29:05 +00:00
2017-11-13 01:47:52 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-07-17 18:08:36 +00:00
2018-06-15 13:48:55 +00:00
2018-01-21 16:14:51 +00:00
2018-06-26 12:41:15 +00:00
2018-06-27 00:47:53 +00:00
2018-05-11 20:04:50 +00:00
2017-11-13 01:47:52 +00:00
2017-12-30 05:54:22 +00:00
2017-11-16 16:38:42 +00:00
2018-03-25 21:16:33 +00:00
2018-04-16 14:13:57 +00:00
2018-04-16 14:13:57 +00:00
2018-03-25 21:16:33 +00:00
2018-04-05 15:36:55 +00:00
2018-02-15 15:07:12 +00:00
2018-02-15 15:07:12 +00:00
2018-04-05 15:36:55 +00:00
2017-11-16 16:59:49 +00:00
2018-04-05 15:36:55 +00:00
2018-03-18 14:32:54 +00:00
2018-04-05 15:36:55 +00:00
2018-05-31 00:16:58 +00:00
2018-03-05 18:04:12 +00:00
2018-05-30 23:55:12 +00:00
2018-05-14 22:05:01 +00:00
2018-04-05 18:51:45 +00:00
2018-02-14 06:58:08 +00:00
2018-04-18 00:36:40 +00:00
2017-11-13 01:47:52 +00:00
2018-07-06 04:04:13 +00:00
2018-04-03 17:26:20 +00:00
2018-02-14 06:58:08 +00:00
2018-07-12 14:56:17 +00:00
2018-07-11 19:05:04 +00:00
2018-07-06 04:04:13 +00:00
2018-07-06 04:04:13 +00:00
2017-10-15 15:39:15 +00:00
2018-06-21 18:07:38 +00:00
2018-07-16 02:23:00 +00:00
2017-11-08 21:59:51 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-10-10 05:07:54 +00:00
2017-12-30 03:13:00 +00:00
2018-07-12 23:55:20 +00:00
2018-04-28 15:45:07 +00:00
2018-04-28 15:45:07 +00:00
2018-07-09 22:27:23 +00:00
2017-12-09 00:21:41 +00:00
2018-07-09 22:27:23 +00:00
2018-05-09 02:40:45 +00:00
2017-12-08 15:32:10 +00:00
2018-07-09 22:27:23 +00:00
2018-04-22 15:59:14 +00:00
2018-04-04 19:01:51 +00:00
2018-05-31 06:00:36 +00:00
2018-05-31 06:00:36 +00:00
2018-05-31 06:00:36 +00:00
2018-05-31 06:00:36 +00:00
2018-07-06 04:04:13 +00:00
2018-05-20 14:23:23 +00:00
2018-05-10 20:03:13 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-07-09 22:27:23 +00:00
2018-07-09 22:27:23 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-02-12 23:06:55 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-04-06 16:06:08 +00:00
2018-01-19 17:13:12 +00:00
2018-04-22 17:07:44 +00:00
2018-05-31 19:55:27 +00:00
2017-12-26 15:09:19 +00:00
2018-05-10 20:03:13 +00:00
2018-02-13 23:02:12 +00:00
2017-12-12 20:28:46 +00:00
2018-06-04 03:33:01 +00:00
2017-10-22 20:28:17 +00:00
2018-07-09 22:21:16 +00:00
2018-01-19 17:13:12 +00:00
2018-03-25 17:48:20 +00:00
2017-12-14 12:00:04 +00:00
2018-04-27 21:23:20 +00:00
2018-04-20 10:49:19 +00:00
2017-12-13 11:21:18 +00:00
2017-11-13 01:47:52 +00:00
2018-02-03 17:33:50 +00:00
2017-12-10 17:25:54 +00:00
2018-03-01 15:13:42 +00:00
2017-11-19 16:42:27 +00:00
2017-12-13 11:21:18 +00:00
2018-01-19 17:13:12 +00:00
2017-12-09 23:42:56 +00:00
2018-02-14 18:08:33 +00:00
2018-05-21 17:46:34 +00:00
2017-11-13 01:47:52 +00:00
2018-04-18 14:21:31 +00:00
2018-06-26 16:30:00 +00:00
2018-05-11 00:46:09 +00:00
2018-07-03 11:29:00 +00:00
2018-06-04 02:52:36 +00:00
2018-02-28 16:53:45 +00:00
2018-05-20 14:23:23 +00:00
2018-05-31 19:55:27 +00:00
2018-02-01 13:05:25 +00:00
2017-10-31 12:34:02 +00:00
2018-03-08 14:57:08 +00:00
2018-01-19 10:05:15 +00:00
2018-05-03 21:58:44 +00:00
2018-05-31 19:55:27 +00:00
2018-04-22 17:07:44 +00:00
2018-04-24 21:06:06 +00:00
2018-07-09 22:27:23 +00:00
2018-06-08 15:44:47 +00:00
2018-04-21 16:58:00 +00:00
2018-02-03 16:51:03 +00:00
2018-07-10 16:09:49 +00:00
2018-01-24 21:36:45 +00:00
2018-01-19 17:13:12 +00:00
2018-05-11 17:50:49 +00:00
2018-01-19 17:13:12 +00:00
2018-05-11 16:53:56 +00:00
2018-01-19 17:13:12 +00:00
2018-06-08 20:42:36 +00:00
2017-12-14 10:36:31 +00:00
2018-07-09 22:27:23 +00:00
2018-01-19 17:13:12 +00:00
2018-04-25 18:58:53 +00:00
2018-04-25 18:58:53 +00:00
2018-01-19 17:13:12 +00:00
2018-07-09 22:27:23 +00:00
2018-07-09 22:27:23 +00:00
2017-12-18 10:31:58 +00:00
2018-01-19 17:13:12 +00:00
2018-02-19 12:10:20 +00:00
2018-01-19 17:13:12 +00:00
2018-07-11 16:52:18 +00:00
2017-11-16 14:40:51 +00:00
2018-02-09 10:43:59 +00:00
2018-05-09 22:27:34 +00:00
2018-04-30 17:59:33 +00:00
2018-04-30 17:59:33 +00:00
2018-05-17 08:16:08 +00:00
2018-05-23 03:01:45 +00:00
2018-05-03 21:58:44 +00:00
2018-02-05 17:53:29 +00:00
2018-03-01 16:28:32 +00:00
2018-06-21 17:51:44 +00:00
2018-07-09 17:20:20 +00:00
2018-03-23 15:39:03 +00:00
2018-03-23 15:39:03 +00:00
2017-12-30 05:54:22 +00:00
2018-02-08 17:54:24 +00:00
2018-02-09 10:43:59 +00:00
2018-02-17 16:00:42 +00:00
2018-03-06 18:19:42 +00:00
2018-07-09 22:27:23 +00:00
2017-09-26 02:36:57 +00:00
2017-09-26 02:36:57 +00:00
2018-03-22 14:08:16 +00:00
2018-04-11 10:29:37 +00:00
2018-06-03 16:35:26 +00:00