[PATCH] D14475: [Sink] Don't move landingpads
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 15 20:50:32 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253182: [Sink] Don't move landingpads (authored by kfischer).
Changed prior to commit:
http://reviews.llvm.org/D14475?vs=39621&id=40245#toc
Repository:
rL LLVM
http://reviews.llvm.org/D14475
Files:
llvm/trunk/lib/Transforms/Scalar/Sink.cpp
llvm/trunk/test/Transforms/Sink/landingpad.ll
Index: llvm/trunk/test/Transforms/Sink/landingpad.ll
===================================================================
--- llvm/trunk/test/Transforms/Sink/landingpad.ll
+++ llvm/trunk/test/Transforms/Sink/landingpad.ll
@@ -0,0 +1,33 @@
+; Test that we don't sink landingpads
+; RUN: opt -sink -S < %s | FileCheck %s
+
+declare hidden void @g()
+declare void @h()
+declare i32 @__gxx_personality_v0(...)
+
+define void @f() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+entry:
+ invoke void @g()
+ to label %invoke.cont.15 unwind label %lpad
+
+invoke.cont.15:
+ unreachable
+
+; CHECK: lpad:
+; CHECK: %0 = landingpad { i8*, i32 }
+lpad:
+ %0 = landingpad { i8*, i32 }
+ catch i8* null
+ invoke void @h()
+ to label %invoke.cont unwind label %lpad.1
+
+; CHECK: invoke.cont
+; CHECK-NOT: %0 = landingpad { i8*, i32 }
+invoke.cont:
+ ret void
+
+lpad.1:
+ %1 = landingpad { i8*, i32 }
+ cleanup
+ resume { i8*, i32 } %1
+}
Index: llvm/trunk/lib/Transforms/Scalar/Sink.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/Sink.cpp
+++ llvm/trunk/lib/Transforms/Scalar/Sink.cpp
@@ -169,7 +169,7 @@
return false;
}
- if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst))
+ if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst) || Inst->isEHPad())
return false;
// Convergent operations cannot be made control-dependent on additional
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14475.40245.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151116/d521074b/attachment.bin>
More information about the llvm-commits
mailing list