aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2022-05-17 15:35:27 +0100
committerStephen Tozer <stephen.tozer@sony.com>2022-08-22 14:51:27 +0100
commit53125e7d916306582bee0c828d38d1ef6d6061dc (patch)
tree0b5d15a4bb04378cb71dba6fb902c8312718a367 /llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
parente2ab6061a976400df672842dc2af76b527fa421a (diff)
downloadllvm-53125e7d916306582bee0c828d38d1ef6d6061dc.zip
llvm-53125e7d916306582bee0c828d38d1ef6d6061dc.tar.gz
llvm-53125e7d916306582bee0c828d38d1ef6d6061dc.tar.bz2
[DebugInfo] Handle joins PHI+Def values in InstrRef LiveDebugValues
In the InstrRefBasedImpl for LiveDebugValues, we attempt to propagate debug values through basic blocks in part by checking to see whether all a variable's incoming debug values to a BB "agree", i.e. whether their properties match and they refer to the same underlying value. Prior to this patch, the check for agreement between incoming values relied on exact equality, which meant that a VPHI and a Def DbgValue that referred to the same underlying value would be seen as disagreeing. This patch changes this behaviour to treat them as referring to the same value, allowing the shared value to propagate into the BB. Differential Revision: https://reviews.llvm.org/D125953
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 23fde21..91d5ac2 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2533,6 +2533,12 @@ bool InstrRefBasedLDV::vlocJoin(
if (*V.second == FirstVal)
continue; // No disagreement.
+ // If both values are not equal but have equal non-empty IDs then they refer
+ // to the same value from different sources (e.g. one is VPHI and the other
+ // is Def), which does not cause disagreement.
+ if (V.second->ID != ValueIDNum::EmptyValue && V.second->ID == FirstVal.ID)
+ continue;
+
// Eliminate if a backedge feeds a VPHI back into itself.
if (V.second->Kind == DbgValue::VPHI &&
V.second->BlockNo == MBB.getNumber() &&