[llvm] [BasicBlockSections] Split cold parts of custom-section functions. (PR #66731)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 10:57:31 PDT 2023


================
@@ -1038,20 +1038,30 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
   // under the .text.eh prefix. For regular sections, we either use a unique
   // name, or a unique ID for the section.
   SmallString<128> Name;
-  if (MBB.getSectionID() == MBBSectionID::ColdSectionID) {
-    Name += BBSectionsColdTextPrefix;
-    Name += MBB.getParent()->getName();
-  } else if (MBB.getSectionID() == MBBSectionID::ExceptionSectionID) {
-    Name += ".text.eh.";
-    Name += MBB.getParent()->getName();
+  StringRef FunctionSectionName = MBB.getParent()->getSection()->getName();
+  if (!FunctionSectionName.equals(".text") &&
----------------
rlavaee wrote:

Switched the conditional.

This piece of code also assigns UniqueID and modifies NextUniqueID based on naming. Not sure if it's worth creating that separate function.

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


More information about the llvm-commits mailing list