llvm-project/llvm/lib/Transforms/IPO
Alexey Lapshin 831bfcea47 [Transforms][GlobalSRA] huge array causes long compilation time and huge memory usage.
Summary:
For artificial cases (huge array, few usages), Global SRA optimization creates
a lot of redundant data. It creates an instance of GlobalVariable for each array
element. For huge array, that means huge compilation time and huge memory usage.
Following example compiles for 10 minutes and requires 40GB of memory.

namespace {
  char LargeBuffer[64 * 1024 * 1024];
}

int main ( void ) {

    LargeBuffer[0] = 0;

    printf("\n ");

    return LargeBuffer[0] == 0;
}

The fix is to avoid Global SRA for large arrays.

Reviewers: craig.topper, rnk, efriedma, fhahn

Reviewed By: rnk

Subscribers: xbolva00, lebedev.ri, lkail, merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71993
2020-01-04 16:42:38 +03:00
..
AlwaysInliner.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ArgumentPromotion.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Attributor.cpp [Attributor][FIX] Allow dead users of rewritten function 2020-01-03 10:43:40 -06:00
BarrierNoopPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BlockExtractor.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CMakeLists.txt [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" 2019-11-21 10:48:08 -08:00
CalledValuePropagation.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
ConstantMerge.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CrossDSOCFI.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DeadArgumentElimination.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ElimAvailExtern.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ExtractGV.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ForceFunctionAttrs.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
FunctionAttrs.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
FunctionImport.cpp [ThinLTO] Add option to disable readonly/writeonly attribute propagation 2019-12-05 16:33:54 -08:00
GlobalDCE.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
GlobalOpt.cpp [Transforms][GlobalSRA] huge array causes long compilation time and huge memory usage. 2020-01-04 16:42:38 +03:00
GlobalSplit.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
HotColdSplitting.cpp HotColdSplitting: Do not outline within noreturn functions 2019-12-19 14:06:24 -08:00
IPConstantPropagation.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
IPO.cpp [LLVM-C][Ocaml] Add MergeFunctions and DCE pass 2019-09-29 16:06:22 +00:00
InferFunctionAttrs.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
InlineSimple.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Inliner.cpp [Alignment][NFC] Remove AllocaInst::setAlignment(unsigned) 2019-09-30 13:34:44 +00:00
Internalize.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopExtractor.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerTypeTests.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MergeFunctions.cpp [MergeFuncs] Remove incorrect attribute copying 2019-12-11 20:09:54 +01:00
PartialInlining.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PassManagerBuilder.cpp [Matrix] Add first set of matrix intrinsics and initial lowering pass. 2019-12-12 15:42:18 +00:00
PruneEH.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SCCP.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SampleProfile.cpp [profile] Fix a crash when -fprofile-remapping-file= triggers an error 2019-12-13 11:38:20 -08:00
StripDeadPrototypes.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StripSymbols.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SyntheticCountsPropagation.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThinLTOBitcodeWriter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
WholeProgramDevirt.cpp [Transforms] Fixes -Wrange-loop-analysis warnings 2019-12-22 19:20:17 +01:00