rogfer01 created this revision. rogfer01 added a reviewer: rsmith. rogfer01 added a subscriber: cfe-commits.
This commit extends tbaa.cpp to just make sure that tbaa markers are not emitted when they should not. http://reviews.llvm.org/D21295 Files: test/CodeGen/tbaa.cpp
Index: test/CodeGen/tbaa.cpp =================================================================== --- test/CodeGen/tbaa.cpp +++ test/CodeGen/tbaa.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -no-struct-path-tbaa -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O0 -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA +// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -relaxed-aliasing -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA // Test TBAA metadata generated by front-end. typedef unsigned char uint8_t; @@ -51,6 +53,9 @@ // PATH-LABEL: define i32 @_Z1g // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_i32:!.*]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z1g +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} *s = 1; A->f32 = 4; return *s; @@ -63,6 +68,9 @@ // PATH-LABEL: define i32 @_Z2g2 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_i32]] // PATH: store i16 4, i16* %{{.*}}, align 4, !tbaa [[TAG_A_f16:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g2 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i16 4, i16* %{{.*}}, align 4{{ *$}} *s = 1; A->f16 = 4; return *s; @@ -75,6 +83,9 @@ // PATH-LABEL: define i32 @_Z2g3 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_B_a_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g3 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} A->f32 = 1; B->a.f32 = 4; return A->f32; @@ -87,6 +98,9 @@ // PATH-LABEL: define i32 @_Z2g4 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i16 4, i16* %{{.*}}, align 4, !tbaa [[TAG_B_a_f16:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g4 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i16 4, i16* %{{.*}}, align 4{{ *$}} A->f32 = 1; B->a.f16 = 4; return A->f32; @@ -99,6 +113,9 @@ // PATH-LABEL: define i32 @_Z2g5 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_B_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g5 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} A->f32 = 1; B->f32 = 4; return A->f32; @@ -111,6 +128,9 @@ // PATH-LABEL: define i32 @_Z2g6 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_B_a_f32_2:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g6 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} A->f32 = 1; B->a.f32_2 = 4; return A->f32; @@ -123,6 +143,9 @@ // PATH-LABEL: define i32 @_Z2g7 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g7 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} A->f32 = 1; S->f32 = 4; return A->f32; @@ -135,6 +158,9 @@ // PATH-LABEL: define i32 @_Z2g8 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_A_f32]] // PATH: store i16 4, i16* %{{.*}}, align 4, !tbaa [[TAG_S_f16:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g8 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i16 4, i16* %{{.*}}, align 4{{ *$}} A->f32 = 1; S->f16 = 4; return A->f32; @@ -147,6 +173,9 @@ // PATH-LABEL: define i32 @_Z2g9 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_S2_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z2g9 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} S->f32 = 1; S2->f32 = 4; return S->f32; @@ -159,6 +188,9 @@ // PATH-LABEL: define i32 @_Z3g10 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]] // PATH: store i16 4, i16* %{{.*}}, align 4, !tbaa [[TAG_S2_f16:!.*]] +// NO-TBAA-LABEL: define i32 @_Z3g10 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i16 4, i16* %{{.*}}, align 4{{ *$}} S->f32 = 1; S2->f16 = 4; return S->f32; @@ -171,6 +203,9 @@ // PATH-LABEL: define i32 @_Z3g11 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_C_b_a_f32:!.*]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_D_b_a_f32:!.*]] +// NO-TBAA-LABEL: define i32 @_Z3g11 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} C->b.a.f32 = 1; D->b.a.f32 = 4; return C->b.a.f32; @@ -184,6 +219,9 @@ // PATH-LABEL: define i32 @_Z3g12 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_B_a_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_B_a_f32]] +// NO-TBAA-LABEL: define i32 @_Z3g12 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} StructB *b1 = &(C->b); StructB *b2 = &(D->b); // b1, b2 have different context. @@ -206,6 +244,8 @@ // CHECK: load i8, i8* %{{.*}}, align 1, !tbaa [[TAG_char:!.*]] // PATH-LABEL: define signext i8 @_Z3g13 // PATH: load i8, i8* %{{.*}}, align 1, !tbaa [[TAG_five_b:!.*]] +// NO-TBAA-LABEL: define signext i8 @_Z3g13 +// NO-TBAA: load i8, i8* %{{.*}}, align 1{{ *$}} } struct six { @@ -219,6 +259,8 @@ // CHECK: load i8, i8* %{{.*}}, align 1, !tbaa [[TAG_char]] // PATH-LABEL: define signext i8 @_Z3g14 // PATH: load i8, i8* %{{.*}}, align 1, !tbaa [[TAG_six_b:!.*]] +// NO-TBAA-LABEL: define signext i8 @_Z3g14 +// NO-TBAA: load i8, i8* %{{.*}}, align 1{{ *$}} return a->b; } @@ -231,6 +273,9 @@ // PATH-LABEL: define i32 @_Z3g15 // PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]] // PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa [[TAG_S_f32]] +// NO-TBAA-LABEL: define i32 @_Z3g15 +// NO-TBAA: store i32 1, i32* %{{.*}}, align 4{{ *$}} +// NO-TBAA: store i32 4, i32* %{{.*}}, align 4{{ *$}} S->f32 = 1; S3->f32 = 4; return S->f32; @@ -244,6 +289,14 @@ // CHECK: [[TYPE_i16]] = !{!"short", [[TYPE_char]], // CHECK: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0} +// NO-TBAA-NOT: [[TYPE_char:!.*]] = !{!"omnipotent char", [[TAG_cxx_tbaa:!.*]], +// NO-TBAA-NOT: [[TAG_cxx_tbaa]] = !{!"Simple C++ TBAA"} +// NO-TBAA-NOT: [[TAG_i32]] = !{[[TYPE_i32:!.*]], [[TYPE_i32]], i64 0} +// NO-TBAA-NOT: [[TYPE_i32]] = !{!"int", [[TYPE_char]], +// NO-TBAA-NOT: [[TAG_i16]] = !{[[TYPE_i16:!.*]], [[TYPE_i16]], i64 0} +// NO-TBAA-NOT: [[TYPE_i16]] = !{!"short", [[TYPE_char]], +// NO-TBAA-NOT: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0} + // PATH: [[TYPE_CHAR:!.*]] = !{!"omnipotent char", ! // PATH: [[TAG_i32]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0} // PATH: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR]] @@ -270,3 +323,30 @@ // PATH: [[TYPE_five]] = !{!"_ZTS4five", [[TYPE_CHAR]], i64 0, [[TYPE_INT]], i64 1, [[TYPE_CHAR]], i64 1, [[TYPE_CHAR]], i64 2} // PATH: [[TAG_six_b]] = !{[[TYPE_six:!.*]], [[TYPE_CHAR]], i64 4} // PATH: [[TYPE_six]] = !{!"_ZTS3six", [[TYPE_CHAR]], i64 0, [[TYPE_INT]], i64 4, [[TYPE_CHAR]], i64 4, [[TYPE_CHAR]], i64 5} + +// NO-TBAA-NOT: [[TYPE_CHAR:!.*]] = !{!"omnipotent char", ! +// NO-TBAA-NOT: [[TAG_i32]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0} +// NO-TBAA-NOT: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR]] +// NO-TBAA-NOT: [[TAG_A_f32]] = !{[[TYPE_A:!.*]], [[TYPE_INT]], i64 4} +// NO-TBAA-NOT: [[TYPE_A]] = !{!"_ZTS7StructA", [[TYPE_SHORT:!.*]], i64 0, [[TYPE_INT]], i64 4, [[TYPE_SHORT]], i64 8, [[TYPE_INT]], i64 12} +// NO-TBAA-NOT: [[TYPE_SHORT:!.*]] = !{!"short", [[TYPE_CHAR]] +// NO-TBAA-NOT: [[TAG_A_f16]] = !{[[TYPE_A]], [[TYPE_SHORT]], i64 0} +// NO-TBAA-NOT: [[TAG_B_a_f32]] = !{[[TYPE_B:!.*]], [[TYPE_INT]], i64 8} +// NO-TBAA-NOT: [[TYPE_B]] = !{!"_ZTS7StructB", [[TYPE_SHORT]], i64 0, [[TYPE_A]], i64 4, [[TYPE_INT]], i64 20} +// NO-TBAA-NOT: [[TAG_B_a_f16]] = !{[[TYPE_B]], [[TYPE_SHORT]], i64 4} +// NO-TBAA-NOT: [[TAG_B_f32]] = !{[[TYPE_B]], [[TYPE_INT]], i64 20} +// NO-TBAA-NOT: [[TAG_B_a_f32_2]] = !{[[TYPE_B]], [[TYPE_INT]], i64 16} +// NO-TBAA-NOT: [[TAG_S_f32]] = !{[[TYPE_S:!.*]], [[TYPE_INT]], i64 4} +// NO-TBAA-NOT: [[TYPE_S]] = !{!"_ZTS7StructS", [[TYPE_SHORT]], i64 0, [[TYPE_INT]], i64 4} +// NO-TBAA-NOT: [[TAG_S_f16]] = !{[[TYPE_S]], [[TYPE_SHORT]], i64 0} +// NO-TBAA-NOT: [[TAG_S2_f32]] = !{[[TYPE_S2:!.*]], [[TYPE_INT]], i64 4} +// NO-TBAA-NOT: [[TYPE_S2]] = !{!"_ZTS8StructS2", [[TYPE_SHORT]], i64 0, [[TYPE_INT]], i64 4} +// NO-TBAA-NOT: [[TAG_S2_f16]] = !{[[TYPE_S2]], [[TYPE_SHORT]], i64 0} +// NO-TBAA-NOT: [[TAG_C_b_a_f32]] = !{[[TYPE_C:!.*]], [[TYPE_INT]], i64 12} +// NO-TBAA-NOT: [[TYPE_C]] = !{!"_ZTS7StructC", [[TYPE_SHORT]], i64 0, [[TYPE_B]], i64 4, [[TYPE_INT]], i64 28} +// NO-TBAA-NOT: [[TAG_D_b_a_f32]] = !{[[TYPE_D:!.*]], [[TYPE_INT]], i64 12} +// NO-TBAA-NOT: [[TYPE_D]] = !{!"_ZTS7StructD", [[TYPE_SHORT]], i64 0, [[TYPE_B]], i64 4, [[TYPE_INT]], i64 28, [[TYPE_CHAR]], i64 32} +// NO-TBAA-NOT: [[TAG_five_b]] = !{[[TYPE_five:!.*]], [[TYPE_CHAR]], i64 1} +// NO-TBAA-NOT: [[TYPE_five]] = !{!"_ZTS4five", [[TYPE_CHAR]], i64 0, [[TYPE_INT]], i64 1, [[TYPE_CHAR]], i64 1, [[TYPE_CHAR]], i64 2} +// NO-TBAA-NOT: [[TAG_six_b]] = !{[[TYPE_six:!.*]], [[TYPE_CHAR]], i64 4} +// NO-TBAA-NOT: [[TYPE_six]] = !{!"_ZTS3six", [[TYPE_CHAR]], i64 0, [[TYPE_INT]], i64 4, [[TYPE_CHAR]], i64 4, [[TYPE_CHAR]], i64 5}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits