Roman Lebedev
676594305a
[CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case)
...
Summary:
This implements an optimization described in Hacker's Delight 10-17:
when `C` is constant, the result of `X % C == 0` can be computed
more cheaply without actually calculating the remainder.
The motivation is discussed here: https://bugs.llvm.org/show_bug.cgi?id=35479 .
One huge caveat: this signed case is only valid for positive divisors.
While we can freely negate negative divisors, we can't negate `INT_MIN`,
so for now if `INT_MIN` is encountered, we bailout.
As a follow-up, it should be possible to handle that more gracefully
via extra `and`+`setcc`+`select`.
This passes llvm's test-suite, and from cursory(!) cross-examination
the folds (the assembly) match those of GCC, and manual checking via alive
did not reveal any issues (other than the `INT_MIN` case)
Reviewers: RKSimon, spatel, hermord, craig.topper, xbolva00
Reviewed By: RKSimon, xbolva00
Subscribers: xbolva00, thakis, javed.absar, hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65366
llvm-svn: 368702
2019-08-13 14:57:37 +00:00
..
2019-08-09 21:11:20 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-08 11:24:23 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-07-31 12:27:47 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-11 02:08:38 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-07-26 07:33:15 +00:00
2019-08-13 10:51:39 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-07-31 22:58:15 +00:00
2019-08-12 22:18:23 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 10:56:05 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-09 20:16:31 +00:00
2019-08-09 20:18:30 +00:00
2019-08-09 20:16:31 +00:00
2019-07-26 07:33:15 +00:00
2019-08-08 18:11:17 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-09 12:44:20 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 01:29:46 +00:00
2019-08-07 16:24:26 +00:00
2019-07-31 21:57:28 +00:00
2019-07-25 16:39:57 +00:00
2019-07-25 16:39:57 +00:00
2019-07-31 12:29:07 +00:00
2019-08-07 20:45:23 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-09 21:37:32 +00:00
2019-07-31 21:57:28 +00:00
2019-08-07 16:24:26 +00:00
2019-07-31 21:57:28 +00:00
2019-07-31 21:57:28 +00:00
2019-07-24 22:57:22 +00:00
2019-07-24 22:57:22 +00:00
2019-08-06 11:00:34 +00:00
2019-08-06 11:00:34 +00:00
2019-08-06 11:00:34 +00:00
2019-08-06 11:00:34 +00:00
2019-08-03 05:52:47 +00:00
2019-08-03 05:52:47 +00:00
2019-08-03 05:52:47 +00:00
2019-08-03 05:52:47 +00:00
2019-07-27 18:57:59 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 11:11:42 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 22:49:40 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:33:37 +00:00
2019-07-31 12:30:24 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:33:37 +00:00
2019-08-08 21:14:08 +00:00
2019-07-31 22:58:15 +00:00
2019-08-08 21:14:08 +00:00
2019-08-12 22:18:23 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-08 21:36:47 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 17:43:26 +00:00
2019-08-10 02:49:02 +00:00
2019-08-09 12:44:20 +00:00
2019-08-08 13:23:53 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-07-31 22:43:08 +00:00
2019-07-24 17:29:56 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-08 13:23:53 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-02 23:43:53 +00:00
2019-08-07 16:24:26 +00:00
2019-07-24 16:53:14 +00:00
2019-08-10 07:51:13 +00:00
2019-08-06 21:43:15 +00:00
2019-08-08 06:48:22 +00:00
2019-08-13 09:33:25 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:01:16 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-07-26 01:33:30 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 10:51:39 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-11 19:27:14 +00:00
2019-08-11 19:27:14 +00:00
2019-08-11 19:27:14 +00:00
2019-08-12 14:23:13 +00:00
2019-08-13 14:57:37 +00:00
2019-08-13 14:57:37 +00:00
2019-08-13 14:57:37 +00:00
2019-08-13 14:57:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-11 19:27:14 +00:00
2019-08-02 20:17:37 +00:00
2019-08-07 16:33:37 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-05 11:27:07 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-02 17:43:45 +00:00
2019-08-07 16:24:26 +00:00
2019-08-11 19:27:14 +00:00
2019-08-11 19:27:14 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-07-30 08:00:49 +00:00
2019-07-30 08:00:49 +00:00
2019-08-07 16:24:26 +00:00
2019-08-11 19:27:14 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 10:51:39 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 10:51:39 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-06 10:43:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-07-27 12:48:46 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-07-27 12:48:46 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-10 16:46:07 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:33:37 +00:00
2019-08-01 18:49:07 +00:00
2019-08-11 19:27:06 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 06:55:58 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 09:33:25 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 11:43:13 +00:00
2019-08-07 16:24:26 +00:00
2019-07-23 18:46:15 +00:00
2019-08-07 16:24:26 +00:00
2019-08-10 16:46:07 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 22:18:23 +00:00
2019-08-12 22:18:23 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-07-31 12:17:10 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 14:57:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-12 14:23:13 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-07 16:33:37 +00:00
2019-08-07 16:24:26 +00:00
2019-08-03 14:28:34 +00:00
2019-08-12 23:02:00 +00:00
2019-08-07 16:24:26 +00:00
2019-07-26 07:33:15 +00:00
2019-08-07 16:24:26 +00:00
2019-08-13 09:33:25 +00:00