[BasicAA] Clean up calculation of FMRB from attributes
authorNikita Popov <npopov@redhat.com>
Thu, 22 Sep 2022 15:16:48 +0000 (17:16 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 23 Sep 2022 10:05:35 +0000 (12:05 +0200)
commit6c6b48434ed85841f147c789a96a309e1fff16ae
tree9c567d864850ebf29651f73e2f4c515acc1d7393
parent7438df99604233bf9e319875adcbd97aae608520
[BasicAA] Clean up calculation of FMRB from attributes

The current implementation for call sites is pretty convoluted
when you take the underlying implementation of the used APIs
into account. We will query the call site attributes, and then
fall back to the function attributes while taking into account
operand bundles. However, getModRefBehavior() already has it's
own (more accurate) logic for combining call-site FMRB with
function FMRB.

Clean this up by extracting a function that only fetches FMRB
from attributes, which can be directly used in getModRefBehavior()
for functions, and needs to be combined with an operand-bundle
respecting fallback in the call site case.

One caveat (that makes this non-NFC) is that CallBase function
attribute lookups allow using attributes from functions with
mismatching signature. To ensure we don't regress quality, do
the same for the function FMRB fallback.
llvm/lib/Analysis/BasicAliasAnalysis.cpp