[llvm] fe5c4a0 - [LoopVectorize] Use SetVector to track uniform uses to prevent non-determinism.

Huihui Zhang via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 31 11:21:24 PDT 2021


Author: Huihui Zhang
Date: 2021-03-31T11:21:07-07:00
New Revision: fe5c4a06a49c697399323cc55e2135a5452ed616

URL: https://github.com/llvm/llvm-project/commit/fe5c4a06a49c697399323cc55e2135a5452ed616
DIFF: https://github.com/llvm/llvm-project/commit/fe5c4a06a49c697399323cc55e2135a5452ed616.diff

LOG: [LoopVectorize] Use SetVector to track uniform uses to prevent non-determinism.

Use SetVector 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 .

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D99549

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index e2ffb8d544ff..15c53e0d5e99 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5413,7 +5413,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
   // 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;
+  SetVector<Value *> 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.


        


More information about the llvm-commits mailing list