1 ; RUN: opt -function-specialization -func-specialization-avg-iters-cost=3 -S < %s | FileCheck %s
3 ; Check that the loop depth results in a larger specialization bonus.
7 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
9 @A = external dso_local constant i32, align 4
10 @B = external dso_local constant i32, align 4
11 @C = external dso_local constant i32, align 4
12 @D = external dso_local constant i32, align 4
14 declare i1 @cond_begin()
15 declare i1 @cond_end()
18 define internal i32 @foo(i32 %x, i32* %b, i32* %c) {
29 %0 = load i32, i32* %b, align 4
30 %1 = load i32, i32* %c, align 4
31 %add.0 = add nsw i32 %0, %1
32 %add = add nsw i32 %add.0, %x
36 %cond.end = call i1 @cond_end()
37 br i1 %cond.end, label %loop2.entry, label %loop.end
40 %cond2.end = call i1 @getCond()
41 br i1 %cond2.end, label %loop.entry, label %return
47 define dso_local i32 @bar(i32 %x, i32 %y) {
49 %tobool = icmp ne i32 %x, 0
50 br i1 %tobool, label %if.then, label %if.else
53 %call = call i32 @foo(i32 %x, i32* @A, i32* @C)
57 %call1 = call i32 @foo(i32 %y, i32* @B, i32* @D)
61 %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ]