On 11/08/2011 08:29 PM, Jeff Law wrote:
Just to understand, what does this do with your optimization?

void f(void *p) {
 if (p) {
   puts("sell_soul_to_devil"); puts("post_reload_rewrite"); }

 *p = 2; }

... f(NULL);

Does the program sell its soul to the devil before crashing?

If "f" is not inlined into its caller, then there's nothing for the
new pass to do.  There's no explicit NULL dereference and there's no
assignments to "p", so there's no PHI at the merge point for P.

But is that just a limitation of the representation? With assertions as in VRP you'd have

   if (p_1) goto BB1 else goto BB2
BB1: ... goto BB3;
BB2: p_2 = assert(p_1, p_1 == 0); goto BB3;

   p_3 = phi (p_1<BB1>, p_2<BB2>);
   *p_3 = 2;

What would happen then?

Paolo

Reply via email to