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]

[PATCH] [PR rtl-optimization/32790] Fix long standing typo/thinko in reg_scan_mark_refs



Currently virtually working in PST, not sure if I'll end up in Hawaii or points further west or not. :-)


This has been around a long long time.

reg_scan_mark_refs counts the number of references to each pseudo in a function. It has to peek at SET_DEST operands in the off chance that they might be a STRICT_LOW_PART, SUBREG, or ZERO_EXTRACT which have to be considered as read-write operands.

A bit of text from the manual in case anyone is unaware of how ZERO_EXTRACT can appear in a SET_DEST...

table @code
@findex set
@item (set @var{lval} @var{x})
Represents the action of storing the value of @var{x} into the place
represented by @var{lval}.  @var{lval} must be an expression
representing a place that can be stored in: @code{reg} (or @code{subreg},
@code{strict_low_part} or @code{zero_extract}), @code{mem}, @code{pc},
@code{parallel}, or @code{cc0}.

[ ... ]

If @var{lval} is a @code{zero_extract}, then the referenced part of
the bit-field (a memory or register reference) specified by the
@code{zero_extract} is given the value @var{x} and the rest of the
bit-field is not changed.  Note that @code{sign_extract} can not
appear in @var{lval}.


Unfortunately someone used ZERO_EXTEND rather than ZERO_EXTRACT in the test for these special case lvalues that are also reads. The consequences of this goof are tiny, but we might as well fix it. Georg-Johann noticed this back in 2007, but nobody ever took corrective action.



Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed on the trunk.



commit acb3ee94191b9d2093e6954a7255758ed8f83125
Author: Jeff Law <law@redhat.com>
Date:   Sat Jan 17 00:19:23 2015 -0700

    	PR rtl-optimization/32790
            * reginfo.c (reg_scan_mark_refs): Look for ZERO_EXTRACT,
            not ZERO_EXTEND in SET_DESTs.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 12bd23a..04ae255 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-17  Jeff Law  <law@redhat.com>
+
+	PR rtl-optimization/32790
+	* reginfo.c (reg_scan_mark_refs): Look for ZERO_EXTRACT,
+	not ZERO_EXTEND in SET_DESTs.
+
 2015-01-17  Alan Modra  <amodra@gmail.com>
 
 	* cprop.c (do_local_cprop): Revert last change.
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 2a18fb8..9015eeb 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1132,7 +1132,7 @@ reg_scan_mark_refs (rtx x, rtx_insn *insn)
       /* Count a set of the destination if it is a register.  */
       for (dest = SET_DEST (x);
 	   GET_CODE (dest) == SUBREG || GET_CODE (dest) == STRICT_LOW_PART
-	   || GET_CODE (dest) == ZERO_EXTEND;
+	   || GET_CODE (dest) == ZERO_EXTRACT;
 	   dest = XEXP (dest, 0))
 	;
 

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