1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -scoped-noalias-aa -dse < %s | FileCheck %s
3
4; Assume that %p1 != %p2 if and only if %c is true. In that case the noalias
5; metadata is correct, but the first store cannot be eliminated, as it may be
6; read-clobbered by the load.
7define void @test(i1 %c, i8* %p1, i8* %p2) {
8; CHECK-LABEL: @test(
9; CHECK-NEXT:    store i8 0, i8* [[P1:%.*]], align 1
10; CHECK-NEXT:    [[TMP1:%.*]] = load i8, i8* [[P2:%.*]], align 1, !alias.scope !0
11; CHECK-NEXT:    br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
12; CHECK:       if:
13; CHECK-NEXT:    store i8 1, i8* [[P1]], align 1, !noalias !0
14; CHECK-NEXT:    ret void
15; CHECK:       else:
16; CHECK-NEXT:    store i8 2, i8* [[P1]], align 1
17; CHECK-NEXT:    ret void
18;
19  store i8 0, i8* %p1
20  load i8, i8* %p2, !alias.scope !2
21  br i1 %c, label %if, label %else
22
23if:
24  store i8 1, i8* %p1, !noalias !2
25  ret void
26
27else:
28  store i8 2, i8* %p1
29  ret void
30}
31
32!0 = !{!0}
33!1 = !{!1, !0}
34!2 = !{!1}
35