[PATCH] D96372: [CodeGen] Split out cold exception handling pads.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 14:25:32 PST 2021


snehasish created this revision.
snehasish added a reviewer: rahmanl.
Herald added subscribers: pengfei, hiraditya.
snehasish requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Support for splitting exception handling pads was added in D73739 <https://reviews.llvm.org/D73739>. This
change updates the code to split out exception handling pads if profile
information indicates that they are cold.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96372

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
@@ -150,12 +150,12 @@
 }
 
 define i32 @foo7(i1 zeroext %0) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !prof !14 {
-;; Check that cold ehpads are not split out.
+;; Check that cold ehpads are split out.
 ; MFS-DEFAULTS-LABEL: foo7
 ; MFS-DEFAULTS:       .section        .text.split.foo7,"ax", at progbits
 ; MFS-DEFAULTS-NEXT:  foo7.cold:
-; MFS-DEFAULTS-NOT:   callq   _Unwind_Resume
 ; MFS-DEFAULTS:       callq   baz
+; MFS-DEFAULTS:       callq   _Unwind_Resume at PLT
 entry:
   invoke void @_Z1fv()
           to label %try.cont unwind label %lpad
Index: llvm/lib/CodeGen/MachineFunctionSplitter.cpp
===================================================================
--- llvm/lib/CodeGen/MachineFunctionSplitter.cpp
+++ llvm/lib/CodeGen/MachineFunctionSplitter.cpp
@@ -122,10 +122,7 @@
   auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
 
   for (auto &MBB : MF) {
-    // FIXME: We retain the entry block and conservatively keep all landing pad
-    // blocks as part of the original function. Once D73739 is submitted, we can
-    // improve the handling of ehpads.
-    if ((MBB.pred_empty() || MBB.isEHPad()))
+    if (MBB.isEntryBlock())
       continue;
     if (isColdBlock(MBB, MBFI, PSI))
       MBB.setSectionID(MBBSectionID::ColdSectionID);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96372.322502.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210209/e07dcd13/attachment.bin>


More information about the llvm-commits mailing list