• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -indvars -S | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6@G = external global i32
7
8define void @test0(i64* %arg) {
9bb:
10  br label %bb2
11
12bb2:
13  %tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
14  %tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* null)
15  %tmp5 = load i32, i32* %tmp4, align 8
16  %tmp7 = load i64*, i64** undef, align 8
17  br label %bb2
18}
19
20; CHECK-LABEL: void @test0
21; CHECK:         load i32, i32* null
22
23define void @test1(i64* %arg) {
24bb:
25  br label %bb2
26
27bb2:
28  %tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
29  %tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* inttoptr (i64 4 to i32*))
30  %tmp5 = load i32, i32* %tmp4
31  %tmp7 = load i64*, i64** undef, align 8
32  br label %bb2
33}
34
35; CHECK-LABEL: void @test1
36; CHECK:         load i32, i32* inttoptr (i64 4 to i32*)
37
38define void @test2(i64* %arg) {
39bb:
40  br label %bb2
41
42bb2:
43  %tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
44  %tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* @G)
45  %tmp5 = load i32, i32* %tmp4
46  %tmp7 = load i64*, i64** undef, align 8
47  br label %bb2
48}
49
50; CHECK-LABEL: void @test2
51; CHECK:         load i32, i32* @G
52
53
54define void @test3(i64* %arg, i32* %loop.invariant) {
55bb:
56  br label %bb2
57
58bb2:
59  %tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
60  %tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* %loop.invariant)
61  %tmp5 = load i32, i32* %tmp4
62  %tmp7 = load i64*, i64** undef, align 8
63  br label %bb2
64}
65
66; CHECK-LABEL: void @test3
67; CHECK:         load i32, i32* %loop.invariant
68
69define void @test4(i64* %arg, i32* %loop.invariant, i64 %N) {
70bb:
71  br label %bb2
72
73bb2:
74  %tmp = phi i64* [%arg, %bb ], [ %tmp7, %bb2 ]
75  %mul = mul nsw i64 %N, 64
76  %ptr = getelementptr inbounds i32, i32* %loop.invariant, i64 %mul
77  %tmp4 = call i32* @wobble(i64* nonnull %tmp, i32* %ptr)
78  %tmp5 = load i32, i32* %tmp4
79  %tmp7 = load i64*, i64** undef, align 8
80  br label %bb2
81}
82
83; CHECK-LABEL: void @test4
84; CHECK:         [[P:%[a-zA-Z$._0-9]+]] = getelementptr i32, i32* %loop.invariant
85; CHECK:         phi
86; CHECK:         load i32, i32* [[P]]
87
88declare i32* @wobble(i64*, i32* returned)
89