[Bug tree-optimization/97603] Failure to optimize out compare into reuse of subtraction result

2020-10-28 Thread gabravier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97603

--- Comment #3 from Gabriel Ravier  ---
Well, I don't actually know enough to be able to determine which would be
optimal. Transformation to the example from the third comment would be
suboptimal on some targets (say, I don't think AVR would like this for 64-bit
numbers), while doing this as an x86 specific transformation would be missing
on an optimization opportunity on plenty of other targets.

[Bug tree-optimization/97603] Failure to optimize out compare into reuse of subtraction result

2020-10-27 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97603

--- Comment #2 from Hongtao.liu  ---
(In reply to Hongtao.liu from comment #1)
> Shouldn't it be marked as target issue for x86?

Or you means that middle-end should transform code to

int g();

int f(int a, int b)
{
  int c = a - b;
  if (c)
return c;
  return g();
}

[Bug tree-optimization/97603] Failure to optimize out compare into reuse of subtraction result

2020-10-27 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97603

--- Comment #1 from Hongtao.liu  ---
Shouldn't it be marked as target issue for x86?