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: [patch 1/2] PR27313 Discover non-trapping memory accesses


On Saturday 14 April 2007 13:40, Richard Guenther wrote:
> I believe that if we could eliminate the dominating trapping memory
> access as dead we have proved the non-trapping memory accesses
> are also dead (maybe I'm missing something).

This is obviously not true.  Not even within one basic block:

  v_1 = load from X
  v_2 = load from X

You would mark the load to v_2 as not trapping because it is
dominated by the load to v_1, and when v_1 turns out to be dead
code, the load to v_1 would also be removed and you've exposed
the load into v_2.

The questions is, when this can happen.

One obvious case is when tree DCE does not run, but we nuke dead
code on RTL later on.  Another case is when v_1 becomes dead code
after pass_nontrap.

Your new pass runs after FRE, so fully redundant loads without a
store in between should be eliminated. (At least most of the time,
but not always: The dominator tree might change between FRE and
pass_nontrap.)
So I'm guessing that pass_nontrap is probably marking loads which
have a dominating load and a store on the path in between.  If
this is true, then you're relying on the elimination of fully
redundant loads before pass_nontrap.  I don't think this is safe.
(BTW is a store to an address before a load sufficient to prove that
the load cannot trap?)

But, maybe I'm missing something, too :-)

Gr.
Steven


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