1*2556f581SChuanqi Xu; RUN: opt -function-specialization -func-specialization-avg-iters-cost=3 -func-specialization-size-threshold=10 -S < %s | FileCheck %s 2*2556f581SChuanqi Xu 3*2556f581SChuanqi Xu; CHECK-NOT: foo.{{[0-9]+}} 4*2556f581SChuanqi Xu 5*2556f581SChuanqi Xutarget datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 6*2556f581SChuanqi Xu 7*2556f581SChuanqi Xu@A = external dso_local constant i32, align 4 8*2556f581SChuanqi Xu@B = external dso_local constant i32, align 4 9*2556f581SChuanqi Xu@C = external dso_local constant i32, align 4 10*2556f581SChuanqi Xu@D = external dso_local constant i32, align 4 11*2556f581SChuanqi Xu 12*2556f581SChuanqi Xudeclare i1 @cond_begin() 13*2556f581SChuanqi Xudeclare i1 @cond_end() 14*2556f581SChuanqi Xudeclare i1 @getCond() 15*2556f581SChuanqi Xu 16*2556f581SChuanqi Xudefine internal i32 @foo(i32 %x, i32* %b, i32* %c) alwaysinline { 17*2556f581SChuanqi Xuentry: 18*2556f581SChuanqi Xu br label %loop.entry 19*2556f581SChuanqi Xu 20*2556f581SChuanqi Xuloop.entry: 21*2556f581SChuanqi Xu br label %loop2.entry 22*2556f581SChuanqi Xu 23*2556f581SChuanqi Xuloop2.entry: 24*2556f581SChuanqi Xu br label %loop2.body 25*2556f581SChuanqi Xu 26*2556f581SChuanqi Xuloop2.body: 27*2556f581SChuanqi Xu %0 = load i32, i32* %b, align 4 28*2556f581SChuanqi Xu %1 = load i32, i32* %c, align 4 29*2556f581SChuanqi Xu %add.0 = add nsw i32 %0, %1 30*2556f581SChuanqi Xu %add = add nsw i32 %add.0, %x 31*2556f581SChuanqi Xu br label %loop2.end 32*2556f581SChuanqi Xu 33*2556f581SChuanqi Xuloop2.end: 34*2556f581SChuanqi Xu %cond.end = call i1 @cond_end() 35*2556f581SChuanqi Xu br i1 %cond.end, label %loop2.entry, label %loop.end 36*2556f581SChuanqi Xu 37*2556f581SChuanqi Xuloop.end: 38*2556f581SChuanqi Xu %cond2.end = call i1 @getCond() 39*2556f581SChuanqi Xu br i1 %cond2.end, label %loop.entry, label %return 40*2556f581SChuanqi Xu 41*2556f581SChuanqi Xureturn: 42*2556f581SChuanqi Xu ret i32 %add 43*2556f581SChuanqi Xu} 44*2556f581SChuanqi Xu 45*2556f581SChuanqi Xudefine dso_local i32 @bar(i32 %x, i32 %y) { 46*2556f581SChuanqi Xuentry: 47*2556f581SChuanqi Xu %tobool = icmp ne i32 %x, 0 48*2556f581SChuanqi Xu br i1 %tobool, label %if.then, label %if.else 49*2556f581SChuanqi Xu 50*2556f581SChuanqi Xuif.then: 51*2556f581SChuanqi Xu %call = call i32 @foo(i32 %x, i32* @A, i32* @C) 52*2556f581SChuanqi Xu br label %return 53*2556f581SChuanqi Xu 54*2556f581SChuanqi Xuif.else: 55*2556f581SChuanqi Xu %call1 = call i32 @foo(i32 %y, i32* @B, i32* @D) 56*2556f581SChuanqi Xu br label %return 57*2556f581SChuanqi Xu 58*2556f581SChuanqi Xureturn: 59*2556f581SChuanqi Xu %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 60*2556f581SChuanqi Xu ret i32 %retval.0 61*2556f581SChuanqi Xu}