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: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs