llvm-mirror/test/Transforms/Mem2Reg
Bjorn Pettersson 8b01057380 [DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue
Summary:
Do not convert a DbgDeclare to DbgValue if the store
instruction only refer to a fragment of the variable
described by the DbgDeclare.

Problem was seen when for example having an alloca for an
array or struct, and there were stores to individual elements.
In the past we inserted a DbgValue intrinsics for each store,
just as if the store wrote the whole variable.

When handling store instructions we insert a DbgValue that
indicates that the variable is "undefined", as we do not know
which part of the variable that is updated by the store.

When ConvertDebugDeclareToDebugValue is used with a load/phi
instruction we assert that the referenced value is large enough
to cover the whole variable. Afaict this should be true for all
scenarios where those methods are used on trunk. If the assert
blows in the future I guess we could simply skip to insert a
dbg.value instruction.

In the future I think we should examine which part of the variable
that is accessed, and add a DbgValue instrinsic with an appropriate
DW_OP_LLVM_fragment expression.

Reviewers: dblaikie, aprantl, rnk

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 334704
2018-06-14 11:23:42 +00:00
..
2002-03-28-UninitializedVal.ll
2002-05-01-ShouldNotPromoteThisAlloca.ll
2003-04-10-DFNotFound.ll
2003-04-18-DeadBlockProblem.ll
2003-04-24-MultipleIdenticalSuccessors.ll
2003-06-26-IterativePromote.ll
2003-10-05-DeadPHIInsertion.ll
2005-06-30-ReadBeforeWrite.ll
2005-11-28-Crash.ll
2007-08-27-VolatileLoadsStores.ll
atomic.ll
ConvertDebugInfo2.ll
ConvertDebugInfo.ll
crash.ll
dbg-addr-inline-dse.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
dbg-addr.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
dbg-inline-scope-for-phi.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
debug-alloca-phi-2.ll [DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue 2018-06-14 11:23:42 +00:00
debug-alloca-phi.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ignore-lifetime.ll
optnone.ll
pr24179.ll
pr37632-unreachable-list-of-stores.ll [Mem2Reg] Avoid replacing load with itself in promoteSingleBlockAlloca. 2018-06-07 11:09:05 +00:00
preserve-nonnull-load-metadata.ll
PromoteMemToRegister.ll [Debugify] Avoid printing unnecessary square braces, NFC 2018-05-24 23:00:22 +00:00
UndefValuesMerge.ll