This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][DAG] Don't reuse debug location on COPY if width changes.
ClosedPublic

Authored by tbosch on May 29 2020, 10:29 AM.

Details

Summary

This caused incorrect debug information for parameters:
Previously, after a COPY of a parameter that changes the width,
we would emit a DBG_VALUE that continues to be associated to that
parameter, even though it now used a different width.
This made the LiveDebugValues pass assume the parameter value
got clobbered and it stopped tracking the parameter entry
value, leading to incorrect debug information.

Fixes https://bugs.llvm.org/show_bug.cgi?id=39715

Diff Detail

Event Timeline

tbosch created this revision.May 29 2020, 10:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2020, 10:29 AM
tbosch added a reviewer: vsk.May 29 2020, 10:31 AM

Thanks for this! The discussion on the bugzilla PR covers some alternative ways to tackle this, which I won’t rehash here. I think it's reasonable to shoot for a narrow bugfix first.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
624

I missed this earlier, but: with this change, if the first copy use fails the width check, we'd emit a debug value if there’s a second copy use of the register.

A narrow fix might be to move the width check to line 629, where we check whether CopyUseMI has been set and emit a debug value if so.

tbosch updated this revision to Diff 267317.May 29 2020, 11:53 AM

Do the width check at the right time

As suggested by vsk

vsk accepted this revision.May 29 2020, 12:28 PM

Lgtm.

This revision is now accepted and ready to land.May 29 2020, 12:28 PM
This revision was automatically updated to reflect the committed changes.

You can drop Reviewers: Subscribers: Tags: and the text Summary: with the following script

arcfilter () {
        arc amend
        git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F -
}

Reviewed By: is considered important by some people. You should keep the tag. (I have updated my script to use --date=now (setting author date to committer date))