[PATCH] ccp for V_MUST_DEF operands
Diego Novillo
dnovillo@redhat.com
Fri Jul 16 20:13:00 GMT 2004
On Fri, 2004-07-16 at 10:26, Brian Booth wrote:
> On Thu, 2004-07-15 at 09:18, Diego Novillo wrote:
> > Could you add a test case? Something like this should suffice:
> >
> > --------------------------------------------------------------------
> > int G;
> >
> > foo (int i)
> > {
> > if (i > 0)
> > G = 3;
> > else
> > G = 3;
> > if (G != 3)
> > link_error ();
> > }
> >
> > main ()
> > {
> > foo (0);
> > return 0;
> > }
> > --------------------------------------------------------------------
>
> I'm withdrawing this patch for the time being because it does not
> propagate G in the testcase above. The problem has to do with performing
> a meet operation on UNKNOWN_VAL. More specifically, the case CONSTANT M
> UNKNOWN_VAL = VARYING is causing G not to be propagated since the PHI
> node for G is simulated before one of the assignments to G in the
> if-else block. This is causing the PHI node to be marked as VARYING and
> ensures that it is not simulated again.
>
What about initially setting phi_val to UNDEFINED if
get_value (PHI_RESULT (phi)) returns UNKNOWN_VAL?
So, the first time we visit the PHI we get UNDEFINED M 3 = 3. The
second time we'll get 3 M 3 = 3.
If the else branches didn't have an assignment to G, we would get
UNDEFINED M 3 = 3. But the second round would give us 3 M UNKNOWN_VAL =
VARYING.
Diego.
More information about the Gcc-patches
mailing list