This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][CodeGen] Emit alignment "Max Skip" operand for AArch64 loops
ClosedPublic

Authored by NickGuy on Dec 1 2021, 7:51 AM.

Details

Summary

Implementation of D114590 for the AArch64 backend. Specifying the loop alignment and the max padding permitted for the neoverse-n1, -n2, and -v1 subtargets

Diff Detail

Event Timeline

NickGuy created this revision.Dec 1 2021, 7:51 AM
dmgreen added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
2

The alignments in AArch64 are usually set in MachineBlockPlacement::alignBlocks, which is probably the more general place for this. The alignments can then be set in the same places as setPrefLoopAlignment for each backend.

Maybe at the moment, before we've fixed on proper values for AArch64 cpus, we could use an option as a way of testing that the values are getting propagated correctly.

NickGuy updated this revision to Diff 392320.Dec 7 2021, 2:34 AM

Do we want this to work the same way as PrefFunctionLogAlignment from AArch64, being set in the subtarget per cpu? Do you have a motivating cpu that we can start to make work immediately? I'm not sure I understand the code here at the moment.

NickGuy updated this revision to Diff 393846.Dec 13 2021, 3:57 AM
NickGuy edited the summary of this revision. (Show Details)
dmgreen added inline comments.Dec 14 2021, 12:27 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
2

Do we need to override this method, or can it work more consistently like TargetLoweringBase::setPrefLoopAlignment and getPrefLoopAlignment? That way we can set the value in AArch64TargetLowering::AArch64TargetLowering like we already do for other loop alignments, and keep everything together.

The (LoopAlign, MaxBytesForLoopAlign) can be thought of as a pair. I think it makes sense to keep them as separate variables, but ideally they are set and used together.

llvm/test/CodeGen/AArch64/aarch64-p2align-max-bytes-neoverse.ll
12

This file needn't have the objfile checks, so long as they are tested elsewhere.

NickGuy updated this revision to Diff 394515.Dec 15 2021, 3:37 AM
NickGuy marked 3 inline comments as done.
dmgreen accepted this revision.Jan 4 2022, 12:57 AM

I would suggest updating the names a little. Otherwise LGTM.

llvm/lib/Target/AArch64/AArch64Subtarget.h
6

MaxLoopAlignment -> MaxBytesForLoopAlignment

6

getMaxBytesForAlignment -> getMaxBytesForLoopAlignment

This revision is now accepted and ready to land.Jan 4 2022, 12:57 AM
This revision was landed with ongoing or failed builds.Jan 5 2022, 4:54 AM
This revision was automatically updated to reflect the committed changes.