[PATCH] D157514: [ARM] Set preferred function alignment
Nicholas Guy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 06:54:35 PDT 2023
NickGuy updated this revision to Diff 550727.
NickGuy edited the summary of this revision.
NickGuy added a comment.
I've assigned the function alignment to the same as the loop alignment, as in my testing I'd seen that the values are "best" when they are equal.
> Can you improve the summary to explain why this is being done? Its the same reasons as we align loops.
Words seem to be failing me today. Hopefully the new summary makes sense.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157514/new/
https://reviews.llvm.org/D157514
Files:
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/ARM/preferred-function-alignment.ll
Index: llvm/test/CodeGen/ARM/preferred-function-alignment.ll
===================================================================
--- llvm/test/CodeGen/ARM/preferred-function-alignment.ll
+++ llvm/test/CodeGen/ARM/preferred-function-alignment.ll
@@ -1,20 +1,22 @@
-; RUN: llc -mtriple=arm-none-eabi -mcpu=generic < %s | FileCheck --check-prefixes=ALIGN-GENERIC,CHECK %s
-; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m23 < %s | FileCheck --check-prefixes=ALIGN,CHECK %s
-; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m33 < %s | FileCheck --check-prefixes=ALIGN,CHECK %s
-; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m55 < %s | FileCheck --check-prefixes=ALIGN,CHECK %s
-; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m85 < %s | FileCheck --check-prefixes=ALIGN,CHECK %s
+; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m85 < %s | FileCheck --check-prefixes=CHECK,ALIGN-16,ALIGN-CS-16 %s
+; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m23 < %s | FileCheck --check-prefixes=CHECK,ALIGN-16,ALIGN-CS-16 %s
+
+; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-a5 < %s | FileCheck --check-prefixes=CHECK,ALIGN-32,ALIGN-CS-32 %s
+; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m33 < %s | FileCheck --check-prefixes=CHECK,ALIGN-32,ALIGN-CS-16 %s
+; RUN: llc -mtriple=arm-none-eabi -mcpu=cortex-m55 < %s | FileCheck --check-prefixes=CHECK,ALIGN-32,ALIGN-CS-16 %s
+
; CHECK-LABEL: test
-; ALIGN-GENERIC: .p2align 2
-; ALIGN: .p2align 1
+; ALIGN-16: .p2align 1
+; ALIGN-32: .p2align 2
define void @test() {
ret void
}
; CHECK-LABEL: test_optsize
-; ALIGN-GENERIC: .p2align 2
-; ALIGN: .p2align 1
+; ALIGN-CS-16: .p2align 1
+; ALIGN-CS-32: .p2align 2
define void @test_optsize() optsize {
ret void
Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1612,6 +1612,7 @@
PredictableSelectIsExpensive = Subtarget->getSchedModel().isOutOfOrder();
setPrefLoopAlignment(Align(1ULL << Subtarget->getPrefLoopLogAlignment()));
+ setPrefFunctionAlignment(Align(1ULL << Subtarget->getPrefLoopLogAlignment()));
setMinFunctionAlignment(Subtarget->isThumb() ? Align(2) : Align(4));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157514.550727.patch
Type: text/x-patch
Size: 2246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/8ca0c9ef/attachment.bin>
More information about the llvm-commits
mailing list