Question about TBAA MDNode generation for pointer type

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.


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.


JinGu Kang