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

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 02:56:50 PDT 2022


jmorse 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) {
----------------
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).


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

https://reviews.llvm.org/D105207



More information about the llvm-commits mailing list