[PATCH] D92238: [SCEVExpander] Migrate costAndCollectOperands to use InstructionCost.

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 10:24:27 PST 2021


ctetreau added inline comments.


================
Comment at: llvm/include/llvm/Support/InstructionCost.h:238
+// of the complexities around Instruction's state.
+class InstructionBudget {
+  InstructionCost Budget;
----------------
ctetreau wrote:
> ctetreau wrote:
> > I think this new class is uneccesary. Can't we just write `0 > Cost` for any case where we would use  `Cost.isExceeded()`?
> I guess this doesn't work either. You have to do the isInvalid() call
Things that are logically "budgets" can be initialized with negative numbers, and have costs added to them, rather than subtracted. Then `Cost > 0` can be used and will work correctly.


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

https://reviews.llvm.org/D92238



More information about the llvm-commits mailing list