This is an archive of the discontinued LLVM Phabricator instance.

[clang codegen] Use IR "align" attribute for static array arguments.
ClosedPublic

Authored by efriedma on Jul 30 2020, 5:38 PM.

Details

Summary

Without the "align" attribute, marking the argument dereferenceable is basically useless. See also D80166.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46876 .

Diff Detail

Event Timeline

efriedma created this revision.Jul 30 2020, 5:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 5:38 PM
efriedma requested review of this revision.Jul 30 2020, 5:38 PM
rjmccall added inline comments.Aug 10 2020, 12:39 PM
clang/lib/CodeGen/CGCall.cpp
2524

Is it reasonable to assume that this is an array of complete objects, or do we need to worry about someone doing e.g.

class A : virtual HighlyAligned { char buffer[16]; ];

void foo(A[static 1]);

This isn't completely disabled in C++ mode, is it?

efriedma added inline comments.Aug 10 2020, 12:48 PM
clang/lib/CodeGen/CGCall.cpp
2524

It is disabled in C++: "error: static array size is a C99 feature, not permitted in C++",

rjmccall accepted this revision.Aug 10 2020, 1:50 PM

Okay. LGTM, then.

This revision is now accepted and ready to land.Aug 10 2020, 1:50 PM
This revision was landed with ongoing or failed builds.Aug 18 2020, 12:51 PM
This revision was automatically updated to reflect the committed changes.