================
@@ -82,3 +89,123 @@ bool TargetInfo::maybeCommonClassifyReturnType(FunctionInfo 
&FI) const {
 
   return false;
 }
+
+namespace {
+
+bool isEmptyRecordForHA(const Type *Ty) {
+  const auto *RT = dyn_cast<RecordType>(Ty);
+  return RT && RT->isEmpty();
+}
+
+/// Storage-container width mirroring Clang's ASTContext::getTypeSize for the
+/// types that matter to homogeneous-aggregate detection.
+uint64_t getHATypeSizeInBits(const Type *Ty) {
+  if (const auto *VT = dyn_cast<VectorType>(Ty)) {
+    uint64_t EltWidth = VT->getElementType()->getSizeInBits().getFixedValue();
+    uint64_t Width = std::max<uint64_t>(
+        8, EltWidth * VT->getNumElements().getKnownMinValue());
+    if (Width & (Width - 1))
+      Width = alignTo(Width, bit_ceil(Width));
----------------
madhur13490 wrote:

This can be simplified to Width = llvm::bit_ceil(Width).

https://github.com/llvm/llvm-project/pull/218799
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to