DLA: Add RemoveConflictingEdges step

Add a DLA step that removes all instance-at-offset-0 edges between nodes
that already have an inheritance edge between them.
This commit is contained in:
Alvise de Faveri
2021-09-15 18:57:41 +02:00
parent fda2b0042f
commit 7e72fc4be1
8 changed files with 170 additions and 6 deletions
+24
View File
@@ -12,6 +12,7 @@
#include "llvm/Support/raw_ostream.h"
#include "revng/ADT/FilteredGraphTraits.h"
#include "revng/Support/Assert.h"
#include "revng/Support/Debug.h"
#include "revng/Support/DebugHelper.h"
@@ -639,6 +640,29 @@ bool LayoutTypeSystem::verifyInheritanceTree() const {
return true;
}
bool LayoutTypeSystem::verifyConflicts() const {
using GraphNodeT = const LayoutTypeSystemNode *;
using LinkT = const LayoutTypeSystemNode::Link;
for (GraphNodeT Node : llvm::nodes(this)) {
for (auto &Succ : Node->Successors) {
auto HasSameSucc = [&Succ](const LinkT &L2) {
return isInstanceOff0Edge(L2) and (Succ.first == L2.first);
};
if (isInheritanceEdge(Succ)
and llvm::any_of(Node->Successors, HasSameSucc)) {
if (VerifyDLALog.isEnabled())
revng_check(false);
return false;
}
}
}
return true;
}
unsigned VectEqClasses::growBy1() {
++NElems;
grow(NElems);