• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -indvars < %s | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.11.0"
5
6; SCEVExpander would try to RAUW %val_2 with %c.lcssa, breaking "def
7; dominates uses".
8
9define void @pr27232(i32 %val) {
10; CHECK-LABEL: @pr27232(
11entry:
12  br i1 undef, label %loop_0.cond, label %for.body.us
13
14for.body.us:
15  br label %loop_0.cond
16
17loop_0.cond:
18  %val_2 = phi i32 [ %val, %for.body.us ], [ undef, %entry ]
19  br i1 true, label %loop_0.ph, label %loop_1.ph
20
21loop_0.ph:
22  br label %loop_0
23
24loop_1.exit:
25  br label %loop_1.ph
26
27loop_1.ph:
28  %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val_2, %loop_1.exit ]
29  br label %loop_1
30
31loop_0:
32  br i1 undef, label %loop_0, label %loop_1.exit
33
34loop_1:
35  %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val_2, %loop_1.ph ]
36  %t.1 = phi i32 [ %val_2, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
37  br i1 undef, label %leave, label %loop_1
38
39leave:
40  ret void
41}
42
43
44; @ReplaceArg_0 and @ReplaceArg_1 used to trigger a failed cast<>
45; assertion in SCEVExpander.
46
47define void @ReplaceArg_0(i32 %val) {
48; CHECK-LABEL: @ReplaceArg_0(
49entry:
50  br i1 undef, label %loop_0.cond, label %for.body.us
51
52for.body.us:
53  br label %loop_0.cond
54
55loop_0.cond:
56  br i1 true, label %loop_0.ph, label %loop_1.ph
57
58loop_0.ph:
59  br label %loop_0
60
61loop_1.exit:
62  br label %loop_1.ph
63
64loop_1.ph:
65  %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
66  br label %loop_1
67
68loop_0:
69  br i1 undef, label %loop_0, label %loop_1.exit
70
71loop_1:
72  %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
73  %t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
74  br i1 undef, label %leave, label %loop_1
75
76leave:
77  ret void
78}
79
80define void @ReplaceArg_1(i32 %val) {
81; CHECK-LABEL: @ReplaceArg_1(
82entry:
83  br i1 undef, label %loop_0.cond, label %for.body.us
84
85for.body.us:
86  br label %loop_0.cond
87
88loop_0.cond:
89  br i1 true, label %loop_0.ph, label %loop_1.ph
90
91loop_0.ph:
92  br label %loop_0
93
94loop_1.exit:
95  br label %loop_1.ph
96
97loop_1.ph:
98  %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
99  br label %loop_1
100
101loop_0:
102  br i1 undef, label %loop_0, label %loop_1.exit
103
104loop_1:
105  %t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
106  %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
107  br i1 undef, label %leave, label %loop_1
108
109leave:
110  ret void
111}
112