This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Tree sharing issues...
> In message <20031119230806.GU11681@kam.mff.cuni.cz>, Jan Hubicka writes:
> >> In message <20031119225619.GR11681@kam.mff.cuni.cz>, Jan Hubicka writes:
> >> >> In message <20031119224619.GP11681@kam.mff.cuni.cz>, Jan Hubicka writes
> >:
> >> >> >> >OK, I will extend my sharing test by is_gimple_min_invariant. Do
> >es t
> >> >hat
> >> >> >> >look right?
> >> >> >> is_gimple_min_invariant (blah) && ! IS_EMPTY_STMT (blah) since I
> >> >> >> believe the empty statement is (void) 0, but is not shared.
> >> >> >>
> >> >> >> Ugh.
> >> >> >OK, another positive:
> >> >> >../../gcc/caller-save.c:370: error: Wrong sharing of tree nodes
> >> >> ># hard_regs_to_save_6 = VDEF <hard_regs_to_save_624>;
> >> >> >hard_regs_to_save[1] = T.329_1370;
> >> >> >
> >> >> >hard_regs_to_save[1];
> >> >> >
> >> >> >../../gcc/caller-save.c:370: error: Wrong sharing of tree nodes
> >> >> ># hard_regs_to_save_143 = VDEF <hard_regs_to_save_81>;
> >> >> >hard_regs_to_save[1] = T.339_1393;
> >> >> >
> >> >> >hard_regs_to_save[1];
> >> >> >
> >> >> >../../gcc/caller-save.c:370: error: Wrong sharing of tree nodes
> >> >> ># hard_regs_to_save_623 = VDEF <hard_regs_to_save_488>;
> >> >> >hard_regs_to_save[1] = T.349_1416;
> >> >> >
> >> >> >hard_regs_to_save[1];
> >> >> >
> >> >> >../../gcc/caller-save.c:370: error: Wrong sharing of tree nodes
> >> >> ># hard_regs_to_save_80 = VDEF <hard_regs_to_save_5>;
> >> >> >hard_regs_to_save[1] = T.357_1437;
> >> >> >
> >> >> >hard_regs_to_save[1];
> >> >> >
> >> >> >
> >> >> >This looks wrong. Seems to happen during jump threading...
> >> >> I'm not sure why we wouldn't be sharing that node
> >> >> (hard_regs_to_save[1]).
> >> >>
> >> >> Diego?
> >> >I can add it into my definition of shareable nodes, if you tell me how
> >> >to recognize these.
> >>
> >> TREE_ADDRESSABLE (var)
> >> || decl_function_context (var) != current_function_decl
> >> || may_aliases (var)
> >>
> >> Or something close to that.
> >I am already allowing sharing of all DECL_P nodes. The node above is
> >ARRAY_REF with constant operand, isn't it? So I need some kind of test
> >"if array_ref is having all arguments constant, then it can be shared"
> >or am I wrong?
> Well, you also need to allow sharing of certain constants, SSA_NAME nodes
> and probably other stuff.
>
> Fundamentally trees haven't had well defined sharing rules, so you're going
> to largely have to "figure things out and document them".
Yes, I quite understand the uglyness of situation :)
Even on RTL we are breaking sharing all the time, so that is why
I want to implement this early.
This is my current status:
/* Return true when the T can be shared. */
static bool
tree_node_shared_p (tree t)
{
if (TYPE_P (t) || DECL_P (t)
|| is_gimple_min_invariant (t)
|| TREE_CODE (t) == SSA_NAME)
return true;
return false;
}
It pretty much match what you are mentioning.
The array reference above is other stuff. If you think it makes
sense, I will add check for ARRAY_REF with all operands passing
is_gimple_min_invariant. DOes that sound plausible?
Or do we want to fix jump threading?
Honza
>
>
> Jeff
>