Fix DFG synthesis non-determinism (#6557) (#6568)

This commit is contained in:
Todd Strader 2025-10-20 11:16:36 -04:00 committed by GitHub
parent 9bd30baba4
commit ffd7ec1007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -531,7 +531,14 @@ class AstToDfgSynthesize final {
// TYPES
using Variable = std::conditional_t<T_Scoped, AstVarScope, AstVar>;
using SymTab = std::unordered_map<Variable*, DfgVertexVar*>;
// SymTab must be ordered in order to yield stable results
struct VariableComparator final {
bool operator()(const Variable* lhs, const Variable* rhs) const {
return lhs->name() < rhs->name();
}
};
using SymTab = std::map<Variable*, DfgVertexVar*, VariableComparator>;
// Represents a [potentially partial] driver of a variable
struct Driver final {