Open cbossut7 opened 2 years ago
@llvm/issue-subscribers-debuginfo
Good find, thanks for the comprehensive bug report -- it looks like the site that creates the instruction is here:
https://github.com/llvm/llvm-project/blob/f00f894d5d828c3ea7757f62268eaa4cd9a28c88/llvm/lib/Transforms/Scalar/DivRemPairs.cpp#L209
and it indeed doesn't call setDebugLoc on the instruction it creates. The fix would be to use setDebugLoc to preserve the line number, and write a test to ensure that behaviour is preserved (probably using your reproducer). As you're already using debugify to find bugs, do you feel up to submitting a patch for that?
Overview: In the attached example, the div-rem-pairs pass will drop debug location unnecessarily.
Steps to reproduce (files attached at the end):
Here is the version of llvm:
The variable
%rem
seems to have a one-to-one relationship with%rem.recomposed
, so it seems the debug location!15
is unnecessarily dropped, according to the principles in: https://llvm.org/docs/HowToUpdateDebugInfo.htmlThere's a one-to-one relationship between the new and old instruction, and it's placed in the same location, so the DebugLoc should be preserved in the reproducer.
Relevant files: File 1—------------------------------------------------------------------------------
File 2-----------------------------------------------------------------------