Don't sink landingpad instructions during ind-var simplification.
authorBill Wendling <isanbard@gmail.com>
Fri, 26 Aug 2011 20:40:15 +0000 (20:40 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 26 Aug 2011 20:40:15 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138651 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/crash.ll

index 4433657bf9c5efc0f19e6909331f27068dfba1e2..b12a76acf8595cca4b98be8e0f13bb9520c05527 100644 (file)
@@ -1724,6 +1724,10 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) {
     if (isa<DbgInfoIntrinsic>(I))
       continue;
 
+    // Skip landingpad instructions.
+    if (isa<LandingPadInst>(I))
+      continue;
+
     // Don't sink static AllocaInsts out of the entry block, which would
     // turn them into dynamic allocas!
     if (AllocaInst *AI = dyn_cast<AllocaInst>(I))
index 516fd8084d9e9b6372b98cfeeade5cb002e1899c..949997884a572e15801c126db80127a67d48deb4 100644 (file)
@@ -53,3 +53,35 @@ bb30:                                             ; preds = %bb29
   %2 = add nsw i32 %r.0, 1                        ; <i32> [#uses=1]
   br label %bb24
 }
+
+; PR10770
+
+declare void @__go_panic() noreturn
+
+declare void @__go_undefer()
+
+declare i32 @__gccgo_personality_v0(i32, i64, i8*, i8*)
+
+define void @main.main() uwtable {
+entry:
+  invoke void @__go_panic() noreturn
+          to label %0 unwind label %"5.i"
+
+; <label>:0                                       ; preds = %entry
+  unreachable
+
+"3.i":                                            ; preds = %"7.i", %"5.i"
+  invoke void @__go_undefer()
+          to label %main.f.exit unwind label %"7.i"
+
+"5.i":                                            ; preds = %entry
+  %1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0
+          catch i8* null
+  br label %"3.i"
+
+"7.i":                                            ; preds = %"3.i"
+  br label %"3.i"
+
+main.f.exit:                                      ; preds = %"3.i"
+  unreachable
+}