summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse.llvm@gmail.com>2018-12-10 11:20:47 +0000
committerJeremy Morse <jeremy.morse.llvm@gmail.com>2018-12-10 11:20:47 +0000
commit045c67769d7fe577fc38cccb6fb40fd814437447 (patch)
tree6c1c9c40451d39815096bcb9a9d8d5cc879de5f7 /llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
parente79477895e1af4425aecaded2881e3b3c878faf5 (diff)
downloadbcm5719-llvm-045c67769d7fe577fc38cccb6fb40fd814437447.tar.gz
bcm5719-llvm-045c67769d7fe577fc38cccb6fb40fd814437447.zip
[DebugInfo] Emit undef DBG_VALUEs when SDNodes are optimised out
This is a fix for PR39896, where dbg.value's of SDNodes that have been optimised out do not lead to "DBG_VALUE undef" instructions being created. Such undef instructions are necessary to terminate earlier variable ranges, otherwise variable values leak past the point where they're valid. The "invalidated" flag of SDDbgValue is currently being abused to mean two things: * The corresponding SDNode is now invalid * This SDDbgValue should not be emitted Of which there are several legitimate combinations of meaning: * The SDNode has been invalidated and we should emit "DBG_VALUE undef" * The SDNode has been invalidated but the debug data was salvaged, don't emit anything for this SDDbgValue * This SDDbgValue has been emitted This patch introduces distinct "Emitted" and "Invalidated" fields to the SDDbgValue class, updates users accordingly, and generates "undef" DBG_VALUEs for invalidated records. Awkwardly, there are circumstances where we emit SDDbgValue's twice, specifically DebugInfo/X86/dbg-addr-dse.ll which I've preserved. Differential Revision: https://reviews.llvm.org/D55372 llvm-svn: 348751
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h b/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
index 490105a9d58..f7566b246f3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
+++ b/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
@@ -53,6 +53,7 @@ private:
enum DbgValueKind kind;
bool IsIndirect;
bool Invalid = false;
+ bool Emitted = false;
public:
/// Constructor for non-constants.
@@ -126,6 +127,15 @@ public:
void setIsInvalidated() { Invalid = true; }
bool isInvalidated() const { return Invalid; }
+ /// setIsEmitted / isEmitted - Getter/Setter for flag indicating that this
+ /// SDDbgValue has been emitted to an MBB.
+ void setIsEmitted() { Emitted = true; }
+ bool isEmitted() const { return Emitted; }
+
+ /// clearIsEmitted - Reset Emitted flag, for certain special cases where
+ /// dbg.addr is emitted twice.
+ void clearIsEmitted() { Emitted = false; }
+
LLVM_DUMP_METHOD void dump(raw_ostream &OS) const;
};
OpenPOWER on IntegriCloud