[llvm-branch-commits] [llvm] [CodeGen][StaticDataSplitter]Support constant pool partitioning (PR #129781)

Mingming Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 5 16:11:29 PST 2025


================
@@ -386,6 +386,16 @@ MCSection *TargetLoweringObjectFile::getSectionForConstant(
   return DataSection;
 }
 
+MCSection *TargetLoweringObjectFile::getSectionForConstant(
+    const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment,
+    StringRef SectionPrefix) const {
+  // Fallback to `getSectionForConstant` without `SectionPrefix` parameter if it
+  // is empty.
+  if (SectionPrefix.empty())
----------------
mingmingl-llvm wrote:

Do you mean something like `assert(!SectionPrefix.empty() && "Call another method if section prefix is empty` here?

I think with the refactor suggested above (https://github.com/llvm/llvm-project/pull/129781/files#r1980454779), we can allow the new interface to handle empty section prefix by falling back to the original interface. What do you think about it?

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


More information about the llvm-branch-commits mailing list