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: don't rename unreferenced formerly-addressable vars in debug stmts


On Wed, Sep 30, 2009 at 9:02 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> This patch fixes a problem we've run into in the backport of VTA to GCC
> 4.4. ?I couldn't trigger the problem in the trunk, but I can't quite
> rule out the possibility that it hits, so I figured I'd post the patch.
>
> The testcase has a debug stmt such as:
>
> # DEBUG z => *&b % b.1_5
>
> b is optimized so that it is no longer addressable, and in the end all
> references to it are optimized away, except for the reference in the
> debug stmt, that, in the branch, gets simplified to b % b.1_5.
>
> Since b is not referenced elsewhere, it is no longer marked as
> referenced, but we still mark it for renaming, because it's a gimple
> register, but then we crash when we attempt to rename the
> otherwise-unreferenced variable.
>
> The fix that is actually important for the branch is the addition of
> referenced_var_p(), and its use when we scan for vars that need renaming
> in pop_stmt_changes(). ?It is not applicable to the trunk.
>
> However, the other change, that amounts to clearing the mark that a
> variable needs renaming when the variable becomes unreferenced (it's
> marked when it becomes non-addressable), might be useful for the trunk,
> even though I don't have any testcase that exhibits a problem.
>
> Thoughts? ?Should I check the first patch in the trunk? ?The second is
> for redhat/gcc-4_4-branch.

No.  I think what you see on the branch cannot happen on trunk.
In fact we only ever mark variables for renaming that are still
in the list of referenced vars (if I grok execute_update_addresses_taken
correctly).  You likely saw the issue because of our use of
arbitrary decls as virtual operands.

Richard.

>
>
> --
> Alexandre Oliva, freedom fighter ? ?http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/ ? FSF Latin America board member
> Free Software Evangelist ? ? ?Red Hat Brazil Compiler Engineer
>
>


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