This is the mail archive of the gcc-bugs@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]

[Bug middle-end/42505] [4.4/4.5/4.6 Regression] loop canonicalization causes a lot of unnecessary temporary variables



------- Comment #4 from sandra at codesourcery dot com  2010-06-04 00:09 -------
I've been looking at this problem today.  Here's the stupid part coming out of
ivopts:

<bb 5>:
  # ivtmp.7_21 = PHI <0(2), ivtmp.7_20(4)>
  # ivtmp.10_22 = PHI <ivtmp.10_24(2), ivtmp.10_23(4)>
  count_25 = (int) ivtmp.10_22;
  if (count_25 != 0)
    goto <bb 3>;
  else
    goto <bb 6>;

No subsequent pass is recognizing that the unsigned-to-signed conversion is
useless and "count" is otherwise dead.  

If I change the parameter "count" to have type "unsigned int", then ivopts does
the obvious replacement itself:

<bb 5>:
  # ivtmp.7_21 = PHI <0(2), ivtmp.7_20(4)>
  # ivtmp.10_22 = PHI <count_7(D)(2), ivtmp.10_23(4)>
  if (ivtmp.10_22 != 0)
    goto <bb 3>;
  else
    goto <bb 6>;

Then "count" is completely gone from the loop after ivopts and the resulting
code looks good.

So, fix this somewhere inside ivopts to make the signed case produce the same
code as the unsigned one?  Or tell it not to replace count at all if it has to
do a type conversion?  I'm still trying to find my way around the code for this
pass to figure out where things happen, so if this is obvious to someone else
I'd appreciate a pointer.  :-)


-- 

sandra at codesourcery dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at codesourcery dot
                   |                            |com


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


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