llvm-6502/lib/Transforms
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
..
Hello [CMake] Add LLVM_LINK_COMPONENTS to loadable modules, LLVMHello and BugpointPasses, on Win32. 2014-07-13 13:36:48 +00:00
InstCombine [InstCombine] Fix wrong folding of constant comparison involving ahsr and negative quantities (PR20945). 2014-09-17 11:32:31 +00:00
Instrumentation [asan] fix debug info produced for asan-coverage=2 2014-09-03 23:24:18 +00:00
IPO Add control of function merging to the PMBuilder. 2014-09-13 21:46:00 +00:00
ObjCARC Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created. 2014-08-27 05:25:25 +00:00
Scalar [C API] Make the 'lower switch' pass available via the C API. 2014-09-11 21:32:32 +00:00
Utils Remove dead code in SimplifyCFG 2014-09-15 20:48:13 +00:00
Vectorize Rename getMaximumUnrollFactor -> getMaxInterleaveFactor; also rename option names controlling this variable. 2014-09-10 17:58:16 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile