[PATCH] D91174: [Analysis] Introduce a new InstructionCost class
Paul Walker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 26 03:00:50 PST 2020
paulwalker-arm added a comment.
I agree with @david-arm because this unsigned->class conversion has a different rational than TypeSize. Here we want to have the ability to allow natural maths when computing a cost but also be able to reflect the state where the cost is special, one example of which is "the cost is meaningless", rather than trying to second guess the callers intention and say "just returning a big number in the hope the user does what we need".
When it comes to comparisons, you're asking the question for a reason so whilst we can and probably should ensure that the unnatural states have an order (presumably sitting at the end of the "return a high number" range) it's my believe that performing such comparisons without ever querying the cost's status (which could just be an assert in some cases) is likely a source of error.
I also wonder how much of the interface is here temporarily for pragmatic reasons. `operator*=(InstructionCount&)` is a good example of this. Is there a real use case for such an interface or is it just a temporary measure until uses can be refactored at which point it can be removed.
CHANGES SINCE LAST ACTION
More information about the llvm-commits