Skip to content

Commit

Permalink
[TBAA] Add test showing tbaa.struct being generated with relaxed-alias.
Browse files Browse the repository at this point in the history
Add test showing that tbaa.struct is generated when using TSan with
relaxed-aliasing.
  • Loading branch information
fhahn committed Mar 7, 2024
1 parent ced1fac commit 167b90d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 167b90d

Please sign in to comment.