From df3d63b896a5435c2d8c06e147e19b2a358d381d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 2 Jan 2010 22:08:28 +0000 Subject: 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 --- test/Transforms/InstCombine/load-cmp.ll | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/Transforms/InstCombine/load-cmp.ll') 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 +} -- cgit v1.2.3