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] tree-vrp.c: Pick up a constant from an assertion.


On Thu, 2005-04-14 at 09:05 -0400, Kazu Hirata wrote:
> Attached is a patch to improve VRP by picking up a range from an
> expression that maybe_add_assert_expr inserts.
> 
> If we see an "if" statement of the form
> 
>   if (a == 123)
> 
> We insert "a = 123;" into the "then" arm of the "if" statement
> so that the propagation engine can pick up range [123, 123].
> 
> The problem is that the propagation engine does not pick up a range
> from "a = 123;".  Instead it thinks that the value of 'a' is
> VR_VARYING.
> 
> The patch fixes this problem by noticing an assignment of an integer
> constant into an SSA_NAME to create an appropriate VR_RANGE.
> 
> With the current pass ordering, the number of COND_EXPRs that VRP
> folds into unconditional jumps stays the same while compiling cc1-i
> files, with or without this patch.  I guess this kind of opportunity
> is easily taken by DOM.
Yes.  DOM catches this case trivially as it's just a constant 
propagation where the set is implicitly derived from the 
COND_EXPR.  There's definitely value in recording these
equivalencies, so adding this to VRP is a "good thing".

jeff




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