[PATCH] D111582: [clang] Clear IR analyses before codegen pipeline

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 11 15:12:19 PDT 2021


aeubanks created this revision.
Herald added a subscriber: ormris.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This saves a tiny bit of memory in non-LTO builds [1].

[1] https://llvm-compile-time-tracker.com/compare.php?from=fbddf22ef72d3c2e9b14e1501841b03380eef12b&to=cd276df52eb6f2b84a8e1efe5318460c6debf82d&stat=max-rss


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111582

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1512,6 +1512,12 @@
 
   // Now if needed, run the legacy PM for codegen.
   if (NeedCodeGen) {
+    // Save some memory by clearing analyses used in the optimization pipeline.
+    LAM.clear();
+    FAM.clear();
+    CGAM.clear();
+    MAM.clear();
+
     PrettyStackTraceString CrashInfo("Code generation");
     CodeGenPasses.run(*TheModule);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111582.378811.patch
Type: text/x-patch
Size: 539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211011/0043999f/attachment.bin>


More information about the cfe-commits mailing list