[tree-ssa]: Easy way to get default def of a variable?
Daniel Berlin
dberlin@dberlin.org
Thu Jun 5 15:39:00 GMT 2003
On Thursday, June 5, 2003, at 07:21 AM, Andrew MacLeod wrote:
> On Thu, 2003-06-05 at 00:38, Daniel Berlin wrote:
>>>>
>>>>
>>> We now connect them to empty_stmt_expr. Do you want to connect them
>>> to
>>> this table so that we can traverse that table to look for live-
>>> on-entry
>>> or uninitialized uses? I guess we could do that.
>>
>> Well, remember, i want the table because right now i have to take a
>> use, and walk the entire def chain backwards, to get the default def's
>> version.
>> This is expensive.
>>
>
> Out of curiosity, why do you need the default def? ie, why do you care
> that a_2 is live on entry when you have a_4 = a_3 + 2, and a_3 has a
> def?
There are cases where we need to insert *before* the first "real"
definition of a variable.
They are the odd corner case, but it happens.
One is when we move things out of loops, need to generate a save before
the beginning of the loop, and the only definition (of one of the
variables in our expression) on entry to the loop is the default one
coming from a function argument.
To insert the save before the loop, we need the default def (of that
variable).
It won't be the version used in one of the in-loop expressions we are
eliminating, because (at least in this test case) there is a phi node
first in the loop that the in-loop expression is using the result of.
I have a testcase if you'd really like to see it happen.
--Dan
More information about the Gcc
mailing list