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
5 ; Test that we don't inline when caller and callee don't have matching
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
11 define i32 @profile() { ret i32 42 }
12 define i32 @noprofile() noprofile { ret i32 43 }
13 define i32 @profile_aa() alwaysinline { ret i32 44 }
14 define i32 @noprofile_aa() noprofile alwaysinline { ret i32 45 }
16 define i32 @profile_caller() noprofile {
17 ; CHECK-LABEL: @profile_caller(
18 ; CHECK-NEXT: [[TMP1:%.*]] = call i32 @profile()
19 ; CHECK-NEXT: ret i32 44
22 %2 = call i32 @profile_aa()
26 define i32 @noprofile_caller() {
27 ; CHECK-LABEL: @noprofile_caller(
28 ; CHECK-NEXT: [[TMP1:%.*]] = call i32 @noprofile()
29 ; CHECK-NEXT: ret i32 45
32 %2 = call i32 @noprofile_aa()
36 ; Test that we do inline when caller and callee don't have matching
37 ; noprofile fn attrs, when CallInst is alwaysinline.
38 define i32 @aa_callsite() {
39 ; CHECK-INLINE-LABEL: @aa_callsite(
40 ; CHECK-INLINE-NEXT: ret i32 43
42 %1 = call i32 @noprofile() alwaysinline