1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes=inline %s -S -pass-remarks-missed=inline 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-INLINE 3; RUN: opt -passes=always-inline %s -S | FileCheck %s 4 5; Test that we don't inline when caller and callee don't have matching 6; noprofile fn attrs. 7 8; CHECK-INLINE: 'profile' not inlined into 'profile_caller' because it should never be inlined (cost=never): conflicting attributes 9; CHECK-INLINE: 'noprofile' not inlined into 'noprofile_caller' because it should never be inlined (cost=never): conflicting attributes 10 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 44 20; 21 call i32 @profile() 22 %2 = call i32 @profile_aa() 23 ret i32 %2 24} 25 26define i32 @noprofile_caller() { 27; CHECK-LABEL: @noprofile_caller( 28; CHECK-NEXT: [[TMP1:%.*]] = call i32 @noprofile() 29; CHECK-NEXT: ret i32 45 30; 31 call i32 @noprofile() 32 %2 = call i32 @noprofile_aa() 33 ret i32 %2 34} 35 36; Test that we do inline when caller and callee don't have matching 37; noprofile fn attrs, when CallInst is alwaysinline. 38define i32 @aa_callsite() { 39; CHECK-INLINE-LABEL: @aa_callsite( 40; CHECK-INLINE-NEXT: ret i32 43 41; 42 %1 = call i32 @noprofile() alwaysinline 43 ret i32 %1 44} 45