This is an archive of the discontinued LLVM Phabricator instance.

[MemCpy] Check for alias in performMemCpyToMemSetOptzn, instead of the identity of two operands
ClosedPublic

Authored by timshen on Aug 24 2016, 11:15 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

timshen updated this revision to Diff 69145.Aug 24 2016, 11:15 AM
timshen retitled this revision from to [MemCpy] Check for alias in performMemCpyToMemSetOptzn, instead of the identity of two operands.
timshen updated this object.
timshen added a subscriber: llvm-commits.
timshen added a reviewer: ab.Aug 24 2016, 11:21 AM
timshen updated this object.Aug 25 2016, 1:02 AM
iteratee accepted this revision.Aug 25 2016, 11:29 AM
iteratee edited edge metadata.

MustAlias is true only for exact aliases correct?

If so, this can land.

This revision is now accepted and ready to land.Aug 25 2016, 11:29 AM

MustAlias is true only for exact aliases correct?

Correct.

If so, this can land.

MustAlias is true only for exact aliases correct?

Yes, the comment in AliasAnalysis.h says so:

/// The two locations precisely alias each other.
MustAlias,
This revision was automatically updated to reflect the committed changes.
echristo added inline comments.Aug 25 2016, 1:52 PM
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
1111

Can probably fold this into the conditional since this is the only place it's used.

1114

Document why you care about MustAlias here.

llvm/trunk/test/Transforms/MemCpyOpt/pr29105.ll
4

Comment on what you're testing.

timshen marked 2 inline comments as done.Aug 25 2016, 2:16 PM
timshen added inline comments.
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
1111

If you are talking about:

if (LookupAliasAnalysis().isMustAlias(...))

, then for consistency with other call sites, I like to keep it as is (I searched for "LookupAliasAnalysis()." and found nothing).

If you are talking about:

if (auto &AA = LoopupAliasAnalysis(); AA.isMustAlias(...))

It's a C++17 feature and we are not quite there yet! :)

echristo added inline comments.Aug 25 2016, 2:25 PM
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
1111

Feel free to fix up the other single uses at the same time? :)

That said, I don't feel that strongly here either way.