[PATCH] D148622: [LoongArch] Prefer to align functions and tight loops to 16 bytes

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 21:59:16 PDT 2023


xen0n added a comment.

In D148622#4279228 <https://reviews.llvm.org/D148622#4279228>, @SixWeining wrote:

> In D148622#4277173 <https://reviews.llvm.org/D148622#4277173>, @xry111 wrote:
>
>> Hmm, it seems to me `setMaxBytesForAlignment` sets "the maximum amount of padding allowed for aligning the BB", not the max loop size.  Or am I missing something?
>
> I agree. It should be the third expression described in https://ftp.gnu.org/old-gnu/Manuals/gas-2.9.1/html_chapter/as_7.html#SEC113.
>
>> I mean, I didn't see how the change only sets loop alignments for tight loops. Maybe I'm missing something, but with GCC there seems no way to limit -falign-loops only for tight loops.
>
> I have the same concern.
>
> BTW, @xen0n Could you please add some dedicate tests for function alignment settings. For example:
>
>   ; RUN: llc --mtriple=loongarch64 %s -o - | FileCheck %s
>   ; RUN: llc --mtriple=loongarch64 -mcpu=la464 %s -o - | FileCheck %s
>   
>   define void @foo() nounwind {
>   ;CHECK: .p2align 4
>   ;CHECK: foo:
>   entry:
>     ret void
>   }

I've checked the logic behind `MaxBytesForAlignment` and it seems to be the case, sorry for the confusion. I'll fix in the next revision. Thank you both.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148622/new/

https://reviews.llvm.org/D148622



More information about the llvm-commits mailing list