Andrea Di Biagio
a34cab9be7
[InstCombine] Fix wrong folding of constant comparison involving ahsr and negative quantities (PR20945).
...
Example:
define i1 @foo(i32 %a) {
%shr = ashr i32 -9, %a
%cmp = icmp ne i32 %shr, -5
ret i1 %cmp
}
Before this fix, the instruction combiner wrongly thought that %shr
could have never been equal to -5. Therefore, %cmp was always folded to 'true'.
However, when %a is equal to 1, then %cmp evaluates to 'false'. Therefore,
in this example, it is not valid to fold %cmp to 'true'.
The problem was only affecting the case where the comparison was between
negative quantities where one of the quantities was obtained from arithmetic
shift of a negative constant.
This patch fixes the problem with the wrong folding (fixes PR20945).
With this patch, the 'icmp' from the example is now simplified to a
comparison between %a and 1. This still allows us to get rid of the arithmetic
shift (%shr).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 11:32:31 +00:00
..
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-07-09 07:50:59 +00:00
2014-07-30 22:51:54 +00:00
2014-07-30 22:51:54 +00:00
2013-07-30 20:45:05 +00:00
2013-07-30 20:45:05 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-07-14 01:42:54 +00:00
2013-11-15 01:34:59 +00:00
2014-07-04 22:05:26 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:50:49 +00:00
2013-07-14 01:50:49 +00:00
2013-07-14 01:42:54 +00:00
2014-05-24 12:50:23 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-06-06 01:20:28 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-06-12 14:06:00 +00:00
2013-07-14 01:42:54 +00:00
2014-08-11 22:32:02 +00:00
2014-06-02 21:23:54 +00:00
2014-06-17 00:42:07 +00:00
2014-06-19 16:50:16 +00:00
2014-06-06 21:52:55 +00:00
2014-06-19 03:35:49 +00:00
2013-09-03 21:05:48 +00:00
2014-07-22 16:58:55 +00:00
2013-07-14 01:42:54 +00:00
2014-04-28 17:40:03 +00:00
2014-08-30 06:18:20 +00:00
2013-07-14 01:42:54 +00:00
2013-07-09 07:50:59 +00:00
2013-07-30 20:45:05 +00:00
2013-08-28 23:04:41 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-09-07 19:21:07 +00:00
2014-09-07 18:57:58 +00:00
2014-09-07 21:28:34 +00:00
2013-07-14 01:50:49 +00:00
2013-07-14 01:42:54 +00:00
2014-06-03 02:41:57 +00:00
2013-08-12 07:26:09 +00:00
2014-03-25 17:21:41 +00:00
2013-07-14 01:42:54 +00:00
2013-07-13 22:00:58 +00:00
2013-09-19 20:59:04 +00:00
2014-05-27 16:54:33 +00:00
2014-04-30 17:22:00 +00:00
2014-01-18 22:47:12 +00:00
2013-09-17 21:10:14 +00:00
2013-07-14 01:42:54 +00:00
2013-11-15 01:34:59 +00:00
2014-02-20 23:00:15 +00:00
2014-01-22 22:32:58 +00:00
2014-08-22 17:11:04 +00:00
2014-03-24 04:36:06 +00:00
2013-11-16 16:00:48 +00:00
2014-06-15 21:40:57 +00:00
2013-11-04 20:46:52 +00:00
2014-03-05 19:41:48 +00:00
2014-03-06 05:32:52 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-11-22 21:49:45 +00:00
2013-11-22 21:49:45 +00:00
2014-07-10 17:13:27 +00:00
2013-07-14 01:42:54 +00:00
2014-06-26 08:57:33 +00:00
2013-07-02 05:21:11 +00:00
2013-07-09 22:01:22 +00:00
2014-08-16 08:55:06 +00:00
2013-12-28 02:40:19 +00:00
2013-08-21 18:54:53 +00:00
2013-11-17 02:06:35 +00:00
2013-07-14 01:42:54 +00:00
2014-02-04 20:27:23 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:50:49 +00:00
2014-01-19 13:36:27 +00:00
2013-07-14 01:42:54 +00:00
2014-01-20 07:44:53 +00:00
2014-06-17 00:42:07 +00:00
2013-12-16 22:42:40 +00:00
2014-01-20 07:44:53 +00:00
2013-07-30 23:53:17 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-20 07:13:13 +00:00
2013-08-28 23:04:41 +00:00
2014-01-18 00:48:14 +00:00
2013-11-28 21:38:05 +00:00
2013-11-28 21:38:05 +00:00
2014-02-26 19:51:08 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-04-03 17:51:58 +00:00
2014-05-29 20:29:47 +00:00
2014-09-01 21:10:02 +00:00
2013-09-04 11:57:17 +00:00
2014-09-17 11:32:31 +00:00
2014-08-28 03:34:28 +00:00
2013-07-14 01:42:54 +00:00
2014-03-07 10:24:44 +00:00
2014-07-04 10:22:21 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-03-13 22:51:43 +00:00
2013-09-30 21:11:01 +00:00
2013-07-14 01:42:54 +00:00
2014-07-15 00:07:27 +00:00
2014-07-15 01:55:03 +00:00
2013-07-21 23:11:42 +00:00
2014-08-19 23:36:30 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-06-06 21:52:55 +00:00
2013-07-14 01:50:49 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-01-19 15:24:22 +00:00
2013-08-21 19:53:10 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-07-30 22:51:54 +00:00
2014-07-30 22:51:54 +00:00
2014-01-19 16:48:41 +00:00
2013-07-14 01:42:54 +00:00
2014-08-21 05:14:48 +00:00
2014-08-20 22:55:40 +00:00
2013-07-14 01:50:49 +00:00
2014-06-24 10:47:52 +00:00
2013-07-14 01:42:54 +00:00
2014-05-08 19:50:24 +00:00
2013-12-06 21:48:36 +00:00
2013-07-14 01:42:54 +00:00
2014-03-06 00:18:15 +00:00
2013-07-14 01:42:54 +00:00
2013-08-19 06:55:47 +00:00
2013-07-13 22:00:58 +00:00
2013-12-02 18:43:59 +00:00
2014-04-14 21:50:37 +00:00
2014-07-09 17:49:58 +00:00
2014-07-04 22:05:26 +00:00
2014-02-26 22:29:11 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-06-19 01:19:19 +00:00
2014-06-02 22:01:04 +00:00
2014-03-07 04:36:21 +00:00
2014-01-20 07:44:53 +00:00
2013-07-14 01:42:54 +00:00
2013-11-04 20:36:06 +00:00
2014-02-12 23:54:07 +00:00
2014-06-17 00:42:07 +00:00
2014-06-02 22:01:04 +00:00
2013-07-14 01:42:54 +00:00
2014-04-14 21:50:37 +00:00
2014-02-11 21:09:03 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-03-29 10:18:08 +00:00
2013-07-14 01:42:54 +00:00
2014-02-26 22:29:11 +00:00
2013-07-14 01:42:54 +00:00
2013-09-27 18:34:27 +00:00
2013-10-07 18:06:48 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-02-04 05:55:16 +00:00
2014-08-19 23:36:30 +00:00
2013-07-14 01:42:54 +00:00
2013-10-07 18:06:48 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-05-02 04:11:45 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-08-19 23:36:30 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-08-15 20:58:59 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-09-27 18:34:27 +00:00
2014-08-19 23:36:30 +00:00
2014-08-22 16:41:23 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2014-04-29 22:20:40 +00:00
2013-08-28 23:04:41 +00:00
2014-01-24 19:02:37 +00:00
2013-08-28 23:04:41 +00:00
2014-01-19 15:24:22 +00:00
2014-01-19 20:05:13 +00:00
2014-06-24 10:38:10 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:42:54 +00:00
2013-07-14 01:50:49 +00:00
2013-08-31 18:19:35 +00:00
2014-09-16 08:50:10 +00:00
2014-06-02 22:01:04 +00:00
2014-01-19 20:05:13 +00:00