Index: lib/Transforms/Scalar/Sink.cpp =================================================================== --- lib/Transforms/Scalar/Sink.cpp +++ lib/Transforms/Scalar/Sink.cpp @@ -169,7 +169,8 @@ return false; } - if (isa(Inst) || isa(Inst)) + if (isa(Inst) || isa(Inst) || + isa(Inst) || isa(Inst)) return false; // Convergent operations cannot be made control-dependent on additional Index: test/Transforms/Sink/landingpad.ll =================================================================== --- /dev/null +++ test/Transforms/Sink/landingpad.ll @@ -0,0 +1,39 @@ +; Test that we don't sink landingpads +; RUN: opt -sink -S < %s | FileCheck %s + +define void @_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + invoke void @_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE4fillEv() + to label %invoke.cont.15 unwind label %lpad.1 + +invoke.cont.15: ; preds = %entry + unreachable + +; CHECK: lpad.1: +; CHECK: %0 = landingpad { i8*, i32 } +lpad.1: ; preds = %entry + %0 = landingpad { i8*, i32 } + catch i8* null + invoke void @_ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv() + to label %invoke.cont.33 unwind label %lpad.32 + +; CHECK: invoke.cont.33 +; CHECK-NOT: %0 = landingpad { i8*, i32 } +invoke.cont.33: ; preds = %lpad.1 + ret void + +lpad.32: ; preds = %lpad.1 + %1 = landingpad { i8*, i32 } + cleanup + resume { i8*, i32 } %1 +} + +declare i32 @__gxx_personality_v0(...) + +; Function Attrs: alwaysinline +declare hidden void @_ZNKSt3__19basic_iosIcNS_11char_traitsIcEEE4fillEv() #1 align 2 + +declare void @_ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv() #0 + +attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="0" "stackrealign" "target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { alwaysinline "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="0" "stackrealign" "target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt" "unsafe-fp-math"="false" "use-soft-float"="false" }