1 ; RUN: opt < %s -tbaa -basicaa -gvn -S | FileCheck %s
3 ; Test that basic alias queries work.
7 define i8 @test0_yes(i8* %a, i8* %b) nounwind {
8 %x = load i8* %a, !tbaa !1
9 store i8 0, i8* %b, !tbaa !2
10 %y = load i8* %a, !tbaa !1
16 ; CHECK: add i8 %x, %y
17 define i8 @test0_no(i8* %a, i8* %b) nounwind {
18 %x = load i8* %a, !tbaa !3
19 store i8 0, i8* %b, !tbaa !4
20 %y = load i8* %a, !tbaa !3
25 ; Test that basic invariant-memory queries work.
28 ; CHECK: add i8 %x, %x
29 define i8 @test1_yes(i8* %a, i8* %b) nounwind {
30 %x = load i8* %a, !tbaa !5
32 %y = load i8* %a, !tbaa !5
38 ; CHECK: add i8 %x, %y
39 define i8 @test1_no(i8* %a, i8* %b) nounwind {
40 %x = load i8* %a, !tbaa !6
42 %y = load i8* %a, !tbaa !6
50 !1 = metadata !{ metadata !"foo", metadata !0 }
51 ; Some other non-aliasing type.
52 !2 = metadata !{ metadata !"bar", metadata !0 }
55 !3 = metadata !{ metadata !"foo", metadata !0 }
56 ; Some type in a different type system.
57 !4 = metadata !{ metadata !"bar", metadata !"different" }
60 !5 = metadata !{ metadata !"qux", metadata !0, i1 1 }
61 ; Not invariant memory.
62 !6 = metadata !{ metadata !"qux", metadata !0, i1 0 }