This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Do not use memcpy for scalable struct copy.
AbandonedPublic

Authored by HsiangKai on Mar 30 2021, 6:54 AM.

Details

Summary

For scalable struct types, we do not know the exact size of the struct. Do not use memcpy for struct copy. We use extractvalue and insertvalue for the purpose.

Diff Detail

Event Timeline

HsiangKai created this revision.Mar 30 2021, 6:54 AM
HsiangKai requested review of this revision.Mar 30 2021, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 6:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
craig.topper retitled this revision from [Clang] Do not use memcpy for struct copy. to [Clang] Do not use memcpy for scalable struct copy..Mar 30 2021, 10:15 AM
frasercrmck added inline comments.Mar 31 2021, 6:28 AM
clang/include/clang/AST/Type.h
4627

nit: missing "a": is a sizeless type

clang/lib/CodeGen/CGExprAgg.cpp
2085

Are SrcVec and DestVec the right names here? It took me a while to realise they're not vector types.

2086

We could define Vec inside the loop?

2088

I don't know if getContext().getASTRecordLayout(Record).getFieldCount() is expensive to compute, but this may be recomputing it on every iteration.

HsiangKai updated this revision to Diff 334579.Mar 31 2021, 8:02 PM

Address comments.

HsiangKai marked 4 inline comments as done.Mar 31 2021, 8:03 PM
HsiangKai abandoned this revision.Jun 2 2021, 7:43 AM