[PATCH] Add iterator for PHINode value/BB pair

Pete Cooper peter_cooper at apple.com
Thu Jul 23 15:28:56 PDT 2015


> On Jul 23, 2015, at 1:23 PM, Daniel Berlin <dberlin at dberlin.org> wrote:
> 
>> 
>> 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.
Any chance you have a recent patch for that?  I see a thread from a few months ago, but nothing more recent.

> 
> 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 :)
I’d be interested to see if what i have here is applicable.  If its not then we should see why as perhaps i need to make changes.





More information about the llvm-commits mailing list