This is an archive of the discontinued LLVM Phabricator instance.

[PoC][Clang] Use TypeSize instead of uint64_t for getTypeAllocSize().
AbandonedPublic

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

Details

Summary

The return type of getTypeAllocSize() is TypeSize. We do not rely on the implicit conversion to uint64_t. The return value may be scalable values.

Diff Detail

Event Timeline

HsiangKai created this revision.Mar 30 2021, 6:57 AM
HsiangKai requested review of this revision.Mar 30 2021, 6:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 6:57 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sdesmalen added inline comments.Mar 30 2021, 1:35 PM
clang/lib/CodeGen/CGCall.cpp
2856–2857

Can we assume their scalable flags must match? In that case, it's best to assert this.

llvm::TypeSize::isKnownLE() should be used with some caution, because isKnownLE(4, vscale x 4) evaluates to true, so if their scalable flags don't match, this may lead to surprising results.

4930

This doesn't seem correct for scalable vectors.
If you expect it to work only for fixed-width vectors, you should use getFixedSize instead.

HsiangKai updated this revision to Diff 334590.Mar 31 2021, 9:56 PM

Address comments.

HsiangKai marked 2 inline comments as done.Mar 31 2021, 9:56 PM
HsiangKai abandoned this revision.Jun 5 2021, 5:50 AM