llvm-project/llvm/test/Transforms/LoopStrengthReduce/X86
Wei Mi 90707394e3 [LSR] Narrow search space by filtering non-optimal formulae with the same ScaledReg and Scale.
When the formulae search space is huge, LSR uses a series of heuristic to keep
pruning the search space until the number of possible solutions are within
certain limit.

The big hammer of the series of heuristics is NarrowSearchSpaceByPickingWinnerRegs,
which picks the register which is used by the most LSRUses and deletes the other
formulae which don't use the register. This is a effective way to prune the search
space, but quite often not a good way to keep the best solution. We saw cases before
that the heuristic pruned the best formula candidate out of search space.

To relieve the problem, we introduce a new heuristic called
NarrowSearchSpaceByFilterFormulaWithSameScaledReg. The basic idea is in order to
reduce the search space while keeping the best formula, we want to keep as many
formulae with different Scale and ScaledReg as possible. That is because the central
idea of LSR is to choose a group of loop induction variables and use those induction
variables to represent LSRUses. An induction variable candidate is often represented
by the Scale and ScaledReg in a formula. If we have more formulae with different
ScaledReg and Scale to choose, we have better opportunity to find the best solution.
That is why we believe pruning search space by only keeping the best formula with the
same Scale and ScaledReg should be more effective than PickingWinnerReg. And we use
two criteria to choose the best formula with the same Scale and ScaledReg. The first
criteria is to select the formula using less non shared registers, and the second
criteria is to select the formula with less cost got from RateFormula. The patch
implements the heuristic before NarrowSearchSpaceByPickingWinnerRegs, which is the
last resort.

Testing shows we get 1.8% and 2% on two internal benchmarks on x86. llvm nightly
testsuite performance is neutral. We also tried lsr-exp-narrow and it didn't help
on the two improved internal cases we saw.

Differential Revision: https://reviews.llvm.org/D34583

llvm-svn: 307269
2017-07-06 15:52:14 +00:00
..
2008-08-14-ShadowIV.ll
2009-11-10-LSRCrash.ll
2011-07-20-DoubleIV.ll
2011-11-29-postincphi.ll
2011-12-04-loserreg.ll
2012-01-13-phielim.ll Fix testcases failing after r284036 2016-10-12 20:39:33 +00:00
bin_power.ll [SCEV] Teach SCEVExpander to expand BinPow 2017-06-19 06:24:53 +00:00
canonical-2.ll [LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix PR33077. 2017-05-18 17:21:22 +00:00
canonical.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
incorrect-offset-scaling.ll Re-enable "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start" 2017-05-26 06:47:04 +00:00
ivchain-X86.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
ivchain-stress-X86.ll
lit.local.cfg
lsr-expand-quadratic.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
lsr-filtering-scaledreg.ll [LSR] Narrow search space by filtering non-optimal formulae with the same ScaledReg and Scale. 2017-07-06 15:52:14 +00:00
lsr-insns-1.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
lsr-insns-2.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
nested-loop.ll Revert r304824 "Fix PR23384 (part 3 of 3)" 2017-06-19 17:57:15 +00:00
no_superflous_induction_vars.ll
pr17473.ll
pr28719.ll
sibling-loops.ll [LSR] Prevent formula with SCEVAddRecExpr type of Reg from Sibling loops 2017-02-16 21:27:31 +00:00