Page MenuHomePhabricator

[Mem2Reg] Create merged debug locations for inserted phis
ClosedPublic

Authored by vsk on Apr 6 2018, 6:07 PM.

Details

Summary

Track the debug locations of the incoming values to newly-created phis,
and apply merged debug locations to the phis.

A merged location will be on line 0, but will have the correct scope
set. This improves crash reporting when an inlined instruction with a
merged location triggers a machine exception. A debugger will be able to
narrow down the crash to the correct inlined scope, instead of simply
pointing to the outer scope of the caller.

Taken together with a change allows generating merged line-0 locations
for instructions which aren't calls, this results in a 0.5% increase in
the uncompressed size of the .debug_line section of a stage2+Release
build of llc (-O3 -g).

Depends on https://reviews.llvm.org/D45396.

rdar://33858697

Edit: The 0.5% size increase of the .debug_line section was for llc. I typed
clang mistakenly. The number for clang is 0.6%.

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Apr 6 2018, 6:07 PM
vsk updated this revision to Diff 141464.Apr 6 2018, 6:08 PM
  • Removed an unused #include.
aprantl added inline comments.Apr 10 2018, 9:28 AM
lib/Transforms/Utils/PromoteMemoryToRegister.cpp
552 ↗(On Diff #141464)

I don't think we can use this condition. LLVM supports (((debug info) being inlined into a nodebug function) being inlined into a function with debug info). You may need to just unconditionally turn this on.

vsk updated this revision to Diff 141911.EditedApr 10 2018, 2:17 PM

Merge debug locs unconditionally, per Adrian's comment.

vsk edited the summary of this revision. (Show Details)Apr 10 2018, 3:01 PM
aprantl accepted this revision.Apr 17 2018, 1:06 PM
aprantl added inline comments.
lib/Transforms/Utils/PromoteMemoryToRegister.cpp
167 ↗(On Diff #141911)

///

169 ↗(On Diff #141911)

might as well make this a struct?

This revision is now accepted and ready to land.Apr 17 2018, 1:06 PM
vsk marked 2 inline comments as done.Apr 17 2018, 3:04 PM

Thanks!

lib/Transforms/Utils/PromoteMemoryToRegister.cpp
169 ↗(On Diff #141911)

I'll do this in a prep commit.

This revision was automatically updated to reflect the committed changes.