[llvm-branch-commits] [llvm] [BOLT] Detect .warm split functions as cold fragments (PR #93759)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 30 14:52:53 PDT 2024


https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/93759

>From 9ac7c047c6d15082f05e7494b764d50150e3fd27 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Thu, 30 May 2024 14:52:45 -0700
Subject: [PATCH] s/ColdFragment/FunctionFragmentTemplate/

Created using spr 1.3.4
---
 bolt/include/bolt/Rewrite/RewriteInstance.h | 2 +-
 bolt/lib/Rewrite/RewriteInstance.cpp        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bolt/include/bolt/Rewrite/RewriteInstance.h b/bolt/include/bolt/Rewrite/RewriteInstance.h
index d8d62badcc377..a55516d553979 100644
--- a/bolt/include/bolt/Rewrite/RewriteInstance.h
+++ b/bolt/include/bolt/Rewrite/RewriteInstance.h
@@ -598,7 +598,7 @@ class RewriteInstance {
   NameResolver NR;
 
   // Regex object matching split function names.
-  const Regex ColdFragment{"(.*)\\.(cold|warm)(\\.[0-9]+)?"};
+  const Regex FunctionFragmentTemplate{"(.*)\\.(cold|warm)(\\.[0-9]+)?"};
 
   friend class RewriteInstanceDiff;
 };
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index fb920ebbeafc4..e452e956c949e 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1225,7 +1225,7 @@ void RewriteInstance::discoverFileObjects() {
     }
 
     // Check if it's a cold function fragment.
-    if (ColdFragment.match(SymName)) {
+    if (FunctionFragmentTemplate.match(SymName)) {
       static bool PrintedWarning = false;
       if (!PrintedWarning) {
         PrintedWarning = true;
@@ -1457,7 +1457,7 @@ void RewriteInstance::registerFragments() {
       StringRef BaseName = NR.restore(Name);
       const bool IsGlobal = BaseName == Name;
       SmallVector<StringRef> Matches;
-      if (!ColdFragment.match(BaseName, &Matches))
+      if (!FunctionFragmentTemplate.match(BaseName, &Matches))
         continue;
       StringRef ParentName = Matches[1];
       const BinaryData *BD = BC->getBinaryDataByName(ParentName);



More information about the llvm-branch-commits mailing list