aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCCodeView.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-07-19 16:55:29 -0700
committerFangrui Song <i@maskray.me>2025-07-19 16:55:30 -0700
commit39c8cfb70d203439e3296dfdfe3d41f1cb2ec551 (patch)
treed5cc9405d2e382022f7a641b0bf7606a1e5262e2 /llvm/lib/MC/MCCodeView.cpp
parent54492c231c5d9091d086bfb767423415ea6bd0bc (diff)
downloadllvm-39c8cfb70d203439e3296dfdfe3d41f1cb2ec551.zip
llvm-39c8cfb70d203439e3296dfdfe3d41f1cb2ec551.tar.gz
llvm-39c8cfb70d203439e3296dfdfe3d41f1cb2ec551.tar.bz2
MC: Optimize getOrCreateDataFragment
... by eagerly allocating an empty fragment when adding a fragment with a variable-size tail. X86AsmBackend, The JCC erratum mitigation and x86-pad-for-align set a flag for FT_Relaxable, which needs to be moved to emitInstructionBegin. ``` if (CF->getKind() == MCFragment::FT_Relaxable) CF->setAllowAutoPadding(canPadInst(Inst, OS)); ``` Follow-up to #148544
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r--llvm/lib/MC/MCCodeView.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 1f98251..b151a25 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -166,8 +166,8 @@ void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
// somewhere else. If somebody wants two string tables in their .s file, one
// will just be empty.
if (!StrTabFragment) {
- StrTabFragment = Ctx.allocFragment<MCFragment>();
- OS.insert(StrTabFragment);
+ OS.newFragment();
+ StrTabFragment = OS.getCurrentFragment();
}
OS.emitValueToAlignment(Align(4), 0);