[llvm] [SystemZ] Fix compile time regression in adjustInliningThreshold(). (PR #137527)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 04:35:21 PDT 2025


================
@@ -92,25 +92,37 @@ unsigned SystemZTTIImpl::adjustInliningThreshold(const CallBase *CB) const {
     }
   }
 
-  // Give bonus for globals used much in both caller and callee.
-  std::set<const GlobalVariable *> CalleeGlobals;
-  std::set<const GlobalVariable *> CallerGlobals;
-  for (const GlobalVariable &Global : M->globals())
-    for (const User *U : Global.users())
-      if (const Instruction *User = dyn_cast<Instruction>(U)) {
-        if (User->getParent()->getParent() == Callee)
-          CalleeGlobals.insert(&Global);
-        if (User->getParent()->getParent() == Caller)
-          CallerGlobals.insert(&Global);
+  // Give bonus for globals used much in both caller and a relatively small
+  // callee.
+  unsigned InstrCount = 0;
+  SmallDenseMap<const Value *, unsigned> Ptr2NumUses;
+  for (auto &I : instructions(Callee)) {
----------------
JonPsson1 wrote:

I started out with that actually, but @nikic suggested this not being needed with the new debug refs, which was committed for SystemZ a month ago. (haven't double-checked though)

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


More information about the llvm-commits mailing list