llvm-project/llvm/lib
Haicheng Wu 0aae2bc260 [CGP] Split large data structres to sink more GEPs
Accessing the members of a large data structures needs a lot of GEPs which
usually have large offsets due to the size of the underlying data structure. If
the offsets are too large to fit into the r+i addressing mode, these GEPs cannot
be sunk to their users' blocks and many extra registers are needed then to carry
the values of these GEPs.

This patch tries to split a large data struct starting from %base like the
following.

Before:
BB0:
  %base     =

BB1:
  %gep0     = gep %base, off0
  %gep1     = gep %base, off1
  %gep2     = gep %base, off2

BB2:
  %load1    = load %gep0
  %load2    = load %gep1
  %load3    = load %gep2

After:
BB0:
  %base     =
  %new_base = gep %base, off0

BB1:
  %new_gep0 = %new_base
  %new_gep1 = gep %new_base, off1 - off0
  %new_gep2 = gep %new_base, off2 - off0

BB2:
  %load1    = load i32, i32* %new_gep0
  %load2    = load i32, i32* %new_gep1
  %load3    = load i32, i32* %new_gep2

In the above example, the struct is split into two parts. The first part still
starts from %base and the second part starts from %new_base. After the
splitting, %new_gep1 and %new_gep2 have smaller offsets and then can be sunk to
BB2 and folded into their users.

The algorithm to split data structure is simple and very similar to the work of
merging SExts. First, it collects GEPs that have large offsets when iterating
the blocks. Second, it splits the underlying data structures and updates the
collected GEPs to use smaller offsets.

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

llvm-svn: 332015
2018-05-10 18:27:36 +00:00
..
Analysis [CFLGraph] Fixed Select instruction handling 2018-05-10 11:47:36 +00:00
AsmParser [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
BinaryFormat Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
Bitcode [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
CodeGen [CGP] Split large data structres to sink more GEPs 2018-05-10 18:27:36 +00:00
DebugInfo Fix signed/unsigned comparison warning and print format 2018-05-10 12:15:43 +00:00
Demangle [demangler] Add a partial demangling API for LLDB. 2018-04-12 20:41:38 +00:00
ExecutionEngine [RuntimeDyld][MachO] Properly handle thumb to thumb calls within a section. 2018-05-09 01:38:13 +00:00
FuzzMutate [llvm-opt-fuzzer] Add irce to the fuzzing options 2018-03-20 11:32:13 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
IR [LLVM-C] Add Accessors for Common DIType and DILocation Properties 2018-05-10 18:23:55 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LTO [LTO] Handle Task=-1 passed to addSaveTemps 2018-05-05 14:37:20 +00:00
LineEditor
Linker [ThinLTO] Recommit of import global variables 2018-03-12 10:30:50 +00:00
MC [WebAssembly] Create section start symbols automatically for all sections 2018-05-10 17:38:35 +00:00
Object [COFF] Improve correctness of def parsing for GNU features 2018-05-09 09:21:53 +00:00
ObjectYAML Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Option IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
Passes Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ProfileData [Coverage] Take filenames into account when loading function records. 2018-05-08 19:26:51 +00:00
Support [X86] ptwrite intrinsic 2018-05-10 07:26:05 +00:00
TableGen Revert r330742: Let TableGen write output only if it changed, instead of doing so in cmake. 2018-05-07 23:41:48 +00:00
Target [CGP] Split large data structres to sink more GEPs 2018-05-10 18:27:36 +00:00
Testing [LLVMTestingSupport] Add explicit linkage to LLVMSupport 2018-04-08 06:49:17 +00:00
ToolDrivers [COFF] Improve correctness of def parsing for GNU features 2018-05-09 09:21:53 +00:00
Transforms [PM/LoopUnswitch] Avoid pointlessly creating an exit block set. 2018-05-10 17:33:20 +00:00
WindowsManifest Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix. 2018-04-07 04:28:08 +00:00
XRay [XRay] clarify error messages when parsing broken traces 2018-01-30 13:41:34 +00:00
CMakeLists.txt
LLVMBuild.txt