Skip to content

Commit 2523439

Browse files
authored
[LoongArch] Add a test case for inline compatibility checks (#117144)
1 parent 3fb0bea commit 2523439

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; RUN: opt < %s -mtriple=loongarch64-unknown-linux-gnu -S -passes=inline | FileCheck %s
2+
; RUN: opt < %s -mtriple=loongarch64-unknown-linux-gnu -S -passes='cgscc(inline)' | FileCheck %s
3+
; Check that we only inline when we have compatible target attributes.
4+
5+
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
6+
target triple = "loongarch64-unknown-linux-gnu"
7+
8+
define i32 @foo() #0 {
9+
entry:
10+
%call = call i32 (...) @baz()
11+
ret i32 %call
12+
; CHECK-LABEL: foo
13+
; CHECK: call i32 (...) @baz()
14+
}
15+
declare i32 @baz(...) #0
16+
17+
define i32 @bar() #1 {
18+
entry:
19+
%call = call i32 @foo()
20+
ret i32 %call
21+
; CHECK-LABEL: bar
22+
; CHECK: call i32 (...) @baz()
23+
}
24+
25+
define i32 @qux() #0 {
26+
entry:
27+
%call = call i32 @bar()
28+
ret i32 %call
29+
; CHECK-LABEL: qux
30+
; CHECK: call i32 @bar()
31+
}
32+
33+
attributes #0 = { "target-cpu"="generic-la64" "target-features"="+f,+d" }
34+
attributes #1 = { "target-cpu"="generic-la64" "target-features"="+f,+d,+lsx,+lasx" }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if not "LoongArch" in config.root.targets:
2+
config.unsupported = True

0 commit comments

Comments
 (0)