[PATCH] D99544: [VPlan] Use SmallVector for VPExternalDefs to prevent non-determinism.
Huihui Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 15:22:47 PDT 2021
huihuiz created this revision.
huihuiz added reviewers: efriedma, StephenTozer, MaskRay, nikic, zzheng, mgrang.
huihuiz added a project: LLVM.
Herald added subscribers: tschuett, psnobl, rogfer01, bollu, hiraditya.
huihuiz requested review of this revision.
Herald added a subscriber: vkmr.
Use SmallVector 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99544
Files:
llvm/lib/Transforms/Vectorize/VPlan.h
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1767,7 +1767,7 @@
// VPlan. External definitions must be immutable and hold a pointer to its
// underlying IR that will be used to implement its structural comparison
// (operators '==' and '<').
- SmallPtrSet<VPValue *, 16> VPExternalDefs;
+ SmallVector<VPValue *, 16> VPExternalDefs;
/// Represents the backedge taken count of the original loop, for folding
/// the tail.
@@ -1835,9 +1835,7 @@
/// Add \p VPVal to the pool of external definitions if it's not already
/// in the pool.
- void addExternalDef(VPValue *VPVal) {
- VPExternalDefs.insert(VPVal);
- }
+ void addExternalDef(VPValue *VPVal) { VPExternalDefs.push_back(VPVal); }
void addVPValue(Value *V) {
assert(V && "Trying to add a null Value to VPlan");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99544.333996.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/4663f226/attachment.bin>
More information about the llvm-commits
mailing list