1 ; RUN: opt < %s -passes=gvn -S | FileCheck %s
3 ; loop.then is not reachable from loop, so we should be able to deduce that the
4 ; store through %phi2 cannot alias %ptr1.
7 define void @test1(ptr %ptr1, ptr %ptr2) {
9 ; CHECK: %[[GEP:.*]] = getelementptr inbounds i32, ptr %ptr1, i64 1
10 ; CHECK: %[[VAL1:.*]] = load i32, ptr %[[GEP]]
12 br label %loop.preheader
15 %gep1 = getelementptr inbounds i32, ptr %ptr1, i64 1
21 %phi1 = phi ptr [ %gep1, %loop.preheader ], [ %phi2, %loop.then ]
22 %val1 = load i32, ptr %phi1
23 br i1 false, label %loop.then, label %loop.if
26 %gep2 = getelementptr inbounds i32, ptr %gep1, i64 1
27 %val2 = load i32, ptr %gep2
28 %cmp = icmp slt i32 %val1, %val2
31 ; CHECK-LABEL: loop.then
32 ; CHECK: store i32 %[[VAL1]], ptr %phi2
34 %phi2 = phi ptr [ %ptr2, %loop ], [ %gep2, %loop.if ]
35 store i32 %val1, ptr %phi2
36 store i32 0, ptr %ptr1