Page MenuHomePhabricator

[VPlan] Use SetVector for VPExternalDefs to prevent non-determinism.
ClosedPublic

Authored by huihuiz on Mon, Mar 29, 3:22 PM.

Details

Summary

Use SetVector instead of SmallPtrSet for external definitions created for VPlan.
Doing this can help avoid non-determinism caused by iterating over unordered containers.

This bug was found with reverse iteration turning on,
--extra-llvm-cmake-variables="-DLLVM_REVERSE_ITERATION=ON".
Failing LLVM-Unit test VPRecipeTest.dump.

Diff Detail

Event Timeline

huihuiz created this revision.Mon, Mar 29, 3:22 PM
huihuiz requested review of this revision.Mon, Mar 29, 3:22 PM
fhahn added a subscriber: fhahn.Tue, Mar 30, 7:06 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/VPlan.h
1770

Should this be SetVector? I think we still want to avoid adding duplicates.

huihuiz updated this revision to Diff 334202.Tue, Mar 30, 9:50 AM
huihuiz marked an inline comment as done.
huihuiz retitled this revision from [VPlan] Use SmallVector for VPExternalDefs to prevent non-determinism. to [VPlan] Use SetVector for VPExternalDefs to prevent non-determinism..
huihuiz edited the summary of this revision. (Show Details)
huihuiz added a reviewer: fhahn.

Thank you for the feedback!
Addressed review comments.

MaskRay accepted this revision.Tue, Mar 30, 11:07 AM

LGTM.

This revision is now accepted and ready to land.Tue, Mar 30, 11:07 AM