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

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 08:52:54 PDT 2021


sdesmalen marked 4 inline comments as done.
sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6132
+          OS << ")\n";
+        OS << "\t" << *InstructionVFPair.first << "\t(";
+        Current = InstructionVFPair.first;
----------------
fhahn wrote:
> 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.
@dmgreen also asked a question about that on https://reviews.llvm.org/D105473#2861460
There is precedent for printing IR directly, although I'm not sure if that's necessarily desirable.

What I've done now is:
1. Prints the opcode and in case of a `call`, also the name of the function.
2. Emit one remark for each function that has invalid cost and pass the individual Instruction so that the remark mechanism can take the file/line/column info from it.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6141
+    reportVectorizationInfo(OutString, "InvalidCost", ORE, TheLoop,
+                            InvalidCosts[0].first);
+  }
----------------
kmclaughlin wrote:
> nit: should `InvalidCosts[0].first` be used as the location of the remark from reportVectorizationInfo, since there could be multiple instructions found in the loop with invalid costs?
Fair point! The updated patch should address this now. It now emits a remark with corresponding line/column info for each instruction with invalid cost.


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