This is an archive of the discontinued LLVM Phabricator instance.

[Analysis] Fix merging TBAA tags with different final access types
ClosedPublic

Authored by kosarev on Nov 7 2017, 7:27 AM.

Details

Summary

There are cases when we have to merge TBAA access tags with the same base access type, but different final access types. For example, accesses to different members of the same structure may be vectorized into a single load or store instruction. Since we currently assume that the tags to merge always share the same final access type, we incorrectly return a tag that describes an access to one of the original final access types as the generic tag. This patch fixes that by producing generic tags for the common type and not the final access types of the original tags.

Resolves:
PR35225: Wrong tbaa metadata after load store vectorizer due to recent change
https://bugs.llvm.org/show_bug.cgi?id=35225

Diff Detail

Event Timeline

kosarev created this revision.Nov 7 2017, 7:27 AM
hfinkel added inline comments.Nov 7 2017, 8:36 AM
lib/Analysis/TypeBasedAliasAnalysis.cpp
545

Can you please *explain* the problem in the patch description.

Also, we're now creating new metadata nodes speculatively (i.e., in cases where we we'll return false); can we avoid doing that? (maybe using a lambda function would help?)

kosarev edited the summary of this revision. (Show Details)Nov 7 2017, 9:14 AM
kosarev added inline comments.Nov 7 2017, 9:20 AM
lib/Analysis/TypeBasedAliasAnalysis.cpp
545

Sure, sorry.

Re: creating nodes: we have to produce the generic tag regardless of whether the input tags may alias. We did it before and we do it now; the patch is not supposed to change anything in this regard.

hfinkel accepted this revision.Nov 7 2017, 9:21 AM
hfinkel added inline comments.
lib/Analysis/TypeBasedAliasAnalysis.cpp
545

Thanks. LGTM.

This revision is now accepted and ready to land.Nov 7 2017, 9:21 AM
This revision was automatically updated to reflect the committed changes.