This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][NFC] Move LiveDebugValues class declaration to a header, add unit test boilerplate
ClosedPublic

Authored by jmorse on Sep 21 2021, 6:27 AM.

Details

Summary

Hi,

After pondering how best to communicate changes to this pass, I figured it's easiest if there are unit tests. There are several interacting internal phases, which aren't easily accessed from MIR tests. Thus, in this patch I copy the InstrRefBasedLDV and MLocTracker class definitions to a header, accompanied by various related utility classes. I've also added a unit-test C++ file with no actual tests in it, in preparation for the next patch which adds such tests.

This is almost entirely a copy and paste; there should be no functional changes.

Diff Detail

Event Timeline

jmorse created this revision.Sep 21 2021, 6:27 AM
jmorse requested review of this revision.Sep 21 2021, 6:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 6:27 AM
djtodoro added inline comments.
llvm/unittests/CodeGen/InstrRefLDVTest.cpp
33

I guess we don't need this.

48

So this is just an infrastructure, and we are going to add tests here in the future patches?

jmorse added inline comments.Sep 21 2021, 6:49 AM
llvm/unittests/CodeGen/InstrRefLDVTest.cpp
48

Tests in future patches, currently incoming.

Apart from missing clang-format this patch seems fine to me.

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
41

?

122

?

jmorse added inline comments.Oct 12 2021, 6:45 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
41

Erk, forgot to copy across documentation for this class, will fold that in.

122

When this was originally looked at by Vedant last year, he suggested that there shouldn't be an "empty" or "illegal" value number. Avoiding having to think about an extra edge case makes reasoning a lot easier, so I removed the empty value number. But then I started using the IndexedMap container, which needs a "null" value to work, so put it back. And apparently this comment too.

I'll replace this with an explanation of where the "empty" value is used, and why.

jmorse updated this revision to Diff 379037.Oct 12 2021, 7:51 AM

Rebase for recent DBG_VALUE operand flags change, apply clang-format, add some missing documentation. clang-tidy warnings will be squelched by some changes folded into later commits.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 12 2021, 8:07 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.