This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.
ClosedPublic

Authored by ikudrin on Aug 6 2020, 8:50 AM.

Details

Summary

This also fixes the condition in the assertion in DwarfCompileUnit::getLabelBegin() because it checked something unrelated to the returned value.

Diff Detail

Event Timeline

ikudrin created this revision.Aug 6 2020, 8:50 AM
ikudrin requested review of this revision.Aug 6 2020, 8:50 AM
aprantl accepted this revision.Aug 6 2020, 12:45 PM
aprantl added inline comments.
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
302

can you add an && "some meaningful message" to hint at what went wrong?

This revision is now accepted and ready to land.Aug 6 2020, 12:45 PM
dblaikie added inline comments.Aug 6 2020, 4:32 PM
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
60

Is this used before its initialization - generally nice not to prematurely initiliaze things, because it thwarts checking like msan that might find bugs if this isn't intended to be used until after some other initialization.

ikudrin added inline comments.Aug 6 2020, 8:03 PM
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
60

LabelBegin is initialized under a condition, not in the constructor, thus, it can be left uninitialized. If we rely on MSan, the assert in getLabelBegin() is useless and vice versa.

302

Nothing more meaningful than "LabelBegin is not initialized" comes to me, but that would be a tautology. Any suggestions?

dblaikie added inline comments.Aug 7 2020, 12:13 PM
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
60

Fair enough - thanks for the explanation!

This revision was landed with ongoing or failed builds.Aug 10 2020, 2:19 AM
This revision was automatically updated to reflect the committed changes.