[LLVMbugs] [Bug 13734] New: Inefficient code for passing a non-pod by value
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Aug 30 18:22:13 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13734
Bug #: 13734
Summary: Inefficient code for passing a non-pod by value
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rafael.espindola at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Given
struct ostreambuf_iterator {
int* _M_sbuf;
bool _M_failed;
ostreambuf_iterator();
};
void do_put(ostreambuf_iterator) ;
struct num_put {
void put(ostreambuf_iterator __s) const ;
};
void num_put::put(ostreambuf_iterator __s) const{
do_put(__s);
}
clang now produces
define void @_ZNK7num_put3putE19ostreambuf_iterator(%struct.num_put* nocapture
%this, i32* %__s.coerce0, i8 %__s.coerce1) uwtable optsize ssp align 2 {
%__s = alloca %struct.ostreambuf_iterator, align 8
%1 = alloca %struct.ostreambuf_iterator, align 8
%2 = getelementptr inbounds %struct.ostreambuf_iterator* %__s, i64 0, i32 0
store i32* %__s.coerce0, i32** %2, align 8
%3 = getelementptr %struct.ostreambuf_iterator* %__s, i64 0, i32 1
store i8 %__s.coerce1, i8* %3, align 8
%4 = bitcast %struct.ostreambuf_iterator* %1 to i8*
%5 = bitcast %struct.ostreambuf_iterator* %__s to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 9, i32 8, i1 false)
%6 = getelementptr inbounds %struct.ostreambuf_iterator* %1, i64 0, i32 0
%7 = load i32** %6, align 8
%8 = getelementptr %struct.ostreambuf_iterator* %1, i64 0, i32 1
%9 = load i8* %8, align 8
call void @_Z6do_put19ostreambuf_iterator(i32* %7, i8 %9) optsize
ret void
}
Before r162254 we used to produce
define void @_ZNK7num_put3putE19ostreambuf_iterator(%struct.num_put* nocapture
%this, i32* %__s.coerce0, i8 %__s.coerce1) uwtable optsize ssp align 2 {
tail call void @_Z6do_put19ostreambuf_iterator(i32* %__s.coerce0, i8
%__s.coerce1) optsize
ret void
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list