This is an archive of the discontinued LLVM Phabricator instance.

[RewriteStatepointsForGC] Use SetVector/MapVector instead of DenseSet/DenseMap to guarantee stable ordering
ClosedPublic

Authored by igor-laevsky on Apr 28 2016, 10:03 AM.

Details

Summary

Goal of this change is to guarantee stable ordering of the statepoint arguments and other newly inserted values such as gc.relocates. Previously we had explicit sorting in a couple of places. However for unnamed values ordering was partial and overall we didn't have any strong invariant regarding it. This change switches all data structures to use SetVector's and MapVector's which provide possibility for deterministic iteration over them. Explicit sorting is now redundant and was removed.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky retitled this revision from to [RewriteStatepointsForGC] Use SetVector/MapVector instead of DenseSet/DenseMap to guarantee stable ordering.
igor-laevsky updated this object.
igor-laevsky added reviewers: sanjoy, reames.
igor-laevsky added a subscriber: llvm-commits.
sanjoy accepted this revision.Apr 29 2016, 1:16 PM
sanjoy edited edge metadata.

This lgtm with some inline comments on the SetOperations bit.

include/llvm/ADT/SetOperations.h
34 ↗(On Diff #55430)

Given that these functions only work with SetVector, why not just add these as member functions on SetVector (with the same TODO there as you have here)?

35 ↗(On Diff #55430)

Add a blank line here, same for set_subtract

39 ↗(On Diff #55430)

The first template args should probably be named V1Ty or El1Ty, since it is no longer a "set" type. Same for set_subtract.

This revision is now accepted and ready to land.Apr 29 2016, 1:16 PM
This revision was automatically updated to reflect the committed changes.