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: Non-call exceptions versus cse


> On Tue, Dec 10, 2002 at 05:18:34PM +0000, Andrew Haley wrote:
> > This is the case I'm interested in:
> > 
> >    a = ({ tmp = foo->bar; tmp; });
> > 
> > We must not convert this into
> > 
> >    a = foo->bar;
> 
> I don't believe this.
> 
> I do believe that there are problems in CSE wrt this problem,
> since it doesn't use the CFG properly, but I can't see how this
> is related at all.
I was looking at the CSE basic block discovery code and trying to get it
to use CFG as I mentioned earlier and got to feeling tha it is pretty
safe.  CSE is interested in the superblock and superblock can be safely
discovered via CODE_LABEL.

My understanding currently is that the instruction killing value (ie
killing a) is defined to have no effect in dataflow.
IE in Java semantic something like

a = 5;
tmp = *NULL; (edge to trap)
a = tmp;

segfault_trap:
print(a)

should print 5.  When we fold out the TMP, we change liveness to make
first set of a dead resulting in wrong code.  I don't think we want to
hook this somewhat into dataflow and related passes even when this is
what most of hardware does.

Alternate is of course to keep value of destionation on trap undefined
and always use the temporary.  The transofrmation in question is not
CSE, but backward copy propagation.  I think CSE handles it by:
  /* Special handling for (set REG0 REG1) where REG0 is the
     "cheapest", cheaper than REG1.  After cse, REG1 will probably not
      be used in the sequel, so (if easily done) change this insn to
      (set REG1 REG0) and replace REG1 with REG0 in the previous insn
      that computed their value.  Then REG1 will become a dead store
      and won't cloud the situation for later optimizations. */
But that code laready checks for basic block boundary via INSN_BASIC_BLOCK
note that should be threre.  Where exactly in CSE the instruction is
transformed?

Honza
> 
> 
> r~


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