On 9/11/19 1:10 PM, Richard Sandiford wrote: > This pass previously excluded rematerialisation candidates if they > clobbered a call-preserved register, on the basis that it then > wouldn't be safe to add new instances of the candidate instruction > after a call. This patch instead makes the decision on a call-by-call > basis. > > The second emit_remat_insns_for_block hunk probably isn't needed, > but it seems safer and more consistent to have it, so that every call > to emit_remat_insns is preceded by a check for invalid clobbers. > > > 2019-09-11 Richard Sandiford <richard.sandif...@arm.com> > > gcc/ > * early-remat.c: Include regs.h and function-abi.h. > (early_remat::maybe_add_candidate): Don't check for call-clobbered > registers here. > (early_remat::restrict_remat_for_unavail_regs): New function. > (early_remat::restrict_remat_for_call): Likewise. > (early_remat::process_block): Before calling emit_remat_insns > for a previous call in the block, invalidate any candidates > that would clobber call-preserved registers. > (early_remat::emit_remat_insns_for_block): Likewise for the > final call in a block. Do the same thing for live-in registers > when calling emit_remat_insns at the head of a block. > OK jeff