This is an archive of the discontinued LLVM Phabricator instance.

[clang][CodeGen] Use memory type representation in `va_arg`
ClosedPublic

Authored by jansvoboda11 on Feb 3 2022, 7:03 AM.

Details

Summary

Some types (e.g. _Bool) have different scalar and memory representations. CodeGen for va_arg didn't take this into account, leading to an assertion failures with different types.

This patch makes sure we use memory representation for va_arg.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Feb 3 2022, 7:03 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 7:03 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Should we add tests for other targets besides arm64?

clang/test/CodeGen/arm64-arguments.c
203

Not sure what to check here. Currently, we're just verifying the compiler doesn't crash.

Add proper check

ahatanak accepted this revision.Feb 3 2022, 2:26 PM

LGTM

clang/test/CodeGen/arm64-arguments.c
203

If CreateStore is crashing, you can check the store instruction is being emitted with the correct type.

This revision is now accepted and ready to land.Feb 3 2022, 2:26 PM
This revision was landed with ongoing or failed builds.Feb 4 2022, 3:11 AM
This revision was automatically updated to reflect the committed changes.