[PATCH] D142948: [OpenCL] Disable vector to scalar types coercion for OpenCL
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 3 12:31:06 PST 2023
Anastasia added a comment.
It doesn't seem to make sense to have a `LangOpt` for this, if anything a new `CodeGenOpt` feels like a better fit. Then you should probably extend existing classify functions to prevent coercion instead of adding yet another function otherwise you will need to handle all the different corner cases again as there seem to be quite many if I look at `X86_32ABIInfo::classifyReturnType`...
FYI OpenCL vectors are implemented as generic vector extension so this probably shouldn't be bind to OpenCL at all:
https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors?
Perhaps it can be a general feature to prevent coercion? But then other targets have similar logic too... should it then be more generalized?
> Such behavior is completely valid for x86, but the backend vectorizer
> cannot work with scalars instead of vectors.
>
> With this patch, argument and result types will be leaved unchanged in
> the CodeGen.
>
> New option fopencl-force-vector-abi is also added to force-disables
> vector to scalar coercion when provided.
Do you have any public examples to look at? The coercion is part of the ABI so it should ideally be respected by other tools.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142948/new/
https://reviews.llvm.org/D142948
More information about the cfe-commits
mailing list