diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-14 21:24:36 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-18 23:07:50 +0100 |
commit | 70e3c9a8b6684c49576aee38b5c90b18fdf00d2c (patch) | |
tree | b764e454cfb95873dab2fa482b3825ab0c56f1e2 /llvm/lib/Analysis/GlobalsModRef.cpp | |
parent | b006902b2dfac792e8ade73798ca1b216654faf7 (diff) | |
download | llvm-70e3c9a8b6684c49576aee38b5c90b18fdf00d2c.zip llvm-70e3c9a8b6684c49576aee38b5c90b18fdf00d2c.tar.gz llvm-70e3c9a8b6684c49576aee38b5c90b18fdf00d2c.tar.bz2 |
[BasicAA] Always strip single-argument phi nodes
We can always look through single-argument (LCSSA) phi nodes when
performing alias analysis. getUnderlyingObject() already does this,
but stripPointerCastsAndInvariantGroups() does not. We still look
through these phi nodes with the usual aliasPhi() logic, but
sometimes get sub-optimal results due to the restrictions on value
equivalence when looking through arbitrary phi nodes. I think it's
generally beneficial to keep the underlying object logic and the
pointer cast stripping logic in sync, insofar as it is possible.
With this patch we get marginally better results:
aa.NumMayAlias | 5010069 | 5009861
aa.NumMustAlias | 347518 | 347674
aa.NumNoAlias | 27201336 | 27201528
...
licm.NumPromoted | 1293 | 1296
I've renamed the relevant strip method to stripPointerCastsForAliasAnalysis(),
as we're past the point where we can explicitly spell out everything
that's getting stripped.
Differential Revision: https://reviews.llvm.org/D96668
Diffstat (limited to 'llvm/lib/Analysis/GlobalsModRef.cpp')
-rw-r--r-- | llvm/lib/Analysis/GlobalsModRef.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp index 145baf8..aafc19a 100644 --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -828,9 +828,9 @@ AliasResult GlobalsAAResult::alias(const MemoryLocation &LocA, AAQueryInfo &AAQI) { // Get the base object these pointers point to. const Value *UV1 = - getUnderlyingObject(LocA.Ptr->stripPointerCastsAndInvariantGroups()); + getUnderlyingObject(LocA.Ptr->stripPointerCastsForAliasAnalysis()); const Value *UV2 = - getUnderlyingObject(LocB.Ptr->stripPointerCastsAndInvariantGroups()); + getUnderlyingObject(LocB.Ptr->stripPointerCastsForAliasAnalysis()); // If either of the underlying values is a global, they may be non-addr-taken // globals, which we can answer queries about. |