[clang] [lld] [llvm] CodeGen: Emit .prefalign directives based on the prefalign attribute. (PR #155529)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 11 16:47:10 PDT 2026
================
@@ -999,8 +999,20 @@ void AsmPrinter::emitFunctionHeader() {
emitVisibility(CurrentFnSym, F.getVisibility());
emitLinkage(&F, CurrentFnSym);
- if (MAI->hasFunctionAlignment())
- emitAlignment(MF->getPreferredAlignment(), &F);
+ if (MAI->hasFunctionAlignment()) {
+ // The preferred alignment directive will not have the intended effect
+ // unless function sections are enabled.
+ if (MAI->useIntegratedAssembler() && MAI->hasPreferredAlignment() &&
+ TM.getFunctionSections()) {
----------------
MaskRay wrote:
There is another issue, redundant `.prefalign`. Fix: https://github.com/llvm/llvm-project/pull/191675
https://github.com/llvm/llvm-project/pull/155529
More information about the llvm-commits
mailing list