[PATCH] Add iterator for PHINode value/BB pair
dberlin at dberlin.org
Thu Jul 23 15:54:19 PDT 2015
On Thu, Jul 23, 2015 at 3:28 PM, Pete Cooper <peter_cooper at apple.com> wrote:
>> 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.
Yes. I ended up dealing with a ton of manager related stuff, but have
a bit of time again now.
It hasn't changed much since it was approved in review, i've mostly
been removing the bits that were controversial and adding more
I'll post it again in a day or two, but work in progress is at
Note that the memory defs and upward_defs iterators really want to be
able to walk phi arguments and blocks at the same time. Instead, it
uses kind of a hack (it tracks operand numbers and gives access to the
block through the iterator).
>> 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