[llvm] ef8dedc - Refactor BasicBlockSectionsProfileReader::getBBClusterInfoForFunction.

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 14:22:36 PDT 2023


Author: Rahman Lavaee
Date: 2023-04-18T21:21:54Z
New Revision: ef8dedc79ce02710ffba6a3005e05672702f555f

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

LOG: Refactor BasicBlockSectionsProfileReader::getBBClusterInfoForFunction.

Added: 
    

Modified: 
    llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
index 5bc8d82debc3..89299559458d 100644
--- a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
@@ -35,13 +35,10 @@ bool BasicBlockSectionsProfileReader::isFunctionHot(StringRef FuncName) const {
 std::pair<bool, SmallVector<BBClusterInfo>>
 BasicBlockSectionsProfileReader::getBBClusterInfoForFunction(
     StringRef FuncName) const {
-  std::pair<bool, SmallVector<BBClusterInfo>> cluster_info(false, {});
   auto R = ProgramBBClusterInfo.find(getAliasName(FuncName));
-  if (R != ProgramBBClusterInfo.end()) {
-    cluster_info.second = R->second;
-    cluster_info.first = true;
-  }
-  return cluster_info;
+  return R != ProgramBBClusterInfo.end()
+             ? std::pair(true, R->second)
+             : std::pair(false, SmallVector<BBClusterInfo>{});
 }
 
 // Basic Block Sections can be enabled for a subset of machine basic blocks.


        


More information about the llvm-commits mailing list