fix reload versus duplicated commutative operands

Jan Hubicka jh@suse.cz
Tue Nov 20 13:20:00 GMT 2001


Hi,
when reload is swapping commutative operands it forgets to update duplicates.
This forms invalid instruction but usually compilation finishes as the instruciton
is never re-recognized.
Software trace cache duplicates instructions but not the recog cache making
compilation to crash.
Bootstrapped/regtested both cfg-branch and mainline. OK for mainline?
Installing for branch.

Honza

Fri Nov 30 21:26:46 CET 2001  Jan Hubicka  <jh@suse.cz>
	* reload.c (find_reloads): Update the dupplicates after swappingg.

*** reload.c.old	Fri Nov 30 19:51:35 2001
--- reload.c	Fri Nov 30 19:58:14 2001
*************** find_reloads (insn, replace, ind_levels,
*** 3510,3515 ****
--- 3510,3520 ----
  
  	  recog_data.operand[commutative] = substed_operand[commutative + 1];
  	  recog_data.operand[commutative + 1] = substed_operand[commutative];
+ 	  /* Swap the duplicates too.  */
+ 	  for (i = 0; i < recog_data.n_dups; i++)
+ 	    if (recog_data.dup_num[i] == commutative
+ 		|| recog_data.dup_num[i] == commutative + 1)
+ 	      *recog_data.dup_loc[i] = recog_data.operand[(int) recog_data.dup_num[i]];
  
  	  tclass = preferred_class[commutative];
  	  preferred_class[commutative] = preferred_class[commutative + 1];
*************** find_reloads (insn, replace, ind_levels,
*** 3528,3533 ****
--- 3533,3543 ----
  	  recog_data.operand[commutative] = substed_operand[commutative];
  	  recog_data.operand[commutative + 1]
  	    = substed_operand[commutative + 1];
+ 	  /* Unswap the duplicates too.  */
+ 	  for (i = 0; i < recog_data.n_dups; i++)
+ 	    if (recog_data.dup_num[i] == commutative
+ 		|| recog_data.dup_num[i] == commutative + 1)
+ 	      *recog_data.dup_loc[i] = recog_data.operand[(int) recog_data.dup_num[i]];
  	}
      }
  



More information about the Gcc-patches mailing list