https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126556
Igor Shevlyakov <ishevlyakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
CC| |ishevlyakov at gcc dot gnu.org
--- Comment #5 from Igor Shevlyakov <ishevlyakov at gcc dot gnu.org> ---
The ICE is in generic combine code; aarch64 only exposes it.
When simplify_set finds that the comparison setting a CC register has a
constant result, it substitutes the constant into the CC user
(SUBST (*cc_use, tmp)) and then simplifies the user's SET_SRC. Here the
user is *cstoresi_insn_uxtw:
(set (reg:DI 111) (zero_extend:DI (gt:SI (reg:CC 66 cc) (const_int 0))))
so the first step creates (zero_extend:DI (const_int 0)), and the SUBST
of the simplified source then trips the do_SUBST assertion against that
RTL. Building the new source in one step with simplify_replace_rtx,
which still knows the mode of the zero_extend operand, avoids it;
removing *cstoresi_insn_uxtw would only hide the problem.
No other in-tree backend currently has a pattern with an extension
directly around a CC comparison, so other targets don't hit it today:
the testcase does not ICE on x86_64 (-O2, -O3, -m32, -march=x86-64-v3,
-mapxf), whose setcc patterns use the comparison in the wider mode
directly.
I'm testing a patch (x86_64 and aarch64 bootstrap + regtest).