[PATCH] D129599: [SimpleLoopUnswitch] Skip non-trivial unswitching of cold loops

Ruobing Han via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 27 11:51:34 PDT 2022


drcut updated this revision to Diff 456138.
drcut added a comment.

As suggested by other users, we need to make the skip check more restrict to avoid performance degradation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129599/new/

https://reviews.llvm.org/D129599

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp


Index: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -3086,6 +3086,7 @@
   // Skip cold loops, as unswitching them brings little benefit
   // but increases the code size
   if (PSI && PSI->hasProfileSummary() && BFI &&
+      PSI->isFunctionColdInCallGraph(L.getHeader()->getParent(), *BFI) &&
       PSI->isColdBlock(L.getHeader(), BFI)) {
     LLVM_DEBUG(dbgs() << " Skip cold loop: " << L << "\n");
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129599.456138.patch
Type: text/x-patch
Size: 605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220827/43181836/attachment.bin>


More information about the llvm-commits mailing list