[PATCH] D38229: [DebugInfo] Insert DEBUG_VALUEs after each register redefinition

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 08:30:14 PDT 2017


rnk added a comment.

One concern I have about this is that it may lead to inaccurate debug info when the value is computed long before its (dead) assignment. Consider this kind of program (untested, yet):

  int v1 = getval();
  int v2 = getval();
  usevals(v1, v2);
  v1 = v2;
  if (v1) { /* empty after inlining, making v2 dead */ }

After optimization, v1 will probably use a CSR and v2 will use a volatile register clobbered by the usevals call. So, the dead `v1 = v2` assignment will produce a DBG_VALUE of a physical register that has been clobbered. It would be innacurate to hoist the DBG_VALUE across the `usevals` call, since the value should still be the result of the first `getval` call, not the second.

One way to address this would be to avoid moving DBG_VALUEs across instructions with different DebugLoc lines.

Even if we decide that this issue is unimportant, we should probably write tests for it.


https://reviews.llvm.org/D38229





More information about the llvm-commits mailing list