David Green ffc922ec35 [LSR] Attempt to increase the accuracy of LSR's setup cost
In some loops, we end up generating loop induction variables that look like:
  {(-1 * (zext i16 (%i0 * %i1) to i32))<nsw>,+,1}
As opposed to the simpler:
  {(zext i16 (%i0 * %i1) to i32),+,-1}
i.e we count up from -limit to 0, not the simpler counting down from limit to
0. This is because the scores, as LSR calculates them, are the same and the
second is filtered in place of the first. We end up with a redundant SUB from 0
in the code.

This patch tries to make the calculation of the setup cost a little more
thoroughly, recursing into the scev members to better approximate the setup
required. The cost function for comparing LSR costs is:

return std::tie(C1.NumRegs, C1.AddRecCost, C1.NumIVMuls, C1.NumBaseAdds,
                C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
       std::tie(C2.NumRegs, C2.AddRecCost, C2.NumIVMuls, C2.NumBaseAdds,
                C2.ScaleCost, C2.ImmCost, C2.SetupCost);
So this will only alter results if none of the other variables turn out to be
different.

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

llvm-svn: 355597
2019-03-07 13:44:40 +00:00
..
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-26 17:53:48 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2017-10-18 18:07:07 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:07:21 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-06 19:15:58 +00:00
2018-03-06 19:15:58 +00:00
2018-03-06 19:15:58 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-06 19:15:58 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-06 19:15:58 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2017-10-18 18:07:07 +00:00
2018-06-26 18:44:05 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-10-19 17:31:11 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2017-11-22 20:43:00 +00:00
2018-03-12 14:01:28 +00:00
2018-09-07 13:36:21 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2017-10-18 18:07:07 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-19 19:03:18 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-26 17:53:48 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2017-10-18 18:07:07 +00:00
2017-10-18 18:07:07 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-10-19 17:31:11 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-26 17:53:48 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2017-10-18 18:07:07 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00
2018-03-12 14:01:28 +00:00