diff mbox

[committed] Don't grow internal_arg_pointer_exp_state.cache vector when idx is smaller than VEC_length (PR middle-end/51510)

Message ID 20111212165215.GQ1957@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 12, 2011, 4:52 p.m. UTC
Hi!

When idx is smaller than VEC_length (which happens when some pseudo
is set more than once in the tail call sequence), we should try to grow
the vector to smaller size than it has.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested in arm cross
on the testcase mentioned in the PR with -march=iwmmxt -O2, commited
to trunk as obvious.  Will backport to 4.6 soon.

2011-12-12  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/51510
	* calls.c (internal_arg_pointer_based_exp_scan): Don't use
	VEC_safe_grow_cleared if idx is smaller than VEC_length.


	Jakub
diff mbox

Patch

--- gcc/calls.c.jj	2011-12-08 16:36:42.000000000 +0100
+++ gcc/calls.c	2011-12-12 09:59:26.543358601 +0100
@@ -1705,9 +1705,11 @@  internal_arg_pointer_based_exp_scan (voi
 	    val = internal_arg_pointer_based_exp (SET_SRC (set), false);
 	  if (val != NULL_RTX)
 	    {
-	      VEC_safe_grow_cleared (rtx, heap,
-				     internal_arg_pointer_exp_state.cache,
-				     idx + 1);
+	      if (idx
+		  >= VEC_length (rtx, internal_arg_pointer_exp_state.cache))
+		VEC_safe_grow_cleared (rtx, heap,
+				       internal_arg_pointer_exp_state.cache,
+				       idx + 1);
 	      VEC_replace (rtx, internal_arg_pointer_exp_state.cache,
 			   idx, val);
 	    }