[all-commits] [llvm/llvm-project] 831bfc: [Transforms][GlobalSRA] huge array causes long com...

avl-llvm via All-commits all-commits at lists.llvm.org
Sat Jan 4 05:42:42 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 831bfcea47826a102ece03f0fad33ce39a73c672
      https://github.com/llvm/llvm-project/commit/831bfcea47826a102ece03f0fad33ce39a73c672
  Author: Alexey Lapshin <a.v.lapshin at mail.ru>
  Date:   2020-01-04 (Sat, 04 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp
    A llvm/test/Transforms/GlobalOpt/long-compilation-global-sra.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list