This is an archive of the discontinued LLVM Phabricator instance.

Ignore duplicated, identical fragment declarations
ClosedPublic

Authored by dotdash on Oct 4 2017, 7:10 AM.

Details

Summary

Some passes might duplicate calls to llvm.dbg.declare causing
duplicated, identical fragment declarations which currently cause an
assertion might is meant to catch erroneous overlapping fragment
declarations. But for declarations that are simply duplicated we can be
a bit more lenient and just ignore the duplicates.

PR33157 was fixed by a similar change for non-fragment declarations in
r305244.

Diff Detail

Repository
rL LLVM

Event Timeline

dotdash created this revision.Oct 4 2017, 7:10 AM
rnk edited edge metadata.Oct 4 2017, 9:03 AM

DbgVariable::addMMIEntry already handles de-duplication of non-fragment FrameIndexExprs, so I think we should put the logic for frame index exprs there. In fact, what you're doing here is plainly more general the special case code that we have there, and we should be able to get rid of it.

I'd also move addMMIEntry out of line. It has clearly grown in complexity over time.

dotdash updated this revision to Diff 117789.Oct 5 2017, 3:05 AM

Updated to address comments by rnk.

aprantl accepted this revision.Oct 5 2017, 8:45 AM

Thanks!

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
240 ↗(On Diff #117789)

This strips out true duplicates (which was the *intention* behind the old code). The old code also deleted all but the first non-fragment entry.

This only affects inputs that are arguably already broken (two non-fragment entries for the same variable at different frame indices), so I don't think the old behavior is worth keeping.

This revision is now accepted and ready to land.Oct 5 2017, 8:45 AM
This revision was automatically updated to reflect the committed changes.