[PATCH] D83468: [Debuginfo] Fix for PR46653

Jaydeep Chauhan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 12:27:16 PDT 2020


Jac1494 marked an inline comment as done.
Jac1494 added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:2183
   CurBuilder->setDebugLoc(Inst.getDebugLoc());
-  // We only emit constants into the entry block from here. To prevent jumpy
-  // debug behaviour set the line to 0.
-  if (const DebugLoc &DL = Inst.getDebugLoc())
-    EntryBuilder->setDebugLoc(
-        DebugLoc::get(0, 0, DL.getScope(), DL.getInlinedAt()));
-  else
-    EntryBuilder->setDebugLoc(DebugLoc());
+  EntryBuilder->setDebugLoc(DebugLoc());
 
----------------
aemerson wrote:
> aemerson wrote:
> > So...you deleted the previous code here to prevent jumpy debug behavior. How does the new code address that problem?
> On further thought, I think we can probably do better here in general to preserve more debug info. SelectionDAG doesn't drop or zero the loc for the global value reference, so we should be able to keep it too.
I have tried below testcase which is mention in PR 40887.
```

int var1;           // 1
int var2;           // 2
int main() {        // 3
  if (var1 == 1) {  // 4
    var2 = 2;       // 5
  }                 // 6
  return 0;         // 7
}
```



When we set break point to main,so control goes from line 1-> 4 ->1 ->7(when global-isel),But with SelectionDAg/fastisel control goes from line 4-> 7 which seems correct to me ,since line 1 is not executable statement.

This behaviour is prevalent before and after this patch. This patch don't fix this problem.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83468/new/

https://reviews.llvm.org/D83468





More information about the llvm-commits mailing list