[LV] Remove nondeterminacy by changing LoopVectorizationLegality::Reductions
authorWei Mi <wmi@google.com>
Tue, 28 Jan 2020 00:49:50 +0000 (16:49 -0800)
committerWei Mi <wmi@google.com>
Tue, 28 Jan 2020 00:53:20 +0000 (16:53 -0800)
commitf60671f049bcbe1de8f24ca2bb50aa23564e6a7f
tree81bd57ba2dc9dc95b64716706a7394577290030a
parent949294f39627421f4bfaaca7d5d9deacb33efbe0
[LV] Remove nondeterminacy by changing LoopVectorizationLegality::Reductions
from DenseMap to MapVector

The iteration order of LoopVectorizationLegality::Reductions matters for the
final code generation, so we better use MapVector instead of DenseMap for it
to remove the nondeterminacy. reduction-order.ll in the patch is an example
reduced from the case we saw. In the output of opt command, the order of the
select instructions in the vector.body block keeps changing from run to run
currently.

Differential Revision: https://reviews.llvm.org/D73490
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/test/Transforms/LoopVectorize/reduction-order.ll [new file with mode: 0644]