http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39976

Michael Matz <matz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu.org

--- Comment #39 from Michael Matz <matz at gcc dot gnu.org> 2011-11-17 16:56:10 
UTC ---
Actually the second (redundant) PHI node is introduced in lim1 for me.
Which makes sense as the loop-invarant load and store from/to cikve
(and crkveuk) are optimized.  It's just that the values would have been
available already in one PHI node, but lim isn't setup to avoid this
redundancy.

We have plenty of passes after lim1 that could be enabled to remove this
redundancy.  Unfortunately right now only PRE does.  Even scheduling a PRE
pass (e.g. right before 2nd pass_dominator) doesn't fully help this problem,
because then we're left with this BB7:

  # prephitmp.35_361 = PHI <prephitmp.35_39(6), prephitmp.35_125(7)>
  # prephitmp.35_362 = PHI <prephitmp.35_72(6), prephitmp.35_132(7)>
  # prephitmp.42_366 = PHI <prephitmp.42_93(6), prephitmp.42_156(7)>
  # prephitmp.42_367 = PHI <prephitmp.42_114(6), prephitmp.42_179(7)>
  # ivtmp.58_257 = PHI <ivtmp.58_256(6), ivtmp.58_264(7)>
  D.3099_121 = prephitmp.35_361 * prephitmp.35_39;
  D.3101_124 = prephitmp.35_362 * prephitmp.35_72;
  prephitmp.35_125 = D.3099_121 - D.3101_124;              <--- (1)
  D.3103_128 = prephitmp.35_361 * prephitmp.35_72;         <--- (2)

No redundant PHI nodes anymore, but still _125 can't be coalesced with _361
(to avoid a backedge copy), because the setting of _125 at (1) conflicts
with the use of _361 at (2).  Swapping both instructions (or moving (1)
down, or (2) up) would alleviate this last problem.

Removing the redundant PHI node seems to be a classic lookup problem, not
so much a propagation problem.  Hence I think it would best fit into
dom, for now.

Reply via email to