[PATCH] D11198: Avoid insertion sorting each new range in MemCpyOptimizer

Anthony Pesch inolen at gmail.com
Tue Jul 14 14:39:46 PDT 2015


inolen created this revision.
inolen added a reviewer: chandlerc.
inolen added a subscriber: llvm-commits.
inolen set the repository for this revision to rL LLVM.

While working on a project I wound up generating a fairly large lookup table (10k entries) of callbacks inside of a static constructor. Clang was taking upwards of ~10 minutes to compile the lookup table. I generated a smaller test case (http://www.inolen.com/static_initializer_test.ll) that, after running with -ftime-report, pointed fingers at GlobalOpt and MemCpyOptimizer.

Running memcpyopt through opt accounted for around ~1 minute. The main culprit was MemCpyOptimizer insertion sorting the ranges as it discovered them in tryMergingIntoMemset. I've changed this up such that ranges are always appended to the list, and once they've all been added they're sorted and merged (n log n vs n^2).

I'm not really sure who to tag as a reviewer, Lang mentioned that Chandler may be appropriate.

Repository:
  rL LLVM

http://reviews.llvm.org/D11198

Files:
  lib/Transforms/Scalar/MemCpyOptimizer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11198.29712.patch
Type: text/x-patch
Size: 4825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150714/21bde710/attachment.bin>


More information about the llvm-commits mailing list