This is an archive of the discontinued LLVM Phabricator instance.

[ModRefInfo] Return NoModRef for Must and NoModRef.
ClosedPublic

Authored by asbirlea on Jan 17 2018, 3:54 PM.

Details

Summary

In ModRefInfo "Must" was introduced to track presence of MustAlias, but we still want to return NoModRef when there is neither Mod or Ref, even when MustAlias is found. Patch has small fixes to ensure this happens.
Minor cleanup to compact 2 if statements into one when calling getModRefInfo for 2 ImmutableCallSites.

Diff Detail

Repository
rL LLVM

Event Timeline

asbirlea created this revision.Jan 17 2018, 3:54 PM
sanjoy requested changes to this revision.Jan 18 2018, 11:03 AM
sanjoy added inline comments.
lib/Analysis/AliasAnalysis.cpp
256 ↗(On Diff #130306)

I'm a bit confused by this -- before if onlyAccessesArgPointees was true and doesAccessArgPointees was false then we'd directly return ModRefInfo::NoModRef. However, now if onlyAccessesArgPointees is true and doesAccessArgPointees is false we're going to return Result after falling through to the end. Is that equivalent? If so, can you please add an assert(Result == NoModRef) or something like that?

This revision now requires changes to proceed.Jan 18 2018, 11:03 AM
asbirlea updated this revision to Diff 130565.Jan 19 2018, 12:55 AM

Add shortcut path to NoModRef when second if test is false, unintended change of meaning in initial patch.

sanjoy accepted this revision.Jan 19 2018, 12:59 AM
sanjoy added inline comments.
lib/Analysis/BasicAliasAnalysis.cpp
858 ↗(On Diff #130565)

[minor] Instead of

if (X)
  return A;
else
  return B;

you can do

if (X)
  return A;
return B;
This revision is now accepted and ready to land.Jan 19 2018, 12:59 AM
asbirlea updated this revision to Diff 130570.Jan 19 2018, 2:02 AM

Address comment.
Thank you the review!

This revision was automatically updated to reflect the committed changes.