expander-replace-congruent-ivs.ll
2.28 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
110
111
; RUN: opt -S -indvars < %s | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
; SCEVExpander would try to RAUW %val_2 with %c.lcssa, breaking "def
; dominates uses".
define void @pr27232(i32 %val) {
; CHECK-LABEL: @pr27232(
entry:
br i1 undef, label %loop_0.cond, label %for.body.us
for.body.us:
br label %loop_0.cond
loop_0.cond:
%val_2 = phi i32 [ %val, %for.body.us ], [ undef, %entry ]
br i1 true, label %loop_0.ph, label %loop_1.ph
loop_0.ph:
br label %loop_0
loop_1.exit:
br label %loop_1.ph
loop_1.ph:
%c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val_2, %loop_1.exit ]
br label %loop_1
loop_0:
br i1 undef, label %loop_0, label %loop_1.exit
loop_1:
%d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val_2, %loop_1.ph ]
%t.1 = phi i32 [ %val_2, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
br i1 undef, label %leave, label %loop_1
leave:
ret void
}
; @ReplaceArg_0 and @ReplaceArg_1 used to trigger a failed cast<>
; assertion in SCEVExpander.
define void @ReplaceArg_0(i32 %val) {
; CHECK-LABEL: @ReplaceArg_0(
entry:
br i1 undef, label %loop_0.cond, label %for.body.us
for.body.us:
br label %loop_0.cond
loop_0.cond:
br i1 true, label %loop_0.ph, label %loop_1.ph
loop_0.ph:
br label %loop_0
loop_1.exit:
br label %loop_1.ph
loop_1.ph:
%c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
br label %loop_1
loop_0:
br i1 undef, label %loop_0, label %loop_1.exit
loop_1:
%d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
%t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
br i1 undef, label %leave, label %loop_1
leave:
ret void
}
define void @ReplaceArg_1(i32 %val) {
; CHECK-LABEL: @ReplaceArg_1(
entry:
br i1 undef, label %loop_0.cond, label %for.body.us
for.body.us:
br label %loop_0.cond
loop_0.cond:
br i1 true, label %loop_0.ph, label %loop_1.ph
loop_0.ph:
br label %loop_0
loop_1.exit:
br label %loop_1.ph
loop_1.ph:
%c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
br label %loop_1
loop_0:
br i1 undef, label %loop_0, label %loop_1.exit
loop_1:
%t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
%d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
br i1 undef, label %leave, label %loop_1
leave:
ret void
}