[PATCH RFC][PR98736]Compute and use programing order preserved RPO in loop distribution

bin.cheng bin.cheng@linux.alibaba.com
Mon Mar 22 11:00:05 GMT 2021


Hi,

This is the patch for PR98736.  The root cause is like:

    Use programing order preserved RPO in loop distribution.
    
    Tree loop distribution uses RPO to build reduced dependence graph,
    it's important that RPO preserves the original programing order and
    usually it does.  However, when distributing loop nest, the exit bb
    could be placed before some loop basic blocks while after loop header.
    
    This patch fixes the issue by preferring loop exit edge in DFS when
    computing RPO.

In the patch, I just duplicated and created new function loop_first_rev_post_order_compute_fn.
I am not sure if I should change the original function pre_and_rev_post_order_compute_fn 
(maybe not at this stage)? I am neither sure about the name, though haven't got a better one.
Any comment is appreciated?

Bootstrap and test on x86_64.

Thanks,
bin

gcc/ChangeLog:

        PR tree-optimization/98736
        * cfganal.c (loop_first_rev_post_order_compute_fn): New function.
        * cfganal.h (loop_first_rev_post_order_compute_fn): New decl.
        * tree-loop-distribution.c (loop_distribution::bb_top_order_init):
        Compute RPO with programing order preserved by calling above.

gcc/testsuite/ChangeLog:

        PR tree-optimization/98736
        * gcc.c-torture/execute/pr98736.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr98736-20210322.txt
Type: application/octet-stream
Size: 6622 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210322/aab9691b/attachment.obj>


More information about the Gcc-patches mailing list