[PATCH] D60266: [LoopUnroll] Rotate loop, when optimizing for size and can fully unroll a loop.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 07:22:28 PDT 2019


fhahn created this revision.
fhahn added reviewers: vsk, efriedma, dmgreen, paquette.
Herald added subscribers: dexonsmith, zzheng, hiraditya, kristof.beyls, javed.absar, mehdi_amini.
Herald added a project: LLVM.
fhahn added a parent revision: D60265: [LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size..

If we can fully unroll a loop, there should be no size overhead when
rotating a loop, as a prerequisite for unrolling. Loop rotation is
conservative when optimizing for size, but we can rotate in loop-unroll,
if unrolling is beneficial.

To avoid rotating when LoopUnroll would fail, do some checks if rotating
will result in an unroll-able loop.

I measure code size on ARM64 with -Oz -flto on MultiSource, SPEC2000 and
SPEC2006. Codesize changes are as follows:

test-suite...Rodinia/backprop/backprop.test   1796.00   1752.00   -2.4%
 test-suite.../Benchmarks/Olden/mst/mst.test   1436.00   1420.00   -1.1%
 test-suite...006/447.dealII/447.dealII.test   256408.00 255040.00 -0.5%
 test-suite...urce/Applications/lua/lua.test   88648.00  88508.00  -0.2%
 test-suite.../CINT2000/176.gcc/176.gcc.test   837764.00 836520.00 -0.1%
 test-suite...yApps-C++/PENNANT/PENNANT.test   40156.00  40188.00   0.1%
 test-suite...rks/tramp3d-v4/tramp3d-v4.test   195420.00 195280.00 -0.1%
 test-suite...0/253.perlbmk/253.perlbmk.test   335568.00 335400.00 -0.1%


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60266

Files:
  llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
  llvm/test/Transforms/LoopUnroll/AArch64/unroll-optsize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60266.193704.patch
Type: text/x-patch
Size: 6792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/064b4a89/attachment.bin>


More information about the llvm-commits mailing list