Page MenuHomePhabricator

Relax cross-section branches
Needs ReviewPublic

Authored by dhoekwater on Mar 2 2023, 8:09 PM.

Details

Summary

Because the code layout is not known during compilation, the distance of
cross-section jumps is not knowable at compile-time. Unconditional branches
are relaxed via thunk insertion by the linker, but conditional branches
must be manually relaxed. Because of this, we should assume that any
cross-sectional conditional jumps are out of range. This assumption is
necessary for machine function splitting on Arm.

Diff Detail

Event Timeline

dhoekwater created this revision.Mar 2 2023, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2023, 8:09 PM
dhoekwater updated this revision to Diff 502834.Mar 6 2023, 3:39 PM

Add a missing semicolon

Add unconditional branch relaxation for AArch64 and remove the flag

Make all getCrossSectionBranchDistance instances return uint64_t

Add checks to tests

Rebase updated changes and clang-format

dhoekwater retitled this revision from Add a flag to assume cross-section conditional branches must be relaxed to Relax cross-section branches.Thu, May 25, 1:24 PM
dhoekwater published this revision for review.Thu, May 25, 1:54 PM
dhoekwater added reviewers: arsenm, hliao, mingmingl.
Herald added a project: Restricted Project. · View Herald TranscriptThu, May 25, 1:54 PM

Clarify documentation comment wording

arsenm added inline comments.Thu, Jun 8, 4:48 PM
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
271–273

I think it would be better to just fix the scavenger to tolerate empty blocks.