[PATCH] D139582: [GVN] Improve PRE on load instructions

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 14:05:19 PST 2022


Carrot added a comment.

The compile time regression on ClamAV is in file libclamav_htmlnorm.c.  The increased compile time is completely in GVN pass, from 4.0s to 5.3s. There is a huge function cli_html_normalise in this file, it's more than 6600 lines in generated assembly file. The statistic result of NumPRELoad increased from 1 to 10 because of this patch. In function GVNPass::runImpl we have

  unsigned Iteration = 0;
  while (ShouldContinue) {
    LLVM_DEBUG(dbgs() << "GVN iteration: " << Iteration << "\n");
    (void) Iteration;
    ShouldContinue = iterateOnFunction(F);
    Changed |= ShouldContinue;
    ++Iteration;
  }

It means we continuously do GVN on a function until there is no more such optimization applicable. This patch enables more optimizations, potentially it may also cause more iterations on a function. In this case, the loop is executed 4 times without this patch, but 5 times with this patch. These numbers closely correlate to the increased compile time.

So the extra compile time is caused by more iterations on a huge function, and the more iterations is caused by more optimizations enabled by this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139582/new/

https://reviews.llvm.org/D139582



More information about the llvm-commits mailing list