[PATCH] D105108: [InstructionCost] Add saturation support.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 07:16:46 PDT 2021


sdesmalen added a comment.

In D105108#2847011 <https://reviews.llvm.org/D105108#2847011>, @kparzysz wrote:

> Should the max/min values be treated as infinity?  With this implementation, (max+1)-1 = max-1.  Is that what we want?

Yes. It wasn't really the intention of this patch to implement a proper 'infinity', because that makes things a lot more complicated (e.g. having to define what "0 * infinity" means). Simple saturation arithmetic is sufficient for practical uses of InstructionCost which are often about accumulating (possibly scaled) costs, where currently wrapping may occur if large numbers are used.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105108/new/

https://reviews.llvm.org/D105108



More information about the llvm-commits mailing list