RFA: version 2 patch to fix PR37514

H.J. Lu hjl.tools@gmail.com
Mon Dec 1 17:31:00 GMT 2008


On Mon, Dec 1, 2008 at 8:29 AM, Jeff Law <law@redhat.com> wrote:
> Vladimir Makarov wrote:
>>
>> The following patch solves a latent reload bug (in reload inheritance)
>> triggered by IRA.  It is a second version (less pessimistic in reload
>> inheritance optimization) of the patch
>>
>> The problem is described on
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37514
>>
>>
>> The patch invalidates reg_last_reload_reg set in previous insns for
>> INC/DEC if reg_last_reload_reg set is not set for the current insn for some
>> reasons (e.g. the hard register is used in other insn reloads besides reload
>> for INC/DEC).
>>
>> The patch was tested on SH (with -m4 -ml -O3 -fomit-frame-pointer) and
>> successfully bootstrapped on itanium (another port using INC/DEC heavily).
>>
>>
>> Ok to commit?
>>
>> 2008-11-25  Vladimir Makarov  <vmakarov@redhat.com>
>>
>>   PR rtl-optimization/37514
>>   * reload1.c (reload_as_needed): Invalidate reg_last_reload
>>   from previous insns.
>>
>>
> This is fine.  However, at this stage we should be more focused on the
> simpler, safer fix rather than picking up these uncommon
> micro-optimizations.
> Jeff
>

I need this patch.  Otherwise, bootstrap will fail on Linux/x86 with:

cc1: warnings being treated as errors
/net/gnu-6/export/gnu/src/gcc-ira/gcc/gcc/reload1.c: In function
'reload_as_needed':
/net/gnu-6/export/gnu/src/gcc-ira/gcc/gcc/reload1.c:4167: error:
unused variable 'old_prev'

Index: ChangeLog.ira
===================================================================
--- ChangeLog.ira	(revision 142324)
+++ ChangeLog.ira	(working copy)
@@ -1,3 +1,8 @@
+2008-12-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* reload1.c (reload_as_needed): Declare old_prev only if
+	AUTO_INC_DEC is defined.
+
 2008-12-01  Vladimir Makarov  <vmakarov@redhat.com>

 	PR rtl-optimization/37514
Index: reload1.c
===================================================================
--- reload1.c	(revision 142324)
+++ reload1.c	(working copy)
@@ -4164,7 +4164,9 @@ reload_as_needed (int live_known)
       rtx prev = 0;
       rtx insn = chain->insn;
       rtx old_next = NEXT_INSN (insn);
+#ifdef AUTO_INC_DEC
       rtx old_prev = PREV_INSN (insn);
+#endif

       /* If we pass a label, copy the offsets from the label information
 	 into the current offsets of each elimination.  */


-- 
H.J.



More information about the Gcc-patches mailing list