https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80887
--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> ---
Before FRE, we have the following. I marked with comments the SSA_NAMEs that
are value numbered as something other than themselves.
f ()
{
unsigned int t2;
unsigned int t1;
int a;
unsigned int u;
int pos.0_1;
int _2;
int pos.1_3;
unsigned int pos.2_4;
int _5;
unsigned int a.3_6;
<bb 2> [0.00%]:
pos.0_1 = pos;
_2 = pos.0_1 + 1;
pos = _2;
pos.1_3 = pos; // _2
pos.2_4 = (unsigned int) pos.1_3;
u_9 = pos.2_4 + 4294967295;
a_10 = pos; // _2
_5 = a_10 + -1; // pos.0_1
t1_11 = (unsigned int) _5; // u_9
a.3_6 = (unsigned int) a_10; // pos.2_4
t2_12 = a.3_6 + 4294967294; // ...
return;
}
Trying to simplify the last statement:
a.3_6 is valueized to pos.2_4
simplifying pos.2_4 + 4294967294
sees (unsigned)(pos.0_1 + 1) + 4294967294
first produces tmp1 = (unsigned)pos.0_1
mprts_hook - vn_lookup_simplify_result --> replaced by u_9
computes constant 4294967295
trying to simplify u_9+4294967295
aka (pos.2_4 + 4294967295)+4294967295
computes constant 4294967294
simplifying pos.2_4 + 4294967294, but that's already what we are trying to
do a few steps up in the call stack.
I don't know where is the best place to break the recursion.