[llvm] [SystemZ] SLP reductions: cost functions of reductions and scalarization (PR #112491)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 12:23:29 PST 2024


JonPsson1 wrote:

> Prefer option 3

ok - I tried it:

TargetTransformInfo: add an optional argument to getScalarizationOverhead() to pass the actual Values.

BasicTTIImpl: pass the actual Value to getVectorInstrCost() if present.

SLPVectorizer: pass VL to getScalarizationOverhead() instead of changing DemandedElts with supportsEfficientVectorElementLoadStore().

SystemZ: new function isFreeEltLoad() that also checks for the load->store case.
getScalarizationOverhead() now checks actual Values with isFreeEltLoad() for i64 values. For others, BasicTTIImpl will pass the scalar Value to SystemZTTI::getVectorInstrCost() where it is passed to isFreeEltLoad().

@uweigand: In SystemZISelLowering.cpp we have MaxStoresPerMemcpy set to two. But I suppose that's a slightly different case where we use just a single VL per VST. isFreeEltLoad() now avoids all load->store cost discounts, even though on mcf it was i64 only. Does this make sense or could it be that it is better to gather many loads into a single store?


https://github.com/llvm/llvm-project/pull/112491


More information about the llvm-commits mailing list