[LLVMbugs] [Bug 15770] New: mergefunc could improve in face of virtual methods?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 17 09:54:43 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15770

            Bug ID: 15770
           Summary: mergefunc could improve in face of virtual methods?
           Product: new-bugs
           Version: 3.2
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bruce.mitchener at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10360
  --> http://llvm.org/bugs/attachment.cgi?id=10360&action=edit
Example C++ file

With emscripten, we'd like to be able to use the mergefunc optimization pass
and in looking at the results of using it, a lot of thunks are created for
virtual methods, presumably due to vtable references.

I've attached an example C++ file that demonstrates a very basic case of this.
Why do we need the thunk in this situation? Do we really need the bitcast?

I compiled the attached file as follows:

    /usr/local/bin/clang++ -emit-llvm -S -o test.ll -c test.cpp

And then ran opt:

    /usr/local/bin/opt -debug -mergefunc test.ll -o opt-test.bc

And that told me:

    Args: /usr/local/bin/opt -debug -mergefunc test.ll -o opt-test.bc
    size of module: 11
    size of worklist: 8
    Inserting as unique: main
    Inserting as unique: _ZN1BC1Ev
    Inserting as unique: _ZN1CC1Ev
    Inserting as unique: _ZN1CC2Ev
    Inserting as unique: _ZN1AC2Ev
    Inserting as unique: _ZN1C3fooEi
    Inserting as unique: _ZN1BC2Ev
      _ZN1C3fooEi == _ZN1B3fooEi
    writeThunk: _ZN1B3fooEi
    size of FnSet: 7

Any chance this could be better?

-- 
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/20130417/eb714afd/attachment.html>


More information about the llvm-bugs mailing list