tree-cfgcleanup: Don't remove forwarder blocks (with phis) with phis that have abnormal uses [PR125396]

This was a latent bug in the checks for removing of a forwarder block which has a phi.

Take:
      <bb 15> [local count: 182536112]:
      # arr1$0_32 = PHI <arr1$0_36(ab)(11)>

      <bb 14> [local count: 206998870]:
      # arr1$0_43(ab) = PHI <arr1$0_25(ab)(13), 9(15)>
      # sj12_44(ab) = PHI <sj12_31(ab)(13), arr1$0_32(15)>
      f8 ();

Here bb 15 predecessor is a normal edge.
So when merging the forwarder bb 15 into bb14 we end up with:
      <bb 12> [local count: 206998870]:
      # arr1$0_42(ab) = PHI <arr1$0_24(ab)(11), 9(9)>
      # sj12_43(ab) = PHI <sj12_30(ab)(11), arr1$0_35(ab)(9)>
      f8 ();
and now there is an overlap of live range of arr1$0_35 and arr1$0_42.
So we need to reject the case where we have phis and the phi arguments that
use abnormal uses.

Changes since v1:
* v2: Look at phi arguments of the forwarder block rather than the dest bb
      having an abnormal edge out.
* v3: Fix bb_phis_references_abnormal_uses to use the gimple_phi_num_args to
      search over the phi arguments. Also fix the commit message which was wrong.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/125396

gcc/ChangeLog:

	* tree-cfgcleanup.cc (bb_phis_references_abnormal_uses): New function.
	(maybe_remove_forwarder_block): Check to make sure the
	forwarder block does not have a phi that references ssa name that has
	abnormal uses.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr125396-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 files changed