-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DebugInfo@O2][Dexter] Loop strength reduction preserves little debug info #38163
Comments
For a better understanding: -------->8-------- *** IR Dump Before Loop Strength Reduction ***; Preheader: ; Loop: for.cond: ; Exit blocks *** IR Dump After Loop Strength Reduction ***; Preheader: ; Loop: for.cond: ; Exit blocks |
'bob' and 'blah' have been optimized out. 'bob' replaced by: '%lsr.iv' and '%lsr.iv.next' |
NB, Alexey made a start on this here: https://reviews.llvm.org/D67770 |
This issue is being addressed in https://reviews.llvm.org/D87494 |
This particular issue is resolved in commit 06758c6 |
Please see https://reviews.llvm.org/D105207 for some more recent work in this area. |
Suggest this issue is closed as the above patch has been present since 13.0.0 and there is also D120168 to add further salvaging. |
@llvm/issue-subscribers-debuginfo |
As @chrisjbris suggested above, I'll go ahead and close this issue since LSR debug info salvaging has landed. We can track further refinements with new issues as needed. |
Extended Description
It seems the loop-strength-reduction pass doesn't preserve debug information, for any transformation it makes. Compiling the example below with llvm/clang @ r340912 and options "-O2 -g -fno-inline" for x86_64, using both gdb and lldb, both the value of "i" and "blah" are reported as being optimised out, after being rewritten by LSR:
-------->8--------
int
foo(int blah)
{
int i;
for (i = blah; i < blah + 10; i++) {
if (i < 3)
return 0;
}
return 1;
}
int
main()
{
return foo(3);
}
--------8<--------
Which would be fairly frustrating if one landed in the loop and were unable to determine either the loop bound or which iteration it was on. (The example is contrived, but LSR still knackers more complicated loops).
This isn't a bug per se, and the DebugInfo doesn't mislead anyone, it's just a poor debug experience that will annoy developers. Particularly galling is that the values of "i" and "blah" remain in registers for the whole loop, but are still not available to the debugger.
The text was updated successfully, but these errors were encountered: