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