This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by huihuiz on Mar 29 2021, 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.Mar 29 2021, 3:22 PM
huihuiz requested review of this revision.Mar 29 2021, 3:22 PM
fhahn added a subscriber: fhahn.Mar 30 2021, 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.Mar 30 2021, 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.Mar 30 2021, 11:07 AM

LGTM.

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