[PATCH] D45637: [DebugInfo] Ignore DBG_VALUE instructions in PostRA Machine Sink

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 10:35:58 PDT 2018


aprantl added a comment.

That's an interesting question. I could see both sides of the argument:

- if the code has been reordered such that line 1 is executed after line 2, then the debug info should reflect that
- the optimizer should never move a debug intrinsic over another intrinsic

I think this boils down to what the debug locations on the surrounding instructions are. If the debug location of the next instruction (or perhaps the instruction the dbg value is using as a location) is indicating that we are going back in time, then it seems okay to move the debug value. I'm afraid that this judgment needs to be done on a case-by-case basis for every transformation.



================
Comment at: lib/CodeGen/MachineSink.cpp:764
+  // Merge or erase debug location to ensure consistent stepping in profilers
+  // and debuggers.
+  if (!SuccToSinkTo.empty() && InsertPos != SuccToSinkTo.end())
----------------
Can you add a sentence explaining *why* merging vs. erasing is the right thing to do in the respective cases?


https://reviews.llvm.org/D45637





More information about the llvm-commits mailing list