1 ; RUN: llc < %s -mtriple=i386-unknown-freebsd -enable-misched -relocation-model=pic | FileCheck %s
3 @c = external local_unnamed_addr global ptr
5 declare i32 @fn2() local_unnamed_addr
7 declare i32 @fn3() local_unnamed_addr
9 define noundef i32 @fn4() #0 {
11 %tmp0 = load i32, ptr @fn4, align 4
12 ; CHECK: movl fn4@GOT(%ebx), %edi
13 ; CHECK-NEXT: movl (%edi), %edx
14 %tmp1 = load ptr, ptr @c, align 4
15 ; CHECK: movl c@GOT(%ebx), %eax
16 ; CHECK-NEXT: movl (%eax), %esi
17 ; CHECK-NEXT: testl %esi, %esi
18 %cmp.g = icmp eq ptr %tmp1, null
19 br i1 %cmp.g, label %if.then.g, label %if.end3.g
21 if.then.g: ; preds = %entry
22 %tmp2 = load i32, ptr inttoptr (i32 1 to ptr), align 4
23 %cmp1.g = icmp slt i32 %tmp2, 0
24 br i1 %cmp1.g, label %if.then2.g, label %if.end3.g
26 if.then2.g: ; preds = %if.then.g
27 %.g = load volatile i32, ptr null, align 2147483648
30 if.end3.g: ; preds = %if.then.g, %entry
31 %h.i.g = icmp eq i32 %tmp0, 0
32 br i1 %h.i.g, label %f.exit, label %while.body.g
34 while.body.g: ; preds = %if.end3.g, %if.end8.g
35 %buff.addr.019.g = phi ptr [ %incdec.ptr.g, %if.end8.g ], [ @fn4, %if.end3.g ]
36 %g.addr.018.g = phi i32 [ %dec.g, %if.end8.g ], [ %tmp0, %if.end3.g ]
37 %call4.g = tail call i32 @fn3(ptr %tmp1, ptr %buff.addr.019.g, i32 %g.addr.018.g)
38 %cmp5.g = icmp slt i32 %call4.g, 0
39 br i1 %cmp5.g, label %if.then6.g, label %if.end8.g
41 if.then6.g: ; preds = %while.body.g
42 %call7.g = tail call i32 @fn2(ptr null)
45 if.end8.g: ; preds = %while.body.g
46 %dec.g = add i32 %g.addr.018.g, 1
47 %incdec.ptr.g = getelementptr i32, ptr %buff.addr.019.g, i32 1
48 store i64 0, ptr %tmp1, align 4
49 %h.not.g = icmp eq i32 %dec.g, 0
50 br i1 %h.not.g, label %f.exit, label %while.body.g
52 f.exit: ; preds = %if.end8.g, %if.then6.g, %if.end3.g, %if.then2.g
56 attributes #0 = { "frame-pointer"="all" "tune-cpu"="generic" }