[PATCH] D91984: [CostModel] Add basic implementation of getGatherScatterOpCost.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 24 02:58:28 PST 2020
fhahn updated this revision to Diff 307294.
fhahn added a comment.
Updated cost computation for variable masks, also include the cost of extracting the addresses from the address vector.
In D91984#2413019 <https://reviews.llvm.org/D91984#2413019>, @dmgreen wrote:
> Hmm. I still don't think it's a great idea to try to SLP vectorize using gather operations if the target does not have any gathers! Having a better base cost does sound good though.
I think how we treat it in SLP exactly is a separate issue. I think assigning a more accurate cost will go a long way towards avoiding generating gathers in practice, unless they are beneficial even with the bad lowering.
> I think with a non-constant mask, the cost should be higher? I don't think you can just do it with a select, it will include i1 extracts and branches over whether the lanes are on or off.
Yes it probably should better account for the fact that the mem ops need to be executed conditionally. Not really sure how to best cost that. I updated the cost to include extracting the individual conditions, doing a branch and a PHI to combine the result. With that, the cost is not really that much higher. Perhaps something else is missing, or it might be better to just return a sufficiently high number in that case?
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 16942 bytes
Desc: not available
More information about the llvm-commits