This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Remove packed qualifier for MemprofRecord::Frame.
ClosedPublic

Authored by snehasish on Feb 18 2022, 10:37 AM.

Details

Summary

Now that we use dedicated serialize and deserialize methods in order to
ensure consistency across big and small endian systems. The packed
qualifier on the Frame struct can be removed.

Diff Detail

Event Timeline

snehasish requested review of this revision.Feb 18 2022, 10:37 AM
snehasish created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2022, 10:37 AM
This revision is now accepted and ready to land.Feb 18 2022, 12:14 PM

What about the other uses of PACKED e.g. in MemProfData.inc? Should/can they be removed?

What about the other uses of PACKED e.g. in MemProfData.inc? Should/can they be removed?

This use of packed is for reading and writing of the indexed profile format. The packed structs in MemProfData.inc are written by the runtime and read by the raw memprof profile reader. The use of packed structs makes the compiler generate alignment aware code, simplifying the implementation in the runtime. Here, within llvm, we have access to support::endian so implementing endian and alignment aware serialization/deserialization is simple. We would have to replicate this in the memprof runtime.

tejohnson accepted this revision.Feb 18 2022, 1:51 PM

What about the other uses of PACKED e.g. in MemProfData.inc? Should/can they be removed?

This use of packed is for reading and writing of the indexed profile format. The packed structs in MemProfData.inc are written by the runtime and read by the raw memprof profile reader. The use of packed structs makes the compiler generate alignment aware code, simplifying the implementation in the runtime. Here, within llvm, we have access to support::endian so implementing endian and alignment aware serialization/deserialization is simple. We would have to replicate this in the memprof runtime.

Oh ok, that makes sense.

lgtm