[llvm] MC: Restructure MCAlignFragment as a fixed part an alignment tail (PR #149030)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 17 00:00:51 PDT 2025
MaskRay wrote:
As the previous patch shows, the number of FT_Align fragments is far fewer when FT_Relaxable.
The intention of this patch is to ensure all common fragment types (instead of special case BoundaryAlign/PseudoProbe) use the variable-tail part of MCFragment.
```
% /t/clang-new -g -c sqlite3.i -w -mllvm -debug-only=mc-dump &| awk '/^[0-9]+/{s[$2]++;tot++} END{print "Total",tot; n=asorti(s, si); for(i=1;i<=n;i++) print si[i],s[si[i]]}'
Total 32287
Align 2215
Data 2312
Dwarf 12044
DwarfCallFrame 4216
Fill 92
LEB 12
Relaxable 11396
```
> Right now we have FT_Data, FT_Align, FT_Data, FT_Align, FT_Data, this changes it to FT_Align, FT_Align, FT_Data.
The section alignment is the maximum of all FT_Align alignments. The behavior is as if the start has an implicit alignment fragment.
If we keep track of the content size, we could technically identify no-op FT_Align and keep using the existing fragment.
However, I believe the benefit is pretty low, given the smaller number of FT_Align fragments.
https://github.com/llvm/llvm-project/pull/149030
More information about the llvm-commits
mailing list