preserve-mssa.ll
3.32 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
; RUN: opt -S -loop-rotate -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
; CHECK-LABEL: @multiedge(
define void @multiedge() {
entry:
br label %retry
retry: ; preds = %sw.epilog, %entry
br i1 undef, label %cleanup, label %if.end
if.end: ; preds = %retry
switch i32 undef, label %sw.epilog [
i32 -3, label %cleanup
i32 -5, label %cleanup
i32 -16, label %cleanup
i32 -25, label %cleanup
]
sw.epilog: ; preds = %if.end
br label %retry
cleanup: ; preds = %if.end, %if.end, %if.end, %if.end, %retry
ret void
}
; CHECK-LABEL: @read_line(
define internal fastcc i32 @read_line(i8* nocapture %f) unnamed_addr {
entry:
br label %for.cond
for.cond: ; preds = %if.end, %entry
%call = call i8* @prepbuffer(i8* nonnull undef)
%call1 = call i8* @fgets(i8* %call, i32 8192, i8* %f)
br i1 undef, label %if.then, label %if.end
if.then: ; preds = %for.cond
ret i32 undef
if.end: ; preds = %for.cond
%call4 = call i64 @strlen(i8* %call)
br label %for.cond
}
declare dso_local i8* @prepbuffer(i8*) local_unnamed_addr
declare dso_local i8* @fgets(i8*, i32, i8* nocapture) local_unnamed_addr
declare dso_local i64 @strlen(i8* nocapture) local_unnamed_addr
; CHECK-LABEL: @loop3
define dso_local fastcc void @loop3() unnamed_addr {
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
br i1 undef, label %for.body, label %for.end81
for.body: ; preds = %for.cond
%.idx122.val = load i32, i32* undef, align 8
call fastcc void @cont()
br label %for.cond
for.end81: ; preds = %for.cond
ret void
}
; CHECK-LABEL: @loop4
define dso_local fastcc void @loop4() unnamed_addr {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
br i1 undef, label %while.end, label %while.body
while.body: ; preds = %while.cond
call fastcc void @cont()
br label %while.cond
while.end: ; preds = %while.cond
call fastcc void @cont()
call fastcc void @cont()
ret void
}
; Function Attrs: inlinehint nounwind uwtable
declare dso_local fastcc void @cont() unnamed_addr
@glob_array = internal unnamed_addr constant [3 x i32] [i32 1, i32 0, i32 2], align 4
; Test against failure in MemorySSAUpdater, when rotate clones instructions as Value.
; CHECK-LABEL: @loop5
define dso_local fastcc void @loop5() unnamed_addr {
entry:
br label %for.body
do.cond: ; preds = %for.body
unreachable
for.body: ; preds = %if.end, %entry
%indvar = phi i64 [ %indvar.next, %if.end ], [ 0, %entry ]
%array = getelementptr inbounds [3 x i32], [3 x i32]* @glob_array, i64 0, i64 %indvar
%0 = load i32, i32* %array, align 4
br i1 undef, label %do.cond, label %if.end
if.end: ; preds = %for.body
store i32 undef, i32* undef, align 4
%indvar.next = add nuw nsw i64 %indvar, 1
br label %for.body
}