[PATCH] D91059: [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 23:50:42 PST 2020
uabelho added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5805
+ auto GetRegUsage = [&DL, &TTI=TTI](Type *Ty, ElementCount VF) {
if (Ty->isTokenTy())
return 0U;
----------------
sdesmalen wrote:
> The example provided by @uabelho fails for the load instruction (with a struct as result type) which is outside the loop body and isn't actually vectorized, so counting it as a vector register usage seems overly conservative. The `extractvalue` instruction in the body itself is vectorized, which is fine, since the extracted value from the aggregate is a valid element type for a vector.
>
> I suggest addressing the issue with:
> ```
> - if (Ty->isTokenTy())
> + if (Ty->isTokenTy() || !VectorType::isValidElementType(Ty))
> return 0U;
> ```
>
> @uabelho @SjoerdMeijer are you happy with me re-landing the patch with the above change?
I've verified that the above change fixes the problem and in the limited testing I've done of it I haven't seen any new problems. Thanks!
@SjoerdMeijer ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91059/new/
https://reviews.llvm.org/D91059
More information about the llvm-commits
mailing list