[llvm] r351483 - [HotColdSplit] Relax requirement that the cold sink block be extractable

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 17 13:42:36 PST 2019


Author: vedantk
Date: Thu Jan 17 13:42:36 2019
New Revision: 351483

URL: http://llvm.org/viewvc/llvm-project?rev=351483&view=rev
Log:
[HotColdSplit] Relax requirement that the cold sink block be extractable

Relaxing this requirement creates opportunities to split code dominated
by an EH pad.

Tested on LNT+externals.

Modified:
    llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
    llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll

Modified: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp?rev=351483&r1=351482&r2=351483&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp Thu Jan 17 13:42:36 2019
@@ -391,7 +391,8 @@ public:
 
     // Add SinkBB to the cold region. It's considered as an entry point before
     // any sink-successor blocks.
-    addBlockToRegion(&SinkBB, SinkScore);
+    if (mayExtractBlock(SinkBB))
+      addBlockToRegion(&SinkBB, SinkScore);
 
     // Find all successors of SinkBB dominated by SinkBB using DFS.
     auto SuccIt = ++df_begin(&SinkBB);
@@ -486,10 +487,6 @@ bool HotColdSplitting::outlineColdRegion
 
   // Find all cold regions.
   for (BasicBlock *BB : RPOT) {
-    // Skip blocks which can't be outlined.
-    if (!mayExtractBlock(*BB))
-      continue;
-
     // This block is already part of some outlining region.
     if (ColdBlocks.count(BB))
       continue;

Modified: llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll?rev=351483&r1=351482&r2=351483&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll (original)
+++ llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll Thu Jan 17 13:42:36 2019
@@ -58,6 +58,9 @@ normal:
 ; CHECK: sideeffect(i32 0)
 ; CHECK: sink
 
+; CHECK-LABEL: define {{.*}}@bar.cold.1(
+; CHECK: sideeffect(i32 1)
+
 declare void @sideeffect(i32)
 
 declare void @sink() cold




More information about the llvm-commits mailing list