991f2688d7655336e87dde5baa4fd6e25886f55d
[oota-llvm.git] / test / Transforms / LoopIdiom / multi-dimensional.ll
1 ; RUN: opt -basicaa -loop-idiom < %s -S | FileCheck %s
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
3 target triple = "x86_64-apple-darwin10.0.0"
4
5 %struct.ham = type { [2 x [2 x [2 x [16 x [8 x i32]]]]], i32, %struct.zot }
6 %struct.zot = type { i32, i16, i16, [2 x [1152 x i32]] }
7
8 define void @test1(%struct.ham* nocapture %arg) nounwind {
9 bb:
10   br label %bb1
11
12 bb1:                                              ; preds = %bb11, %bb
13   %tmp = phi i64 [ 0, %bb ], [ %tmp12, %bb11 ]
14   br label %bb2
15
16 bb2:                                              ; preds = %bb2, %bb1
17   %tmp3 = phi i64 [ 0, %bb1 ], [ %tmp8, %bb2 ]
18   %tmp4 = getelementptr inbounds %struct.ham* %arg, i64 0, i32 0, i64 0, i64 1, i64 1, i64 %tmp, i64 %tmp3
19   store i32 0, i32* %tmp4, align 4
20   %tmp5 = getelementptr inbounds %struct.ham* %arg, i64 0, i32 0, i64 0, i64 1, i64 0, i64 %tmp, i64 %tmp3
21   store i32 0, i32* %tmp5, align 4
22   %tmp6 = getelementptr inbounds %struct.ham* %arg, i64 0, i32 0, i64 0, i64 0, i64 1, i64 %tmp, i64 %tmp3
23   store i32 0, i32* %tmp6, align 4
24   %tmp7 = getelementptr inbounds %struct.ham* %arg, i64 0, i32 0, i64 0, i64 0, i64 0, i64 %tmp, i64 %tmp3
25   store i32 0, i32* %tmp7, align 4
26   %tmp8 = add i64 %tmp3, 1
27   %tmp9 = trunc i64 %tmp8 to i32
28   %tmp10 = icmp eq i32 %tmp9, 8
29   br i1 %tmp10, label %bb11, label %bb2
30
31 bb11:                                             ; preds = %bb2
32   %tmp12 = add i64 %tmp, 1
33   %tmp13 = trunc i64 %tmp12 to i32
34   %tmp14 = icmp eq i32 %tmp13, 16
35   br i1 %tmp14, label %bb15, label %bb1
36
37 bb15:                                             ; preds = %bb11
38   ret void
39
40 ; CHECK: @test1
41 ; CHECK: bb1:
42 ; CHECK-NOT: store
43 ; CHECK: call void @llvm.memset.p0i8.i64
44 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64
45 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64
46 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64
47 ; CHECK-NOT: store
48 ; CHECK: br
49 }