1 ; RUN: opt < %s -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(i32* %ptr1, i32* %ptr2) {
9 ; CHECK: %[[GEP:.*]] = getelementptr inbounds i32, i32* %ptr1, i64 1
10 ; CHECK: %[[VAL1:.*]] = load i32, i32* %[[GEP]]
12 br label %loop.preheader
15 %gep1 = getelementptr inbounds i32, i32* %ptr1, i64 1
21 %phi1 = phi i32* [ %gep1, %loop.preheader ], [ %phi2, %loop.then ]
22 %val1 = load i32, i32* %phi1
23 br i1 false, label %loop.then, label %loop.if
26 %gep2 = getelementptr inbounds i32, i32* %gep1, i64 1
27 %val2 = load i32, i32* %gep2
28 %cmp = icmp slt i32 %val1, %val2
31 ; CHECK-LABEL: loop.then
32 ; CHECK: store i32 %[[VAL1]], i32* %phi2
34 %phi2 = phi i32* [ %ptr2, %loop ], [ %gep2, %loop.if ]
35 store i32 %val1, i32* %phi2
36 store i32 0, i32* %ptr1