]> granicus.if.org Git - llvm/commit
[GlobalISel][Localizer] Rewrite localizer to run in 2 phases, inter & intra block.
authorAmara Emerson <aemerson@apple.com>
Mon, 17 Jun 2019 23:20:29 +0000 (23:20 +0000)
committerAmara Emerson <aemerson@apple.com>
Mon, 17 Jun 2019 23:20:29 +0000 (23:20 +0000)
commitf765312a6fada38a914163b8eb85daa52daf0b67
tree1221e2a5be796867f5479ca8e5bd23710b28b02b
parent95009014f826bf03040de3348e30b85010329e46
[GlobalISel][Localizer] Rewrite localizer to run in 2 phases, inter & intra block.

Inter-block localization is the same as what currently happens, except now it
only runs on the entry block because that's where the problematic constants with
long live ranges come from.

The second phase is a new intra-block localization phase which attempts to
re-sink the already localized instructions further right before one of the
multiple uses.

One additional change is to also localize G_GLOBAL_VALUE as they're constants
too. However, on some targets like arm64 it takes multiple instructions to
materialize the value, so some additional heuristics with a TTI hook have been
introduced attempt to prevent code size regressions when localizing these.

Overall, these changes improve CTMark code size on arm64 by 1.2%.

Full code size results:

Program                                         baseline       new       diff
------------------------------------------------------------------------------
 test-suite...-typeset/consumer-typeset.test    1249984      1217216     -2.6%
 test-suite...:: CTMark/ClamAV/clamscan.test    1264928      1232152     -2.6%
 test-suite :: CTMark/SPASS/SPASS.test          1394092      1361316     -2.4%
 test-suite...Mark/mafft/pairlocalalign.test    731320       714928      -2.2%
 test-suite :: CTMark/lencod/lencod.test        1340592      1324200     -1.2%
 test-suite :: CTMark/kimwitu++/kc.test         3853512      3820420     -0.9%
 test-suite :: CTMark/Bullet/bullet.test        3406036      3389652     -0.5%
 test-suite...ark/tramp3d-v4/tramp3d-v4.test    8017000      8016992     -0.0%
 test-suite...TMark/7zip/7zip-benchmark.test    2856588      2856588      0.0%
 test-suite...:: CTMark/sqlite3/sqlite3.test    765704       765704       0.0%
 Geomean difference                                                      -1.2%

Differential Revision: https://reviews.llvm.org/D63303

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363632 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/TargetTransformInfo.h
include/llvm/Analysis/TargetTransformInfoImpl.h
include/llvm/CodeGen/GlobalISel/Localizer.h
lib/Analysis/TargetTransformInfo.cpp
lib/CodeGen/GlobalISel/Localizer.cpp
lib/Target/AArch64/AArch64TargetTransformInfo.h
test/CodeGen/AArch64/GlobalISel/localizer-arm64-tti.ll [new file with mode: 0644]
test/CodeGen/AArch64/GlobalISel/localizer.mir