[PATCH] D149654: [SLP][RISCV] Account for offset folding in getPointersChainCost

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 07:48:45 PDT 2023


reames added a comment.

The RISCV and API extension bits now look good to me.  Once Alexey's happy with the SLP bits, you're good to go.

Looking at the structure of the patch - thanks for the scope reduction - I realized this is a special case of pointer difference.  The general form of this would be to compute the offset between each GEP and the base.  If that difference fits in the scalar addressing range, that GEP has zero cost.  Otherwise, it has cost.

This does raise the point that considering a constant offset GEP as zero cost is actually wrong.  If the offsets are 0, and UINT_MAX, that's not a zero cost GEP on RISCV.

The only machinery I know for this in LLVM is BasicAAResult::DecomposedGEP .  We could potentially reuse some of that.

There's also an interaction with the ptradd proposal here.  With simpler GEPs, the subtraction becomes trivial.

This is definite definitely future work through.  And probably not future work actually worth doing, at least for the general case.  :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149654



More information about the llvm-commits mailing list