This is the mail archive of the 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, rtl-optimization]: Fix PR rtl-optimization/33638

Eric Botcazou <> writes:

> > Now, for const functions, we are not interested in these stores into the
> > frame as defined above, we are interested in stores based on the *stack
> > pointer*.
> 	 * dse.c (struct insn_info): Remove 'stack_read' field,
> 	add 'stack_pointer_based' field.
> 	(record_store): For stores with non-constant base, record
> 	whether it is stack pointer based.
> 	(scan_insn): For the call to a const function, remove stack
> 	pointer based stores from the list of local active stores.
> 	(scan_reads_nospill): Delete code dealing with const functions.

+      rtx base_term = find_base_term (XEXP (mem, 0));
+      if (!base_term
+	  || (GET_CODE (base_term) == ADDRESS
+	      && GET_MODE (base_term) == Pmode
+	      && XEXP (base_term, 0) == stack_pointer_rtx))
+	insn_info->stack_pointer_based = true;

Are you sure that checking stack_pointer_rtx is enough here?  Note
that DSE is run after reload.  I would think that in some cases dse
might see hard_frame_pointer_rtx.

Otherwise, this looks good to me.  Please commit it if it passes

> This is enough to fix the problem, but I think we should add support for 

Your patch is conservative, in that it assumes that a const call may
use any store to the stack frame.  The use I see for
CALL_INSN_FUNCTION_USAGE would be to make this less conservative, in
that it would then be possible to prove that some stores to the stack
frame are not used by the const call.  Is that what you mean?


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