This is the mail archive of the gcc@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: [tree-ssa] DCE and conditionals


In message <1052137908.19625.1223.camel@p4>, Andrew MacLeod writes:
 >That means we want someone, perhaps a very fast little pass of its own
 >that we can call when we want it, that goes into PHI nodes, looks at
 >them, and decides when they can be replaced with a copy.
Yes, this can be done very quickly.  It looks something like this:


  FOR_EACH_BB (bb)
    FOR_EACH_PHI (phi)
      FOR_EACH_PHI_ARG (phi_arg)
        if (phi_arg == phi_result)
	  continue;
        if (phi_arg == seen_arg)
          continue;
        if (seen_arg == NULL)
	  seen_arg = arg
        else
          FAIL

      if (!FAIL)
	remove phi & insert copy at start of basic block


The only trick is dealing with dependencies between arguments/results
of PHI nodes.

Jeff



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