This fixes a recent regression on the testcase of PR47259 where
we bring local a global register variable during WPA time and
then mangle its register name spec during ltrans.  Oops.
It doesn't make sense to bring "local" global register variables.

Fixed by making varpool_externally_visible_p return true
for all DECL_HARD_REGISTER decls.

Honza, does this look like the correct fix?  Or should we represent
global register vars differently in the varpool?  Any idea what
caused this to regress?

Sofar tested on the testcase only.

Thanks,
Richard.

2011-12-02  Richard Guenther  <rguent...@suse.de>

        PR lto/47259
        * ipa.c (varpool_externally_visible_p): Register variables
        are always externally visible.

Index: gcc/ipa.c
===================================================================
--- gcc/ipa.c   (revision 181902)
+++ gcc/ipa.c   (working copy)
@@ -662,6 +662,8 @@ varpool_externally_visible_p (struct var
   if (varpool_used_from_object_file_p (vnode))
     return true;
 
+  if (DECL_HARD_REGISTER (vnode->decl))
+    return true;
   if (DECL_PRESERVE_P (vnode->decl))
     return true;
   if (lookup_attribute ("externally_visible",

Reply via email to