This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR 29333: Jump threading getting in the way of PHI-OPT


Hi,
  The problem here is not really jump threading getting in the way of
PHI-OPT rather there is no cleanup of the IR after jump thread but
before phi-opt.
This patch adds a pass_phi_only_cprop right after the first vrp and
pass_merge_phi right before the first and last phiopts.

Since VRP does jump threading just like DOM does, we need a
pass_phi_only_cprop right after it.  And the merge PHI pass should be
done so that going into PHI-OPT we have a CFG which there is only one
PHI for a case like:
bb0:
if (a)
  goto L1;
bb3:
if (b) goto L2;
L1:
x = PHI <b(3), c(0)>
L2:
 x= PHI<x(L1), d(3)>

PHI-OPT does not handle PHIs like this that well.

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

Thanks,
Andrew Pinski

ChangeLog:
* passes.c (init_optimization_passes): Add pass_phi_only_cprop after
the first vpr pass.
Add pass_merge_phi before the first and last phiopt passes.

testsuite/ChangeLog:
* gcc.dg/tree-ssa/phi-opt-7.c: New testcase.

Attachment: improvepassphiopt.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]