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: [3.3 PATCH] fix PHI insertion for RTL SSA-CCP


On Tuesday 24 August 2004 21:56, Jeffrey A Law wrote:
> > But I wanted to see if RTL SSA really is as poor as everyone
> > always claims it to be, and I need it in more-or-less working
> > shape for that purpose (it now "only" fails with a bunch of
> > unrecognizable insns that all look alike -- it actually looks
> > like that may be a "real" bug...).
>
> There's lots of stuff lurking.
>
> libcalls cause major problems
> subregs cause major problems
>
> That's a start.

I just found that out, yes.  With the attached patch all but 2 files
from Diego's cc1-i files build at -O2 -fssa -fssa-ccp on i686.  The
two that fail are both libcall cases.

Anyway, the attached fix is good enough for my purposes.  Posted for 
posterity as I guess it's not worth the trouble for 3.3.

Gr.
Steven


Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ssa-ccp.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 ssa-ccp.c
*** ssa-ccp.c	22 Jul 2002 17:31:42 -0000	1.26
--- ssa-ccp.c	24 Aug 2004 21:41:27 -0000
*************** visit_phi_node (phi_node, block)
*** 152,159 ****
    for (i = 0; i < num_elem; i += 2)
      {
        if (TEST_BIT (executable_edges,
! 		    EIE (BASIC_BLOCK (INTVAL (RTVEC_ELT (phi_vec, i + 1))),
! 			 block)))
  	{
  	  unsigned int current_parm
  	    = REGNO (RTVEC_ELT (phi_vec, i));
--- 152,159 ----
    for (i = 0; i < num_elem; i += 2)
      {
        if (TEST_BIT (executable_edges,
! 	            EIE (BASIC_BLOCK (INTVAL (RTVEC_ELT (phi_vec, i + 1))),
! 		    block)))
  	{
  	  unsigned int current_parm
  	    = REGNO (RTVEC_ELT (phi_vec, i));
*************** ssa_ccp_substitute_constants ()
*** 875,882 ****
  	    {
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file,
! 			 "Register %d is now set to a constant\n",
! 			 SSA_NAME (PATTERN (def)));
  	      SET_SRC (set) = values[i].const_value;
  	      INSN_CODE (def) = -1;
  	      df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), def);
--- 875,896 ----
  	    {
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file,
! 			 "Register %d is now proved to be a constant\n",
! 			 SSA_NAME (set));
! 	      if (validate_change (def, &SET_SRC (set),
! 				   values[i].const_value, 0))
! 		{
! 		  if (rtl_dump_file)
! 		    fprintf (rtl_dump_file,
! 			     "   replacement made and validated\n");
! 		}
! 	      else
! 		{
! 		  if (rtl_dump_file)
! 		    fprintf (rtl_dump_file,
! 			     "   but unable to validate replacement...\n");
! 		}
! 
  	      SET_SRC (set) = values[i].const_value;
  	      INSN_CODE (def) = -1;
  	      df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), def);
Index: ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ssa.c,v
retrieving revision 1.56
diff -c -3 -p -r1.56 ssa.c
*** ssa.c	27 Sep 2002 12:48:03 -0000	1.56
--- ssa.c	24 Aug 2004 21:41:28 -0000
*************** insert_phi_node (regno, bb)
*** 676,682 ****
  
    insn = first_insn_after_basic_block_note (b);
    end_p = PREV_INSN (insn) == b->end;
!   emit_insn_before (phi, insn);
    if (end_p)
      b->end = PREV_INSN (insn);
  }
--- 676,682 ----
  
    insn = first_insn_after_basic_block_note (b);
    end_p = PREV_INSN (insn) == b->end;
!   emit_insn_after (phi, PREV_INSN (insn));
    if (end_p)
      b->end = PREV_INSN (insn);
  }


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