On Sun, Nov 19, 2023 at 05:47:56PM -0700, Jeff Law wrote:
...
> +/* Process uses in INSN. Set appropriate bits in LIVENOW for any chunks of
> + pseudos that become live, potentially filtering using bits from LIVE_TMP.
> +
> + If MODIFIED is true, then optimize sign/zero extensions to SUBREGs when
> + the extended bits are never read and mark pseudos which had extensions
> + eliminated in CHANGED_PSEUDOS. */
> +
> +static void
> +ext_dce_process_uses (rtx insn, bitmap livenow, bitmap live_tmp,
> + bool modify, bitmap changed_pseudos)
> +{
> + /* A nonlocal goto implicitly uses the frame pointer. */
> + if (JUMP_P (insn) && find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
> + {
> + bitmap_set_range (livenow, FRAME_POINTER_REGNUM * 4, 4);
> + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
> + bitmap_set_range (livenow, HARD_FRAME_POINTER_REGNUM * 4, 4);
> + }
> +
> + subrtx_var_iterator::array_type array_var;
> + rtx pat = PATTERN (insn);
> + FOR_EACH_SUBRTX_VAR (iter, array_var, pat, NONCONST)
> + {
> + /* An EXPR_LIST (from call fusage) ends in NULL_RTX. */
> + rtx x = *iter;
> + if (x == NULL_RTX)
> + continue;
> +
> + /* So the basic idea in this FOR_EACH_SUBRTX_VAR loop is to
> + handle SETs explicitly, possibly propagating live information
> + into the uses.
> +
> + We may continue the loop at various points which will cause
> + iteration into the next level of RTL. Breaking from the loop
> + is never safe as it can lead us to fail to process some of the
> + RTL and thus not make objects live when necessary. */
> + enum rtx_code xcode = GET_CODE (x);
> + if (xcode == SET)
> + {
> + const_rtx dst = SET_DEST (x);
> + rtx src = SET_SRC (x);
> + const_rtx y;
> + unsigned HOST_WIDE_INT bit = 0;
> +
> + /* The code of the RHS of a SET. */
> + enum rtx_code code = GET_CODE (src);
> +
> + /* ?!? How much of this should mirror SET handling, potentially
> + being shared? */
> + if (SUBREG_BYTE (dst).is_constant () && SUBREG_P (dst))
Shouldn't SUBREG_P be checked first like:
if (SUBREG_P (dst) && SUBREG_BYTE (dst).is_constant ())
On pru-unknown-elf with RTL checking I get:
conftest.c:16:1: internal compiler error: RTL check: expected code 'subreg',
have 'reg' in ext_dce_process_uses, at ext-dce.cc:421
16 | }
| ^
0x158b39e rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
/mnt/nvme/dinux/local-workspace/gcc/gcc/rtl.cc:770
0x223a486 ext_dce_process_uses
/mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:421
0x223b5ba ext_dce_process_bb
/mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:651
0x223bdd3 ext_dce
/mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:802
0x223c0ac execute
/mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:868
Regards,
Dimitar