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] Store motion rewrite


There seems to be a problem with the code somewhere.
Consider the trivial test case 

	static int x;
	void foo(int p, int q, int r)
	{
	  x = q;
	  if (p)
	    x = r;
	}

I would expect store motion to notice the two stores,
that the one dominates the other (so there are no path
issues), and sink the store below the if.  I.e.

	  tmp = q;
	  if (p)
	    tmp = r;
	  x = tmp;

The code does in fact notice the two stores:

ST_avail and ST_antic (shown under loads..)
LDST list: 
  Pattern (  0): (mem/f:SI (symbol_ref:SI ("x")) [2 x+0 S4 A32])
         Loads : (insn_list 16 (insn_list 11 (nil)))
        Stores : (insn_list 16 (insn_list 11 (nil)))

But we only delete insn 11, and decide to insert its replacement
on the 0->2 edge.  We wind up with a trivial transformation of
the code that doesn't help in the least.  Indeed, the resulting
code is arguably worse.


r~


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