This is an archive of the discontinued LLVM Phabricator instance.

[ADCE] Follow inlinedAt when determining if a DbgInfoIntrinsic is dead
AbandonedPublic

Authored by uabelho on Aug 24 2017, 12:01 AM.

Details

Summary

When inlining has occured there can be calls to dbg.value with debug info
pointing to a scope in the inlined function, and without this patch, such
dbg.values were removed.

However, if we follow the information in the inlinedAt fields we can reach
the scope the call was originally in, and thus we can keep the call and
improve debug info.

Diff Detail

Event Timeline

uabelho created this revision.Aug 24 2017, 12:01 AM
aprantl edited edge metadata.Aug 24 2017, 9:20 AM

I don't understand the example in the testcase. There is no instruction belonging to f1, so the debugger can never stop at f1 to print the value of the anonymous variable !5.

Besides that not (yet?) being convinced that this is useful, I'm also concerned by the performance impact of the change. Did you do any measurements with large C++ programs with lots of small inlined functions?

uabelho abandoned this revision.Aug 25 2017, 1:25 AM

I don't understand the example in the testcase. There is no instruction belonging to f1, so the debugger can never stop at f1 to print the value of the anonymous variable !5.

Very good point. Thanks!

We did this change (for some now unknown reason unfortunately) locally in our tree a year and a half ago and I thought I would try to
upstream it, but as you're saying, it's very questionable what it's actually good for.

If I make f1 more complicated (e.g. adding "i = i + 1;" to it), both that instruction as well as a dbg.value survives in f2.

So instead of pushing this, I'll remove our local change and drop the patch. If it's really needed I suppose it will pop up again
and I can come back with a proper patch.

Thanks and sorry for wasting you time.