1 ; RUN: opt < %s -passes=gvn -S | FileCheck %s
3 define i32 @main(ptr %p, i32 %x, i32 %y) {
6 %cmp = icmp eq i32 %x, %y
7 br i1 %cmp, label %block2, label %block3
13 %b = bitcast i32 0 to i32
18 %DEAD = load i32, ptr %p
22 ; CHECK: define i32 @main(ptr %p, i32 %x, i32 %y) {
24 ; CHECK-NOT: %z = load i32, ptr %p
25 ; CHECK-NEXT: %cmp = icmp eq i32 %x, %y
26 ; CHECK-NEXT: br i1 %cmp, label %block2, label %block3
28 ; CHECK-NEXT: %DEAD.pre = load i32, ptr %p
29 ; CHECK-NEXT: br label %block4
31 ; CHECK-NEXT: store i32 0, ptr %p
32 ; CHECK-NEXT: br label %block4
34 ; CHECK-NEXT: %DEAD = phi i32 [ 0, %block3 ], [ %DEAD.pre, %block2 ]
35 ; CHECK-NEXT: ret i32 %DEAD