[PATCH] D99549: [LoopVectorize] Use SmallVector to track uniform uses to prevent non-determinism.
Huihui Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 15:49:09 PDT 2021
huihuiz created this revision.
huihuiz added reviewers: efriedma, StephenTozer, MaskRay, nikic, zzheng, mgrang.
huihuiz added a project: LLVM.
Herald added a subscriber: hiraditya.
huihuiz requested review of this revision.
Use SmallVector instead of SmallPtrSet to track values with uniform use. 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 test consecutive-ptr-uniforms.ll .
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99549
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5387,7 +5387,7 @@
// here is something which only demands lane 0 of the unrolled iterations;
// it does not imply that all lanes produce the same value (e.g. this is not
// the usual meaning of uniform)
- SmallPtrSet<Value *, 8> HasUniformUse;
+ SmallVector<Value *, 8> HasUniformUse;
// Scan the loop for instructions which are either a) known to have only
// lane 0 demanded or b) are uses which demand only lane 0 of their operand.
@@ -5405,7 +5405,7 @@
if (isUniformDecision(&I, VF)) {
assert(isVectorizedMemAccessUse(&I, Ptr) && "consistency check");
- HasUniformUse.insert(Ptr);
+ HasUniformUse.push_back(Ptr);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99549.334005.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/e11dbbf7/attachment.bin>
More information about the llvm-commits
mailing list