https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80072
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is quite impossible to reduce, after 16 hours of creduce I've reduced 22% from the original size. I've tried to build a testcase based on what I see in the reassociation, but void bar (int); unsigned long int vx, vx2, vx3; unsigned long int foo (unsigned long int _55062, unsigned long int _55063, unsigned long int _55172, unsigned long int _55171, int u, int v, int w, int x) { unsigned long int _55173 = _55171 * _55172; _Bool t1, t2; if (u == 35) t1 = 1; else if (u == 27) t1 = 0; else if (v == 12) { bar (4); t1 = 1; } else if (v == 24) { bar (5); t1 = 1; } else { bar (6); t1 = 1; } unsigned long int _55001 = vx2; unsigned long int _55053 = t1; unsigned long int _55054 = _55001 * _55053; unsigned long int _55064 = _55062 * _55063; unsigned long int _55060 = vx; unsigned long int _55065 = -_55064; unsigned long int _55066 = _55060 * _55065; unsigned long int _55067 = _55054 * _55066; if (w == 35) t2 = 1; else if (w == 27) t2 = 0; else if (x == 12) { bar (4); t2 = 1; } else if (x == 24) { bar (5); t2 = 1; } else { bar (6); t2 = 1; } unsigned long int _55119 = vx3; unsigned long int _55225 = t2; unsigned long int _55226 = _55173 * _55225; unsigned long int _55227 = _55119 * _55226; unsigned long int _55228 = _55067 * _55227; unsigned long int _55229 = _55228 * 9323891652267032265ULL; return _55229; } has different ranks and so while it gives the same ops order after linearize_expr_tree, the following sorting changes it.