Skip to content

[llvmg++] Code is generated for empty classes #509

@lattner

Description

@lattner
Bugzilla Link 137
Resolution FIXED
Resolved on Jun 01, 2009 22:47
Version 1.0
OS All
Depends On llvm/llvm-bugzilla-archive#156
CC @lattner

Extended Description

This testcase should not generate any stores in the function body:


struct X {};
X foo() { return X(); }

It currently generates:


    %struct.X = type { ubyte }

void %_Z3foov(%struct.X* %agg.result) {
entry:
%tmp = getelementptr %struct.X* %agg.result, long 0, ubyte 0
store ubyte 0, ubyte* %tmp
ret void
}

The type is correct (empty classes in C++ have one byte), but the store is not
needed. Empty classes come up a lot in C++ libraries, like the STL, these
stores are getting in the way.

Unfortunately this will require some changes in the front-end, so this will
probably happen after 1.1.

-Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions