>> Would it make sense to pull the check into get_equiv_with_elimination(), >> i.e., let the function look through the subreg and deal with invalid >> substitutions? Then the check would also apply at another call side in >> loc_equivalence_change_p() where we also deal with subregs and potential >> invalid substitutions. > > Yep, good idea. One issue I saw before, though, is that it wasn't enough to > just set subst = old (what the check in get_equiv_with_elimination would do) > but I needed to explicitly "continue", otherwise simplify_operand_subreg(?) > would kick in and still perform a wrong substitution. > > One could argue that then simplify_operand_subreg simply needs to be fixed as > well ;) but I was a bit hesitant to change more than what was immediately > obvious to me. > > I'll re-run with your suggestion and report back.
Looking at it more closely, I think the idea is worthwhile but right now maybe too invasive for stage 4? At both call sites I checked we have subreg handling outside of get_equiv_with_elimination that would also need to be touched. So my gut feeling is to rather stick with the current approach for now and rework later. -- Regards Robin
