[PATCH] D28307: Add Instruction number to LSR cost model (PR23384) part 1 of 3

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 04:42:36 PST 2017


hfinkel added a comment.

In https://reviews.llvm.org/D28307#658330, @qcolombet wrote:

> Hi,


...

> Generally speaking, I think the number of instructions is a good heuristic only for code size and it is not even a given. Indeed, for performance we care about critical path, IPL, this kind of thing. What am I saying is having more instructions is not necessarily a bad thing.

I agree, for performance we should look at critical-path length, ILP, etc. However, here, we're only ranking one formula at a time, and these generally correspond to dependent chains of computations. Making each formula shorter (i.e. using fewer instructions), as a result, will tend to make each path-length shorter. This is obviously heuristic, because we don't have an interface here to query expected latencies, but most of these things are simple integer operations, so I suspect it is not a bad approximation. Nevertheless, if any of these formula are on the critical path, then hopefully it too will get shorter.

For ILP, we may want a longer sequence, but I think it would be hard to reason about that here. It seems better to do that in the MachineCombiner, or something at that level, and for that purpose, using fewer instructions is also probably better: they'll be easier to pattern-match at the MI level.


Repository:
  rL LLVM

https://reviews.llvm.org/D28307





More information about the llvm-commits mailing list