[BasicAA] Don't short-circuit non-capturing arguments
authorNikita Popov <npopov@redhat.com>
Thu, 22 Jun 2023 07:14:08 +0000 (09:14 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 26 Jun 2023 10:27:32 +0000 (12:27 +0200)
commitc0de28b92e98acbeb739eae8a4d762aec77f2705
tree8ab6efbe7474be19b4a934251f9d36af4914b228
parent81e3779a131f2fb14762d848984c90dff14636bf
[BasicAA] Don't short-circuit non-capturing arguments

This is an alternative to D153464. BasicAA currently assumes that
an unescaped alloca cannot be read through non-nocapture arguments
of a call, based on the argument that if the argument were based on
the alloca, it would not be unescaped.

This currently fails in the case where the call is an ephemeral value
and as such does not count as a capture. It also happens for calls
that are readonly+nounwind+void, though that case tends to not matter
in practice, because such calls will get DCEd anyway.

Differential Revision: https://reviews.llvm.org/D153511
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Transforms/PhaseOrdering/dse-ephemeral-value-captures.ll