[llvm link] Destroy ConstantArrays in LLVMContext if they are not used.
authorManman Ren <manman.ren@gmail.com>
Tue, 20 Jan 2015 19:24:59 +0000 (19:24 +0000)
committerManman Ren <manman.ren@gmail.com>
Tue, 20 Jan 2015 19:24:59 +0000 (19:24 +0000)
commit0d12d4ebc62054cd2ac2164f2a1d5e75789f09e7
treeeade4b6abb9cd704b8f4071e6fd02b3d9aa9825c
parentdaa414fd39556b977af5b96e3ac149b9cddbc8c6
[llvm link] Destroy ConstantArrays in LLVMContext if they are not used.

ConstantArrays constructed during linking can cause quadratic memory
explosion. An example is the ConstantArrays constructed when linking in
GlobalVariables with appending linkage.

Releasing all unused constants can cause a 20% LTO compile-time
slowdown for a large application. So this commit releases unused ConstantArrays
only.

rdar://19040716. It reduces memory footprint from 20+G to 6+G.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226592 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Module.h
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h
lib/Linker/LinkModules.cpp