[llvm link] Destroy ConstantArrays in LLVMContext if they are not used.
[oota-llvm.git] / include / llvm / IR / Module.h
index b24023b05e4fad4cd032b043ccc2dfb6fc0142ab..62f41943be833c8ce2bcdf36ab4e8d1541ea4fa7 100644 (file)
@@ -630,6 +630,15 @@ public:
                                                          named_metadata_end());
   }
 
+  /// Destroy ConstantArrays in LLVMContext if they are not used.
+  /// ConstantArrays constructed during linking can cause quadratic memory
+  /// explosion. Releasing all unused constants can cause a 20% LTO compile-time
+  /// slowdown for a large application.
+  ///
+  /// NOTE: Constants are currently owned by LLVMContext. This can then only
+  /// be called where all uses of the LLVMContext are understood.
+  void dropTriviallyDeadConstantArrays();
+
 /// @}
 /// @name Utility functions for printing and dumping Module objects
 /// @{