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 is
4; used by the PHI instruction.  This is bad: because of the semantics of the
5; invoke instruction, we really cannot perform this transformation at all at
6; least without splitting the critical edge.
7;
8; RUN: opt < %s -instcombine -disable-output
9
10declare i8* @test()
11
12define i32 @foo() personality i32 (...)* @__gxx_personality_v0 {
13entry:
14        br i1 true, label %cont, label %call
15
16call:           ; preds = %entry
17        %P = invoke i32* bitcast (i8* ()* @test to i32* ()*)( )
18                        to label %cont unwind label %N          ; <i32*> [#uses=1]
19
20cont:           ; preds = %call, %entry
21        %P2 = phi i32* [ %P, %call ], [ null, %entry ]          ; <i32*> [#uses=1]
22        %V = load i32, i32* %P2              ; <i32> [#uses=1]
23        ret i32 %V
24
25N:              ; preds = %call
26        %exn = landingpad {i8*, i32}
27                 cleanup
28        ret i32 0
29}
30
31declare i32 @__gxx_personality_v0(...)
32