[llvm] 5a3776a - [SCCPSolver] Make getMRVFunctionsTracked return a reference (NFC) (#140851)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 08:56:19 PDT 2025


Author: Kazu Hirata
Date: 2025-05-21T08:56:15-07:00
New Revision: 5a3776af521b8ddc14a19d1954af64e2960d2397

URL: https://github.com/llvm/llvm-project/commit/5a3776af521b8ddc14a19d1954af64e2960d2397
DIFF: https://github.com/llvm/llvm-project/commit/5a3776af521b8ddc14a19d1954af64e2960d2397.diff

LOG: [SCCPSolver] Make getMRVFunctionsTracked return a reference (NFC) (#140851)

This patch makes getMRVFunctionsTracked return a reference.
runIPSCCP, the sole user of getMRVFunctionsTracked, just needs a
read-access to the map.

The missing "&" is most likely an oversight as two "sibling" functions
getTrackedRetVals and getTrackedGlobals return maps by const
reference.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/SCCPSolver.h
    llvm/lib/Transforms/Utils/SCCPSolver.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/SCCPSolver.h b/llvm/include/llvm/Transforms/Utils/SCCPSolver.h
index 696f39ca984d1..f8966f5b7472f 100644
--- a/llvm/include/llvm/Transforms/Utils/SCCPSolver.h
+++ b/llvm/include/llvm/Transforms/Utils/SCCPSolver.h
@@ -147,7 +147,7 @@ class SCCPSolver {
 
   /// getMRVFunctionsTracked - Get the set of functions which return multiple
   /// values tracked by the pass.
-  const SmallPtrSet<Function *, 16> getMRVFunctionsTracked();
+  const SmallPtrSet<Function *, 16> &getMRVFunctionsTracked();
 
   /// markOverdefined - Mark the specified value overdefined.  This
   /// works with both scalars and structs.

diff  --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index ee541fba4e633..6b573f61a3c2a 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -847,7 +847,7 @@ class SCCPInstVisitor : public InstVisitor<SCCPInstVisitor> {
     return TrackedGlobals;
   }
 
-  const SmallPtrSet<Function *, 16> getMRVFunctionsTracked() {
+  const SmallPtrSet<Function *, 16> &getMRVFunctionsTracked() {
     return MRVFunctionsTracked;
   }
 
@@ -2230,7 +2230,7 @@ SCCPSolver::getTrackedGlobals() {
   return Visitor->getTrackedGlobals();
 }
 
-const SmallPtrSet<Function *, 16> SCCPSolver::getMRVFunctionsTracked() {
+const SmallPtrSet<Function *, 16> &SCCPSolver::getMRVFunctionsTracked() {
   return Visitor->getMRVFunctionsTracked();
 }
 


        


More information about the llvm-commits mailing list