clang forcing 8-bytes alignment preference for 64-bit type. Why?

From ASTContext.cpp

unsigned ASTContext::getPreferredTypeAlign(const Type *T) const {
unsigned ABIAlign = getTypeAlign(T);

// Double and long long should be naturally aligned if possible.
if (const ComplexType* CT = T->getAs())
T = CT->getElementType().getTypePtr();
if (T->isSpecificBuiltinType(BuiltinType::Double) ||
T->isSpecificBuiltinType(BuiltinType::LongLong) ||
T->isSpecificBuiltinType(BuiltinType::ULongLong))
return std::max(ABIAlign, (unsigned)getTypeSize(T));

return ABIAlign;
}

Why is it necessary for clang to force 8-byte alignment for 8-byte type?
That information can already be specified in TargetInfo if the architecture requires such alignment preference.

I am asking because I am working on a CPU where 8-byte alignment for 64-bit type is not required (4-bytes is just as fine).

I would like to remove that special case forcing for 64-bit type in ASTContext::getPreferredTypeAlign.

Any objection?

Yes, I object, at least until you can make a convincing argument that this is completely safe and won't penalize other targets. Did you at least look back through the history of that code to see who added it and why? Setting the alignment in the TargetInfo does not cover all the cases that getPreferredTypeAlign() is used for.

Agreed, though the preferred type alignment should probably be CPU+OS
specific and set there with whatever we'd like to default to in
getPreferredTypeAlign().

-eric