This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Drop debug loc in SpeculativelyExecuteBB
ClosedPublic

Authored by vsk on Jun 23 2020, 4:32 PM.

Details

Summary

According to HowToUpdateDebugInfo.rst:

Preserving the debug locations of speculated instructions can make
it seem like a condition is true when it's not (or vice versa), which
leads to a confusing single-stepping experience

This patch follows the recommendation to drop debug locations on
speculated instructions.

Diff Detail

Event Timeline

vsk created this revision.Jun 23 2020, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2020, 4:32 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vsk updated this revision to Diff 272866.Jun 23 2020, 4:36 PM

Back out the change for speculated store instructions: a merged location is applied to this instruction.

davide accepted this revision.Jun 23 2020, 5:14 PM

Yes, this makes a lot of sense.

This revision is now accepted and ready to land.Jun 23 2020, 5:14 PM

do we have an end-to-end testcase where this triggers?

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2149

I prefer DebugLoc() but up to you.

Harbormaster failed remote builds in B61476: Diff 272866!
vsk marked an inline comment as done.Jun 23 2020, 6:20 PM

The issue triggers quite often in a stage2 build: I count 50K instances and the build is less than half complete.

Here's a synthetic example. Before the patch, lldb single-steps to line 7 after visiting line 4:

frame #0: 0x0000000100000f6a t`main(argc=1, argv=0x00007ffeefbff8e8) at t.cc:7:3 [opt]
   4      int y = x;
   5      if (y) {
   6        y += 9;
-> 7      }
   8      y -= 11;
   9      printf("%d\n", y);
   10     return 0;
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2149

I'll fix this before committing.

This revision was automatically updated to reflect the committed changes.