<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59901>59901</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [AssumptionCache] should consider caching the conditions of branches and intrinsic guards
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          caojoshua
      </td>
    </tr>
</table>

<pre>
    Inspired by https://reviews.llvm.org/D141243. There are use cases where the conditions of branches and intrinsic guards and assumes are considered equally. We should consider extending assumption cache to cover branches and guards.

Needs further investigation investigation in the current ways AssumptionCache is used and if we should modify or add APIs. For example, should `AssumptionCache::Assumptions()` return all conditions for branches, assumes, and guards? If just assumes, then we can add following functions:

```
AssumptionCache::Branches();
AssumptionCache::Guards();
AssumptionCache::Conditions(); // Covers all three
```

Also consider renaming AssumptionCache.

If we add branch conditions, a whole lot more testing would be required. Branches get removed frequently in transformations, and AssumptionCache does not seem to be cleaned up very much (my editor finds no references to `AssumptionCache::clear()`.

More discussion/investigation required.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PqzYU_TVmc_UQmJDAgkVmRqlm0aqLSl0b-wIeGTvP106af18Z5pHJvGnVSlES8P0459zrI4j0aBE7Vj-x-iUTMUzOd1K4N0dTFFnv1K17tXTWHhX0N5hCOBOrjoyfGD95vGi8Um7MZc6dHxk_vZS7ku-qHP6Y0CMIjxAJQQpCguvyLkwI0lmlg3aWwA3Qe2HlhATCKtA2eG1JSxij8Gp9KYjinAL8kktaYUKE36Mw5pbDnwg0uWjUdgr4V0CrtB3X5HPqBlLICSE4kO6C_rHx2i5nxQsrjuv3b4iKYIg-TOhB2wtS0KNYSn1-WnlF79EGuIobwXHr-7y01ZS0UCvLAa4b5tkpPdzAeRBKwfH3V8rh5BIFMZ8NMv78I5Lti09V0zCq4_0lMd4w3rJ9AR5D9BaEMR_1Htydd6r8Lu3yd1OBVSd4HeAtUvgYECa0CbcUdoE6OGPcNWk8RCvX9tXxo4JsX7x_lscvwT9taBbk1dO_xP6ywvsPkc8b5S0a1rWF5zR8WoQJk0f8Eup7aUPuvlMerZgT3U8dH5bmdRltkmeV-YP4i8hwnZxBMC7A7NJ9SGtkR7guE-4RPH6P6cLl8EMZGDGAx9ldUMGQztEGc1u2zgtLg_OzuHew6qfdUw4JrAtAiHO6AD2CNCgsKohnuKC_wRzlBIw38w1Q6eA8DNqqlAYeB_RoJVLK_actTAX9tn8PovyamCpNMhJpZxk_Pd6fjXOmukq1VSsy7Mr9oeJNXZVNNnViX_BmkLIphrKtD7uy78vqgHV12DeHoeaZ7njBq6Is2vLAm6rJ5a7GshXNTvC2kT1nuwJnoc3mV5kmitjVbVuUmRE9GlqskHOLV1gOGefJGX2Xcr71cSS2K4ymcHe9LOhgFg_9LEr98pMrJQNKw_6fJphFb7pH8x11mGKfSzczfkpY3n--nb17QxmSxIkBMX5aGP4dAAD__6YTAFw">