1 ; RUN: opt < %s -tbaa -basicaa -dse -S | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 ; DSE should make use of TBAA.
7 ; CHECK-NEXT: load i8, i8* %b
8 ; CHECK-NEXT: store i8 1, i8* %a
9 ; CHECK-NEXT: ret i8 %y
10 define i8 @test0_yes(i8* %a, i8* %b) nounwind {
11 store i8 0, i8* %a, !tbaa !1
12 %y = load i8, i8* %b, !tbaa !2
13 store i8 1, i8* %a, !tbaa !1
18 ; CHECK-NEXT: store i8 0, i8* %a
19 ; CHECK-NEXT: load i8, i8* %b
20 ; CHECK-NEXT: store i8 1, i8* %a
21 ; CHECK-NEXT: ret i8 %y
22 define i8 @test0_no(i8* %a, i8* %b) nounwind {
23 store i8 0, i8* %a, !tbaa !3
24 %y = load i8, i8* %b, !tbaa !4
25 store i8 1, i8* %a, !tbaa !3
30 ; CHECK-NEXT: load i8, i8* %b
31 ; CHECK-NEXT: store i8 1, i8* %a
32 ; CHECK-NEXT: ret i8 %y
33 define i8 @test1_yes(i8* %a, i8* %b) nounwind {
35 %y = load i8, i8* %b, !tbaa !5
41 ; CHECK-NEXT: store i8 0, i8* %a
42 ; CHECK-NEXT: load i8, i8* %b
43 ; CHECK-NEXT: store i8 1, i8* %a
44 ; CHECK-NEXT: ret i8 %y
45 define i8 @test1_no(i8* %a, i8* %b) nounwind {
47 %y = load i8, i8* %b, !tbaa !6
56 ; Some other non-aliasing type.
61 ; Some type in a different type system.
62 !4 = !{!10, !10, i64 0}
65 !5 = !{!11, !11, i64 0, i1 1}
66 ; Not invariant memory.
67 !6 = !{!11, !11, i64 0, i1 0}