32 lines · plain
1; Test for a problem afflicting several C++ programs in the testsuite. The 2; instcombine pass is trying to get rid of the cast in the invoke instruction, 3; inserting a cast of the return value after the PHI instruction, but which is4; used by the PHI instruction. This is bad: because of the semantics of the5; invoke instruction, we really cannot perform this transformation at all at6; least without splitting the critical edge.7;8; RUN: opt < %s -passes=instcombine -disable-output9 10declare ptr @test()11 12define i32 @foo() personality ptr @__gxx_personality_v0 {13entry:14 br i1 true, label %cont, label %call15 16call: ; preds = %entry17 %P = invoke ptr @test( )18 to label %cont unwind label %N ; <ptr> [#uses=1]19 20cont: ; preds = %call, %entry21 %P2 = phi ptr [ %P, %call ], [ null, %entry ] ; <ptr> [#uses=1]22 %V = load i32, ptr %P2 ; <i32> [#uses=1]23 ret i32 %V24 25N: ; preds = %call26 %exn = landingpad {ptr, i32}27 cleanup28 ret i32 029}30 31declare i32 @__gxx_personality_v0(...)32