DLA: revive and rework CollapseSingleChild Step

The step now collapse parents with their single child if they are
indistinguishable, i.e. if the parent has only that single child, at
offset zero, and their size is the same.
This commit is contained in:
Pietro Fezzardi
2022-06-06 15:16:43 +02:00
parent be999ebda8
commit ba50eb4a55
6 changed files with 144 additions and 75 deletions
+9 -2
View File
@@ -446,10 +446,17 @@ bool LayoutTypeSystem::verifyConsistency() const {
unsigned NonPtrChildren = 0U;
bool IsPointer = false;
for (const auto &Edge : NodePtr->Successors) {
if (isPointerEdge(Edge))
if (isPointerEdge(Edge)) {
// Node with outgoing pointer edges, only have one pointer edge.
if (IsPointer) {
if (VerifyDLALog.isEnabled())
revng_check(false);
return false;
}
IsPointer = true;
else if (isInstanceEdge(Edge))
} else if (isInstanceEdge(Edge)) {
NonPtrChildren++;
}
if (IsPointer and NonPtrChildren > 0) {
if (VerifyDLALog.isEnabled())