[PATCH] D96250: [CostModel] An extending load to illegal type is not free.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 13:26:12 PST 2021


sdesmalen added a comment.

In D96250#2556268 <https://reviews.llvm.org/D96250#2556268>, @dmgreen wrote:

> Ah I see. I guess it should be working on the maximum of the two type legalization costs, and the same number of vector lanes for each type? But that looks like a larger change throughout getCastInstrCost.

The cost of legalization is basically the cost of splitting the type. When splitting, either both (Src/Dst) have a legalization cost of 1, or the extended-type has a higher legalization cost than the source type. For that the code is now doing the right thing, either the extend is free (both cost of 1), or it continues down in this function to calculate a cost. When the destination type is legal and the source vector is widened, both have a legalization cost of 1 (no splitting occurred). Having the extend still be free makes sense because the widening doesn't actually happen, the extend operation is directly folded into the load, which results in v2i64.

> I think this splitting the same number of times still makes sense as a heuristic.

Thanks for giving it another look!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96250/new/

https://reviews.llvm.org/D96250



More information about the llvm-commits mailing list