This is an archive of the discontinued LLVM Phabricator instance.

[RewriteStatepointsForGC] Generalized vector phi/select handling for base pointers
ClosedPublic

Authored by reames on Jun 15 2015, 3:23 PM.

Details

Summary

This change extends the detection of base pointers for vector constructs to handle arbitrary phi and select nodes. The existing non-vector code already handles those, so this is basically just extending the vector special case to be less special cased. It still isn't generalized vector handling since we can't handle arbitrary vector instructions (e.g. shufflevectors), but it's a lot closer.

The general structure of the change is as follows:

  • Extend the base defining value relation over a subset of vector instructions and vector typed phi & select instructions.
  • Move scalarization from before base pointer rewriting to after base pointer rewriting. The extension of the BDV relation is sufficient to find vector base phis for vector inputs.
  • Preserve the existing special case logic for when the base of a vector element is locally obvious. This general idea could be extended to the scalar case as well.

Diff Detail

Repository
rL LLVM

Event Timeline

reames updated this revision to Diff 27722.Jun 15 2015, 3:23 PM
reames retitled this revision from to [RewriteStatepointsForGC] Generalized vector phi/select handling for base pointers.
reames updated this object.
reames edited the test plan for this revision. (Show Details)
reames added reviewers: sanjoy, pgavlin, swaroop.sridhar.
reames added a subscriber: Unknown Object (MLST).
swaroop.sridhar accepted this revision.Jun 17 2015, 6:21 PM
swaroop.sridhar edited edge metadata.
This revision is now accepted and ready to land.Jun 17 2015, 6:21 PM
sanjoy added inline comments.Jun 17 2015, 8:19 PM
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
297 ↗(On Diff #27722)

What happens if Index is nullptr?

301 ↗(On Diff #27722)

What if I is a vector of a vector of pointers?

306 ↗(On Diff #27722)

Nit: indentation.

395 ↗(On Diff #27722)

I'd call this something more descriptive than pair.

1778 ↗(On Diff #27722)

Nit: Value *.

1795 ↗(On Diff #27722)

Why not ElementMapping[V].push_back() directly?

1881 ↗(On Diff #27722)

I think you can use PointerToBase.count(V) here.

2220 ↗(On Diff #27722)

Nit: double space before DT.

pgavlin accepted this revision.Jun 18 2015, 10:27 AM
pgavlin edited edge metadata.

LGTM modulo a few very minor comments.

lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
346 ↗(On Diff #27722)

s/it's/its

399 ↗(On Diff #27722)

s/This an/This is an

1885 ↗(On Diff #27722)

An assert(Elements.size() == BaseElements.size()) might be nice here.

This revision was automatically updated to reflect the committed changes.