[llvm] [AArch64] Do not mark homogeneous prolog/epilog functions optnone (PR #117959)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 19:10:58 PST 2024


https://github.com/nocchijiang created https://github.com/llvm/llvm-project/pull/117959

The verifier complains that synthesized IR functions have minsize and optnone attributes which are incompatible. This patch removes optnone attribute and updates affected tests as needed.

>From ab505969dc64585c62ddff8c8440ba1c0d27b90d Mon Sep 17 00:00:00 2001
From: Zhaoxuan Jiang <jiangzhaoxuan94 at gmail.com>
Date: Thu, 28 Nov 2024 11:00:40 +0800
Subject: [PATCH] [AArch64] Do not mark homogeneous prolog/epilog functions
 optnone

The verifier complains that synthesized IR functions have minsize and
optnone attributes which are incompatible. This patch removes optnone
attribute and updates affected tests as needed.
---
 .../Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp    | 4 +---
 .../AArch64/arm64-homogeneous-prolog-epilog-frame-tail.ll     | 4 ++--
 llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog.ll  | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
index 1aa55864dbff49..ed531038395c43 100644
--- a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
+++ b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
@@ -169,9 +169,7 @@ static MachineFunction &createFrameHelperMachineFunction(Module *M,
   F->setLinkage(GlobalValue::LinkOnceODRLinkage);
   F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
 
-  // Set no-opt/minsize, so we don't insert padding between outlined
-  // functions.
-  F->addFnAttr(Attribute::OptimizeNone);
+  // Set minsize, so we don't insert padding between outlined functions.
   F->addFnAttr(Attribute::NoInline);
   F->addFnAttr(Attribute::MinSize);
   F->addFnAttr(Attribute::Naked);
diff --git a/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog-frame-tail.ll b/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog-frame-tail.ll
index 32cc850dfa7348..cd751840fee483 100644
--- a/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog-frame-tail.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog-frame-tail.ll
@@ -51,8 +51,8 @@ declare i32 @_Z3hoov() nounwind ssp optsize
 ; CHECK-LABEL:  _OUTLINED_FUNCTION_PROLOG_FRAME48_x30x29x19x20d8d9d10d11:
 ; CHECK:      stp     d11, d10, [sp, #-48]!
 ; CHECK-NEXT: stp     d9, d8, [sp, #16]
-; CHECK-NEXT: stp     x20, x19, [sp, #32]
 ; CHECK-NEXT: add     x29, sp, #48
+; CHECK-NEXT: stp     x20, x19, [sp, #32]
 ; CHECK-NEXT: ret
 
 ; CHECK-LABEL: _OUTLINED_FUNCTION_EPILOG_TAIL_x30x29x19x20d8d9d10d11:
@@ -69,8 +69,8 @@ declare i32 @_Z3hoov() nounwind ssp optsize
 ; CHECK-LINUX-LABEL:  OUTLINED_FUNCTION_PROLOG_FRAME32_x19x20x30x29d8d9d10d11:
 ; CHECK-LINUX:      stp     d11, d10, [sp, #-32]!
 ; CHECK-LINUX-NEXT: stp     d9, d8, [sp, #16]
-; CHECK-LINUX-NEXT: stp     x20, x19, [sp, #48]
 ; CHECK-LINUX-NEXT: add     x29, sp, #32
+; CHECK-LINUX-NEXT: stp     x20, x19, [sp, #48]
 ; CHECK-LINUX-NEXT: ret
 
 ; CHECK-LINUX-LABEL: OUTLINED_FUNCTION_EPILOG_TAIL_x19x20x30x29d8d9d10d11:
diff --git a/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog.ll b/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog.ll
index fed564afd18939..c2541a6d819b88 100644
--- a/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-homogeneous-prolog-epilog.ll
@@ -67,8 +67,8 @@ declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
 ; CHECK-LINUX-NEXT: ret
 
 ; CHECK-LINUX-LABEL: OUTLINED_FUNCTION_EPILOG_x19x20x21x22x30x29:
-; CHECK-LINUX:      mov     x16, x30
-; CHECK-LINUX-NEXT: ldp     x20, x19, [sp, #32]
+; CHECK-LINUX:      ldp     x20, x19, [sp, #32]
+; CHECK-LINUX-NEXT: mov     x16, x30
 ; CHECK-LINUX-NEXT: ldp     x22, x21, [sp, #16]
 ; CHECK-LINUX-NEXT: ldp     x29, x30, [sp], #48
 ; CHECK-LINUX-NEXT: ret     x16



More information about the llvm-commits mailing list