[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:11 PDT 2024
https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/95293
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.
>From 4c31b476d7afcfbb1afc765ef5efa025585857e8 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Wed, 12 Jun 2024 19:34:37 +0000
Subject: [PATCH] [MC] Reduce size of MCDataFragment by 8 bytes
Due to alignment, MCFragment was 1 byte over the 8 byte boundary, so
folding to bools into bitfields gives a nice space reduction.
---
llvm/include/llvm/MC/MCFragment.h | 4 ++--
llvm/lib/MC/MCFragment.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
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);
}
More information about the llvm-commits
mailing list