[PATCH] D122926: [X86][CostModel] Strip bitcasts when looking for store GEP operand

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 05:47:59 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:3910
     }
     return TTI::TCC_Basic;
   }
----------------
RKSimon wrote:
> I wonder whether this needs inverting - and we default stores to a cost of TTI::TCC_Basic * 2 UNLESS after stripping we find all indices are constant?
I believe this code is intended to catch the case where we have a GEP that was modeled as free due to addressing mode support, but has non-constant indices and that addressing mode is non-free in store instructions. So I think the current logic is right, though could be more precise if we checked that the GEP cost is actually TCC_Free, otherwise we might double-cost the GEP.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122926



More information about the llvm-commits mailing list