summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/load-cmp.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-02 22:08:28 +0000
committerChris Lattner <sabre@nondot.org>2010-01-02 22:08:28 +0000
commitdf3d63b896a5435c2d8c06e147e19b2a358d381d (patch)
treec57df63a5e1436779525234e211522ecee36e08d /test/Transforms/InstCombine/load-cmp.ll
parentb4f82b4b4f5b9bb67f10375aa633302fddce82ce (diff)
downloadllvm-df3d63b896a5435c2d8c06e147e19b2a358d381d.tar.gz
llvm-df3d63b896a5435c2d8c06e147e19b2a358d381d.tar.bz2
llvm-df3d63b896a5435c2d8c06e147e19b2a358d381d.tar.xz
teach instcombine to optimize idioms like A[i]&42 == 0. This
occurs in 403.gcc in mode_mask_array, in safe-ctype.c (which is copied in multiple apps) in _sch_istable, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/load-cmp.ll')
-rw-r--r--test/Transforms/InstCombine/load-cmp.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/load-cmp.ll b/test/Transforms/InstCombine/load-cmp.ll
index 69e13cb1d0..6ec5524094 100644
--- a/test/Transforms/InstCombine/load-cmp.ll
+++ b/test/Transforms/InstCombine/load-cmp.ll
@@ -80,3 +80,15 @@ define i1 @test7(i32 %X) {
; CHECK-NEXT: %R = icmp ugt i32 {{.*}}, 2
; CHECK-NEXT: ret i1 %R
}
+
+define i1 @test8(i32 %X) {
+ %P = getelementptr [10 x i16]* @G16, i32 0, i32 %X
+ %Q = load i16* %P
+ %R = and i16 %Q, 3
+ %S = icmp eq i16 %R, 0
+ ret i1 %S
+; CHECK: @test8
+; CHECK-NEXT: add i32 %X, -8
+; CHECK-NEXT: %S = icmp ult i32 {{.*}}, 2
+; CHECK-NEXT: ret i1 %S
+}