[clang] [Driver] Pass correct alignment for -falign-functions with no argument (PR #101257)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 30 18:54:43 PDT 2024
================
@@ -1982,7 +1982,7 @@ unsigned tools::ParseFunctionAlignment(const ToolChain &TC,
return 0;
if (A->getOption().matches(options::OPT_falign_functions))
- return 0;
+ return 4; // log2(16)
----------------
MaskRay wrote:
I agree that clangDriver should not hard code a value like 16.
The relevant code is at `llvm/lib/CodeGen/MachineFunction.cpp`
```cpp
// FIXME: Shouldn't use pref alignment if explicit alignment is set on F.
// FIXME: Use Function::hasOptSize().
if (!F.hasFnAttribute(Attribute::OptimizeForSize))
Alignment = std::max(Alignment,
STI->getTargetLowering()->getPrefFunctionAlignment());
```
https://github.com/llvm/llvm-project/pull/101257
More information about the cfe-commits
mailing list