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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
            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@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@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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to