http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49911
Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.08.01 08:33:31
     Ever Confirmed|0                           |1

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-01 
08:33:31 UTC ---
Ok, reproduced on a linux host.  It's quite obvious:

void jsop_setelem(bool, int) (bool y, int z)
{
  RegisterID SR.6;

<bb 2>:
  if (y_1(D) != 0)
    goto <bb 5>;
  else
    goto <bb 3>;

<bb 3>:
  SR.6_11 = (RegisterID) z_3(D);
  if (SR.6_11 <= 45)

the conversion truncates z_3 to precision 3, so it's not VRPs fault here.

It seems to be SRAs fault which replaces D.1809.offset_ with a register of
type RegisterID, then having to insert a not useless conversion (which it
should _never_ need - it's a sign of a bug):

  D.1809.offset_ = z_3(D);
  address.0_7 = (unsigned int) z_3(D);
  if (address.0_7 <= 45)

  D.1816_11 = (RegisterID) z_3(D);
             ^^^^^^^^^^^^^^ here
  SR.6_6 = D.1816_11;
  address.0_7 = (unsigned int) z_3(D);
  if (address.0_7 <= 45)

Now, then comes along DOM and replaces

Optimizing statement address.0_7 = (unsigned int) z_3(D);
LKUP STMT address.0_7 = nop_expr z_3(D)
          address.0_7 = (unsigned int) z_3(D);
FIND: SR.6_11
  Replaced redundant expr '(unsigned int) z_3(D)' with 'SR.6_11'
==== ASGN address.0_7 = SR.6_11
Optimizing statement if (address.0_7 <= 45)
  Replaced 'address.0_7' with variable 'SR.6_11'

for some other reason ...

Reply via email to