https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114511
--- Comment #2 from Richard Biener ---
Confirmed.
_3 = _1 + _2;
y = _3;
_18 = b_9(D) + c_12(D);
_19 = _18 - a_8(D);
_20 = _3 + _19;
_6 = _20 - _1;
re-association doesn't associate the def of _3 because it has multiple uses
and there's no special handling of
((_1 + _2) + _19) - _1
what makes this work for -fno-wrapv is the fre1 difference (+ is -fwrapv)
Replaced y with _3 in all uses of y.0_4 = y;
+Matching expression match.pd:2030, gimple-match-6.cc:54
+Applying pattern match.pd:2057, gimple-match-2.cc:4362
+Applying pattern match.pd:2048, gimple-match-6.cc:2758
+gimple_simplified to _18 = b_12(D) - a_11(D);
+_5 = _18 - _1;
Replaced x with _5 in all uses of x.1_6 = x;
-Applying pattern match.pd:4682, gimple-match-6.cc:4679
-Applying pattern match.pd:3432, gimple-match-7.cc:531
-gimple_simplified to _18 = c_16(D) - _3;
-_7 = _18;
Replaced y with _3 in all uses of y.2_8 = y;
-Applying pattern match.pd:4682, gimple-match-7.cc:4394
-Applying pattern match.pd:3494, gimple-match-6.cc:508
-gimple_simplified to _9 = c_16(D);
Removing dead stmt y.2_8 = y;
Removing dead stmt x.1_6 = x;
Removing dead stmt y.0_4 = y;
@@ -77,12 +77,12 @@
_2 = a_11(D) - b_12(D);
_3 = _1 + _2;
y = _3;
- _5 = -_3;
+ _18 = b_12(D) - a_11(D);
+ _5 = _18 - _1;
x = _5;
- _18 = c_16(D) - _3;
- _7 = _18;
- _9 = c_16(D);
- x = c_16(D);
+ _7 = _5 + c_16(D);
+ _9 = _3 + _7;
+ x = _9;
return;
}