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
80
81
82
83
84
85
86
87
88
| ; RUN: opt < %s -indvars -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@G = external global i32
define void @test0(i64* %arg) {
bb:
br label %bb2
bb2:
%tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
%tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* null)
%tmp5 = load i32, i32* %tmp4, align 8
%tmp7 = load i64*, i64** undef, align 8
br label %bb2
}
; CHECK-LABEL: void @test0
; CHECK: load i32, i32* null
define void @test1(i64* %arg) {
bb:
br label %bb2
bb2:
%tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
%tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* inttoptr (i64 4 to i32*))
%tmp5 = load i32, i32* %tmp4
%tmp7 = load i64*, i64** undef, align 8
br label %bb2
}
; CHECK-LABEL: void @test1
; CHECK: load i32, i32* inttoptr (i64 4 to i32*)
define void @test2(i64* %arg) {
bb:
br label %bb2
bb2:
%tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
%tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* @G)
%tmp5 = load i32, i32* %tmp4
%tmp7 = load i64*, i64** undef, align 8
br label %bb2
}
; CHECK-LABEL: void @test2
; CHECK: load i32, i32* @G
define void @test3(i64* %arg, i32* %loop.invariant) {
bb:
br label %bb2
bb2:
%tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
%tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* %loop.invariant)
%tmp5 = load i32, i32* %tmp4
%tmp7 = load i64*, i64** undef, align 8
br label %bb2
}
; CHECK-LABEL: void @test3
; CHECK: load i32, i32* %loop.invariant
define void @test4(i64* %arg, i32* %loop.invariant, i64 %N) {
bb:
br label %bb2
bb2:
%tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
%mul = mul nsw i64 %N, 64
%ptr = getelementptr inbounds i32, i32* %loop.invariant, i64 %mul
%tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* %ptr)
%tmp5 = load i32, i32* %tmp4
%tmp7 = load i64*, i64** undef, align 8
br label %bb2
}
; CHECK-LABEL: void @test4
; CHECK: [[P:%[a-zA-Z$._0-9]+]] = getelementptr i32, i32* %loop.invariant
; CHECK: phi
; CHECK: load i32, i32* [[P]]
declare i32* @wobble(i64*, i32* returned)
|