diff options
author | Jessica Paquette <jpaquette@apple.com> | 2021-02-11 17:00:00 -0800 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2021-02-12 14:55:15 -0800 |
commit | 61b4702a408834228c1c139b0e9af98616774db4 (patch) | |
tree | c716ab52e6fefedd8cc4acd84c8601aec57748ec /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 60a55337e012b0c1739cad0f1b93fb35a7a0053f (diff) | |
download | llvm-61b4702a408834228c1c139b0e9af98616774db4.zip llvm-61b4702a408834228c1c139b0e9af98616774db4.tar.gz llvm-61b4702a408834228c1c139b0e9af98616774db4.tar.bz2 |
[AArch64][GlobalISel] Fold constants into G_GLOBAL_VALUE
This is pretty much just ports `performGlobalAddressCombine` from
AArch64ISelLowering. (AArch64 doesn't use the generic DAG combine for this.)
This adds a pre-legalize combine which looks for this pattern:
```
%g = G_GLOBAL_VALUE @x
%ptr1 = G_PTR_ADD %g, cst1
%ptr2 = G_PTR_ADD %g, cst2
...
%ptrN = G_PTR_ADD %g, cstN
```
And then, if possible, transforms it like so:
```
%g = G_GLOBAL_VALUE @x
%offset_g = G_PTR_ADD %g, -min(cst)
%ptr1 = G_PTR_ADD %offset_g, cst1
%ptr2 = G_PTR_ADD %offset_g, cst2
...
%ptrN = G_PTR_ADD %offset_g, cstN
```
Where min(cst) is the smallest out of the G_PTR_ADD constants.
This means we should save at least one G_PTR_ADD.
This also updates code in the legalizer + selector which assumes that
G_GLOBAL_VALUE will never have an offset and adds/updates relevant tests.
Differential Revision: https://reviews.llvm.org/D96624
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions