aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2025-07-18 13:33:46 -0700
committerGitHub <noreply@github.com>2025-07-18 13:33:46 -0700
commit9878ef3abd2a48fcfb81357d581dac292b52ddb3 (patch)
treedc840d6320a87139eba22f0de568e975d914eb71 /llvm/lib/CodeGen/MachineFunction.cpp
parentc5f0c4ad378803f449f37730601b7d95059600a4 (diff)
downloadllvm-9878ef3abd2a48fcfb81357d581dac292b52ddb3.zip
llvm-9878ef3abd2a48fcfb81357d581dac292b52ddb3.tar.gz
llvm-9878ef3abd2a48fcfb81357d581dac292b52ddb3.tar.bz2
CodeGen: Respect function align attribute if less than preferred alignment.
Reviewers: arsenm, efriedma-quic Reviewed By: arsenm Pull Request: https://github.com/llvm/llvm-project/pull/149444
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 38ad582..429a17a 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -211,9 +211,8 @@ void MachineFunction::init() {
ConstantPool = new (Allocator) MachineConstantPool(getDataLayout());
Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
- // FIXME: Shouldn't use pref alignment if explicit alignment is set on F.
// FIXME: Use Function::hasOptSize().
- if (!F.hasFnAttribute(Attribute::OptimizeForSize))
+ if (!F.getAlign() && !F.hasFnAttribute(Attribute::OptimizeForSize))
Alignment = std::max(Alignment,
STI->getTargetLowering()->getPrefFunctionAlignment());