[PATCH] D79162: [Analysis] TTI: Add CastContextHint for getCastInstrCost

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 04:31:58 PDT 2020


Pierre-vh added a comment.

In D79162#2012372 <https://reviews.llvm.org/D79162#2012372>, @samparker wrote:

> This feels like a hack to me too, I think we need to move away from passing snippets of information to the instruction cost hooks. There are many other places in the vectorizer where instruction costs are calculated too. What information do we have at this point and what do we need to know? I like the sound of TTI taking something like the LoopVectorizationLegality object, but doing it at a higher level than on a per-instruction basis, allowing TTI to look at the loop.




> What information do we have at this point and what do we need to know?

For D79163 <https://reviews.llvm.org/D79163>, we'd need to know whether a LoadInstr or a StoreInstr will become a masked load/store or not (and `LoopVectorizationLegality` can answer that question).

> I like the sound of TTI taking something like the LoopVectorizationLegality object, but doing it at a higher level than on a per-instruction basis, allowing TTI to look at the loop.

What do you mean by "doing it at a higher level"?
`LoopVectorizationLegality` already contains the `Loop` and `LoopInfo` objects. We'd just need to add more (const) getters to the class so TTI can access them (because they're private right now).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79162





More information about the llvm-commits mailing list