Hi Eric, Thanks for reviewing the patch! I have upstreamed the patch after incorporating your comments.
After a week on the trunk, I would like to backport the patch to gcc 13 as this is a customer reported issue. Hope this is fine. Regards, Surya On 18/11/25 8:26 pm, Eric Botcazou wrote: >> In this patch, a new field is added to 'struct value_data_entry' >> which indicates if the instruction that created this >> value is frame related or not. Then during copy propagation, we do not >> replace registers if the copy is happening from a non-frame related insn >> to a frame related insn. >> >> Bootstrapped and regtested on powerpc64le. >> >> 2025-11-16 Surya Kumari Jangala <[email protected]> >> >> gcc: >> PR rtl-optimization/122274 >> * regcprop.cc (value_data_entry): New field. >> (kill_value_one_regno): Update field. >> (init_value_data): Initialize field. >> (kill_set_value_data): New field. >> (kill_set_value): Update field. >> (kill_autoinc_value): Likewise. >> (copy_value): New parameter. Update field. >> (find_oldest_value_reg): New parameter. Compare frame relatedness >> of insn and propagated value. >> (replace_oldest_value_reg): Pass additional parameter to >> find_oldest_value_reg(). >> (copyprop_hardreg_forward_1): Pass additional parameter to >> find_oldest_value_reg(). Compare frame relatedness of insn and >> propagated value. Call copy_value() with additional parameter. > > The transformation needs to be blocked in two different places, namely > find_oldest_value_reg and copyprop_hardreg_forward_1 directly, so can you > factor out the condition into a predicate and document in its description the > reason why it is necessary (because dwarf2out needs to...), for example: > > /* Return whether... */ > > static bool > compatible_frame_status (bool to_frame_related, bool from_frame_related) > { > return !to_frame_related || from_frame_related; > } > > Otherwise this looks good to me. >
