[llvm-commits] [PATCH] Memory footprint improvement of pass GlobalOpt

Jakub Staszak kubastaszak at gmail.com
Thu Nov 29 07:14:35 PST 2012


Any particular  reason you use SetVector? It looks like insertion order
doesn't make any difference, so SmallPtrSet should be cheaper.

- Kuba


On Thu, Nov 29, 2012 at 7:45 AM, Sheng Zhou <zhousheng00 at gmail.com> wrote:

> Hi,
>
> The attached patch is to improve the memory footprint of pass GlobalOpt. Please
> kindly let me know if the patch is good to commit.
> I also attached a case to repeat the issue, on which 'opt -globalopt'
> consumes 3.2GB memory and is stuck for long time.
> With my patch the memory footprint is reduced to 300MB and GlobalOpt
> transform finishes in 3mins. (My machine info: 16 Intel(R) Xeon(R) CPU
> E5620 at 2.40GHz, 16GB)
>
> The big memory footprint cause is that current GlobalOpt one by one hoists
> and stores the leaf element constant into the global array,
> in each iteration, it recreates the global array initializer constant and
> leave the old initializer alone. This may result in many obsolete constants
> left.
> For example:  we have global array @rom = global [16 x i32] zeroinitializer
> After the first element value is hoisted and installed:   @rom = global
> [16 x i32] [ 1, 0, 0, ... ]
> After the second element value is installed:  @rom = global [16 x 32] [ 1,
> 2, 0, 0, ... ]        // here the previous initializer is obsolete
> ...
> When the transform is done, we have 15 obsolete initializers left useless.
>
>
>
> -Sheng
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121129/bc5e32b6/attachment.html>


More information about the llvm-commits mailing list