[PATCH] D149889: [TTI] Use users of GEP to guess access type in getGEPCost

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 06:37:45 PDT 2023

luke added inline comments.

Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:1057
+    return IsFoldable ? TTI::TCC_Free : TTI::TCC_Basic;
ABataev wrote:
> Same question, cost of int add instead of basic?
I agree we should use getArithmeticInstrCost here, but I have some ideas about adding a new target hook to control this and was wondering if I could defer it to that patch?
On RISC-V if `Scale != 1` then we will need an extra `mul` instruction, as opposed to aarch64 which can perform both an add and multiply in one. I think this would make sense to expose the address calculation cost as a hook since it's target dependent, and we already have all the information available here to pass onto TTI.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list