summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-10-09 12:41:49 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-10-09 12:41:49 +0000
commit458a669f49e30a30b0fbfcc34fc4e556befbb73b (patch)
tree3910473c2104a4a7138d9c50220f32f2bca5a13a /llvm/test
parent9b280eab6699e4d1e3e203254ec93b424f10f40d (diff)
downloadbcm5719-llvm-458a669f49e30a30b0fbfcc34fc4e556befbb73b.tar.gz
bcm5719-llvm-458a669f49e30a30b0fbfcc34fc4e556befbb73b.zip
[InstCombine] Fix wrong folding of constant comparisons involving ashr and negative values.
This patch fixes a bug in method InstCombiner::FoldCmpCstShrCst where we wrongly computed the distance between the highest bits set of two negative values. This fixes PR21222. Differential Revision: http://reviews.llvm.org/D5700 llvm-svn: 219406
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-shr.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-shr.ll b/llvm/test/Transforms/InstCombine/icmp-shr.ll
index 8e7c906a545..7562f24a35d 100644
--- a/llvm/test/Transforms/InstCombine/icmp-shr.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-shr.ll
@@ -688,3 +688,11 @@ define i1 @PR20945(i32 %B) {
%cmp = icmp ne i32 %shr, -5
ret i1 %cmp
}
+
+; CHECK-LABEL: @PR21222
+; CHECK: icmp eq i32 %B, 6
+define i1 @PR21222(i32 %B) {
+ %shr = ashr i32 -93, %B
+ %cmp = icmp eq i32 %shr, -2
+ ret i1 %cmp
+}
OpenPOWER on IntegriCloud