diff options
author | stozer <stephen.tozer@sony.com> | 2019-12-10 14:33:17 +0000 |
---|---|---|
committer | stozer <stephen.tozer@sony.com> | 2019-12-12 12:28:39 +0000 |
commit | e39e2b4a79c6645a85f0aee5b1e9e6d5d917033a (patch) | |
tree | efd75748705ce35df5dae40eaa214823347dbecc /llvm/lib/CodeGen | |
parent | f70f18014854a333ce27504515bb8aab7c73c6c2 (diff) | |
download | bcm5719-llvm-e39e2b4a79c6645a85f0aee5b1e9e6d5d917033a.tar.gz bcm5719-llvm-e39e2b4a79c6645a85f0aee5b1e9e6d5d917033a.zip |
[DebugInfo] Prevent invalid fragments at ISel from dropping debug info
During SelectionDAG, if a value which is associated with a DBG_VALUE
needs to be split across multiple registers, the DBG_VALUE will be split
into a set of fragment expressions to recreate the original value.
If one or more of these fragments cannot be created, they would
previously be silently dropped, causing the old debug value to live past
its expiry date. This patch fixes this issue by keeping invalid
fragments while setting their value as Undef.
Differential revision: https://reviews.llvm.org/D70248
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index f8868916969..21a122d4512 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -5553,8 +5553,14 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue( for (auto RegAndSize : SplitRegs) { auto FragmentExpr = DIExpression::createFragmentExpression( Expr, Offset, RegAndSize.second); - if (!FragmentExpr) + // If a valid fragment expression cannot be created, the variable's + // correct value cannot be determined and so it is set as Undef. + if (!FragmentExpr) { + SDDbgValue *SDV = DAG.getConstantDbgValue( + Variable, Expr, UndefValue::get(V->getType()), DL, SDNodeOrder); + DAG.AddDbgValue(SDV, nullptr, false); continue; + } assert(!IsDbgDeclare && "DbgDeclare operand is not in memory?"); FuncInfo.ArgDbgValues.push_back( BuildMI(MF, DL, TII->get(TargetOpcode::DBG_VALUE), false, |