On Tue, Sep 22, 2015 at 1:16 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Mon, Sep 21, 2015 at 9:32 PM, Richard Sandiford > <rdsandif...@googlemail.com> wrote: >> Richard Biener <richard.guent...@gmail.com> writes: >>> On Fri, Sep 18, 2015 at 3:32 PM, Trevor Saunders <tbsau...@tbsaunde.org> >>> wrote: >>>> On Wed, Sep 16, 2015 at 03:11:14PM -0400, David Malcolm wrote: >>>>> On Wed, 2015-09-16 at 09:16 -0400, Trevor Saunders wrote: >>>>> > Hi, >>>>> > >>>>> > I gave changing from gimple to gimple * a shot last week. It turned out >>>>> > to be not too hard. As you might expect the patch is huge so its >>>>> > attached compressed. >>>>> > >>>>> > patch was bootstrapped + regtested on x86_64-linux-gnu, and run through >>>>> > config-list.mk. However I needed to update it some for changes made >>>>> > while testing. Do people want to make this change now? If so I'll try >>>>> > and commit the patch over the weekend when less is changing. >>>>> >>>>> >>>>> FWIW there are some big changes in gcc/tree-vect-slp.c:vectorizable_load >>>>> that looks like unrelated whitespace changes, e.g. the following (and >>>>> there are some followup hunks). Did something change underneath, or was >>>>> there a stray whitespace cleanup here? (I skimmed through the patch, >>>>> and this was the only file I spotted where something looked wrong) >>>> >>>> yeah, it was a stray whitespace cleanup, but I reverted it. >>>> >>>> Given the few but only positive comments I've seen I'm planning to >>>> commit this over the weekend. >>> >>> Thanks a lot! >>> >>> If you are still in a refactoring mood then I have sth else here. When >>> streamlining the gimple accessors I noticed the glaring const-correctness >>> issue in >>> >>> /* Return a pointer to the LHS of assignment statement GS. */ >>> >>> static inline tree * >>> gimple_assign_lhs_ptr (const gassign *gs) >>> { >>> return const_cast<tree *> (&gs->op[0]); >>> } >>> >>> and was thinking to either "fix" it by removing the 'const' or by >>> merging gimple_assign_lhs and gimple_assign_lhs_ptr into >>> >>> static inline const tree& >>> gimple_assign_lhs (const gassign *); >>> >>> static inline tree& >>> gimple_assign_lhs (gassign *); >> >> AIUI const_tree (like const_rtx) only protects the top-level tree. >> This is something I always hoped to change for rtl one day, but fixing >> all the fallout would be an incredibly dull task... >> >> I suppose protecting the top level is still better than nothing though. > > Note these functions return pointers to parts of that "top level" so they > break const correctness. Not sure why they were made to take a > const_gimple in the first place.
So for const gimple * they should return a const tree * which AFAIK only protects the pointer, not the contents of the tree (as opposed to const_tree *). Still AFAIK it's used to modify the pointer in some places. Richard. > Richard. > >> Thanks, >> Richard >>