[DebugInfo] Remove Expr from debug variables used as DenseMap keys

We do keep the fragment part of the expression as it is important
to identify fragments separately.

A variable with less fragments should be considered a superset of
variables with more fragments, but that would require to change a
lot of code.
This commit is contained in:
Emil Pedersen
2024-05-09 15:05:27 -07:00
parent 784034fd3a
commit b2930992a8
5 changed files with 20 additions and 5 deletions

View File

@@ -296,6 +296,16 @@ public:
return Elements.size() &&
Elements[0].getAsOperator() == SILDIExprOperator::Dereference;
}
/// Return the part of this SILDebugInfoExpression corresponding to fragments
SILDebugInfoExpression getFragmentPart() const {
for (auto it = element_begin(), end = element_end(); it != end; ++it) {
if (it->getAsOperator() == SILDIExprOperator::Fragment
|| it->getAsOperator() == SILDIExprOperator::TupleFragment)
return SILDebugInfoExpression(ArrayRef(it, element_end()));
}
return {};
}
};
/// Returns the hashcode for the di expr element.