[clang] 167b90d - [TBAA] Add test showing tbaa.struct being generated with relaxed-alias.

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 13:42:40 PST 2024


Author: Florian Hahn
Date: 2024-03-07T21:40:23Z
New Revision: 167b90d0401d0fe488195c7e3d6fc1edc8fc5d94

URL: https://github.com/llvm/llvm-project/commit/167b90d0401d0fe488195c7e3d6fc1edc8fc5d94
DIFF: https://github.com/llvm/llvm-project/commit/167b90d0401d0fe488195c7e3d6fc1edc8fc5d94.diff

LOG: [TBAA] Add test showing tbaa.struct being generated with relaxed-alias.

Add test showing that tbaa.struct is generated when using TSan with
relaxed-aliasing.

Added: 
    clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp b/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp
new file mode 100644
index 00000000000000..931ff2476cd1bb
--- /dev/null
+++ b/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - -O1 -relaxed-aliasing -fsanitize=thread -disable-llvm-optzns %s | \
+// RUN:     FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -new-struct-path-tbaa \
+// RUN:     -emit-llvm -o - -O1 -relaxed-aliasing -fsanitize=thread -disable-llvm-optzns %s | \
+// RUN:     FileCheck %s
+//
+// Check that we do not create tbaa for instructions generated for copies.
+// FIXME: !tbaa.struct is generated with null node as tag.
+
+// CHECK: !tbaa.struct
+// CHECK-NOT: !tbaa
+
+struct A {
+  short s;
+  int i;
+  char c;
+  int j;
+};
+
+void copyStruct(A *a1, A *a2) {
+  *a1 = *a2;
+}
+
+void copyInt(int *a, int *b) {
+  *a = *b;
+}


        


More information about the cfe-commits mailing list