https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98190
--- Comment #10 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #9) > Perhaps some of those checks on the other side are redundant and could be > turned e.g. into gcc_checking_assert of gcc_assert, I bet if the MEM_REF > doesn't overwrite all bits, but only some subset of them, then the > destination couldn't be a nonmem decl and thus couldn't be promoted. Yeah, asserting sounds good. Checking the other conditions makes it look like we could still fall through to the else for some promoted subregs. If we can't assert, I guess the rule is that we need to extend whenever we're storing to the MSB of the inner register. We can do that either by extending the source value and the range to the outer register, or by assigning to the inner register and then extending it separately.