[PATCH][debug] Fix pre_dec handling in vartrack

Jakub Jelinek jakub@redhat.com
Mon Jul 16 07:24:00 GMT 2018


On Sun, Jul 15, 2018 at 11:21:56PM +0200, Tom de Vries wrote:
> 2018-07-15  Tom de Vries  <tdevries@suse.de>
> 
> 	* var-tracking.c (vt_initialize): Fix pre_dec handling.  Print adjusted
> 	insn slim if dump_flags request TDF_SLIM.
> 
> 	* gcc.target/i386/vartrack-1.c: New test.
> 
> ---
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -115,6 +115,7 @@
>  #include "tree-pretty-print.h"
>  #include "rtl-iter.h"
>  #include "fibonacci_heap.h"
> +#include "print-rtl.h"
>  
>  typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
>  typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
> @@ -10208,12 +10209,17 @@ vt_initialize (void)
>  			    log_op_type (PATTERN (insn), bb, insn,
>  					 MO_ADJUST, dump_file);
>  			  VTI (bb)->mos.safe_push (mo);
> -			  VTI (bb)->out.stack_adjust += pre;
>  			}
>  		    }
>  
>  		  cselib_hook_called = false;
>  		  adjust_insn (bb, insn);
> +
> +		  if (!frame_pointer_needed)
> +		    {
> +		      if (pre)
> +			VTI (bb)->out.stack_adjust += pre;
> +		    }

That is certainly unexpected.  For the pre side-effects, they should be
applied before adjusting the insn, not after that.
I'll want to see this under the debugger.

>  		  if (DEBUG_MARKER_INSN_P (insn))
>  		    {
>  		      reemit_marker_as_note (insn);
> @@ -10227,7 +10233,10 @@ vt_initialize (void)
>  		      cselib_process_insn (insn);
>  		      if (dump_file && (dump_flags & TDF_DETAILS))
>  			{
> -			  print_rtl_single (dump_file, insn);
> +			  if (dump_flags & TDF_SLIM)
> +			    dump_insn_slim (dump_file, insn);
> +			  else
> +			    print_rtl_single (dump_file, insn);
>  			  dump_cselib_table (dump_file);
>  			}
>  		    }

This part is certainly ok.

	Jakub



More information about the Gcc-patches mailing list