[PATCH] D59129: [SROA] Don't lower expensive allocas with minsize

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 06:21:32 PDT 2019


SjoerdMeijer updated this revision to Diff 199575.
SjoerdMeijer retitled this revision from "[SROA] WIP: Lowering alloca is not always beneficial" to "[SROA] Don't lower expensive allocas with minsize".
SjoerdMeijer added a comment.

With all the groundwork now committed, I would like to progress this. I've added:

- some minor cleanups as commented earlier,
- my motivating example as a test case.

And I've also ran codesize benchmarks with this change. This didn't show any changes in MBed and another codesize corpus (which is okay). For the CSiBe benchmark, there were a few changes:

| App                       | Before   | After    | Diff % |
| ------------------------- | -------- | -------- | ------ |
| csibe/OpenTCP-1.0.4       | 21835.0  | 21835.0  | 0.0    |
| csibe/bzip2-1.0.2         | 47344.0  | 47344.0  | 0.0    |
| csibe/cg_compiler_opensrc | 96142.0  | 96198.0  | 0.0582471760521    |
| csibe/compiler            | 19278.0  | 19278.0  | 0.0    |
| csibe/jikespg-1.3         | 170498.0 | 170152.0 | -0.202934931788   |
| csibe/jpeg-6b             | 96337.0  | 96337.0  | 0.0    |
| csibe/libpng-1.2.5        | 77620.0  | 77636.0  | 0.0206132440093    |
| csibe/lwip-0.5.3.preproc  | 68569.0  | 68569.0  | 0.0    |
| csibe/mpeg2dec-0.3.1      | 38904.0  | 38904.0  | 0.0    |
| csibe/mpgcut-1.1          | 7192.0   | 7192.0   | 0.0    |
| csibe/teem-1.6.0-src      | 1028555.0      | 1028555.0      | 0.0    |
| csibe/ttt-0.10.1.preproc  | 12691.0  | 12691.0  | 0.0    |
| csibe/unrarlib-0.4.0      | 10382.0  | 10382.0  | 0.0    |
| csibe/zlib-1.1.4          | 29221.0  | 29297.0  | 0.260086923788    |
| total                     | 1724569.0      | 1724371.0      | -0.011481129488   |
|

This shows a really code size reduction of 346 bytes in jikespg-1.3, with a few minor regressions, but a fairly decent improvement overall. Thus, I am happy with the results as it does what I wanted and hoped for.

The only thing I haven't tried yet is @efriedma 's suggestion to do check on a per-slice basis; currently I do indeed per alloca.


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

https://reviews.llvm.org/D59129

Files:
  include/llvm/Transforms/Scalar/SROA.h
  lib/Transforms/Scalar/SROA.cpp
  test/Transforms/SROA/memcpy-minsize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59129.199575.patch
Type: text/x-patch
Size: 6680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190515/a4eefbdd/attachment.bin>


More information about the llvm-commits mailing list