Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonicalization pass #311

Open
pgoodman opened this issue Oct 24, 2022 · 0 comments
Open

Canonicalization pass #311

pgoodman opened this issue Oct 24, 2022 · 0 comments

Comments

@pgoodman
Copy link
Collaborator

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant