This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR63404, gcc 5 miscompiles linux block layer


On 29/09/14 19:32, Richard Henderson wrote:
> On 09/29/2014 11:12 AM, Jiong Wang wrote:
>> +inline rtx single_set_no_clobber_use (const rtx_insn *insn)
>> +{
>> +  if (!INSN_P (insn))
>> +    return NULL_RTX;
>> +
>> +  if (GET_CODE (PATTERN (insn)) == SET)
>> +    return PATTERN (insn);
>> +
>> +  /* Defer to the more expensive case, and return NULL_RTX if there is
>> +     USE or CLOBBER.  */
>> +  return single_set_2 (insn, PATTERN (insn), true);
>>  }
> 
> What more expensive case?
> 
> If you're disallowing USE and CLOBBER, then single_set is just GET_CODE == SET.
> 
> I think this function is somewhat useless, and should not be added.
> 
> An adjustment to move_insn_for_shrink_wrap may be reasonable though.  I haven't
> tried to understand the miscompilation yet.  I can imagine that this would
> disable quite a bit of shrink wrapping for x86 though.  Can we do better in
> understanding when the clobbered register is live at the location to which we'd
> like to move then insns?
> 
> 
> r~
> 

I think part of the problem is in the naming of single_set().  From the
name it's not entirely obvious to users that this includes insns that
clobber registers or which write other registers that are unused after
that point.  I've previously had to fix a bug where this assumption was
made (eg https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54300)

Most uses of single_set prior to register allocation are probably safe;
but later uses are fraught with potential problems of this nature and
may well be bugs waiting to happen.

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]