1 ; RUN: opt < %s -tbaa -basicaa -dse -S | FileCheck %s
3 ; DSE should make use of TBAA.
6 ; CHECK-NEXT: load i8* %b
7 ; CHECK-NEXT: store i8 1, i8* %a
8 ; CHECK-NEXT: ret i8 %y
9 define i8 @test0_yes(i8* %a, i8* %b) nounwind {
10 store i8 0, i8* %a, !tbaa !1
11 %y = load i8* %b, !tbaa !2
12 store i8 1, i8* %a, !tbaa !1
17 ; CHECK-NEXT: store i8 0, i8* %a
18 ; CHECK-NEXT: load i8* %b
19 ; CHECK-NEXT: store i8 1, i8* %a
20 ; CHECK-NEXT: ret i8 %y
21 define i8 @test0_no(i8* %a, i8* %b) nounwind {
22 store i8 0, i8* %a, !tbaa !3
23 %y = load i8* %b, !tbaa !4
24 store i8 1, i8* %a, !tbaa !3
29 ; CHECK-NEXT: load i8* %b
30 ; CHECK-NEXT: store i8 1, i8* %a
31 ; CHECK-NEXT: ret i8 %y
32 define i8 @test1_yes(i8* %a, i8* %b) nounwind {
34 %y = load i8* %b, !tbaa !5
40 ; CHECK-NEXT: store i8 0, i8* %a
41 ; CHECK-NEXT: load i8* %b
42 ; CHECK-NEXT: store i8 1, i8* %a
43 ; CHECK-NEXT: ret i8 %y
44 define i8 @test1_no(i8* %a, i8* %b) nounwind {
46 %y = load i8* %b, !tbaa !6
54 !1 = metadata !{ metadata !"foo", metadata !0 }
55 ; Some other non-aliasing type.
56 !2 = metadata !{ metadata !"bar", metadata !0 }
59 !3 = metadata !{ metadata !"foo", metadata !0 }
60 ; Some type in a different type system.
61 !4 = metadata !{ metadata !"bar", metadata !"different" }
64 !5 = metadata !{ metadata !"qux", metadata !0, i1 1 }
65 ; Not invariant memory.
66 !6 = metadata !{ metadata !"qux", metadata !0, i1 0 }