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]

Save unnecesary copy in combine.c


Hi,
combine produces about 800Kb of garbage during compiling itself just to create
copy of insn container with two fields changed.  Bootstrapped/regtested
i686-pc-gnu-linux.  Not sure if it is noise, but Zdenek's tester claims:

Compilation speed before:

real    2m7.325s
user    2m5.418s
sys     0m1.887s

real    2m7.517s
user    2m5.582s
sys     0m1.933s

Compilation speed after:

real    2m6.798s
user    2m4.892s
sys     0m1.886s

real    2m6.810s
user    2m4.897s
sys     0m1.906s

Perhaps on GGC run...

2004-01-25  Jan Hubicka  <jh@suse.cz>
	* combine.c (recog_for_combine): Avoid allocating unnecesary RTX.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.402
diff -c -3 -p -r1.402 combine.c
*** combine.c	23 Jan 2004 22:23:10 -0000	1.402
--- combine.c	24 Jan 2004 21:09:20 -0000
*************** recog_for_combine (rtx *pnewpat, rtx ins
*** 9869,9875 ****
    int num_clobbers_to_add = 0;
    int i;
    rtx notes = 0;
!   rtx dummy_insn;
  
    /* If PAT is a PARALLEL, check to see if it contains the CLOBBER
       we use to indicate that something didn't match.  If we find such a
--- 9869,9875 ----
    int num_clobbers_to_add = 0;
    int i;
    rtx notes = 0;
!   rtx old_notes, old_pat;
  
    /* If PAT is a PARALLEL, check to see if it contains the CLOBBER
       we use to indicate that something didn't match.  If we find such a
*************** recog_for_combine (rtx *pnewpat, rtx ins
*** 9880,9892 ****
  	  && XEXP (XVECEXP (pat, 0, i), 0) == const0_rtx)
  	return -1;
  
!   /* *pnewpat does not have to be actual PATTERN (insn), so make a dummy
!      instruction for pattern recognition.  */
!   dummy_insn = shallow_copy_rtx (insn);
!   PATTERN (dummy_insn) = pat;
!   REG_NOTES (dummy_insn) = 0;
  
!   insn_code_number = recog (pat, dummy_insn, &num_clobbers_to_add);
  
    /* If it isn't, there is the possibility that we previously had an insn
       that clobbered some register as a side effect, but the combined
--- 9880,9891 ----
  	  && XEXP (XVECEXP (pat, 0, i), 0) == const0_rtx)
  	return -1;
  
!   old_pat = PATTERN (insn);
!   old_notes = REG_NOTES (insn);
!   PATTERN (insn) = pat;
!   REG_NOTES (insn) = 0;
  
!   insn_code_number = recog (pat, insn, &num_clobbers_to_add);
  
    /* If it isn't, there is the possibility that we previously had an insn
       that clobbered some register as a side effect, but the combined
*************** recog_for_combine (rtx *pnewpat, rtx ins
*** 9911,9919 ****
        if (pos == 1)
  	pat = XVECEXP (pat, 0, 0);
  
!       PATTERN (dummy_insn) = pat;
!       insn_code_number = recog (pat, dummy_insn, &num_clobbers_to_add);
      }
  
    /* Recognize all noop sets, these will be killed by followup pass.  */
    if (insn_code_number < 0 && GET_CODE (pat) == SET && set_noop_p (pat))
--- 9910,9920 ----
        if (pos == 1)
  	pat = XVECEXP (pat, 0, 0);
  
!       PATTERN (insn) = pat;
!       insn_code_number = recog (pat, insn, &num_clobbers_to_add);
      }
+   PATTERN (insn) = old_pat;
+   REG_NOTES (insn) = old_notes;
  
    /* Recognize all noop sets, these will be killed by followup pass.  */
    if (insn_code_number < 0 && GET_CODE (pat) == SET && set_noop_p (pat))


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