llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-codegen Author: Florian Hahn (fhahn) <details> <summary>Changes</summary> Without this bail out, we may generate fields with null nodes as tags are generated by using getTypeInfo which has the same bail out. --- Full diff: https://github.com/llvm/llvm-project/pull/84386.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CodeGenTBAA.cpp (+3) - (modified) clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp (-2) ``````````diff diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp index 8a081612193978..1f07205a5af225 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -343,6 +343,9 @@ CodeGenTBAA::CollectFields(uint64_t BaseOffset, llvm::MDNode * CodeGenTBAA::getTBAAStructInfo(QualType QTy) { + if (CodeGenOpts.OptimizationLevel == 0 || CodeGenOpts.RelaxedAliasing) + return nullptr; + const Type *Ty = Context.getCanonicalType(QTy).getTypePtr(); if (llvm::MDNode *N = StructMetadataCache[Ty]) diff --git a/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp b/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp index 931ff2476cd1bb..ce613b9d6b23f8 100644 --- a/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp +++ b/clang/test/CodeGen/tbaa-struct-relaxed-aliasing-with-tsan.cpp @@ -5,9 +5,7 @@ // 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 { `````````` </details> https://github.com/llvm/llvm-project/pull/84386 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits