Failure while running loop vectorizer


While trying to compile my program, I faced problem with Loop Vectorizer which is trying interleave a load instruction. Error mentioned below

Error message :: void llvm::InnerLoopVectorizer::vectorizeMemoryInstruction(llvm::Instruction*, llvm::VPTransformState&, llvm::VPValue*, llvm::VPValue*, llvm::VPValue*): Assertion `(Decision == LoopVectorizationCostModel::CM_Widen || Decision == LoopVectorizationCostModel::CM_Widen_Reverse || Decision == LoopVectorizationCostModel::CM_GatherScatter) && “CM decision is not to widen the memory instruction”’ failed.

Source code ::

I have reduced my program to a shorter test case(vect.ll is attached). The same problem is reproducible with opt.

Command to reproduce the error: ./opt -loop-vectorize -hexagon-autohvx=1 vect.ll -S

Based on my analysis, I see that Decision is getting return value as CM_Interleave but Loop Vectorizer expects either of the following values: CM_Widen, CM_Widen_Reverse, CM_GatherScatter. Otherwise it asserts out.

Could you please help in sharing insights on what could be an issue here ?



vect.ll (2.68 KB)