[PATCH] D23715: Add @llvm.dbg.value entries for the phi node created by -mem2reg

Keith Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 08:28:35 PDT 2016


keith.walker.arm created this revision.
keith.walker.arm added reviewers: llvm-commits, dblaikie, aprantl.
Herald added subscribers: nemanjai, qcolombet.

When phi nodes are created in the -mem2reg phase, the @llvm.dbg.declare
entries are converted to @llvm.dbg.value entries at the place where the
store instructions existed.   However no entry is created to describe
the resulting value of the phi node.

The effect of this is especially noticeable in for loops which have a
constant for the intial value; the loop control variable's location
would be described as the intial constant value in the loop body once
the -mem2reg optimization phase was run.

This change adds the creation of the @llvm.dbg.value entries to describe
variables whose location is the result of a phi node created in -mem2reg.

Also when the phi node is finally lowered to a machine instruction it
is important that the lowered "load" instruction is placed before the
associated DEBUG_VALUE entry describing the value loaded.


https://reviews.llvm.org/D23715

Files:
  include/llvm/CodeGen/MachineBasicBlock.h
  include/llvm/Transforms/Utils/Local.h
  lib/CodeGen/InlineSpiller.cpp
  lib/CodeGen/LiveDebugVariables.cpp
  lib/CodeGen/MachineBasicBlock.cpp
  lib/CodeGen/PHIEliminationUtils.cpp
  lib/CodeGen/SplitKit.cpp
  lib/Target/PowerPC/PPCEarlyReturn.cpp
  lib/Transforms/Utils/Local.cpp
  lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  test/CodeGen/AArch64/phi-dbg.ll
  test/Transforms/Util/mem2reg-dbg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23715.68691.patch
Type: text/x-patch
Size: 14803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/bba08f7b/attachment.bin>


More information about the llvm-commits mailing list