Skip to content

Canonicalization pass #311

Description

@pgoodman

It would be nice if there were a canonicalization pass that attempted to improve the likelihood of deterministic output across runs. For example:

image

The idea of a canonicalizing pass in this instance would be to determine if the conditions tested in an short-circuiting and/or can be evaluated in any order, and if so, impose a specific order. The specific order imposed could be based on sorting the hashes of the sub-nodes, where the hashes are implemented with a clang::StmtProfilerWithoutPointers, which is accessible via

void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID, class ODRHash &Hash) const {
  StmtProfilerWithoutPointers Profiler(ID, Hash);
  Profiler.Visit(this);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions