[2/2] var-tracking: Add entry values up to max register mode

Message ID 20220907142026.936922-3-stefansf@linux.ibm.com
State New, archived
Headers
Series Variable tracking and subvalues |

Commit Message

Stefan Schulze Frielinghaus Sept. 7, 2022, 2:20 p.m. UTC
  For parameter of type integer which do not consume a whole register
(modulo sign/zero extension) this patch adds entry values up to maximal
register mode.

gcc/ChangeLog:

	* var-tracking.cc (vt_add_function_parameter): Add entry values
	up to maximal register mode.
---
 gcc/var-tracking.cc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Stefan Schulze Frielinghaus Sept. 26, 2022, 6:10 a.m. UTC | #1
Ping.

On Wed, Sep 07, 2022 at 04:20:26PM +0200, Stefan Schulze Frielinghaus wrote:
> For parameter of type integer which do not consume a whole register
> (modulo sign/zero extension) this patch adds entry values up to maximal
> register mode.
> 
> gcc/ChangeLog:
> 
> 	* var-tracking.cc (vt_add_function_parameter): Add entry values
> 	up to maximal register mode.
> ---
>  gcc/var-tracking.cc | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
> index 235981d100f..9c40ec4fb8b 100644
> --- a/gcc/var-tracking.cc
> +++ b/gcc/var-tracking.cc
> @@ -9906,6 +9906,23 @@ vt_add_function_parameter (tree parm)
>  				     VAR_INIT_STATUS_INITIALIZED, NULL, INSERT);
>  		}
>  	    }
> +
> +	  if (GET_MODE_CLASS (mode) == MODE_INT)
> +	    {
> +	      machine_mode wider_mode_iter;
> +	      FOR_EACH_WIDER_MODE (wider_mode_iter, mode)
> +		{
> +		  if (!HWI_COMPUTABLE_MODE_P (wider_mode_iter))
> +		    break;
> +		  rtx wider_reg
> +		    = gen_rtx_REG (wider_mode_iter, REGNO (incoming));
> +		  cselib_val *wider_val
> +		    = cselib_lookup_from_insn (wider_reg, wider_mode_iter, 1,
> +					       VOIDmode, get_insns ());
> +		  preserve_value (wider_val);
> +		  record_entry_value (wider_val, wider_reg);
> +		}
> +	    }
>  	}
>      }
>    else if (GET_CODE (incoming) == PARALLEL && !dv_onepart_p (dv))
> -- 
> 2.37.2
>
  
Jeff Law Sept. 27, 2022, 11:44 p.m. UTC | #2
On 9/7/22 08:20, Stefan Schulze Frielinghaus via Gcc-patches wrote:
> For parameter of type integer which do not consume a whole register
> (modulo sign/zero extension) this patch adds entry values up to maximal
> register mode.
>
> gcc/ChangeLog:
>
> 	* var-tracking.cc (vt_add_function_parameter): Add entry values
> 	up to maximal register mode.

OK

jeff
  

Patch

diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
index 235981d100f..9c40ec4fb8b 100644
--- a/gcc/var-tracking.cc
+++ b/gcc/var-tracking.cc
@@ -9906,6 +9906,23 @@  vt_add_function_parameter (tree parm)
 				     VAR_INIT_STATUS_INITIALIZED, NULL, INSERT);
 		}
 	    }
+
+	  if (GET_MODE_CLASS (mode) == MODE_INT)
+	    {
+	      machine_mode wider_mode_iter;
+	      FOR_EACH_WIDER_MODE (wider_mode_iter, mode)
+		{
+		  if (!HWI_COMPUTABLE_MODE_P (wider_mode_iter))
+		    break;
+		  rtx wider_reg
+		    = gen_rtx_REG (wider_mode_iter, REGNO (incoming));
+		  cselib_val *wider_val
+		    = cselib_lookup_from_insn (wider_reg, wider_mode_iter, 1,
+					       VOIDmode, get_insns ());
+		  preserve_value (wider_val);
+		  record_entry_value (wider_val, wider_reg);
+		}
+	    }
 	}
     }
   else if (GET_CODE (incoming) == PARALLEL && !dv_onepart_p (dv))