[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)
Bushev Dmitry via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 10:03:59 PST 2024
================
@@ -105,13 +105,34 @@ static bool isValidBaseType(QualType QTy) {
if (RD->hasFlexibleArrayMember())
return false;
// RD can be struct, union, class, interface or enum.
- // For now, we only handle struct and class.
- if (RD->isStruct() || RD->isClass())
+ if (RD->isStruct() || RD->isClass() ||
+ (RD->isUnion() && CodeGenOpts.UnionTBAA))
return true;
}
return false;
}
+// Give unique tag for compatible types.
+std::string CodeGenTBAA::getPointeeName(const Type *Ty) {
----------------
dybv-sc wrote:
Changed function to append to raw_ostream.
`Ty` here is coming from `getPointeeType()` so it may be not canonical, right?
https://github.com/llvm/llvm-project/pull/75177
More information about the cfe-commits
mailing list