[PATCH] D105207: [debuginfo][lsr] SCEV-based salvaging for LoopStrengthReduction

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 03:03:31 PDT 2022


bjope added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6024
+    // Emit a simpler form if only a single location is referenced.
+    if (Values.size() == 1 && Expr[0] == llvm::dwarf::DW_OP_LLVM_arg &&
+        Expr[1] == 0) {
----------------
jmorse wrote:
> bjope wrote:
> > Is this some kind of optimization on IR/MIR level?
> > 
> > Seems like this can result in DBG_VALUE with DW_OP_LLVM_arg in the DIExpression (i.e. neither having a DIArgList or using DBG_VALUE_LIST). But it also seem like that particular scenario doesn't seem to be handled by DwarfDebug. See https://github.com/llvm/llvm-project/issues/55097
> > 
> > Maybe such things should be expected by all passes? Or is this just a pseudo optimization introducing a special case that complicate logic in other passes?
> > 
> > Well, I haven't analysed things so closely so maybe this choice is needed for some other reason.
> (Drive-by comment) IIRC this clause is here to optimise scenarios where the expression starts with `DW_OP_LLVM_arg, 0`, and where there are no other arguments to the expression, meaning it could be replaced by a plain dbg.value(%123, ..., !DIExpression(blah)), rather than a variadic dbg.value. (Maybe it's faulty, I haven't dug in either).
Ok, I see now that the comment for setShortFinalExpression actually say "omit DW_OP_llvm_arg" and not "emit DW_OP_llvm_arg" as I read it the first time.

So maybe the case here is that there are several references to "DW_OP_LLVM_arg, 0" and not only at the expression start. And then we can't just skip adding a DIArgList.


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

https://reviews.llvm.org/D105207



More information about the llvm-commits mailing list