[PATCH] D151644: [InstCombine] Propegating `nocapture` flag to callsites

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 23:52:00 PDT 2023


goldstein.w.n added a comment.

@nikic think this should do it. I did assume that non-visible captures are okay. (I.e unused return value, or in your example provably dead-store).
The basic rule AFAICT is:
If the the callsite is in a returning basic-block, and between the callsite and the return there are only readonly instructions, then the capture state CANNOT change between the callsite and the return. Since at the return we KNOW the argument hasn't been captured, we can deduce that after the callsite (since it can't change after that) the pointer hasn't been captured.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151644/new/

https://reviews.llvm.org/D151644



More information about the llvm-commits mailing list