1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 5
2 ; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=1 \
3 ; RUN: -funcspec-for-literal-constant=true \
4 ; RUN: -funcspec-min-codesize-savings=50 \
5 ; RUN: -funcspec-min-latency-savings=50 \
6 ; RUN: -funcspec-max-codesize-growth=1 \
7 ; RUN: -S < %s | FileCheck %s
9 ; Verify that we are able to specialize a function successfully after analysis
10 ; of other specializations that are found to not be profitable.
11 define void @test_specialize_after_failed_analysis(i32 %n) {
13 %notspec0 = call i32 @add(i32 0, i32 %n)
14 %notspec1 = call i32 @add(i32 1, i32 %n)
15 %spec = call i32 @add(i32 1, i32 1)
19 define i32 @add(i32 %x, i32 %y) {
24 ; CHECK-LABEL: define void @test_specialize_after_failed_analysis(
25 ; CHECK-SAME: i32 [[N:%.*]]) {
26 ; CHECK-NEXT: [[ENTRY:.*:]]
27 ; CHECK-NEXT: [[NOTSPEC0:%.*]] = call i32 @add(i32 0, i32 [[N]])
28 ; CHECK-NEXT: [[NOTSPEC1:%.*]] = call i32 @add(i32 1, i32 [[N]])
29 ; CHECK-NEXT: [[SPEC:%.*]] = call i32 @add.specialized.1(i32 1, i32 1)
30 ; CHECK-NEXT: ret void
33 ; CHECK-LABEL: define i32 @add(
34 ; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
35 ; CHECK-NEXT: [[ENTRY:.*:]]
36 ; CHECK-NEXT: [[RES:%.*]] = add i32 [[X]], [[Y]]
37 ; CHECK-NEXT: ret i32 [[RES]]
40 ; CHECK-LABEL: define internal i32 @add.specialized.1(
41 ; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
42 ; CHECK-NEXT: [[ENTRY:.*:]]
43 ; CHECK-NEXT: ret i32 poison