https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99830
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|jakub at gcc dot gnu.org |unassigned at gcc dot
gnu.org
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems the exact spot where the clobber is optimized away is e.g. when
simplify_and_const_int_1 (SImode, (ashift:SI (subreg:SI (and:TI (clobber:TI
(const_int 0 [0])) (const_int 255 [0xff])) 0) (const_int 16 [0x10])), 255);
is called.
It calls nonzero_bits, nonzero_bits sees VARYING << 16 and so returns
0xffff0000,
/* Turn off all bits in the constant that are known to already be zero.
Thus, if the AND isn't needed at all, we will have CONSTOP == NONZERO_BITS
which is tested below. */
constop &= nonzero;
/* If we don't have any bits left, return zero. */
if (constop == 0)
return const0_rtx;
So, are you suggesting that in all such spots we need to test side_effects_p
and punt?
Note, simplify_and_const_int_1 already starts with:
if (GET_CODE (varop) == CLOBBER)
return NULL_RTX;
so it would need to use
if (side_effects_p (varop))
return NULL_RTX;
instead.