1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
@G = global [10 x i32] zeroinitializer, align 4
define void @select_in_gep1(i1 %c, i64 %x) {
entry:
; CHECK-LABEL: Function: select_in_gep1
; CHECK: NoAlias: i32* %arrayidx1, i32* %arrayidx2
%add1_ = add nsw i64 %x, 1
%add2_ = add nsw i64 %x, 2
%select_ = select i1 %c, i64 %add1_, i64 %add2_
%arrayidx1 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select_
store i32 42, ptr %arrayidx1, align 4
%arrayidx2 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %x
store i32 43, ptr %arrayidx2, align 4
ret void
}
define void @select_in_gep2(i1 %c, i64 %x) {
entry:
; TODO: should be "NoAlias" here as well.
; CHECK-LABEL: Function: select_in_gep2
; CHECK: MayAlias: i32* %arrayidx1, i32* %arrayidx2
%add1_ = add nsw i64 %x, 1
%add2_ = add nsw i64 %x, 2
%add3_ = add nsw i64 %x, 3
%select_ = select i1 %c, i64 %add1_, i64 %add2_
%arrayidx1 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select_
store i32 42, ptr %arrayidx1, align 4
%arrayidx2 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %add3_
store i32 43, ptr %arrayidx2, align 4
ret void
}
define void @two_selects_in_gep_same_cond(i1 %c, i64 %x) {
entry:
; CHECK-LABEL: Function: two_selects_in_gep_same_cond
; CHECK: NoAlias: i32* %arrayidx1, i32* %arrayidx2
%add1_ = add nsw i64 %x, 1
%add2_ = add nsw i64 %x, 2
%select1_ = select i1 %c, i64 %x, i64 %add1_
%select2_ = select i1 %c, i64 %add2_, i64 %x
%arrayidx1 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select1_
store i32 42, ptr %arrayidx1, align 4
%arrayidx2 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select2_
store i32 43, ptr %arrayidx2, align 4
ret void
}
define void @two_selects_in_gep_different_cond1(i1 %c1, i1 %c2, i64 %x) {
entry:
; CHECK-LABEL: Function: two_selects_in_gep_different_cond1
; CHECK: NoAlias: i32* %arrayidx1, i32* %arrayidx2
%add1_ = add nsw i64 %x, 1
%add2_ = add nsw i64 %x, 2
%add3_ = add nsw i64 %x, 3
%add4_ = add nsw i64 %x, 4
%select1_ = select i1 %c1, i64 %add1_, i64 %add2_
%select2_ = select i1 %c2, i64 %add3_, i64 %add4_
%arrayidx1 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select1_
store i32 42, ptr %arrayidx1, align 4
%arrayidx2 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select2_
store i32 43, ptr %arrayidx2, align 4
ret void
}
define void @two_selects_in_gep_different_cond2(i1 %c1, i1 %c2, i64 %x) {
entry:
; CHECK-LABEL: Function: two_selects_in_gep_different_cond2
; CHECK: MayAlias: i32* %arrayidx1, i32* %arrayidx2
%add1_ = add nsw i64 %x, 1
%add2_ = add nsw i64 %x, 2
%select1_ = select i1 %c1, i64 %x, i64 %add1_
%select2_ = select i1 %c2, i64 %x, i64 %add2_
%arrayidx1 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select1_
store i32 42, ptr %arrayidx1, align 4
%arrayidx2 = getelementptr inbounds [10 x i32], ptr @G, i64 0, i64 %select2_
store i32 43, ptr %arrayidx2, align 4
ret void
}
|