[LV] Remove nondeterminacy by changing LoopVectorizationLegality::Reductions…

Authored by wmi on Jan 27 2020, 4:49 PM.


[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

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