Hi, I wonder why getScalarizationOverhead() does not take into account the number of operands of the instruction? This should influence the number of extracts needed, so instead of Scalarization cost = NumEls * (insert + extract) it would be better to do Scalarization cost = NumEls * (insert + (extract * numOperands)) / Jonas
On 01/20/2017 06:11 AM, Jonas Paulsson via llvm-dev wrote:> Hi, > > I wonder why getScalarizationOverhead() does not take into account the > number of operands of the instruction? This should influence the > number of extracts needed, so instead of > > Scalarization cost = NumEls * (insert + extract) > > it would be better to do > > Scalarization cost = NumEls * (insert + (extract * numOperands))I suspect this is an oversight (although we need to be a bit careful here because if two operands are the same, which is not uncommon, we don't want to double the cost). -Hal> > > / Jonas > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
On 2017-01-20 14:31, Hal Finkel wrote:> > On 01/20/2017 06:11 AM, Jonas Paulsson via llvm-dev wrote: >> Hi, >> >> I wonder why getScalarizationOverhead() does not take into account >> the number of operands of the instruction? This should influence the >> number of extracts needed, so instead of >> >> Scalarization cost = NumEls * (insert + extract) >> >> it would be better to do >> >> Scalarization cost = NumEls * (insert + (extract * numOperands)) > > I suspect this is an oversight (although we need to be a bit careful > here because if two operands are the same, which is not uncommon, we > don't want to double the cost). > > -HalDo you in those cases of an identical operand want to count just a cost of "1" for a register move, instead of the "extraction cost"? /Jonas