Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / InstCombine / 2004-01-13-InstCombineInvokePHI.ll
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: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output
9
10 declare sbyte* %test()
11
12 int %foo() {
13 entry:
14   br bool true, label %cont, label %call
15 call:
16   %P = invoke int*()* cast (sbyte*()* %test to int*()*)()
17        to label %cont except label %N
18 cont:
19   %P2 = phi int* [%P, %call], [null, %entry]
20   %V = load int* %P2
21   ret int %V
22 N:
23   ret int 0
24 }