[clang] f290c00 - [TBAA] Add additional bitfield tests.
Florian Hahn via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 26 04:36:11 PST 2024
Author: Florian Hahn
Date: 2024-02-26T12:36:00Z
New Revision: f290c000d87bfc72a31b151dffa2d190596ebe91
URL: https://github.com/llvm/llvm-project/commit/f290c000d87bfc72a31b151dffa2d190596ebe91
DIFF: https://github.com/llvm/llvm-project/commit/f290c000d87bfc72a31b151dffa2d190596ebe91.diff
LOG: [TBAA] Add additional bitfield tests.
Additional test for https://github.com/llvm/llvm-project/pull/82922/.
Added:
Modified:
clang/test/CodeGen/tbaa-struct.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGen/tbaa-struct.cpp b/clang/test/CodeGen/tbaa-struct.cpp
index ff5521fcf3f604..e25fbc1a778103 100644
--- a/clang/test/CodeGen/tbaa-struct.cpp
+++ b/clang/test/CodeGen/tbaa-struct.cpp
@@ -109,8 +109,6 @@ struct NamedBitfields {
double f3;
};
-NamedBitfields g;
-
void copy8(NamedBitfields *a1, NamedBitfields *a2) {
// CHECK-LABEL: _Z5copy8P14NamedBitfieldsS0_
// CHECK: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %a1, ptr noundef nonnull align 8 dereferenceable(16) %a2, i64 16, i1 false),
@@ -119,6 +117,23 @@ void copy8(NamedBitfields *a1, NamedBitfields *a2) {
*a1 = *a2;
}
+struct NamedBitfields2 {
+ char a, b, c;
+ signed f0 : 3;
+ unsigned f1 : 4;
+ char f2 : 7;
+ double f3;
+ unsigned f4 : 4;
+};
+
+void copy9(NamedBitfields2 *a1, NamedBitfields2 *a2) {
+// CHECK-LABEL: _Z5copy9P15NamedBitfields2S0_
+// CHECK: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %a1, ptr noundef nonnull align 8 dereferenceable(24) %a2, i64 24, i1 false),
+// CHECK-OLD-SAME: !tbaa.struct [[TS7:!.*]]
+// CHECK-NEW-SAME: !tbaa [[TAG_NamedBitfields2:!.+]], !tbaa.struct
+ *a1 = *a2;
+}
+
// CHECK-OLD: [[TS]] = !{i64 0, i64 2, !{{.*}}, i64 4, i64 4, !{{.*}}, i64 8, i64 1, !{{.*}}, i64 12, i64 4, !{{.*}}}
// CHECK-OLD: [[CHAR:!.*]] = !{!"omnipotent char", !{{.*}}}
// CHECK-OLD: [[TAG_INT:!.*]] = !{[[INT:!.*]], [[INT]], i64 0}
@@ -133,6 +148,7 @@ void copy8(NamedBitfields *a1, NamedBitfields *a2) {
// CHECK-OLD: [[TS6]] = !{i64 0, i64 4, [[TAG_INT]], i64 1, i64 4, [[TAG_INT]], i64 2, i64 1, [[TAG_CHAR]], i64 8, i64 8, [[TAG_DOUBLE:!.+]]}
// CHECK-OLD: [[TAG_DOUBLE]] = !{[[DOUBLE:!.+]], [[DOUBLE]], i64 0}
// CHECK-OLD [[DOUBLE]] = !{!"double", [[CHAR]], i64 0}
+// CHECK-OLD: [[TS7]] = !{i64 0, i64 1, [[TAG_CHAR]], i64 1, i64 1, [[TAG_CHAR]], i64 2, i64 1, [[TAG_CHAR]], i64 3, i64 4, [[TAG_INT]], i64 3, i64 4, [[TAG_INT]], i64 4, i64 1, [[TAG_CHAR]], i64 8, i64 8, [[TAG_DOUBLE]], i64 16, i64 4, [[TAG_INT]]}
// CHECK-NEW-DAG: [[TYPE_char:!.*]] = !{{{.*}}, i64 1, !"omnipotent char"}
// CHECK-NEW-DAG: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0, i64 0}
@@ -150,3 +166,5 @@ void copy8(NamedBitfields *a1, NamedBitfields *a2) {
// CHECK-NEW-DAG: [[TAG_NamedBitfields]] = !{[[TYPE_NamedBitfields:!.+]], [[TYPE_NamedBitfields]], i64 0, i64 16}
// CHECK-NEW-DAG: [[TYPE_NamedBitfields]] = !{[[TYPE_char]], i64 16, !"_ZTS14NamedBitfields", [[TYPE_int]], i64 0, i64 4, [[TYPE_int]], i64 1, i64 4, [[TYPE_char]], i64 2, i64 1, [[TYPE_double:!.+]], i64 8, i64 8}
// CHECK-NEW-DAG: [[TYPE_double]] = !{[[TYPE_char]], i64 8, !"double"}
+// CHECK-NEW-DAG: [[TAG_NamedBitfields2]] = !{[[TYPE_NamedBitfields2:!.+]], [[TYPE_NamedBitfields2]], i64 0, i64 24}
+// CHECK-NEW-DAG: [[TYPE_NamedBitfields2]] = !{[[TYPE_char]], i64 24, !"_ZTS15NamedBitfields2", [[TYPE_char]], i64 0, i64 1, [[TYPE_char]], i64 1, i64 1, [[TYPE_char]], i64 2, i64 1, [[TYPE_int]], i64 3, i64 4, [[TYPE_int]], i64 3, i64 4, [[TYPE_char]], i64 4, i64 1, [[TYPE_double]], i64 8, i64 8, [[TYPE_int]], i64 16, i64 4}
More information about the cfe-commits
mailing list