1 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
2 ; No explicit integer multiplications!
3 ; No i8* arithmetic or pointer casting anywhere!
4 ; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}}
5 ; Exactly one getelementptr for each load+store.
6 ; Each getelementptr using %struct.Q* %s as a base and not i8*.
7 ; CHECK: getelementptr %struct.Q* %s,
8 ; CHECK: getelementptr %struct.Q* %s,
9 ; CHECK: getelementptr %struct.Q* %s,
10 ; CHECK: getelementptr %struct.Q* %s,
11 ; CHECK: getelementptr %struct.Q* %s,
12 ; CHECK: getelementptr %struct.Q* %s,
13 ; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}}
15 ; FIXME: This test should pass with or without TargetData. Until opt
16 ; supports running tests without targetdata, just hardware this in.
17 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-n:32:64"
19 %struct.Q = type { [10 x %struct.N] }
20 %struct.N = type { %struct.S }
21 %struct.S = type { [100 x double], [100 x double] }
23 define void @foo(%struct.Q* %s, i64 %n) nounwind {
28 %i = phi i64 [ 2, %entry ], [ %i.next, %bb ]
29 %j = phi i64 [ 0, %entry ], [ %j.next, %bb ]
30 %t5 = icmp slt i64 %i, %n
31 br i1 %t5, label %bb, label %return
34 %t0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i
35 %t1 = load double* %t0, align 8
36 %t2 = fmul double %t1, 3.200000e+00
37 %t3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i
38 store double %t2, double* %t3, align 8
40 %s0 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i
41 %s1 = load double* %s0, align 8
42 %s2 = fmul double %s1, 3.200000e+00
43 %s3 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i
44 store double %s2, double* %s3, align 8
46 %u0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j
47 %u1 = load double* %u0, align 8
48 %u2 = fmul double %u1, 3.200000e+00
49 %u3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j
50 store double %u2, double* %u3, align 8
52 %v0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i
53 %v1 = load double* %v0, align 8
54 %v2 = fmul double %v1, 3.200000e+00
55 %v3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i
56 store double %v2, double* %v3, align 8
58 %w0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j
59 %w1 = load double* %w0, align 8
60 %w2 = fmul double %w1, 3.200000e+00
61 %w3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j
62 store double %w2, double* %w3, align 8
64 %x0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i
65 %x1 = load double* %x0, align 8
66 %x2 = fmul double %x1, 3.200000e+00
67 %x3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i
68 store double %x2, double* %x3, align 8
70 %i.next = add i64 %i, 1
71 %j.next = add i64 %j, 1