)]}'
{
  "commit": "ee738ac1f838a090cac74ba8981e2104b6c02d44",
  "tree": "24fb80f961eacb64cee9e29c07189a899ed400ae",
  "parents": [
    "fbe1ed616fd91aae781f7cfbce027d91114f78e5"
  ],
  "author": {
    "name": "Alon Zakai",
    "email": "azakai@google.com",
    "time": "Tue May 09 18:17:18 2023"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue May 09 18:17:18 2023"
  },
  "message": "Remove TypeUpdater in Vacuum and always ReFinalize (#5707)\n\nTypeUpdater::remove must be called after removing a thing from the\r\ntree. If not, then we can get confused by something like this:\r\n\r\n(block $b\r\n  (br $b)\r\n)\r\n\r\nIf we first call TypeUpdater::remove then we see that the block\u0027s only\r\nbr is going away, so it becomes unreachable. But when we then remove\r\nthe br then the block should have type none. Removing the br first\r\nfrom the IR, and then calling TypeUpdater::remove, is the safe way to do it.\r\n\r\nHowever, changing that order in Vacuum is not trivial. After looking into\r\nthis, I realized that it is just simpler to remove TypeUpdater entirely.\r\nInstead, we can ReFinalize at the end unconditionally. This has the downside\r\nthat we do not propagate type updates \"as we go\", but that should be very\r\nrare.\r\n\r\nAnother downside is that TypeUpdater tracks the number of brs, which\r\ncan help remove code like in the one test that regresses here (see comment\r\nthere). But I\u0027m not sure that removal was valid - Vacuum should not really be\r\ndoing it, and it looks like its related to this bug actually. Instead, we have a\r\ndedicated pass for removing unused brs - RemoveUnusedBrs - so leave\r\nthings for it.\r\n\r\nThis PR\u0027s benefit, aside from now handling the fuzz testcase, is that it makes\r\nthe code simpler and faster. I see a 10-25% speedup on the Vacuum pass on\r\nvarious binaries I tested on. (Vacuum is one of our faster passes anyhow,\r\nthough, so the runtime of -O1 is not much improved.)\r\n\r\nAnother minor benefit might be that running ReFinalize more often can\r\npropagate type info more quickly, thanks to #5704 etc. But that is probably\r\nvery minor.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7c394900dc2cb2c04c6a76cad94f3c98c88beeef",
      "old_mode": 33188,
      "old_path": "src/passes/Vacuum.cpp",
      "new_id": "8d89553b232d88a5e5f6439d36806d8779d51feb",
      "new_mode": 33188,
      "new_path": "src/passes/Vacuum.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1bd44ce17c21bd082721a476eaa5bdb7a76364d4",
      "new_mode": 33188,
      "new_path": "test/lit/passes/vacuum-global-effects.wast"
    },
    {
      "type": "modify",
      "old_id": "36074af30b2d3aea02c90961133f16158b8c5e1d",
      "old_mode": 33188,
      "old_path": "test/lit/passes/vacuum_all-features.wast",
      "new_id": "1a64521edcd59f6efcacb381371953080234ad39",
      "new_mode": 33188,
      "new_path": "test/lit/passes/vacuum_all-features.wast"
    }
  ]
}
