This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Remove redundant initialization of DbgVariable's MInsn, NFC
AcceptedPublic

Authored by dstenb on Jan 24 2019, 2:42 AM.

Details

Summary

When building a location list, the first debug value for a variable was
passed to DebugLocStream::ListBuilder. Later on, in ListBuilder()'s
destructor, initializeDbgValue() was called with the passed debug value,
setting the DbgVariable's MInsn pointer. A non-null MInsn says that the
variable is described by a single debug value through the variable's
scope, which is not the case when we have begun building a location
list.

In DwarfCompileUnit::constructVariableDIEImpl(), the presence of a
location list index is checked before emitting a single location, so
setting MInsn for variables expressed by location lists did not have any
effect in practice. However, as it is unnecessary with the current code
base, remove that initialization.

I have verified that `llvm-dwarfdump -v' produces the same location
output with respectively without this patch when building a
RelWithDebInfo-profiled clang-tblgen binary.

Diff Detail

Event Timeline

dstenb created this revision.Jan 24 2019, 2:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2019, 9:12 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
StephenTozer accepted this revision.EditedJul 26 2019, 5:55 AM
StephenTozer added a subscriber: StephenTozer.

Looks like a sensible straightforward change. Someone closer to the code in particular should approve as well before this lands, but this should serve as a ping.

This revision is now accepted and ready to land.Jul 26 2019, 5:55 AM