1 ; RUN: opt < %s -disable-output "-passes=print<da>" \
2 ; RUN: "-aa-pipeline=basic-aa,globals-aa" 2>&1 | FileCheck %s
3 define void @i32_subscript(ptr %a) {
8 %i = phi i32 [ 0, %entry ], [ %i.inc, %for.body ]
9 %a.addr = getelementptr i32, ptr %a, i32 %i
10 %a.addr.2 = getelementptr i32, ptr %a, i32 5
11 %0 = load i32, ptr %a.addr, align 4
13 store i32 %1, ptr %a.addr.2, align 4
14 %i.inc = add nsw i32 %i, 1
15 %i.inc.ext = sext i32 %i to i64
16 %exitcond = icmp ne i64 %i.inc.ext, 100
17 br i1 %exitcond, label %for.body, label %for.end
27 ; Test for a bug, which caused an assert in ScalarEvolution because
28 ; the Dependence Analyzer attempted to zero extend a type to a smaller
31 ; void t(unsigned int *a, unsigned int n) {
32 ; for (unsigned int i = 0; i != n; i++) {
33 ; a[(unsigned short)i] = g;
36 @g = common global i32 0, align 4
38 define void @t(ptr noalias %a, i32 %n) nounwind {
40 %cmp1 = icmp eq i32 %n, 0
41 br i1 %cmp1, label %for.end, label %for.body
44 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
45 %0 = load i32, ptr @g, align 4
46 %idxprom = and i32 %i.02, 65535
47 %arrayidx = getelementptr inbounds i32, ptr %a, i32 %idxprom
48 store i32 %0, ptr %arrayidx, align 4
49 %inc = add i32 %i.02, 1
50 %cmp = icmp eq i32 %inc, %n
51 br i1 %cmp, label %for.end, label %for.body
60 define void @i16_wrap(ptr %a) {
64 %i = phi i64 [0, %entry], [%i.inc, %for.inc]
65 %i.tr = trunc i64 %i to i16
66 %idx = getelementptr i64, ptr %a, i16 %i.tr
67 %0 = load i64, ptr %idx
69 store i64 %1, ptr %idx
73 %i.inc = add nuw i64 %i, 1
74 %cmp = icmp ult i64 %i.inc, 17179869184
75 br i1 %cmp, label %for.body, label %for.end
83 define void @i8_stride_wrap(ptr noalias %a, ptr noalias %b) {
87 %i = phi i32 [1,%entry], [%i.inc, %for.inc]
88 %i.tr = trunc i32 %i to i8
89 %idx = getelementptr i32, ptr %a, i8 %i.tr
90 %idx.2 = getelementptr i32, ptr %b, i32 %i
91 %0 = load i32, ptr %idx, align 4
93 store i32 %1, ptr %idx.2, align 4
97 %i.inc = add nsw i32 %i, 256
98 %exitcond = icmp ult i32 %i, 65536
99 br i1 %exitcond, label %for.body, label %for.end