1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -S -passes=inline | FileCheck %s
6 ; This call should not get inlined, because it would make the callee_not_avx
7 ; call ABI incompatible.
8 define void @caller_avx() "target-features"="+avx" {
9 ; CHECK-LABEL: define {{[^@]+}}@caller_avx
10 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
11 ; CHECK-NEXT: call void @caller_not_avx()
12 ; CHECK-NEXT: ret void
14 call void @caller_not_avx()
18 define internal void @caller_not_avx() {
19 ; CHECK-LABEL: define {{[^@]+}}@caller_not_avx() {
20 ; CHECK-NEXT: [[TMP1:%.*]] = call i64 @callee_not_avx(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
21 ; CHECK-NEXT: ret void
23 call i64 @callee_not_avx(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
27 define i64 @callee_not_avx(<4 x i64> %arg) noinline {
28 ; CHECK-LABEL: define {{[^@]+}}@callee_not_avx
29 ; CHECK-SAME: (<4 x i64> [[ARG:%.*]]) #[[ATTR1:[0-9]+]] {
30 ; CHECK-NEXT: [[V:%.*]] = extractelement <4 x i64> [[ARG]], i64 2
31 ; CHECK-NEXT: ret i64 [[V]]
33 %v = extractelement <4 x i64> %arg, i64 2
37 ; This call also shouldn't be inlined, as we don't know whether callee_unknown
38 ; is ABI compatible or not.
39 define void @caller_avx2() "target-features"="+avx" {
40 ; CHECK-LABEL: define {{[^@]+}}@caller_avx2
41 ; CHECK-SAME: () #[[ATTR0]] {
42 ; CHECK-NEXT: call void @caller_not_avx2()
43 ; CHECK-NEXT: ret void
45 call void @caller_not_avx2()
49 define internal void @caller_not_avx2() {
50 ; CHECK-LABEL: define {{[^@]+}}@caller_not_avx2() {
51 ; CHECK-NEXT: [[TMP1:%.*]] = call i64 @callee_unknown(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
52 ; CHECK-NEXT: ret void
54 call i64 @callee_unknown(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
58 declare i64 @callee_unknown(<4 x i64>)
60 ; This call should get inlined, because we assume that intrinsics are always
62 define void @caller_avx3() "target-features"="+avx" {
63 ; CHECK-LABEL: define {{[^@]+}}@caller_avx3
64 ; CHECK-SAME: () #[[ATTR0]] {
65 ; CHECK-NEXT: [[TMP1:%.*]] = call i64 @llvm.some_intrinsic(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
66 ; CHECK-NEXT: ret void
68 call void @caller_not_avx3()
72 define internal void @caller_not_avx3() {
73 call i64 @llvm.some_intrinsic(<4 x i64> <i64 0, i64 1, i64 2, i64 3>)
77 declare i64 @llvm.some_intrinsic(<4 x i64>)
79 ; This call should get inlined, because only simple types are involved.
80 define void @caller_avx4() "target-features"="+avx" {
81 ; CHECK-LABEL: define {{[^@]+}}@caller_avx4
82 ; CHECK-SAME: () #[[ATTR0]] {
83 ; CHECK-NEXT: [[TMP1:%.*]] = call i64 @caller_unknown_simple(i64 0)
84 ; CHECK-NEXT: ret void
86 call void @caller_not_avx4()
90 define internal void @caller_not_avx4() {
91 call i64 @caller_unknown_simple(i64 0)
95 declare i64 @caller_unknown_simple(i64)