45 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=inline %s -S -pass-remarks-missed=inline 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-INLINE3; RUN: opt -passes=always-inline %s -S | FileCheck %s4 5; Test that we don't inline when caller and callee don't have matching6; noprofile fn attrs.7 8; CHECK-INLINE: 'profile' not inlined into 'profile_caller' because it should never be inlined (cost=never): conflicting attributes9; CHECK-INLINE: 'noprofile' not inlined into 'noprofile_caller' because it should never be inlined (cost=never): conflicting attributes10 11define i32 @profile() { ret i32 42 }12define i32 @noprofile() noprofile { ret i32 43 }13define i32 @profile_aa() alwaysinline { ret i32 44 }14define i32 @noprofile_aa() noprofile alwaysinline { ret i32 45 }15 16define i32 @profile_caller() noprofile {17; CHECK-LABEL: @profile_caller(18; CHECK-NEXT: [[TMP1:%.*]] = call i32 @profile()19; CHECK-NEXT: ret i32 4420;21 call i32 @profile()22 %2 = call i32 @profile_aa()23 ret i32 %224}25 26define i32 @noprofile_caller() {27; CHECK-LABEL: @noprofile_caller(28; CHECK-NEXT: [[TMP1:%.*]] = call i32 @noprofile()29; CHECK-NEXT: ret i32 4530;31 call i32 @noprofile()32 %2 = call i32 @noprofile_aa()33 ret i32 %234}35 36; Test that we do inline when caller and callee don't have matching37; noprofile fn attrs, when CallInst is alwaysinline.38define i32 @aa_callsite() {39; CHECK-INLINE-LABEL: @aa_callsite(40; CHECK-INLINE-NEXT: ret i32 4341;42 %1 = call i32 @noprofile() alwaysinline43 ret i32 %144}45