[PATCH] D48547: Improve ConvertDebugDeclareToDebugValue

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 06:59:17 PDT 2018


bjope created this revision.
bjope added reviewers: aprantl, vsk, efriedma.

This is a follow-up to r334830 and r335031.

In the valueCoversEntireFragment check we now also handle
the situation when there is a variable length array (VLA)
involved, and the length of the array has been reduced to
a constant.

The ConvertDebugDeclareToDebugValue functions that are related
to PHI nodes and load instructions now avoid inserting dbg.value
intrinsics when the value does not, for certain, cover the
variable/fragment that should be described.
In r334830 we assumed that the value always covered the entire
var/fragment and we had assertions in the code to show that
assumption. However, those asserts failed when compiling code
with VLAs, so we removed the asserts in r335031. Now when we
know that the valueCoversEntireFragment check can fail also for
PHI/Load instructions we avoid to insert the faulty dbg.value
intrinsic in such situations. Compared to the Store instruction
scenario we simply drop the dbg.value here (as the variable does
not change its value due to PHI/Load, so an earlier dbg.value
describing the variable should still be valid).


Repository:
  rL LLVM

https://reviews.llvm.org/D48547

Files:
  include/llvm/IR/Instructions.h
  lib/IR/Instructions.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/Mem2Reg/debug-alloca-vla-1.ll
  test/Transforms/Mem2Reg/debug-alloca-vla-2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48547.152685.patch
Type: text/x-patch
Size: 9146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180625/d5762c6b/attachment.bin>


More information about the llvm-commits mailing list