Clean up loop-closed PHIs after loop finalize
authorguojiufu <guojiufu@linux.ibm.com>
Tue, 17 Nov 2020 11:49:03 +0000 (19:49 +0800)
committerguojiufu <guojiufu@linux.ibm.com>
Wed, 18 Nov 2020 05:29:14 +0000 (13:29 +0800)
commitd87ee7f1c9cd2ffa6302cdfd0686d72e5bb7463b
treec4f1dda5d267c73b2a7a7e1cceffc5b13bdbe7ab
parent397654d66a4f84d4439e046cd330d9968af3b62b
Clean up loop-closed PHIs after loop finalize

This patch propagates loop-closed PHIs them out at
loop_optimizer_finalize.  For some cases, to clean up loop-closed PHIs
would save efforts of optimization passes after loopdone.

Thanks,
Jiufu Guo.

gcc/ChangeLog:
2020-10-18  Jiufu Guo   <guojiufu@linux.ibm.com>

* cfgloop.h (loop_optimizer_finalize): Add flag argument.
* loop-init.c (loop_optimizer_finalize): Call clean_up_loop_closed_phi.
* tree-cfgcleanup.h (clean_up_loop_closed_phi): New declare.
* tree-ssa-loop.c (tree_ssa_loop_done): Call loop_optimizer_finalize
with flag argument.
* tree-ssa-propagate.c (clean_up_loop_closed_phi): New function.

gcc/testsuite/ChangeLog:
2020-10-18  Jiufu Guo   <guojiufu@linux.ibm.com>

* gcc.dg/tree-ssa/loopclosedphi.c: New test.
gcc/cfgloop.h
gcc/loop-init.c
gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c [new file with mode: 0644]
gcc/tree-cfgcleanup.h
gcc/tree-ssa-loop.c
gcc/tree-ssa-propagate.c