This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Initialize MemInfoBlock data.
ClosedPublic

Authored by snehasish on Mar 22 2022, 1:59 PM.

Details

Summary

This patch updates the existing default no-arg constructor for
MemInfoBlock to explicitly initialize all members. Also add missing
DataTypeId initialization to the other constructor. These issues were
exposed by msan on patch D121179. With this patch D121179 builds cleanly
on msan.

Diff Detail

Event Timeline

snehasish created this revision.Mar 22 2022, 1:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 1:59 PM
snehasish requested review of this revision.Mar 22 2022, 1:59 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 22 2022, 1:59 PM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
tejohnson added inline comments.Mar 22 2022, 2:06 PM
compiler-rt/include/profile/MemProfData.inc
109–131

What if this constructor also did the same default initialization as the no-arg constructor, then overwrote the fields given by argument? That way we would not have missed initializations like this if the fields change.

snehasish updated this revision to Diff 417406.Mar 22 2022, 2:29 PM

Address comments.

PTAl, thanks!

compiler-rt/include/profile/MemProfData.inc
109–131

Good idea, we can delegate to the default constructor and only initialize the necessary fields. Also took the opportunity to clean up the snake case arg names to be consistent with the rest of the surrounding code.

This revision is now accepted and ready to land.Mar 22 2022, 2:32 PM
This revision was landed with ongoing or failed builds.Mar 22 2022, 2:36 PM
This revision was automatically updated to reflect the committed changes.