[all-commits] [llvm/llvm-project] 140757: [DebugInfo] Prevent invalid debug info being produ...

Stephen Tozer via All-commits all-commits at lists.llvm.org
Thu Apr 8 05:05:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 140757bfaaa00110a92d2247a910c847e6e3bcc8
      https://github.com/llvm/llvm-project/commit/140757bfaaa00110a92d2247a910c847e6e3bcc8
  Author: Stephen Tozer <Stephen.Tozer at Sony.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicInst.h
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    A llvm/test/Transforms/LoopStrengthReduce/dbg-preserve-2.ll

  Log Message:
  -----------
  [DebugInfo] Prevent invalid debug info being produced during LoopStrengthReduce

During LoopStrengthReduce, some of the SSA values that are used by debug values
may be lost and/or salvaged. After LSR we attempt to recover any undef debug
values, including any that were salvaged but then lost their values afterwards,
by replacing the lost values with any live equal values (plus a possible
constant offset) that have been gathered prior to running LSR. When we do this
we restore the debug value's original DIExpression, to undo any salvaging (as we
have gone back to using the original debug value).

This process can currently produce invalid debug info if the number of operands
has changed by salvaging during LSR. Replacing old values during the
applyEqualValues step does not change the number of location operands, which
means that when we restore the old DIExpression we may have a mismatch between
the number of operands used by the debug value and the number of operands
referenced by the DIExpression. This patch fixes this by restoring the full
original location metadata at the start of the applyEqualValues step, so that
there is no mismatch in operand count between the debug value and its
DIExpression.

Differential Revision: https://reviews.llvm.org/D98644




More information about the All-commits mailing list