[PATCH] D88256: [NFC][regalloc] Separate iteration from AllocationOrder

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 18:28:17 PDT 2020


mtrofin marked an inline comment as done.
mtrofin added a comment.

In D88256#2293981 <https://reviews.llvm.org/D88256#2293981>, @wmi wrote:

> Is the intention to have multiple iterators live for the same AllocationOrder?

The main goal is to avoid this:

void fooBar(AllocationOrder &Order) {

  Order.rewind();
  while (...Order.next()) {
   <lots of code>
  }

}

So if the while loop is large, you need to go see that the order has actually been reset. Also, the state post-while loop should be reset. The alternative I'm proposing allows allocation orders be passed around without worrying they get surprisingly mutated - so easier to read and maintain.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88256



More information about the llvm-commits mailing list