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 tree-optimization/65307] [4.9 Regression] Incorrect optimization breaks basic arithmetic


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65307

--- Comment #7 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Well, it looked like the same issue by inspection dumps, as folding issue
happens in reassoc-pass.  Of course it might be that forward-prop patch is the
actual issue.

I noticed for -O3 on 4.9.x that valid computation (dse1):

...
g (const unsigned int from_f)
{
  const unsigned int thirty_four;
  unsigned int _3;
  unsigned int _4;
  unsigned int global.0_8;
  unsigned int _9;
  unsigned int _10;

  <bb 2>:
  global.0_8 = global;
  _9 = global.0_8 * 2;
  _3 = _9 * 2;
  _10 = _9 * 3;
  _4 = _10 * 5;
  thirty_four_5 = _3 + _4;
...

Shows after reassoc1 pass:
...
g (const unsigned int from_f)
{
  const unsigned int thirty_four;
  unsigned int _3;
  unsigned int _4;
  unsigned int global.0_8;
  unsigned int _9;
  unsigned int _10;

  <bb 2>:
  global.0_8 = global;
  _9 = global.0_8 * 2;
  _4 = 15;
  _3 = _4 + 2;
  _10 = _9 * _3;
  thirty_four_5 = _10;
...

so it seems to be the forward-propagate patch.

Sorry for the noise


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