[llvm] r348870 - [HotColdSplitting] Disable outlining landingpad instructions (PR39917)

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 11 10:05:31 PST 2018


Author: vedantk
Date: Tue Dec 11 10:05:31 2018
New Revision: 348870

URL: http://llvm.org/viewvc/llvm-project?rev=348870&view=rev
Log:
[HotColdSplitting] Disable outlining landingpad instructions (PR39917)

It's currently not safe to outline landingpad instructions (see
llvm.org/PR39917). Like @llvm.eh.typeid.for, the order and content of
previous landingpad instructions in a function alters the lowering of
subsequent landingpads by renumbering type info ID's. Outlining a
landingpad therefore breaks exception handling & unwinding.

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=348870&r1=348869&r2=348870&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp Tue Dec 11 10:05:31 2018
@@ -125,7 +125,7 @@ bool unlikelyExecuted(BasicBlock &BB) {
 
 /// Check whether it's safe to outline \p BB.
 static bool mayExtractBlock(const BasicBlock &BB) {
-  return !BB.hasAddressTaken();
+  return !BB.hasAddressTaken() && !BB.isEHPad();
 }
 
 /// Check whether \p Region is profitable to outline.

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=348870&r1=348869&r2=348870&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll (original)
+++ llvm/trunk/test/Transforms/HotColdSplit/eh-pads.ll Tue Dec 11 10:05:31 2018
@@ -26,8 +26,11 @@ normal:
   ret void
 }
 
+; See llvm.org/PR39917. It's currently not safe to outline landingpad
+; instructions.
+;
 ; CHECK-LABEL: define {{.*}}@bar(
-; CHECK-NOT: landingpad
+; CHECK: landingpad
 define void @bar(i32 %cond) personality i8 0 {
 entry:
   br i1 undef, label %exit, label %continue
@@ -54,10 +57,6 @@ normal:
 ; CHECK: sideeffect(i32 1)
 ; CHECK: sink
 
-; CHECK-LABEL: define {{.*}}@bar.cold.1(
-; CHECK: sideeffect(i32 0)
-; CHECK: sideeffect(i32 1)
-
 declare void @sideeffect(i32)
 
 declare void @sink() cold




More information about the llvm-commits mailing list