[PATCH] Add iterator for PHINode value/BB pair

Daniel Berlin dberlin at dberlin.org
Thu Jul 23 13:23:43 PDT 2015


>
> There are a fair few places where we iterate over two things in parallel and
> they're pretty awkward right now - could find a smattering of those and
> clean them up with the use of this tool (with a helper function to allow
> building these on-site within the range-for). I'm not sure of the easiest
> way to find places that could use this cleanup though... probably looking
> for for loops that either increment two things, or that use integers
> (because they're indexing into two containers).

FWIW: I have this exact issue in memoryssa (for MemoryPhi nodes), and
for walking defs.

For MemoryPhi's, it's *literally* the same problem (Things want to
iterate the memoryphi arguments and blocks at the same time), and you
also want to iterate over both the defs and the translated phi
arguments at the same time.

I wrote something like edge_iterator because zip_iterator seemed hard :)



More information about the llvm-commits mailing list