[PATCH] Optimize MINUS_EXPR jump (PR middle-end/21237)

Roger Sayle roger@eyesopen.com
Sun May 8 21:25:00 GMT 2005


On Sun, 8 May 2005, David Edelsohn wrote:
>
> 	PR middle-end/21237
> 	* dojump.c (do_jump, MINUS_EXPR): Build NE_EXPR and fall through
> 	to NE_EXPR case.

This is OK for mainline, after a suitable bootstrap and regression test.

I'd investigated PR middle-end/21237 a bit myself, it appears that
somewhere in the tree-ssa optimizers, between .t66.copyrename3 and
.t67.optimized, we generate the tree "a - b != 0", in function "g"
below without calling fold which would transform it into "a != b".

int g(long long a, long long b)
{
  a -= b;
  return !a;
}

int f(long long a, long long b)
{
  return a == b;
}

int h(long long a, long long b)
{
  return !(a - b);
}

I'd be interested in knowing why/how we're generating unfolded trees
for this test case.  Fixing this in expand is a reasonable solution,
but I think there's a deeper problem that still needs to be investigated.


Roger
--



More information about the Gcc-patches mailing list