public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63874] New: vtable address generation goes through memory
@ 2014-11-14 17:01 pinskia at gcc dot gnu.org
  2014-11-17  9:11 ` [Bug target/63874] " ramana at gcc dot gnu.org
  2014-11-18 17:17 ` rearnsha at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-14 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63874

            Bug ID: 63874
           Summary: vtable address generation goes through memory
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Target: aarch64

Take:
struct a
{
  virtual void f(void);
  virtual ~a();
};
struct b : a
{
  virtual void f(void);
  virtual ~b();
};
void b::f(void){}
b::~b(void){}

Currently b::~b() produces:
_ZN1bD2Ev:
.LFB2:
    .cfi_startproc
    ldr    x1, .LC0
    str    x1, [x0]
    b    _ZN1aD2Ev
    .cfi_endproc

This really should be:
_ZN1bD2Ev:
.LFB1:
    .cfi_startproc
    adrp    x1, _ZTV1b+16
    add    x1, x1, :lo12:_ZTV1b+16
    str    x1, [x0]
    b    _ZN1aD2Ev

Which is produced if I don't have a definition of b::f() in the same TU causing
the vtable not to be defined weak in this TU.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/63874] vtable address generation goes through memory
  2014-11-14 17:01 [Bug target/63874] New: vtable address generation goes through memory pinskia at gcc dot gnu.org
@ 2014-11-17  9:11 ` ramana at gcc dot gnu.org
  2014-11-18 17:17 ` rearnsha at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ramana at gcc dot gnu.org @ 2014-11-17  9:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63874

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-17
                 CC|                            |ramana at gcc dot gnu.org
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/63874] vtable address generation goes through memory
  2014-11-14 17:01 [Bug target/63874] New: vtable address generation goes through memory pinskia at gcc dot gnu.org
  2014-11-17  9:11 ` [Bug target/63874] " ramana at gcc dot gnu.org
@ 2014-11-18 17:17 ` rearnsha at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-11-18 17:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63874

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Sounds like this might be confusion between weak definitions and weak
references.  If we have a weak reference to the object, we cannot convert it
into a pc-relative expression, since that would mean we couldn't detect NULL. 
However, if we have a non-weak reference to a weak object we can replace that
with a pc-relative addressing mode, _provided_ that we can guarantee that the
definition will appear in the same link unit (ie it's not part of building a
DSO).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-18 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 17:01 [Bug target/63874] New: vtable address generation goes through memory pinskia at gcc dot gnu.org
2014-11-17  9:11 ` [Bug target/63874] " ramana at gcc dot gnu.org
2014-11-18 17:17 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).