1 ; RUN: opt < %s -gvn -S | grep {%cv = phi i32}
2 ; RUN: opt < %s -gvn -S | grep {%bv = phi i32}
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i386-apple-darwin7"
6 define i32 @g(i32* %b, i32* %c) nounwind {
8 %g = alloca i32 ; <i32*> [#uses=4]
9 %t1 = icmp eq i32* %b, null ; <i1> [#uses=1]
10 br i1 %t1, label %bb, label %bb1
13 %t2 = load i32* %c, align 4 ; <i32> [#uses=1]
14 %t3 = add i32 %t2, 1 ; <i32> [#uses=1]
15 store i32 %t3, i32* %g, align 4
19 %t5 = load i32* %b, align 4 ; <i32> [#uses=1]
20 %t6 = add i32 %t5, 1 ; <i32> [#uses=1]
21 store i32 %t6, i32* %g, align 4
24 bb2: ; preds = %bb1, %bb
25 %c_addr.0 = phi i32* [ %g, %bb1 ], [ %c, %bb ] ; <i32*> [#uses=1]
26 %b_addr.0 = phi i32* [ %b, %bb1 ], [ %g, %bb ] ; <i32*> [#uses=1]
27 %cv = load i32* %c_addr.0, align 4 ; <i32> [#uses=1]
28 %bv = load i32* %b_addr.0, align 4 ; <i32> [#uses=1]
29 %ret = add i32 %cv, %bv ; <i32> [#uses=1]