xref: /llvm-project/llvm/test/Transforms/Inline/X86/inline-target-attr.ll (revision e5369823bc0655806469724335d0ca5a4c17d8c7)
1; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -S -passes=inline | FileCheck %s
2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -S -passes='cgscc(inline)' | FileCheck %s
3; Check that we only inline when we have compatible target attributes.
4; X86 has implemented a target attribute that will verify that the attribute
5; sets are compatible.
6
7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-unknown-linux-gnu"
9
10define i32 @foo() #0 {
11entry:
12  %call = call i32 (...) @baz()
13  ret i32 %call
14; CHECK-LABEL: foo
15; CHECK: call i32 (...) @baz()
16}
17declare i32 @baz(...) #0
18
19define i32 @bar() #1 {
20entry:
21  %call = call i32 @foo()
22  ret i32 %call
23; CHECK-LABEL: bar
24; CHECK: call i32 (...) @baz()
25}
26
27define i32 @qux() #0 {
28entry:
29  %call = call i32 @bar()
30  ret i32 %call
31; CHECK-LABEL: qux
32; CHECK: call i32 @bar()
33}
34
35attributes #0 = { "target-cpu"="x86-64" "target-features"="+sse,+sse2" }
36attributes #1 = { "target-cpu"="x86-64" "target-features"="+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" }
37