[cfe-dev] Question about TBAA MDNode generation for pointer type

Jingu Kang via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 4 02:53:42 PDT 2021


Hi All,

I have a question about TBAA MDNode generation for pointer type. It looks like clang generates same MDNode for different pointer types as below.

clang/lib/CodeGen/CodeGenTBAA.cpp
llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
…
  // Handle pointers and references.
  // TODO: Implement C++'s type "similarity" and consider dis-"similar"
  // pointers distinct.
  if (Ty->isPointerType() || Ty->isReferenceType())
    return createScalarTypeNode("any pointer", getChar(), Size);

It seems gcc creates different alias sets for different pointer types. I can not find the clear background reference about the alias rule for pointer type…
If the gcc’s alias rule for pointer type is correct, I would like to suggest for clang to follow it… because the alias analysis is quite crucial for performance…
If I missed something, please let me know.

Thanks
JinGu Kang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211104/0f0c3eb9/attachment.html>


More information about the cfe-dev mailing list