This is the mail archive of the gcc@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: ICE in change_address at emit_rtl.c


Richard Kenner wrote:

>    This is one reason why fold causes problems as it sometimes
>    creates SAVE_EXPR.  Using  a scoped temporary:
>       let tmp := expr in BODY
>    would be preferable for us.
>
>But is it realistic for fold to make one?  fold has no idea where the
>expression being folded is going.
>
I'm not sure what the problem is.  My proposal is to use some kind of
LET_EXPR, which takes a declaration and two expressions.  It seems
plausible to me that any place that creates a SAVE_EXPR could use a
LET_EXPR instead. For example:
  arr[index] += expr
Here of course arr and index should only be evaluated once.  So this
would be
  LET t1 :=arr IN LET t2 := index IN t1[t2] = t1[t2] + expr
Similarly, where fold creates a SAVE_EXPR because some sub-expression
may be evaluated more than once, you can wrap the expression (the argument
to fold) in a LET_EXPR, or whatever makes sense.  I.e. you can control
the lifetime of the temporary as it is needed.
    --Per Bothner


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