[PATCH] D4723: Add framework for iterative compilation to llvm

Radovan Obradovic via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 07:08:44 PDT 2015


Radovan.Obradovic updated this revision to Diff 31808.
Radovan.Obradovic added a comment.
Herald added subscribers: qcolombet, MatzeB.

- Rebase

This version of patch is rebased to current trunk. Old version can be
found here:

- Decision points in pre-codegen and in codegen phase

This version introduces support for decision points in both
pre-codegen and codegen phase.

This feature led to a lot changes in code becuse implementation of the
ImmutablePass is such that an ImmutablePass is destroyed between
pre-codegen and codegen phase. The issue is resolved with temporary
JSON files which pass information between those two phases. Also, we
had to merge results from these phases.

We find that such behaviour of ImmutablePass and boundary between
pre-codegen and codegen phases is a bit strange and that there is
space for improvements which would simplify this patch and
implementation of similar features in llvm.

- New optimization point - RegAllocGreedy

Decision points in codegen phase enabled us to implement a new
optimization point where iterative compilation can take an alternative
path. In this version of patch iterative compilation can take
alternative paths in register allocation, next to LICM and Inliner
which were present in the old version, too.

- Bugfixes

During development we fixed some bugs. Some of them were introduced by
new changes and some were existing even in the old version.

- Testing procedure and current status

We are targeting MIPS architecture and current testing procedure looks
like this:

- create CSiBE test configuration
- preprocess files with gcc
- run all tests with -Oz -target mipsel-unknown-linux

-fiterative-comp=n -S

- assemble output with MIPS gcc toolchain
- measure results with `size`

Our results show that there are improvements of up to 8.78% in code
size which is promising and we are working on getting such results in
more cases and getting even better results.

Our results also show that making alternative decisions in compilation
path in LICM, Inliner or RegAlloc only (separated) can lead to
improvements in code size up to, respectively, 6%, 5% and 8%. This
results proved our assumption that these optimization points are good
for making decisions to take alternative compilation path is true.

Significant improvements are seen as early as with 10 iterations, but
100 iterations lead to even better results. As expected, improvements
and iteration count are not linearly dependant.

- RFC

We would like to see this feature (iterative compilation) merged into
the LLVM/Clang core and we would like to hear what we should change
and improve so this will be possible in the future.

We would also like to hear from you if you find this approach
interesting and get any suggestion where to steer research and
experiments. Any suggestions which passes have potential for taking
alternative path?

Currently, there are few issues that we are working among which the
most interesting are:

- Register allocator has higher priority than other optimization

points so we will change implementation in that way that all
optimization points can get a chance to take alternative direction

- Our decision whether to take an alternative path or not is based on

a fitness function which can be improved. We will be working on
that, too.

Please, feel free to experiment with this patch and to contact us for
any help and information.


http://reviews.llvm.org/D4723

Files:
  include/llvm/Analysis/DecisionTree.h
  include/llvm/Analysis/ICSetCurrentFunc.h
  include/llvm/Analysis/Passes.h
  include/llvm/InitializePasses.h
  include/llvm/Transforms/IPO/InlinerPass.h
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Analysis/Analysis.cpp
  lib/Analysis/CMakeLists.txt
  lib/Analysis/DecisionTree.cpp
  lib/Analysis/ICSetCurrentFunc.cpp
  lib/CodeGen/RegAllocGreedy.cpp
  lib/Target/Mips/CMakeLists.txt
  lib/Target/Mips/Mips.h
  lib/Target/Mips/MipsFunctionFitness.cpp
  lib/Target/Mips/MipsTargetMachine.cpp
  lib/Transforms/IPO/InlineAlways.cpp
  lib/Transforms/IPO/InlineSimple.cpp
  lib/Transforms/IPO/Inliner.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/LICM.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4723.31808.patch
Type: text/x-patch
Size: 72751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150811/b9ec8ad5/attachment-0001.bin>


More information about the llvm-commits mailing list