[llvm] [clang] Enable OpenCL hostcall printf (WIP) (PR #72556)
Vikram Hegde via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 19 21:57:08 PST 2023
================
@@ -278,7 +310,13 @@ static Value *callBufferedPrintfStart(
StringData(StringRef(), LenWithNull, LenWithNullAligned, false));
}
} else {
- int AllocSize = M->getDataLayout().getTypeAllocSize(Args[i]->getType());
+ int AllocSize = 0;
+ if (OCLVectors.test(i)) {
+ auto VecArg = dyn_cast<FixedVectorType>(Args[i]->getType());
+ assert(VecArg && "invalid vector specifier");
+ AllocSize = VecArg->getNumElements() * 8;
+ } else
+ AllocSize = M->getDataLayout().getTypeAllocSize(Args[i]->getType());
----------------
vikramRH wrote:
I extract individual vector elements, expand them to 8 bytes and store them onto the buffer. The "getTypeAllocSize" would not give me the actual occupied size in the buffer in this case.
https://github.com/llvm/llvm-project/pull/72556
More information about the cfe-commits
mailing list