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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |110262

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So another testcase:

int g2(int a)
{
  if (a < 0) __builtin_unreachable();
  int t = ((a) < (1) ? (a) : (1));
  return  t;
}


The above should be optimized to `return a != 0`. If we do that, then PR 110262
is optimized.
Now the question becomes which is canonical of how we should represent this.
`MIN_EXPR<t, 1>`
or
`(type)t != 0`
The MIN is "cheaper" for gimple but not decent to optimize with sometimes might
need to change between the two versions ...


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110262
[Bug 110262] `t < 0 ? 1 : min(t, 1)` is not simplified down to just `t != 0`

Reply via email to