[PATCH] D153511: [BasicAA] Don't short-circuit non-capturing arguments

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 12:14:50 PDT 2023


fhahn added a comment.

In D153511#4442180 <https://reviews.llvm.org/D153511#4442180>, @nikic wrote:

> You don't really need an assume to show the issue, this simpler variant exhibits the same problem: https://llvm.godbolt.org/z/M3K5fG97G The store is removed even though the call reads it.
>
> This just happens to mostly work out fine right now because such calls get DCEd, so we don't observe end-to-end miscompiles. If capture tracking were slightly smarter and followed the return value (as we effectively do in the assume case) we would get observable miscompiles even without ephemeral value interactions.

Yeah, one issue seems to be that AA uses CaptureTracking as proxy for escaping (e.g. EarliestEscapeInfo by DSE), but in some cases escaping doesn't imply capturing and things go wrong. I *think* tracking escapes (instead of captures) would make sense in general, as this should help to avoid most code-size changes seen by this patch I suspect.


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

https://reviews.llvm.org/D153511



More information about the llvm-commits mailing list