45 lines · plain
1; REQUIRES: asserts2; RUN: opt -S -debug-counter=partially-inline-libcalls-transform=1 \3; RUN: -passes=partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s4;; Test that, with debug counters on, we will skip the first optimization opportunity, perform next 1,5;; and ignore all the others left.6 7define float @f1(float %val) {8; CHECK-LABEL: @f1(9; CHECK-NEXT: entry:10; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]])11; CHECK-NEXT: ret float [[RES:%.*]]12entry:13 %res = tail call float @sqrtf(float %val)14 ret float %res15}16 17define float @f2(float %val) {18; CHECK-LABEL: @f2(19; CHECK-NEXT: entry:20; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]]) #021; CHECK-NEXT: [[TMP0:%.*]] = fcmp oge float [[VAL]], 0.000000e+0022; CHECK-NEXT: br i1 [[TMP0]], label [[ENTRY_SPLIT:%.*]], label [[CALL_SQRT:%.*]]23; CHECK: call.sqrt:24; CHECK-NEXT: [[TMP1:%.*]] = tail call float @sqrtf(float [[VAL]])25; CHECK-NEXT: br label [[ENTRY_SPLIT]]26; CHECK: entry.split:27; CHECK-NEXT: [[TMP2:%.*]] = phi float [ [[RES]], [[ENTRY:%.*]] ], [ [[TMP1]], [[CALL_SQRT]] ]28; CHECK-NEXT: ret float [[TMP2]]29entry:30 %res = tail call float @sqrtf(float %val)31 ret float %res32}33 34define float @f3(float %val) {35; CHECK-LABEL: @f3(36; CHECK-NEXT: entry:37; CHECK-NEXT: [[RES:%.*]] = tail call float @sqrtf(float [[VAL:%.*]])38; CHECK-NEXT: ret float [[RES:%.*]]39entry:40 %res = tail call float @sqrtf(float %val)41 ret float %res42}43 44declare float @sqrtf(float)45