llvm/test/Analysis/TypeBasedAliasAnalysis
Michael Kruse 52ebe03cb0 [BasicAA] Use MayAlias instead of PartialAlias for fallback.
Using various methods, BasicAA tries to determine whether two
GetElementPtr memory locations alias when its base pointers are known
to be equal. When none of its heuristics are applicable, it falls back
to PartialAlias to, according to a comment, protect TBAA making a wrong
decision in case of unions and malloc. PartialAlias is not correct,
because a PartialAlias result implies that some, but not all, bytes
overlap which is not necessarily the case here.

AAResults returns the first analysis result that is not MayAlias.
BasicAA is always the first alias analysis. When it returns
PartialAlias, no other analysis is queried to give a more exact result
(which was the intention of returning PartialAlias instead of MayAlias).
For instance, ScopedAA could return a more accurate result.

The PartialAlias hack was introduced in r131781 (and re-applied in
r132632 after some reverts) to fix llvm.org/PR9971 where TBAA returns a
wrong NoAlias result due to a union. A test case for the malloc case
mentioned in the comment was not provided and I don't think it is
affected since it returns an omnipotent char anyway.

Since r303851 (https://reviews.llvm.org/D33328) clang does emit specific
TBAA for unions anymore (but "omnipotent char" instead). Hence, the
PartialAlias workaround is not required anymore.

This patch passes the test-suite and check-llvm/check-clang of a
self-hoisted build on x64.

Reviewed By: hfinkel

Differential Revision: https://reviews.llvm.org/D34318

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305938 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21 18:25:37 +00:00
..
aliastest.ll [Verifier] Add verification for TBAA metadata 2016-12-11 20:07:15 +00:00
argument-promotion.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
cyclic.ll [TBAAVerifier] Be stricter around verifying scalar nodes 2016-12-29 15:47:05 +00:00
dse.ll [Verifier] Add verification for TBAA metadata 2016-12-11 20:07:15 +00:00
dynamic-indices.ll [BasicAA] Use MayAlias instead of PartialAlias for fallback. 2017-06-21 18:25:37 +00:00
functionattrs.ll [attrs] Move the norecurse deduction to operate on the node set rather 2016-02-13 08:47:51 +00:00
gvn-nonlocal-type-mismatch.ll [Verifier] Add verification for TBAA metadata 2016-12-11 20:07:15 +00:00
intrinsics.ll AA: Use generic intrinsics for tests instead of target specific ones 2017-05-13 00:12:52 +00:00
licm.ll [Verifier] Add verification for TBAA metadata 2016-12-11 20:07:15 +00:00
memcpyopt.ll [Verifier] Add verification for TBAA metadata 2016-12-11 20:07:15 +00:00
placement-tbaa.ll [PM/AA] Wire up TBAA to the new pass manager's registry and test it. 2016-02-20 04:04:52 +00:00
PR17620.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
precedence.ll [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
sink.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
tbaa-path.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00