[llvm] [NFC][AlwaysInliner] Reduce AlwaysInliner memory consumption. (PR #96958)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 07:08:48 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff aa8409fdca5e738c30a4ab70a3dc809bb4e9160d 3a2078ea7a8cdf9ede7fcbeabb0219ff1b038143 -- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
index 9290435bab..d73518c627 100644
--- a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -51,9 +51,9 @@ bool AlwaysInlineImpl(
     for (User *U : F.users())
       if (auto *CB = dyn_cast<CallBase>(U))
         if (CB->getCalledFunction() == &F &&
-              CB->hasFnAttr(Attribute::AlwaysInline) &&
-              !CB->getAttributes().hasFnAttr(Attribute::NoInline))
-            Calls.insert(CB);
+            CB->hasFnAttr(Attribute::AlwaysInline) &&
+            !CB->getAttributes().hasFnAttr(Attribute::NoInline))
+          Calls.insert(CB);
 
     for (CallBase *CB : Calls) {
       Function *Caller = CB->getCaller();
@@ -62,18 +62,17 @@ bool AlwaysInlineImpl(
       BasicBlock *Block = CB->getParent();
 
       InlineFunctionInfo IFI(GetAssumptionCache, &PSI,
-                              GetBFI ? &GetBFI(*Caller) : nullptr,
-                              GetBFI ? &GetBFI(F) : nullptr);
+                             GetBFI ? &GetBFI(*Caller) : nullptr,
+                             GetBFI ? &GetBFI(F) : nullptr);
 
       InlineResult Res = InlineFunction(*CB, IFI, /*MergeAttributes=*/true,
                                         &GetAAR(F), InsertLifetime);
       if (!Res.isSuccess()) {
         ORE.emit([&]() {
-          return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc,
-                                          Block)
-                  << "'" << ore::NV("Callee", &F) << "' is not inlined into '"
-                  << ore::NV("Caller", Caller)
-                  << "': " << ore::NV("Reason", Res.getFailureReason());
+          return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+                 << "'" << ore::NV("Callee", &F) << "' is not inlined into '"
+                 << ore::NV("Caller", Caller)
+                 << "': " << ore::NV("Reason", Res.getFailureReason());
         });
         continue;
       }
@@ -101,8 +100,8 @@ bool AlwaysInlineImpl(
   }
 
   // Delete the non-comdat ones from the module and also from our vector.
-  auto *NonComdatBegin = partition(
-      InlinedFunctions, [&](Function *F) { return F->hasComdat(); });
+  auto *NonComdatBegin =
+      partition(InlinedFunctions, [&](Function *F) { return F->hasComdat(); });
   for (Function *F : make_range(NonComdatBegin, InlinedFunctions.end())) {
     M.getFunctionList().erase(F);
     Changed = true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/96958


More information about the llvm-commits mailing list