[llvm-dev] LSR breaks debug info
Jeremy Morse via llvm-dev
llvm-dev at lists.llvm.org
Thu Sep 10 03:04:32 PDT 2020
Hi Markus,
On Thu, Sep 10, 2020 at 8:44 AM Markus Lavin <markus.lavin at ericsson.com> wrote:
> The Loop Strength Reduction pass appears to break debug information even for
> the most basic input. I believe this is a well known issue already (see
> https://bugs.llvm.org/show_bug.cgi?id=38815) but I also believe that it deserve
> some extra attention.
Indeed, it's a poor performer, and losing loop variables is one of the
most common complaints I've heard,
[...]
> One idea for how to address this would be that, since LSR is a SCEV based
> optimization, one could perform additional debug salvaging by comparing SCEV
> expressions for the new and old PHI-node and then adjusting DIExpressions if
> they match with an offset.
>
> Any thoughts on that?
It sounds like a plan -- I'm not especially familiar with SCEV, but if
we can determine equivalence in that manner then that kind of
salvaging would be sound. It feels like it would cover quite a common
case, and would be an "easy" win.
How difficult is it to identify an offset in SCEV? It's probably OK to
just compare expressions, as offsets such as in your example can be
recovered with the existing salvageDebugInfo function. It wouldn't be
worth putting a lot of effort into /interpreting/ SCEV expressions, as
we may as well go all the way and ask SCEV to produce an expression
for each dbg.value, and implement the general solution. That's what
I'd like to happen in the long term, but this sounds like a great
stepping stone along the way.
--
Thanks,
Jeremy
More information about the llvm-dev
mailing list