On Thu, Aug 6, 2015 at 11:19 AM, Richard Sandiford
<rdsandif...@googlemail.com> wrote:
> "H.J. Lu" <hongjiu...@intel.com> writes:
>> Since ira_implicitly_set_insn_hard_regs may be called outside of
>> ira-lives.c, it can't use the local variable, preferred_alternatives.
>> This patch adds an alternative_mask argument to
>> ira_implicitly_set_insn_hard_regs.
>>
>> OK for master and 5 branch if there are no regressions on Linux/x86-64?
>
> Thanks for working on this.  The patch looks good to me FWIW.
>
> I think this version is safer than the second one you posted.  With that
> version we could end up with the same sort of bug, e.g. because a function
> passes false to extract_insn without realising that one of the functions
> that it calls later needs the preferred alternatives to be set.
> Or maybe (as with my patch) a function starts to use preferred_alternatives
> and one of its callers gets missed.
>
> Sorry for the breakage.
>

I think local variable preferred_alternatives in ira-lives.c is problematic
by itself.  It is easy to become stale.  recog_data_d is the natural place
for it. But as you pointed out, it has its own problem.  I don't know if we
should always call get_preferred_alternatives to initialize it even if
it isn't used.  Or we can make preferred_alternatives a pointer in
recog_data_d.  If it isn't initialized, you will get a segfault when you
use it.  This one indirection.  This is just my observation.  I will do whatever
is approved.

Thanks.

-- 
H.J.

Reply via email to