[PATCH] D105806: [LV] Print remark when loop cannot be vectorized due to invalid costs.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 13:34:43 PDT 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1680
   /// the factor width.
-  VectorizationCostTy expectedCost(ElementCount VF);
 
----------------
Could you extend the doc-comment here to include the new argument?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6132
+          OS << ")\n";
+        OS << "\t" << *InstructionVFPair.first << "\t(";
+        Current = InstructionVFPair.first;
----------------
Ideally remarks should be easy to understand for end-users, who do not know about LLVM IR (they specifically are not only targeted at LLVM developers). Instead of printing IR directly, it might be more user-friendly to just say something like `call to function sin` instead of the plain LLVM IR call. Not sure if we have such pretty-printing anywhere else already though.

Including the file/line info where the instruction appears might be a good first step.


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/scalable-call.ll:100
 
+; CHECK-REMARKS: UserVF ignored because of invalid costs.
+; CHECK-REMARKS-NEXT: Instructions with invalid costs prevent vectorization for certain VFs:
----------------
could you add debug locations to the test and also check that the correct locations are used for the remark?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105806/new/

https://reviews.llvm.org/D105806



More information about the llvm-commits mailing list