[all-commits] [llvm/llvm-project] 00e238: [DebugInfo] Nerf placeDbgValues, with prejudice

Jeremy Morse via All-commits all-commits at lists.llvm.org
Mon Dec 9 04:52:45 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 00e238896cd8ad3a7d715b8fb5f12a2e60af8a6f
      https://github.com/llvm/llvm-project/commit/00e238896cd8ad3a7d715b8fb5f12a2e60af8a6f
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2019-12-09 (Mon, 09 Dec 2019)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineInstr.h
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/test/DebugInfo/COFF/register-variables.ll
    M llvm/test/DebugInfo/NVPTX/debug-info.ll
    M llvm/test/DebugInfo/X86/DW_AT_location-reference.ll
    M llvm/test/DebugInfo/X86/PR37234.ll
    M llvm/test/DebugInfo/X86/codegenprep-addrsink.ll
    M llvm/test/tools/llvm-locstats/locstats.ll

  Log Message:
  -----------
  [DebugInfo] Nerf placeDbgValues, with prejudice

CodeGenPrepare::placeDebugValues moves variable location intrinsics to be
immediately after the Value they refer to. This makes tracking of locations
very easy; but it changes the order in which assignments appear to the
debugger, from the source programs order to the order in which the
optimised program computes values. This then leads to PR43986 and PR38754,
where variable locations that were in a conditional block are made
unconditional, which is highly misleading.

This patch adjusts placeDbgValues to only re-order variable location
intrinsics if they use a Value before it is defined, significantly reducing
the damage that it does. This is still not 100% safe, but the rest of
CodeGenPrepare needs polishing to correctly update debug info when
optimisations are performed to fully fix this.

This will probably break downstream debuginfo tests -- if the
instruction-stream position of variable location changes isn't the focus of
the test, an easy fix should be to manually apply placeDbgValues' behaviour
to the failing tests, moving dbg.value intrinsics next to SSA variable
definitions thus:

  %foo = inst1
  %bar = ...
  %baz = ...
  void call @llvm.dbg.value(metadata i32 %foo, ...

to

  %foo = inst1
  void call @llvm.dbg.value(metadata i32 %foo, ...
  %bar = ...
  %baz = ...

This should return your test to exercising whatever it was testing before.

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




More information about the All-commits mailing list