This is an archive of the discontinued LLVM Phabricator instance.

Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI
ClosedPublic

Authored by trentxintong on Mar 1 2017, 10:46 PM.

Details

Summary

Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue.
Prepare for upcoming change which will do phi-translation for load on
phi pointer in jump threading SimplifyPartiallyRedundantLoad.

This is in preparation for https://reviews.llvm.org/D30543

Diff Detail

Repository
rL LLVM

Event Timeline

trentxintong created this revision.Mar 1 2017, 10:46 PM
trentxintong edited the summary of this revision. (Show Details)Mar 1 2017, 10:47 PM
davide added a subscriber: davide.Mar 1 2017, 10:48 PM

I don't think this is bad, but can you please upload the other change to show up how you want to use it?

isUnordered() checks for !isVolatile().

Update comments.

junbuml added a subscriber: junbuml.Mar 2 2017, 7:32 AM
trentxintong edited the summary of this revision. (Show Details)Mar 2 2017, 10:35 AM
trentxintong added a reviewer: davide.
junbuml added inline comments.Mar 2 2017, 12:28 PM
lib/Analysis/Loads.cpp
321 ↗(On Diff #90293)

Do we really need to have this just to wrap FindAvailablePtrLoadStore() in FindAvailableLoadedValue? I guess it's also possible to change existing call sites of FindAvailableLoadedValue() just this like.

326 ↗(On Diff #90293)

Don't you need to have if (!Load->isUnordered()) in FindAvailablePtrLoadStore as well?

trentxintong added inline comments.Mar 2 2017, 12:40 PM
lib/Analysis/Loads.cpp
321 ↗(On Diff #90293)

Its also possible to change existing callsites, which we only have a few (~3). If we do that we can remove the FindAvailableLoadedValue function.

326 ↗(On Diff #90293)

We cant check for that as we are passing in a Ptr, the check needs to be done outside.

junbuml added inline comments.Mar 2 2017, 12:51 PM
lib/Analysis/Loads.cpp
326 ↗(On Diff #90293)

What about passing both load and pointer accessed to FindAvailableLoadedValue ?

trentxintong added inline comments.Mar 2 2017, 1:12 PM
lib/Analysis/Loads.cpp
326 ↗(On Diff #90293)

Its possible. However, I think the whole point of having this function is that we do not need to pass in a LoadInst, as after we do phi translate, we only have a pointer, not a LoadInst.

At this point, I am leaning towards removing FindAvailableLoadedValue and overwrite the callsites (~3) to do the check before calling FindAvailablePtrLoadStore.

davide accepted this revision.Mar 18 2017, 10:35 PM

LGTM

This revision is now accepted and ready to land.Mar 18 2017, 10:35 PM
This revision was automatically updated to reflect the committed changes.