8000 [Xtensa] Fix LLVM argument size for bool vectors. · espressif/llvm-project@3dc2319 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3dc2319

Browse files
committed
[Xtensa] Fix LLVM argument size for bool vectors.
Commit d4f4b2f [clang] Fix sizeof of boolean vector changed the result of ASTContext::getTypeSize() for bool vector to at least 8 bits. This commit fixes the Xtensa bool vector size calculation.
1 parent e3f239d commit 3dc2319

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/CodeGen/Targets/Xtensa.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ ABIArgInfo XtensaABIInfo::classifyArgumentType(QualType Ty,
101101

102102
// xtbool
103103
if (getTarget().hasFeature("bool") && Size <= 8 && Ty->isVectorType()) {
104+
// The type size is rounded up to the power of two and at least 8 bits,
105+
// so we need to get the "true" size from num of vector elements
106+
const VectorType *VT = Ty->getAs<VectorType>();
107+
unsigned NumBits = VT->getNumElements();
104108
llvm::Type *ResType =
105-
llvm::FixedVectorType::get(llvm::Type::getInt1Ty(getVMContext()), Size);
109+
llvm::FixedVectorType::get(llvm::Type::getInt1Ty(getVMContext()), NumBits);
106110
return ABIArgInfo::getDirect(ResType);
107111
}
108112
// Vector arguments

0 commit comments

Comments
 (0)
0