blob: 01f9276dc28c257d28a6483a8eefbab73a6678fd [file] [log] [blame]
Andrew Trick070e5402012-03-16 03:16:56 +00001; RUN: opt -loop-reduce -S < %s | FileCheck %s
2;
3; <rdar://problem/11049788> Segmentation fault: 11 in LoopStrengthReduce
4
5target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
6target triple = "x86_64-apple-darwin10.0.0"
7
8; IVUsers should not consider tmp128 a valid user because it is not in a
9; simplified loop nest.
10; CHECK: @nopreheader
11; CHECK: for.cond:
12; CHECK: %tmp128 = add i64 %0, %indvar65
13define void @nopreheader(i8* %cmd) nounwind ssp {
14entry:
15 indirectbr i8* undef, [label %while.cond]
16
17while.cond: ; preds = %while.body, %entry
18 %0 = phi i64 [ %indvar.next48, %while.body ], [ 0, %entry ]
19 indirectbr i8* undef, [label %while.end, label %while.body]
20
21while.body: ; preds = %lor.rhs, %lor.lhs.false17, %lor.lhs.false11, %lor.lhs.false, %land.rhs
22 %indvar.next48 = add i64 %0, 1
23 indirectbr i8* undef, [label %while.cond]
24
25while.end: ; preds = %lor.rhs, %while.cond
26 indirectbr i8* undef, [label %if.end152]
27
28if.end152: ; preds = %lor.lhs.false144, %if.end110
29 indirectbr i8* undef, [label %lor.lhs.false184, label %for.cond]
30
31lor.lhs.false184: ; preds = %lor.lhs.false177
32 indirectbr i8* undef, [label %return, label %for.cond]
33
34for.cond: ; preds = %for.inc, %lor.lhs.false184, %if.end152
35 %indvar65 = phi i64 [ %indvar.next66, %for.inc ], [ 0, %lor.lhs.false184 ], [ 0, %if.end152 ]
36 %tmp128 = add i64 %0, %indvar65
37 %s.4 = getelementptr i8* %cmd, i64 %tmp128
38 %tmp195 = load i8* %s.4, align 1
39 indirectbr i8* undef, [label %return, label %land.rhs198]
40
41land.rhs198: ; preds = %for.cond
42 indirectbr i8* undef, [label %return, label %for.inc]
43
44for.inc: ; preds = %lor.rhs234, %land.lhs.true228, %land.lhs.true216, %land.lhs.true204
45 %indvar.next66 = add i64 %indvar65, 1
46 indirectbr i8* undef, [label %for.cond]
47
48return: ; preds = %if.end677, %doshell, %if.then96
49 ret void
50}
Andrew Trick36607352012-03-20 21:24:40 +000051
52define void @nopreheader2() nounwind ssp {
53entry:
54 indirectbr i8* undef, [label %while.cond, label %return]
55
56while.cond: ; preds = %while.cond.backedge, %entry
57 indirectbr i8* undef, [label %while.cond.backedge, label %lor.rhs]
58
59lor.rhs: ; preds = %while.cond
60 indirectbr i8* undef, [label %while.cond.backedge, label %while.end]
61
62while.cond.backedge: ; preds = %lor.rhs, %while.cond
63 indirectbr i8* undef, [label %while.cond]
64
65while.end: ; preds = %lor.rhs
66 indirectbr i8* undef, [label %if.then18, label %return]
67
68if.then18: ; preds = %while.end
69 indirectbr i8* undef, [label %if.end35, label %lor.lhs.false]
70
71lor.lhs.false: ; preds = %if.then18
72 indirectbr i8* undef, [label %if.end35, label %return]
73
74if.end35: ; preds = %lor.lhs.false, %if.then18
75 indirectbr i8* undef, [label %while.cond36]
76
77while.cond36: ; preds = %while.body49, %if.end35
78 %0 = phi i64 [ %indvar.next13, %while.body49 ], [ 0, %if.end35 ]
79 indirectbr i8* undef, [label %while.body49, label %lor.rhs42]
80
81lor.rhs42: ; preds = %while.cond36
82 indirectbr i8* undef, [label %while.body49, label %while.end52]
83
84while.body49: ; preds = %lor.rhs42, %while.cond36
85 %indvar.next13 = add i64 %0, 1
86 indirectbr i8* undef, [label %while.cond36]
87
88while.end52: ; preds = %lor.rhs42
89 indirectbr i8* undef, [label %land.lhs.true, label %return]
90
91land.lhs.true: ; preds = %while.end52
92 indirectbr i8* undef, [label %while.cond66.preheader, label %return]
93
94while.cond66.preheader: ; preds = %land.lhs.true
95 indirectbr i8* undef, [label %while.cond66]
96
97while.cond66: ; preds = %while.body77, %while.cond66.preheader
98 indirectbr i8* undef, [label %land.rhs, label %while.cond81.preheader]
99
100land.rhs: ; preds = %while.cond66
101 indirectbr i8* undef, [label %while.body77, label %while.cond81.preheader]
102
103while.cond81.preheader: ; preds = %land.rhs, %while.cond66
104 %tmp45 = add i64 undef, %0
105 %tmp46 = add i64 %tmp45, undef
106 indirectbr i8* undef, [label %while.cond81]
107
108while.body77: ; preds = %land.rhs
109 indirectbr i8* undef, [label %while.cond66]
110
111while.cond81: ; preds = %while.body94, %while.cond81.preheader
112 %tmp25 = add i64 %tmp46, undef
113 indirectbr i8* undef, [label %while.body94, label %lor.rhs87]
114
115lor.rhs87: ; preds = %while.cond81
116 indirectbr i8* undef, [label %while.body94, label %return]
117
118while.body94: ; preds = %lor.rhs87, %while.cond81
119 indirectbr i8* undef, [label %while.cond81]
120
121return: ; preds = %if.end216, %land.lhs.true183, %land.lhs.true, %while.end52, %lor.lhs.false, %while.end, %entry
122 ret void
123}