• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -regalloc=greedy -verify-coalescing -mtriple=x86_64-unknown-linux-gnu < %s
2; Check the live range is updated properly after register coalescing.
3
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5
6@.str = internal unnamed_addr constant { [17 x i8], [47 x i8] } { [17 x i8] c"0123456789ABCDEF\00", [47 x i8] zeroinitializer }, align 32
7@b = common local_unnamed_addr global i32 0, align 4
8@a = common local_unnamed_addr global i32* null, align 8
9@__sancov_gen_cov = private global [9 x i32] zeroinitializer
10
11; Function Attrs: nounwind sanitize_address
12define void @fn2(i8* %p1) local_unnamed_addr #0 {
13entry:
14  %0 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 4) to i32*) monotonic, align 4
15  %1 = icmp sge i32 0, %0
16  br i1 %1, label %2, label %3
17
18; <label>:2:                                      ; preds = %entry
19  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 4) to i32*))
20  call void asm sideeffect "", ""()
21  br label %3
22
23; <label>:3:                                      ; preds = %entry, %2
24  br label %while.cond.outer
25
26while.cond.outer:                                 ; preds = %75, %3
27  %e.0.ph = phi i8* [ %e.058, %75 ], [ undef, %3 ]
28  %c.0.ph = phi i32* [ %c.059, %75 ], [ undef, %3 ]
29  %p1.addr.0.ph = phi i8* [ %incdec.ptr60, %75 ], [ %p1, %3 ]
30  %4 = ptrtoint i8* %p1.addr.0.ph to i64
31  %5 = lshr i64 %4, 3
32  %6 = add i64 %5, 2147450880
33  %7 = inttoptr i64 %6 to i8*
34  %8 = load i8, i8* %7
35  %9 = icmp ne i8 %8, 0
36  br i1 %9, label %10, label %15
37
38; <label>:10:                                     ; preds = %while.cond.outer
39  %11 = and i64 %4, 7
40  %12 = trunc i64 %11 to i8
41  %13 = icmp sge i8 %12, %8
42  br i1 %13, label %14, label %15
43
44; <label>:14:                                     ; preds = %10
45  call void @__asan_report_load1(i64 %4)
46  call void asm sideeffect "", ""()
47  unreachable
48
49; <label>:15:                                     ; preds = %10, %while.cond.outer
50  %16 = load i8, i8* %p1.addr.0.ph, align 1
51  call void @__sanitizer_cov_trace_cmp1(i8 %16, i8 0)
52  %cmp57 = icmp eq i8 %16, 0
53  br i1 %cmp57, label %while.cond.outer.enoent.loopexit96_crit_edge, label %while.body.preheader
54
55while.cond.outer.enoent.loopexit96_crit_edge:     ; preds = %15
56  %17 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 8) to i32*) monotonic, align 4
57  %18 = icmp sge i32 0, %17
58  br i1 %18, label %19, label %20
59
60; <label>:19:                                     ; preds = %while.cond.outer.enoent.loopexit96_crit_edge
61  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 8) to i32*))
62  call void asm sideeffect "", ""()
63  br label %20
64
65; <label>:20:                                     ; preds = %while.cond.outer.enoent.loopexit96_crit_edge, %19
66  br label %enoent.loopexit96
67
68while.body.preheader:                             ; preds = %15
69  br label %while.body
70
71while.body:                                       ; preds = %56, %while.body.preheader
72  %21 = phi i8 [ %52, %56 ], [ %16, %while.body.preheader ]
73  %p1.addr.0.ph.pn = phi i8* [ %incdec.ptr60, %56 ], [ %p1.addr.0.ph, %while.body.preheader ]
74  %c.059 = phi i32* [ %incdec.ptr18, %56 ], [ %c.0.ph, %while.body.preheader ]
75  %e.058 = phi i8* [ %incdec.ptr60, %56 ], [ %e.0.ph, %while.body.preheader ]
76  %incdec.ptr60 = getelementptr inbounds i8, i8* %p1.addr.0.ph.pn, i64 1
77  %conv = sext i8 %21 to i32
78  %call = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @fn3 to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ({ [17 x i8], [47 x i8] }, { [17 x i8], [47 x i8] }* @.str, i32 0, i32 0, i64 0), i32 %conv) #2
79  call void @__sanitizer_cov_trace_cmp4(i32 %call, i32 0)
80  %tobool = icmp eq i32 %call, 0
81  br i1 %tobool, label %if.end5, label %cleanup
82
83if.end5:                                          ; preds = %while.body
84  call void @__sanitizer_cov_trace_cmp1(i8 %21, i8 58)
85  %cmp6 = icmp eq i8 %21, 58
86  br i1 %cmp6, label %if.end14, label %cleanup.thread40
87
88if.end14:                                         ; preds = %if.end5
89  %22 = load i8, i8* inttoptr (i64 add (i64 lshr (i64 ptrtoint (i32** @a to i64), i64 3), i64 2147450880) to i8*)
90  %23 = icmp ne i8 %22, 0
91  br i1 %23, label %24, label %25
92
93; <label>:24:                                     ; preds = %if.end14
94  call void @__asan_report_load8(i64 ptrtoint (i32** @a to i64))
95  call void asm sideeffect "", ""()
96  unreachable
97
98; <label>:25:                                     ; preds = %if.end14
99  %26 = load i32*, i32** @a, align 8
100  %tobool15 = icmp eq i32* %26, null
101  br i1 %tobool15, label %cleanup.thread39, label %cleanup23.loopexit
102
103cleanup.thread39:                                 ; preds = %25
104  %incdec.ptr18 = getelementptr inbounds i32, i32* %c.059, i64 1
105  %27 = ptrtoint i32* %c.059 to i64
106  %28 = lshr i64 %27, 3
107  %29 = add i64 %28, 2147450880
108  %30 = inttoptr i64 %29 to i8*
109  %31 = load i8, i8* %30
110  %32 = icmp ne i8 %31, 0
111  br i1 %32, label %33, label %39
112
113; <label>:33:                                     ; preds = %cleanup.thread39
114  %34 = and i64 %27, 7
115  %35 = add i64 %34, 3
116  %36 = trunc i64 %35 to i8
117  %37 = icmp sge i8 %36, %31
118  br i1 %37, label %38, label %39
119
120; <label>:38:                                     ; preds = %33
121  call void @__asan_report_store4(i64 %27)
122  call void asm sideeffect "", ""()
123  unreachable
124
125; <label>:39:                                     ; preds = %33, %cleanup.thread39
126  store i32 0, i32* %c.059, align 4
127  %40 = ptrtoint i8* %incdec.ptr60 to i64
128  %41 = lshr i64 %40, 3
129  %42 = add i64 %41, 2147450880
130  %43 = inttoptr i64 %42 to i8*
131  %44 = load i8, i8* %43
132  %45 = icmp ne i8 %44, 0
133  br i1 %45, label %46, label %51
134
135; <label>:46:                                     ; preds = %39
136  %47 = and i64 %40, 7
137  %48 = trunc i64 %47 to i8
138  %49 = icmp sge i8 %48, %44
139  br i1 %49, label %50, label %51
140
141; <label>:50:                                     ; preds = %46
142  call void @__asan_report_load1(i64 %40)
143  call void asm sideeffect "", ""()
144  unreachable
145
146; <label>:51:                                     ; preds = %46, %39
147  %52 = load i8, i8* %incdec.ptr60, align 1
148  call void @__sanitizer_cov_trace_cmp1(i8 %52, i8 0)
149  %cmp = icmp eq i8 %52, 0
150  br i1 %cmp, label %enoent.loopexit, label %cleanup.thread39.while.body_crit_edge
151
152cleanup.thread39.while.body_crit_edge:            ; preds = %51
153  %53 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 12) to i32*) monotonic, align 4
154  %54 = icmp sge i32 0, %53
155  br i1 %54, label %55, label %56
156
157; <label>:55:                                     ; preds = %cleanup.thread39.while.body_crit_edge
158  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 12) to i32*))
159  call void asm sideeffect "", ""()
160  br label %56
161
162; <label>:56:                                     ; preds = %cleanup.thread39.while.body_crit_edge, %55
163  br label %while.body
164
165cleanup.thread40:                                 ; preds = %if.end5
166  %57 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 16) to i32*) monotonic, align 4
167  %58 = icmp sge i32 0, %57
168  br i1 %58, label %59, label %60
169
170; <label>:59:                                     ; preds = %cleanup.thread40
171  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 16) to i32*))
172  call void asm sideeffect "", ""()
173  br label %60
174
175; <label>:60:                                     ; preds = %cleanup.thread40, %59
176  %call20 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fn4 to i32 (i8*, ...)*)(i8* %e.058) #2
177  br label %enoent
178
179cleanup:                                          ; preds = %while.body
180  %61 = load i8, i8* inttoptr (i64 add (i64 lshr (i64 ptrtoint (i32* @b to i64), i64 3), i64 2147450880) to i8*)
181  %62 = icmp ne i8 %61, 0
182  br i1 %62, label %63, label %66
183
184; <label>:63:                                     ; preds = %cleanup
185  %64 = icmp sge i8 trunc (i64 add (i64 and (i64 ptrtoint (i32* @b to i64), i64 7), i64 3) to i8), %61
186  br i1 %64, label %65, label %66
187
188; <label>:65:                                     ; preds = %63
189  call void @__asan_report_load4(i64 ptrtoint (i32* @b to i64))
190  call void asm sideeffect "", ""()
191  unreachable
192
193; <label>:66:                                     ; preds = %63, %cleanup
194  %67 = load i32, i32* @b, align 4
195  call void @__sanitizer_cov_trace_cmp4(i32 %67, i32 0)
196  %tobool3 = icmp eq i32 %67, 0
197  br i1 %tobool3, label %cleanup.while.cond.outer_crit_edge, label %cleanup.enoent.loopexit96_crit_edge
198
199cleanup.enoent.loopexit96_crit_edge:              ; preds = %66
200  %68 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 20) to i32*) monotonic, align 4
201  %69 = icmp sge i32 0, %68
202  br i1 %69, label %70, label %71
203
204; <label>:70:                                     ; preds = %cleanup.enoent.loopexit96_crit_edge
205  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 20) to i32*))
206  call void asm sideeffect "", ""()
207  br label %71
208
209; <label>:71:                                     ; preds = %cleanup.enoent.loopexit96_crit_edge, %70
210  br label %enoent.loopexit96
211
212cleanup.while.cond.outer_crit_edge:               ; preds = %66
213  %72 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 24) to i32*) monotonic, align 4
214  %73 = icmp sge i32 0, %72
215  br i1 %73, label %74, label %75
216
217; <label>:74:                                     ; preds = %cleanup.while.cond.outer_crit_edge
218  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 24) to i32*))
219  call void asm sideeffect "", ""()
220  br label %75
221
222; <label>:75:                                     ; preds = %cleanup.while.cond.outer_crit_edge, %74
223  br label %while.cond.outer
224
225enoent.loopexit:                                  ; preds = %51
226  %76 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 28) to i32*) monotonic, align 4
227  %77 = icmp sge i32 0, %76
228  br i1 %77, label %78, label %79
229
230; <label>:78:                                     ; preds = %enoent.loopexit
231  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 28) to i32*))
232  call void asm sideeffect "", ""()
233  br label %79
234
235; <label>:79:                                     ; preds = %enoent.loopexit, %78
236  br label %enoent
237
238enoent.loopexit96:                                ; preds = %71, %20
239  br label %enoent
240
241enoent:                                           ; preds = %enoent.loopexit96, %79, %60
242  %call22 = tail call i32* (...) @fn1() #2
243  br label %cleanup23
244
245cleanup23.loopexit:                               ; preds = %25
246  %80 = load atomic i32, i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 32) to i32*) monotonic, align 4
247  %81 = icmp sge i32 0, %80
248  br i1 %81, label %82, label %83
249
250; <label>:82:                                     ; preds = %cleanup23.loopexit
251  call void @__sanitizer_cov(i32* inttoptr (i64 add (i64 ptrtoint ([9 x i32]* @__sancov_gen_cov to i64), i64 32) to i32*))
252  call void asm sideeffect "", ""()
253  br label %83
254
255; <label>:83:                                     ; preds = %cleanup23.loopexit, %82
256  br label %cleanup23
257
258cleanup23:                                        ; preds = %83, %enoent
259  ret void
260}
261
262declare i32 @fn3(...) local_unnamed_addr #1
263
264declare i32 @fn4(...) local_unnamed_addr #1
265
266declare i32* @fn1(...) local_unnamed_addr #1
267
268declare void @__sanitizer_cov(i32*)
269
270declare void @__sanitizer_cov_trace_cmp1(i8, i8)
271
272declare void @__sanitizer_cov_trace_cmp4(i32, i32)
273
274declare void @__asan_report_load1(i64)
275
276declare void @__asan_report_load4(i64)
277
278declare void @__asan_report_load8(i64)
279
280declare void @__asan_report_store4(i64)
281
282