[Bug rtl-optimization/106187] armhf: Miscompilation at O2 level (O0 / O1 are working)
rearnsha at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 25 13:04:51 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106187
--- Comment #45 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
The problem with changing rtx_equal_for_cselib_1 is that it is essentially
commutative in its operands - it doesn't disambiguate with x substituting for y
or vice-versa, so we cannot tell if an operation is a load or a store.
A minimal fix, which just suppresses stores would be:
@@ -81,6 +81,10 @@ reload_cse_noop_set_p (rtx set)
if (cselib_reg_set_mode (SET_DEST (set)) != GET_MODE (SET_DEST (set)))
return 0;
+ /* Fixme: we need to check that removing a store doesn't change
+ the alias computations. */
+ if (flag_strict_aliasing && MEM_P (SET_DEST (set)))
+ return 0;
return rtx_equal_for_cselib_p (SET_DEST (set), SET_SRC (set));
}
But we could no-doubt improve on that.
More information about the Gcc-bugs
mailing list