diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 4433657bf9c..b12a76acf85 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1724,6 +1724,10 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) { if (isa(I)) continue; + // Skip landingpad instructions. + if (isa(I)) + continue; + // Don't sink static AllocaInsts out of the entry block, which would // turn them into dynamic allocas! if (AllocaInst *AI = dyn_cast(I)) diff --git a/test/Transforms/IndVarSimplify/crash.ll b/test/Transforms/IndVarSimplify/crash.ll index 516fd8084d9..949997884a5 100644 --- a/test/Transforms/IndVarSimplify/crash.ll +++ b/test/Transforms/IndVarSimplify/crash.ll @@ -53,3 +53,35 @@ bb30: ; preds = %bb29 %2 = add nsw i32 %r.0, 1 ; [#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" + +;