[PATCH] D101004: [CodeGen] Do not split functions with attr "implicit-section-name".
Snehasish Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 21 21:54:26 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8077d0ff5c66: [CodeGen] Do not split functions with attr "implicit-section-name". (authored by snehasish).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101004/new/
https://reviews.llvm.org/D101004
Files:
llvm/lib/CodeGen/MachineFunctionSplitter.cpp
llvm/test/CodeGen/X86/machine-function-splitter.ll
Index: llvm/test/CodeGen/X86/machine-function-splitter.ll
===================================================================
--- llvm/test/CodeGen/X86/machine-function-splitter.ll
+++ llvm/test/CodeGen/X86/machine-function-splitter.ll
@@ -223,6 +223,26 @@
ret i32 %5
}
+define void @foo9(i1 zeroext %0) nounwind #0 !prof !14 {
+;; Check that function with section attribute is not split.
+; MFS-DEFAULTS-LABEL: foo9
+; MFS-DEFAULTS-NOT: foo9.cold:
+ br i1 %0, label %2, label %4, !prof !17
+
+2: ; preds = %1
+ %3 = call i32 @bar()
+ br label %6
+
+4: ; preds = %1
+ %5 = call i32 @baz()
+ br label %6
+
+6: ; preds = %4, %2
+ %7 = tail call i32 @qux()
+ ret void
+}
+
+
declare i32 @bar()
declare i32 @baz()
declare i32 @bam()
@@ -232,6 +252,8 @@
@_ZTIi = external constant i8*
+attributes #0 = { "implicit-section-name"="nosplit" }
+
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"ProfileSummary", !1}
!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
Index: llvm/lib/CodeGen/MachineFunctionSplitter.cpp
===================================================================
--- llvm/lib/CodeGen/MachineFunctionSplitter.cpp
+++ llvm/lib/CodeGen/MachineFunctionSplitter.cpp
@@ -101,7 +101,8 @@
// since the split part may not be placed in a contiguous region. It may also
// be more beneficial to augment the linker to ensure contiguous layout of
// split functions within the same section as specified by the attribute.
- if (!MF.getFunction().getSection().empty())
+ if (!MF.getFunction().getSection().empty() ||
+ MF.getFunction().hasFnAttribute("implicit-section-name"))
return false;
// We don't want to proceed further for cold functions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101004.339468.patch
Type: text/x-patch
Size: 1821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/0ea43510/attachment.bin>
More information about the llvm-commits
mailing list