[PATCH] D55299: [LoopDeletion] Update debug values after loop deletion.

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 14:58:49 PST 2018


davide created this revision.
davide added reviewers: efriedma, aprantl, vsk, jmorse, CarlosAlbertoEnciso.
Herald added a subscriber: hiraditya.

When loops are deleted, we don't keep track of variables modified inside the loops, so the DI will contain the wrong value for these.

e.g.

int b() {

  int i;
  for (i = 0; i < 2; i++)
    ;
  patatino();
  return a;

-> 6   	  patatino();

  7   	  return a;
  8   	}
  9   	int main() { b(); }

(lldb) frame var i
(int) i = 0

We mark instead these values as unavailable inserting a `@llvm.dbg.value(undef` to make sure we don't end up printing an incorrect value in the debugger. We could consider doing something fancier, for, e.g. constants, in the future.

PR39868.
rdar://problem/46418795


https://reviews.llvm.org/D55299

Files:
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopDeletion/diundef.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55299.176718.patch
Type: text/x-patch
Size: 6876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/fb4eb00c/attachment.bin>


More information about the llvm-commits mailing list