[llvm-bugs] [Bug 51632] New: `.fill` handling is slow

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 26 09:24:39 PDT 2021


            Bug ID: 51632
           Summary: `.fill` handling is slow
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org

Compiling this file takes over 4s on my machine (targeting mach-o in case it

void f();
int main() {
  __asm__(".fill 0x10000000");  // 256 MiB, max jump dist on arm64
void f() {}

Deleting this look in MCObjectStreamer::emitFill():

    // Emit now if we can for better errors.
    int64_t NonZeroSize = Size > 4 ? 4 : Size;
    Expr &= ~0ULL >> (64 - NonZeroSize * 8);
    for (uint64_t i = 0, e = IntNumValues; i != e; ++i) {
      emitIntValue(Expr, NonZeroSize);
      if (NonZeroSize < Size)
        emitIntValue(0, Size - NonZeroSize);

and making it fall through to the MCFillFragment() case drops that to 0.6s,
which is much better (but still slow -- writing 256 MiB should be ~instant).

Completely deleting it makes some tests fail, possibly because the expression
evaluator can't reason about symbols refering to MCFillFragment (?)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210826/319f7fcb/attachment.html>

More information about the llvm-bugs mailing list