1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00
Andrea Di Biagio 99dc03a95d [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).

llvm-svn: 217950
2014-09-17 11:32:31 +00:00
..
2013-08-28 23:04:41 +00:00
2012-02-29 01:53:13 +00:00
2014-06-02 21:23:54 +00:00
2013-07-09 07:50:59 +00:00
2013-08-28 23:04:41 +00:00
2014-05-27 16:54:33 +00:00
2013-11-15 01:34:59 +00:00
2014-01-22 22:32:58 +00:00
2014-03-06 05:32:52 +00:00
2013-07-09 22:01:22 +00:00
2014-08-16 08:55:06 +00:00
2014-02-26 19:51:08 +00:00
2014-07-15 00:07:27 +00:00
2013-02-16 23:41:36 +00:00
2012-11-14 20:18:34 +00:00
2014-07-09 17:49:58 +00:00
2014-02-26 22:29:11 +00:00
2014-06-02 22:01:04 +00:00
2014-06-02 22:01:04 +00:00
2014-03-29 10:18:08 +00:00
2014-02-26 22:29:11 +00:00
2013-08-28 23:04:41 +00:00
2013-08-28 23:04:41 +00:00
2013-03-28 19:34:14 +00:00
2014-06-02 22:01:04 +00:00

This directory contains test cases for the instcombine transformation.  The
dated tests are actual bug tests, whereas the named tests are used to test
for features that the this pass should be capable of performing.