Anastasiya Ruzhanskaya via llvm-dev
2017-Aug-14 10:58 UTC
[llvm-dev] PHI incoming blocks order
Hello, Is it a convenient way except of somehow iterating from one block to another to find from which block I have initial incoming value and from which I have a changing incoming value (this is only for phi nodes with two incoming blocks)? Dominator tree requires to know one block and one block edge...this is not what I want. Is it valid to take two first instructions from two incoming blocks and see what dominates what? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170814/94559630/attachment.html>
On 8/14/2017 3:58 AM, Anastasiya Ruzhanskaya via llvm-dev wrote:> Hello, > Is it a convenient way except of somehow iterating from one block to > another to find from which block I have initial incoming value and > from which I have a changing incoming value (this is only for phi > nodes with two incoming blocks)? Dominator tree requires to know one > block and one block edge...this is not what I want. Is it valid to > take two first instructions from two incoming blocks and see what > dominates what?You can use Loop::contains() to figure out whether a basic block is inside a loop. I think that's what you're looking for? -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
I would compare depths, incoming block still might be inside a loop (nested loops). On Mon, Aug 14, 2017 at 2:47 PM, Friedman, Eli via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 8/14/2017 3:58 AM, Anastasiya Ruzhanskaya via llvm-dev wrote: > >> Hello, >> Is it a convenient way except of somehow iterating from one block to >> another to find from which block I have initial incoming value and from >> which I have a changing incoming value (this is only for phi nodes with two >> incoming blocks)? Dominator tree requires to know one block and one block >> edge...this is not what I want. Is it valid to take two first instructions >> from two incoming blocks and see what dominates what? >> > > You can use Loop::contains() to figure out whether a basic block is inside > a loop. I think that's what you're looking for? > > -Eli > > -- > Employee of Qualcomm Innovation Center, Inc. > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux > Foundation Collaborative Project > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170814/778cee9a/attachment.html>
On Mon, Aug 14, 2017 at 3:58 AM, Anastasiya Ruzhanskaya via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > Is it a convenient way except of somehow iterating from one block to > another to find from which block I have initial incoming value and from > which I have a changing incoming value (this is only for phi nodes with two > incoming blocks)? Dominator tree requires to know one block and one block > edge... >Dominator tree does not require this, actually ;) It will happily take two blocks? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170814/5aece163/attachment.html>
Anastasiya Ruzhanskaya via llvm-dev
2017-Aug-15 14:08 UTC
[llvm-dev] PHI incoming blocks order
Yes, seems that this is the most convenient one. Thank you! 2017-08-14 20:47 GMT+02:00 Friedman, Eli <efriedma at codeaurora.org>:> On 8/14/2017 3:58 AM, Anastasiya Ruzhanskaya via llvm-dev wrote: > >> Hello, >> Is it a convenient way except of somehow iterating from one block to >> another to find from which block I have initial incoming value and from >> which I have a changing incoming value (this is only for phi nodes with two >> incoming blocks)? Dominator tree requires to know one block and one block >> edge...this is not what I want. Is it valid to take two first instructions >> from two incoming blocks and see what dominates what? >> > > You can use Loop::contains() to figure out whether a basic block is inside > a loop. I think that's what you're looking for? > > -Eli > > -- > Employee of Qualcomm Innovation Center, Inc. > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux > Foundation Collaborative Project > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170815/10917cb7/attachment.html>