[llvm] [MC] Reduce size of MCDataFragment by 8 bytes (PR #95293)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 12:38:51 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: None (aengelke)
<details>
<summary>Changes</summary>
Due to alignment, MCFragment was 1 byte over the 8 byte boundary, so folding to bools into bitfields gives a nice space reduction from 224 to 216 bytes.
---
Full diff: https://github.com/llvm/llvm-project/pull/95293.diff
2 Files Affected:
- (modified) llvm/include/llvm/MC/MCFragment.h (+2-2)
- (modified) llvm/lib/MC/MCFragment.cpp (+1-1)
``````````diff
diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 45599c940659e..d33160f4ff010 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -73,8 +73,8 @@ class MCFragment {
FragmentType Kind;
protected:
- bool HasInstructions;
- bool LinkerRelaxable = false;
+ bool HasInstructions : 1;
+ bool LinkerRelaxable : 1;
MCFragment(FragmentType Kind, bool HasInstructions,
MCSection *Parent = nullptr);
diff --git a/llvm/lib/MC/MCFragment.cpp b/llvm/lib/MC/MCFragment.cpp
index 6d97e8ce552ba..f245f39a87e9f 100644
--- a/llvm/lib/MC/MCFragment.cpp
+++ b/llvm/lib/MC/MCFragment.cpp
@@ -200,7 +200,7 @@ uint64_t llvm::computeBundlePadding(const MCAssembler &Assembler,
MCFragment::MCFragment(FragmentType Kind, bool HasInstructions,
MCSection *Parent)
: Parent(Parent), Atom(nullptr), Offset(~UINT64_C(0)), LayoutOrder(0),
- Kind(Kind), HasInstructions(HasInstructions) {
+ Kind(Kind), HasInstructions(HasInstructions), LinkerRelaxable(false) {
if (Parent && !isa<MCDummyFragment>(*this))
Parent->addFragment(*this);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/95293
More information about the llvm-commits
mailing list