This is an archive of the discontinued LLVM Phabricator instance.

AArch64: allocate small fixed args properly in varargs functions.
ClosedPublic

Authored by t.p.northover on Jan 10 2023, 3:57 AM.

Details

Reviewers
t.p.northover
Summary

Quite an embarrassing one here, vargargs calls have been broken in some edge-cases for quite a while...

On Darwin, function arguments occupy their real size when passed on the stack (e.g. an i16 only consumes 2 bytes). This means that, even for fixed args in varargs calls we need to keep track of the original type being passed before any DAG/GISel promotions. Existing logic only applied this fix to the non-varargs case leading to mismatch between caller & callee in those situations.

On Linux & Windows these arguments always occupy a 64-bit slot anyway so there's no special handling needed.

Diff Detail

Event Timeline

t.p.northover created this revision.Jan 10 2023, 3:57 AM
t.p.northover requested review of this revision.Jan 10 2023, 3:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 3:57 AM
Gerolf added a subscriber: Gerolf.Jan 17 2023, 9:46 AM

LGTM for both (GISel & SDAG).

t.p.northover accepted this revision.Jan 18 2023, 3:35 AM

Thanks, pushed to main (3ed58d4df65e).

This revision is now accepted and ready to land.Jan 18 2023, 3:35 AM
t.p.northover closed this revision.Jan 18 2023, 3:36 AM