The function hash in an instrumented profile should change if and only if control flow changes. This patch hashes the type of each AST node that affects counters, rather than just counting how many there are.
This scheme is not perfect. Ideally, if the condition in an if statement has a semantic change, the hash should change too. However, if a user changes variable names, the hash should not change. Hashing just the type of control flow is a reasonable compromise. Since we need a stable hash (even if Stmt::StmtClass gets reshuffled), create a local enumerator that we can keep stable. Using hash values with the most significant bit set exposed a bug where the current text reader in clang used strtol and strtoll to read unsigned values. Changed to strtoul and strtoull.
pgo-hash.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
