Go to file
Andrea Di Biagio 5b92b4971a [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
clang Don't try to devirtualize non-virtual calls 2014-09-16 22:23:33 +00:00
clang-tools-extra Rename unit test argument and add argument comments for clarity. 2014-09-17 09:05:07 +00:00
compiler-rt Do not link the dyndd runtime library against libdl on FreeBSD 2014-09-17 07:54:46 +00:00
debuginfo-tests relax testcase for LLDB output format compatibility. 2014-03-19 23:06:18 +00:00
libclc R600: Map Address spaces for atomic_cmpxchg 2014-09-16 22:34:59 +00:00
libcxx Add include of <cassert> for the operator comma 2014-09-17 04:09:35 +00:00
libcxxabi Adding ABI support for __cxa_throw_bad_array_new_length. 2014-09-11 17:26:43 +00:00
lld [mach-o] update test case to match new llvm-objdump output 2014-09-17 00:51:18 +00:00
lldb Build lldb-mi on all platforms with Makefile builds 2014-09-17 00:28:31 +00:00
llvm [InstCombine] Fix wrong folding of constant comparison involving ahsr and negative quantities (PR20945). 2014-09-17 11:32:31 +00:00
openmp Fix a crash that occurred under obscure circumstances during library shutdown 2014-09-03 11:34:33 +00:00
polly [Fix] Rewire the Region after a unconditional entry edge is created 2014-09-15 18:34:45 +00:00