]> git.ipfire.org Git - thirdparty/gcc.git/commit
Move copy_phi_arg_into_existing_phi to common location and use it
authorAndrew Pinski <apinski@marvell.com>
Tue, 2 May 2023 23:04:00 +0000 (16:04 -0700)
committerAndrew Pinski <apinski@marvell.com>
Thu, 4 May 2023 11:25:27 +0000 (04:25 -0700)
commit78b0eea7802698f51377f77aa98453556854a328
tree68de52bf3d6359215b071ff6c5ae394fc7dbd687
parent8830e46777407a7d5cd3de353394ffc46f2c785c
Move copy_phi_arg_into_existing_phi to common location and use it

While improving replace_phi_edge_with_variable for the diamond formed bb
case, I need a way to copy phi entries from one edge to another as I am
removing a forwarding bb inbetween. I was pointed out that jump threading
code had copy_phi_arg_into_existing_phi which I can use.
I also noticed that both gimple_duplicate_sese_tail and
remove_forwarder_block have similar code so it makes sense to use that function
in those two locations too.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

* tree-ssa-threadupdate.cc (copy_phi_arg_into_existing_phi): Move to ...
* tree-cfg.cc (copy_phi_arg_into_existing_phi): Here and remove static.
(gimple_duplicate_sese_tail): Use copy_phi_arg_into_existing_phi instead
of an inline version of it.
* tree-cfgcleanup.cc (remove_forwarder_block): Likewise.
* tree-cfg.h (copy_phi_arg_into_existing_phi): New declaration.
gcc/tree-cfg.cc
gcc/tree-cfg.h
gcc/tree-cfgcleanup.cc
gcc/tree-ssa-threadupdate.cc