[PATCH] D156767: [AArch64] [BranchRelaxation] Optimize for hot code size in AArch64 branch relaxation
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 22:20:08 PDT 2023
MaskRay added a comment.
It seems that this patch should link to D145211 <https://reviews.llvm.org/D145211>. This patch will address this comment https://reviews.llvm.org/D145211#4537173
================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:286
RS->enterBasicBlockEnd(MBB);
- Register Reg = RS->FindUnusedReg(&AArch64::GPR64RegClass);
+ // If X16 is unused, then we can rely on the linker to safely insert the
+ // indirect branch.
----------------
This sentence sounds like the linker needs to do work, but in the majority of cases I think the linker won't need to insert a range extension thunk.
Perhaps:
// If X16 is unused, we can rely on linker range extension thunk in case NewDestBB cannot be reached by a single B (e.g. cross-section).
================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:297
+ // manually insert the indirect branch.
+ Reg = RS->FindUnusedReg(&AArch64::GPR64RegClass);
+ if (Reg != AArch64::NoRegister &&
----------------
Can we use another variable so that we can use `const Register Reg = AArch64::X16;` above and remove `Reg = AArch64::X16;` on L312?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156767/new/
https://reviews.llvm.org/D156767
More information about the llvm-commits
mailing list