[PATCH] combine: Allow substituting the target reg of a clobber

Jeff Law law@redhat.com
Mon Sep 22 22:20:00 GMT 2014


On 09/03/14 07:51, Segher Boessenkool wrote:
> This came up when investigating PR62151.  In that PR combine messes up a
> four-insn combination.  It should really have done the combination of the
> first three insns in that.  The second of those instructions sets a register;
> the third clobbers the same.  Substituting the source of the set into the
> clobber usually results in invalid RTL so that the combination will not be
> valid; also, it confuses the undobuf machinery.  can_combine_p rejects
> the combination for this reason.
>
> But we can simply make subst not substitute into clobbers of registers.
> Any unnecessary clobbers will be removed later anyway.
>
> With this patch, the three-insn combination in PR62151 is successful.  It
> does likely not really solve the problem there though, it just hides it.
>
> Bootstrapped and regression checked on powerpc64-linux, options
> -m64,-m32,-m32/-mpowerpc64.
>
> Is this okay for mainline?
>
>
> Segher
>
>
> 2014-09-03  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	PR rtl-optimization/62151
> 	* combine.c (can_combine_p): Allow the destination register of INSN
> 	to be clobbered in I3.
> 	(subst): Do not substitute into clobbers of registers.
Can you add a testcase which shows the 3-insn combination from PR62151 
applying?

With that change, approved.

jeff



More information about the Gcc-patches mailing list