1; RUN: opt < %s -tbaa -basic-aa -gvn -S | FileCheck %s 2 3; Test that basic alias queries work. 4 5; CHECK: @test0_yes 6; CHECK: add i8 %x, %x 7define i8 @test0_yes(i8* %a, i8* %b) nounwind { 8 %x = load i8, i8* %a, !tbaa !1 9 store i8 0, i8* %b, !tbaa !2 10 %y = load i8, i8* %a, !tbaa !1 11 %z = add i8 %x, %y 12 ret i8 %z 13} 14 15; CHECK: @test0_no 16; CHECK: add i8 %x, %y 17define i8 @test0_no(i8* %a, i8* %b) nounwind { 18 %x = load i8, i8* %a, !tbaa !3 19 store i8 0, i8* %b, !tbaa !4 20 %y = load i8, i8* %a, !tbaa !3 21 %z = add i8 %x, %y 22 ret i8 %z 23} 24 25; Test that basic invariant-memory queries work. 26 27; CHECK: @test1_yes 28; CHECK: add i8 %x, %x 29define i8 @test1_yes(i8* %a, i8* %b) nounwind { 30 %x = load i8, i8* %a, !tbaa !5 31 store i8 0, i8* %b 32 %y = load i8, i8* %a, !tbaa !5 33 %z = add i8 %x, %y 34 ret i8 %z 35} 36 37; CHECK: @test1_no 38; CHECK: add i8 %x, %y 39define i8 @test1_no(i8* %a, i8* %b) nounwind { 40 %x = load i8, i8* %a, !tbaa !6 41 store i8 0, i8* %b 42 %y = load i8, i8* %a, !tbaa !6 43 %z = add i8 %x, %y 44 ret i8 %z 45} 46 47; Root note. 48!0 = !{ } 49; Some type. 50!1 = !{!7, !7, i64 0} 51; Some other non-aliasing type. 52!2 = !{!8, !8, i64 0} 53 54; Some type. 55!3 = !{!9, !9, i64 0} 56; Some type in a different type system. 57!4 = !{!10, !10, i64 0} 58 59; Invariant memory. 60!5 = !{!11, !11, i64 0, i1 1} 61; Not invariant memory. 62!6 = !{!11, !11, i64 0, i1 0} 63!7 = !{ !"foo", !0 } 64!8 = !{ !"bar", !0 } 65!9 = !{ !"foo", !0 } 66!10 = !{ !"bar", !12 } 67!11 = !{ !"qux", !0} 68!12 = !{!"different"} 69