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

    <tr>
        <th>Summary</th>
        <td>
            Why does stripPointerCasts on CallBase do getReturnedArgOperand
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    I've been tracking down a bug in my `opt` pass and was able to track it down to a weird behavior in LLVM that I'm not sure is a bug or intended. Specifically, when `stripPointerCasts` is called on a `CallBase` the result of `getReturnedArgOperand` is returned (if the return value would not be NULL).

After inspecting the source code of `llvm/lib/IR/Value.cpp`, the cause for it is in `stripPointerCastAndOffsets` and was initially introduced in the following commit: https://github.com/llvm/llvm-project/commit/5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6
It seems to happen for every such CallBase.

While I can understand the usefulness for Alias Analysis, the behavior in general confuses me and is not documented. Is this behavior intended?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk8GvozYQxv8acxk1AkMgHDhk3wop0mu32qq7Z2OPwV1jI4-dKP99ZZKoW_VdeuGA_X3-5jczgsjMDnFgx0_s-LkQKS4-DPqHscXk1X24MN5dESZEBzEI-cO4GZS_ORAwpRmMg_UOrC39FllbwiaIQDgFN0EgJosQ_UMIJj6E0YOAG5qgYMJFXI0P2eb9_duvEBcRIb-5gvMRKAUEQ8-39nsRnUJ1gD82lEYbKay9M_4GtwVdzkExmO13ny-GN0GRcipDkC-iAp-Ds7Z8E9Z-EoT5NC4IASnZCF7nwxnjV4wpOFTnMH_ZMAinnj7heQCMn4x-avMvuAqbEG4-WbWHnxB--_P9nfH-wMrPrDw_vmcdMRdCG8qYaWYL8ilIBOkVPjNYe10ZH62ZGB8vXxkfv2X_g9w21pa54qyTIhGCzmRiTmc-ZHB26ovWhA8Yr-4YZ6LJ-DLV4FWSqLJB9tXeWn_L6aRfVxNZfYYlxo1YfWZ8ZHycTVzSdJB-T_kMa6_rL1vwf6GMjI9PKR-PsuLqpPGkOyF7UaOsaqWEqo5tpdq66Tosq0a3D0CXCIS4Uh6URWwbur1AvGK4AyW5wKt5_-L6fTEW4QJSOEhOYaCYK83VJEKdrEOi3elsjSA4O2HvZOiF8udZnNFhEBakdzoREqy4YzO0d1Z5mVZ0Mc_hhSAuhn6WP0aU1WOhhlr1dS8KHKquapry2FS8WIaq4V3VirZq-w5507W97OTU47HV7ak6ngoz8JI3ZcP76tjU_HRQouzbqlWVaLlUumZNiasw9pCZH3yYC0OUcOjL5tQVVkxo6bXUYdgbM6WZWFNaQ5H-kUUTLQ7flzsojwT_WZ-8MS_eoDx8uBtFCnb43_OxJybGxz303wEAAP__3p6F6A">