diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2023-04-25 14:57:09 +0200 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2023-04-25 14:59:18 +0200 |
commit | 4b1532a46f66eb71bf80458fa67b86c618803b95 (patch) | |
tree | 9ebbcbc0324d90038a07ac715ca0a71fb379509e /llvm/lib/MC/MCStreamer.cpp | |
parent | 14a7b2bfffe5ea5885839adb4635e96ce04162f0 (diff) | |
download | llvm-4b1532a46f66eb71bf80458fa67b86c618803b95.zip llvm-4b1532a46f66eb71bf80458fa67b86c618803b95.tar.gz llvm-4b1532a46f66eb71bf80458fa67b86c618803b95.tar.bz2 |
[MC] Eagerly skip zero-sized .fill fragments
This doesn't change the output in any way, but we have a bunch of
emitFill for padding. When emitting an array of floats we'd end up with
DataFragment float1
FillFragment 0
DataFragment float2
FillFragment 0
... and so on
We never actually emit anything for those fills, neither in asm nor obj
emission mode, they just consume RAM for no reason.
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 4dd3163..8f29153 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -219,7 +219,8 @@ void MCStreamer::emitGPRel32Value(const MCExpr *Value) { /// Emit NumBytes bytes worth of the value specified by FillValue. /// This implements directives such as '.space'. void MCStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) { - emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue); + if (NumBytes) + emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue); } void llvm::MCStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLen, |