LoopVectorizer assert triggered with -force-vf

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 03:21:27 PST 2017


Hi,

while experimenting with the loop vectorizer, I tried using -force-vf=2, 
and immediately got:

LoopVectorize.cpp:1922: bool 
{anonymous}::LoopVectorizationCostModel::isProfitableToScalarize(llvm::Instruction*, 
unsigned int) const: Assertion `Scalars != InstsToScalarize.end() && "VF 
not yet analyzed for scalarization profitability"' failed.

It seems that adding a call to collectInstsToScalarize(), per below 
makes the problem go away. Is this the right fix?

/Jonas


@@ -6156,6 +6156,7 @@ 
LoopVectorizationCostModel::selectVectorizationFactor(bool OptForSize) {
    if (ForceVF.getNumOccurrences() > 0) {
      Factor.Width = ForceVF;
      Factor.Cost = 1;
+    collectInstsToScalarize(ForceVF);
      return Factor;
    }



More information about the llvm-commits mailing list