[llvm-bugs] [Bug 26327] New: [x86] Redundant displacement in calls to virtual base class function with this-adjustment

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 26 13:30:07 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26327

            Bug ID: 26327
           Summary: [x86] Redundant displacement in calls to virtual base
                    class function with this-adjustment
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org
            Blocks: 26299
    Classification: Unclassified

Consider:

  struct Base1 { virtual void f1(); };
  struct Base2 { virtual void f2(); };

  struct S : Base1, Base2 {
    void foo();
  };

  void S::foo() {
    f2();
  }

At -Os, we generate:

00000000 <?foo at S@@QAEXXZ>:
   0:    8b 41 04                 mov    0x4(%ecx),%eax
   3:    83 c1 04                 add    $0x4,%ecx
   6:    ff 20                    jmp    *(%eax)

MSVC generates:

?foo at S@@QAEXXZ (public: void __thiscall S::foo(void)):
  00000000: 83 C1 04           add         ecx,4
  00000003: 8B 01              mov         eax,dword ptr [ecx]
  00000005: FF 20              jmp         dword ptr [eax] 

saving one byte, admittedly at the cost of a longer dependency chain. Maybe
that's worth it at -Os though?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160126/364ceff5/attachment.html>


More information about the llvm-bugs mailing list