[llvm] [PPC] Implement `areInlineCompatible` (PR #126562)

Henry Jiang via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 14:18:58 PST 2025


================
@@ -0,0 +1,34 @@
+; RUN: opt < %s -mtriple=powerpc64le-ibm-linux-gnu -S -passes=inline | FileCheck %s
+; RUN: opt < %s -mtriple=powerpc64le-ibm-linux-gnu -S -passes='cgscc(inline)' | FileCheck %s
+
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64le-ibm-linux-gnu"
+
+declare i32 @inlined()
+
+define i32 @foo() #0 {
+; CHECK-LABEL: foo
+; CHECK: entry
+; CHECK-NEXT: call i32 @bar()
+; CHECK-NEXT: call i32 @inlined()
+entry:
+    %1 = call i32 @bar()
+    %2 = call i32 @baz()
+    %3 = add i32 %1, %2
+    ret i32 %3
+}
+
+define i32 @bar() #1 {
+entry:
+    %1 = call i32 @inlined()
+    ret i32 %1
+}
+
+define i32 @baz() #0 {
+entry:
+    %1 = call i32 @inlined()
+    ret i32 %1
+}
+
+attributes #0 = { "target-cpu"="pwr7" "target-features"="+allow-unaligned-fp-access" }
+attributes #1 = { "target-cpu"="pwr7" "target-features"="-allow-unaligned-fp-access" }
----------------
mustartt wrote:

I added test case where `-vsx` is not compatible as `pwr7` implies `+vsx`.

https://github.com/llvm/llvm-project/pull/126562


More information about the llvm-commits mailing list