preserve-memoryssa.ll
2.78 KB
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
89
90
91
92
93
94
95
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -aa-pipeline=basic-aa -passes='require<memoryssa>,gvn' -S -verify-memoryssa %s | FileCheck %s
; REQUIRES: asserts
declare void @use(i32) readnone
define i32 @test(i32* %ptr.0, i32** %ptr.1, i1 %c) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LV_0:%.*]] = load i32, i32* [[PTR_0:%.*]], align 8
; CHECK-NEXT: call void @use(i32 [[LV_0]])
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN749:%.*]], label [[FOR_INC774:%.*]]
; CHECK: if.then749:
; CHECK-NEXT: [[LV_1:%.*]] = load i32*, i32** [[PTR_1:%.*]], align 8
; CHECK-NEXT: store i32 10, i32* [[LV_1]], align 4
; CHECK-NEXT: [[LV_2_PRE:%.*]] = load i32, i32* [[PTR_0]], align 8
; CHECK-NEXT: br label [[FOR_INC774]]
; CHECK: for.inc774:
; CHECK-NEXT: [[LV_2:%.*]] = phi i32 [ [[LV_2_PRE]], [[IF_THEN749]] ], [ [[LV_0]], [[ENTRY:%.*]] ]
; CHECK-NEXT: call void @use(i32 [[LV_2]])
; CHECK-NEXT: ret i32 1
;
entry:
br label %for.end435
for.end435:
%lv.0 = load i32, i32* %ptr.0, align 8
call void @use(i32 %lv.0)
br label %if.end724
if.end724:
br i1 %c, label %if.then749, label %for.inc774
if.then749:
%lv.1 = load i32*, i32** %ptr.1, align 8
%arrayidx772 = getelementptr inbounds i32, i32* %lv.1, i64 0
store i32 10, i32* %arrayidx772, align 4
br label %for.inc774
for.inc774:
br label %for.body830
for.body830:
%lv.2 = load i32, i32* %ptr.0, align 8
call void @use(i32 %lv.2)
br label %for.body.i22
for.body.i22:
ret i32 1
}
define i32 @test_volatile(i32* %ptr.0, i32** %ptr.1, i1 %c) {
; CHECK-LABEL: @test_volatile(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LV_0:%.*]] = load volatile i32, i32* [[PTR_0:%.*]], align 8
; CHECK-NEXT: call void @use(i32 [[LV_0]])
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN749:%.*]], label [[FOR_INC774:%.*]]
; CHECK: if.then749:
; CHECK-NEXT: [[LV_1:%.*]] = load volatile i32*, i32** [[PTR_1:%.*]], align 8
; CHECK-NEXT: store i32 10, i32* [[LV_1]], align 4
; CHECK-NEXT: br label [[FOR_INC774]]
; CHECK: for.inc774:
; CHECK-NEXT: [[LV_2:%.*]] = load volatile i32, i32* [[PTR_0]], align 8
; CHECK-NEXT: call void @use(i32 [[LV_2]])
; CHECK-NEXT: ret i32 1
;
entry:
br label %for.end435
for.end435:
%lv.0 = load volatile i32, i32* %ptr.0, align 8
call void @use(i32 %lv.0)
br label %if.end724
if.end724:
br i1 %c, label %if.then749, label %for.inc774
if.then749:
%lv.1 = load volatile i32*, i32** %ptr.1, align 8
%arrayidx772 = getelementptr inbounds i32, i32* %lv.1, i64 0
store i32 10, i32* %arrayidx772, align 4
br label %for.inc774
for.inc774:
br label %for.body830
for.body830:
%lv.2 = load volatile i32, i32* %ptr.0, align 8
call void @use(i32 %lv.2)
br label %for.body.i22
for.body.i22:
ret i32 1
}