From 97716d2e311aed1b3b73461ee83e53faa512e499 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 22 Aug 2025 12:59:54 -0700 Subject: Revert "CodeGen: Respect function align attribute if less than preferred alignment." This reverts commit 9878ef3abd2a48fcfb81357d581dac292b52ddb3. Needs more discussion of the semantics of the align attribute. See: https://discourse.llvm.org/t/rfc-enhancing-function-alignment-attributes/88019 --- llvm/lib/CodeGen/MachineFunction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineFunction.cpp') diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 82ba596..224231c 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -211,7 +211,8 @@ void MachineFunction::init() { ConstantPool = new (Allocator) MachineConstantPool(getDataLayout()); Alignment = STI.getTargetLowering()->getMinFunctionAlignment(); - if (!F.getAlign() && !F.hasOptSize()) + // FIXME: Shouldn't use pref alignment if explicit alignment is set on F. + if (!F.hasOptSize()) Alignment = std::max(Alignment, STI.getTargetLowering()->getPrefFunctionAlignment()); -- cgit v1.1