1 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 2 target triple = "x86_64-unknown-linux-gnu" 3 4 @fptr = internal unnamed_addr global i32 (i32)* @f2, align 8 5 6 define dso_local i32 @foo(i32 %x) local_unnamed_addr { 7 entry: 8 %0 = load i32 (i32)*, i32 (i32)** @fptr, align 8 9 %call = tail call i32 %0(i32 %x), !callees !0 10 ret i32 %call 11 } 12 13 define internal i32 @f2(i32 %x) { 14 entry: 15 %tobool = icmp eq i32 %x, 0 16 br i1 %tobool, label %if.end, label %if.then 17 18 if.then: ; preds = %entry 19 store i32 (i32)* @f1, i32 (i32)** @fptr, align 8 20 %sub.i = add nsw i32 %x, -1 21 br label %if.end 22 23 if.end: ; preds = %entry, %if.then 24 %phi.call = phi i32 [ %sub.i, %if.then ], [ -1, %entry ] 25 ret i32 %phi.call 26 } 27 28 define internal i32 @f1(i32 %x) { 29 entry: 30 %sub = add nsw i32 %x, -1 31 ret i32 %sub 32 } 33 34 !0 = !{i32 (i32)* @f1, i32 (i32)* @f2} 35