[PATCH] D39446: [PGO] Detect more structural changes with the stable hash

Bob Wilson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 09:47:52 PDT 2017


bob.wilson added a comment.

I'm excited to see some progress on this, but since there is overhead to adding a new hashing scheme, I think we should do more before introducing a new scheme. One of the problems with the previous scheme is that is did not take into account nesting. Distinguishing an if-statement from an if-else statement is good but we also need to distinguish what code is inside the then-block, else-block, and the code afterward. As it stands, I believe the following are all hashed the same, even with this patch:

Loop after the if-else:

  if (condition1())
    x = 1;
  else
    x = 2;
  while (condition2()) body();

Loop in the else-block:

  if (condition1())
    x = 1;
  else
    while (condition2()) body();

Loop in the then-block:

  if (condition1()) {
    while (condition2()) body();
  } else
    x = 2

It would be good to fix that.


https://reviews.llvm.org/D39446





More information about the cfe-commits mailing list