Page MenuHomePhabricator

[PATCH][DWARF] Don't propagate or set debug locations for PRE loads and associated address calculations
ClosedPublic

Authored by wolfgangp on Dec 16 2016, 11:49 AM.

Details

Summary

This is another instance of the 'nulling out the debug location of moved instructions' theme. The GVN pass, when performing PRE on load instructions retains the instructions' original debug loc, which causes erratic stepping behavior and incorrect source attribution for autoFDO purposes.
Keeping in mind the ongoing debate about Debug locations for optimized code this patch proposes to null out (or not propagate) the debug locations of such instructions for now to improve debugging behavior.

The modified test case phi-translate.ll covers all cases.

Diff Detail

Repository
rL LLVM

Event Timeline

wolfgangp updated this revision to Diff 81778.Dec 16 2016, 11:49 AM
wolfgangp retitled this revision from to [PATCH][DWARF] Don't propagate or set debug locations for PRE loads and associated address calculations.
wolfgangp updated this object.
wolfgangp added a subscriber: llvm-commits.
aprantl edited edge metadata.Jan 4 2017, 1:31 PM

Is this a case where using new the merge debug location api would make sense because we are merging multiple loads into one, or are we just deleting it so line table doesn't jump back and forth? If yes, we should use it here, otherwise this looks fine.

Is this a case where using new the merge debug location api would make sense because we are merging multiple loads into one, or are we just deleting it so line table doesn't jump back and forth? If yes, we should use it here, otherwise this looks fine.

No, we are effectively moving an instruction from its original place to a different BB, so there is nothing to merge. As you said, we are mostly concerned about line table jumping.

aprantl accepted this revision.Jan 4 2017, 3:17 PM
aprantl edited edge metadata.

I have two suggestions for further clarifying the comments. I'm somewhat concerned that this could regress profiling/instrumentation, but since this only affects singular load instructions it shouldn't be too bad.

thanks!

lib/Transforms/Scalar/GVN.cpp
1577 ↗(On Diff #81778)

... could lead to confusing (but correct) source attributions.

1612 ↗(On Diff #81778)

, and we want to avoid a jumpy line table.

This revision is now accepted and ready to land.Jan 4 2017, 3:17 PM

I have two suggestions for further clarifying the comments. I'm somewhat concerned that this could regress profiling/instrumentation, but since this only affects singular load instructions it shouldn't be too bad.

thanks!

I'll add them. Thanks for the review.

This revision was automatically updated to reflect the committed changes.