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]

Re: Fix a case where combine generates noncanonical debug rtl


Mikael Pettersson <mikpe@it.uu.se> writes:
> Richard Sandiford writes:
>  > Eric Botcazou <ebotcazou@adacore.com> writes:
>  > >> Sorry, I should have mentioned this (because I did check!).  The only
>  > >> use of i2src that isn't conditional on MAY_HAVE_DEBUG_INSNS is for calls,
>  > >> and find_split_point doesn't try to split those.
>  > >
>  > > Fair enough.  Then set i2src in an 'else' branch to a piece of RTL that would 
>  > > cause the compiler to blow up if ever touched later (e.g. some virtual_*_rtx) 
>  > > with a small blurb in the comment.  OK with this change.
>  > 
>  > Using virtual_*_rtx seemed a bit non-obvious, so I just went for NULL
>  > and asserted that i2src was indeed nonnull in the call code.  Here's
>  > what I installed after bootstrapping & regression-testing on
>  > x86_64-linux-gnu.
>  > 
>  > Richard
>  > 
>  > gcc/
>  > 	* combine.c (propagate_for_debug): Call make_compound_operation
>  > 	on the source value.
>  > 	(try_combine): When implementing a split chosen by find_split_point,
>  > 	either copy i2src or set it to null.  Assert that i2src is not null
>  > 	before substituting into CALL_INSN_FUNCTION_USAGE.
>
> This (r159600) triggered a bootstrap failure with trunk on sparc64-linux:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44255
>
> (ARM sees the identical bootstrap failure, but I haven't yet verified
> that the same commit is the cause.)

Sorry for the breakage.  It'll probably be hard to track this down
without access to the targets involved, but it'd be interesting to
know if reverting this hunk:

@@ -3294,6 +3301,11 @@ try_combine (rtx i3, rtx i2, rtx i1, int
 
 	  i2scratch = true;
 
+	  /* *SUBST may be part of I2SRC, so make sure we have the
+	     original expression around for later debug processing.  */
+	  if (MAY_HAVE_DEBUG_INSNS)
+	    i2src = copy_rtx (i2src);
+
 	  /* Get NEWDEST as a register in the proper mode.  We have already
 	     validated that we can do this.  */
 	  if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode)

makes the problem go away.

Richard


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