llvm-project/llvm/lib
Amara Emerson f573d489b6 [AArch64][GlobalISel] Split G_GLOBAL_VALUE into ADRP + G_ADD_LOW and optimize.
The concept of G_GLOBAL_VALUE is nice and simple, but always using it as the
representation for global var addressing until selection time creates some
problems in optimizing accesses in certain code/relocation models.

The problem comes from trying to optimize adrp -> add -> load/store sequences
in the most common "small" code model. These accesses can be optimized into an
adrp -> load with the add offset being folded into the load's immediate field.
If we try to keep all global var references as a single generic instruction
then by the time we get to the complex operand trying to match these, we end up
generating an adrp at the point of use. The real issue here is that we don't
have any form of CSE during selection, so the code size will bloat from many
redundant adrp's.

This patch custom legalizes small code mode non-GOT G_GLOBALs into target ADRP
and a new "target specific generic opcode" G_ADD_LOW. We also teach the
localizer to localize these instructions via the custom hook that was added
recently. Finally, the complex pattern for indexed loads/stores is extended to
try to fold these G_ADD_LOW instructions into the load immediate.

On -O0 CTMark, we see a 0.8% geomean code size improvement. We should also see
some minor performance improvements too.

Differential Revision: https://reviews.llvm.org/D78465
2020-06-01 16:00:56 -07:00
..
Analysis [llvm][NFC] Cache FAM in InlineAdvisor 2020-06-01 13:02:34 -07:00
AsmParser [ThinLTO] Compute the basic block count across modules. 2020-05-28 10:33:05 -07:00
BinaryFormat [MsgPack] Added convenience assignment to MsgPackDocument 2020-05-21 22:13:19 +01:00
Bitcode [ThinLTO] Compute the basic block count across modules. 2020-05-28 10:33:05 -07:00
Bitstream [Bitcode] reserve in front of push_back loops. NFCI. 2020-05-01 15:52:53 +02:00
CodeGen [LiveDebugValues] Remove early-exit when testing regmasks, NFC 2020-06-01 15:16:10 -07:00
DWARFLinker [Clang] Restore replace_path_prefix instead of startswith 2020-05-13 13:49:14 -04:00
DebugInfo For --relativenames, ignore directory 0, which is the comp_dir. 2020-06-01 13:13:37 -07:00
Demangle Give microsoftDemangle() an outparam for how many input bytes were consumed. 2020-05-20 16:17:31 -04:00
ExecutionEngine [jitlink] R_X86_64_PC32 support for the elf x86 jitlinker 2020-05-30 10:53:18 +10:00
Extensions Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00
Frontend [OpenMP] Replace Clang's OpenMP RTL Definitions with OMPKinds.def 2020-06-01 16:23:10 -04:00
FuzzMutate FuzzerCLI.h - reduce StringRef.h include to forward declaration. NFC. 2020-05-12 13:03:50 +01:00
Fuzzer
IR [PGO] Improve the working set size heuristics under the partial sample PGO. 2020-06-01 10:29:23 -07:00
IRReader Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
LTO [PGO] Improve the working set size heuristics under the partial sample PGO. 2020-06-01 10:29:23 -07:00
LineEditor
Linker [SVE] Eliminate calls to default-false VectorType::get() from Linker 2020-05-29 17:43:15 -07:00
MC [DWARF5] Added support for emission of .debug_macro.dwo section 2020-05-30 11:13:23 +05:30
MCA [MCA][InstrBuilder] Correctly mark reserved resources in initializeUsedResources. 2020-05-10 19:25:54 +01:00
Object SymbolicFile.h - removed unused FileSystem.h include. NFC. 2020-05-28 15:26:31 +01:00
ObjectYAML [ObjectYAML][DWARF] Make the `PubSection` optional. 2020-05-29 20:11:53 +08:00
Option
Passes NFC: Simplify O1 pass pipeline construction. 2020-05-29 20:08:22 -07:00
ProfileData [gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and fix llvm-cov's decoding of runcount 2020-05-11 21:53:53 -07:00
Remarks RemarkStringTable.h - reduce StringRef/Remark includes to forward declarations. NFC 2020-05-08 12:30:49 +01:00
Support [Support] Add more context to DataExtractor getLEB128 errors 2020-06-01 14:00:01 +01:00
TableGen [TableGen] Simplify with TGParser::consume() 2020-04-26 15:26:49 -07:00
Target [AArch64][GlobalISel] Split G_GLOBAL_VALUE into ADRP + G_ADD_LOW and optimize. 2020-06-01 16:00:56 -07:00
Testing
TextAPI ArchitectureSet.h - reduce raw_ostream.h include to forward declaration. NFC. 2020-05-30 12:36:16 +01:00
ToolDrivers [COFF] Use Expected in COFFObjectFile creation 2020-05-08 14:22:28 -07:00
Transforms [llvm][NFC] Cache FAM in InlineAdvisor 2020-06-01 13:02:34 -07:00
WindowsManifest
XRay [xray] Add llvm-xray extract support for 32 bit ARM 2020-05-28 18:41:11 -04:00
CMakeLists.txt Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00
LLVMBuild.txt Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00