[PATCH] D68530: [AArch64] Don't combine callee-save and local stack adjustment when optimizing for size
Nikolai Tillmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 20:02:44 PDT 2019
Nikolai updated this revision to Diff 224535.
Nikolai added a comment.
Addressing feedback by removing option, now always changing behavior when optimizing for size.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68530/new/
https://reviews.llvm.org/D68530
Files:
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/test/CodeGen/AArch64/arm64-never-combine-csr-local-stack-bump-for-size.ll
Index: llvm/test/CodeGen/AArch64/arm64-never-combine-csr-local-stack-bump-for-size.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/arm64-never-combine-csr-local-stack-bump-for-size.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s -mtriple=arm64-apple-ios7.0 -disable-post-ra | FileCheck %s
+
+; CHECK-LABEL: main:
+; CHECK: stp x29, x30, [sp, #-16]!
+; CHECK-NEXT: stp xzr, xzr, [sp, #-16]!
+; CHECK: adrp x0, l_.str at PAGE
+; CHECK: add x0, x0, l_.str at PAGEOFF
+; CHECK-NEXT: bl _puts
+; CHECK-NEXT: add sp, sp, #16
+; CHECK-NEXT: ldp x29, x30, [sp], #16
+; CHECK-NEXT: ret
+
+ at .str = private unnamed_addr constant [7 x i8] c"hello\0A\00"
+
+define i32 @main() nounwind ssp optsize {
+entry:
+ %local1 = alloca i64, align 8
+ %local2 = alloca i64, align 8
+ store i64 0, i64* %local1
+ store i64 0, i64* %local2
+ %call = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0))
+ ret i32 %call
+}
+
+declare i32 @puts(i8*)
Index: llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -447,6 +447,9 @@
const AArch64Subtarget &Subtarget = MF.getSubtarget<AArch64Subtarget>();
const AArch64RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
+ if (MF.getFunction().hasOptSize())
+ return false;
+
if (AFI->getLocalStackSize() == 0)
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68530.224535.patch
Type: text/x-patch
Size: 1572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191011/8921e6b9/attachment.bin>
More information about the llvm-commits
mailing list