[GlobalsAA] Loosen an overly conservative bailout
authorJames Molloy <james.molloy@arm.com>
Thu, 22 Oct 2015 13:44:26 +0000 (13:44 +0000)
committerJames Molloy <james.molloy@arm.com>
Thu, 22 Oct 2015 13:44:26 +0000 (13:44 +0000)
commit60851822307ca2d01bf570fb1481eb0ca67fd2d0
tree6c1ce2858cd749df6d23a6ec18b78b0e75e8c321
parentdc5a8f2aac54cdf1199a8cc08b4ad0521f050462
[GlobalsAA] Loosen an overly conservative bailout

Instead of bailing out when we see loads, analyze them. If we can prove that the loaded-from address must escape, then we can conclude that a load from that address must escape too and therefore cannot alias a non-addr-taken global.

When checking if a Value can alias a non-addr-taken global, if the Value is a LoadInst of a non-global, recurse instead of bailing.

If we can follow a trail of loads up to some base that is captured, we know by inference that all the loads we followed are also captured.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251017 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/GlobalsModRef.cpp
test/Analysis/GlobalsModRef/nonescaping-noalias.ll