2 ; RUN: opt -S -debug-counter=partially-inline-libcalls-transform-skip=1,partially-inline-libcalls-transform-count=1 \
3 ; RUN: -partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
4 ;; Test that, with debug counters on, we will skip the first optimization opportunity, perform next 1,
5 ;; and ignore all the others left.
7 define float @f1(float %val) {
10 ; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]])
11 ; CHECK-NEXT: ret float [[RES:%.*]]
13 %res = tail call float @sqrtf(float %val)
17 define float @f2(float %val) {
20 ; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #0
21 ; CHECK-NEXT: [[TMP0:%.*]] = fcmp oge float [[VAL]], 0.000000e+00
22 ; CHECK-NEXT: br i1 [[TMP0]], label [[ENTRY_SPLIT:%.*]], label [[CALL_SQRT:%.*]]
24 ; CHECK-NEXT: [[TMP1:%.*]] = tail call float @sqrtf(float [[VAL]])
25 ; CHECK-NEXT: br label [[ENTRY_SPLIT]]
27 ; CHECK-NEXT: [[TMP2:%.*]] = phi float [ [[RES]], [[ENTRY:%.*]] ], [ [[TMP1]], [[CALL_SQRT]] ]
28 ; CHECK-NEXT: ret float [[TMP2]]
30 %res = tail call float @sqrtf(float %val)
34 define float @f3(float %val) {
37 ; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]])
38 ; CHECK-NEXT: ret float [[RES:%.*]]
40 %res = tail call float @sqrtf(float %val)
44 declare float @sqrtf(float)