[PATCH] D82550: [SLPVectorizer] handle vectorized lib functions

Sanne Wouda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 12:53:37 PDT 2020


sanwou01 marked 2 inline comments as done.
sanwou01 added a comment.

Comments inline.



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3030
+
+      auto Shape =
+          VFShape::get(*CI, {static_cast<unsigned int>(VL.size()), false},
----------------
ABataev wrote:
> Is this a pointer? Then `auto *`.
Surprisingly no! I'll remove auto to avoid the confusion.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5121
+    if (I->mayReadOrWriteMemory() && !isSideeffectIntrinsic(I) &&
+        !isVectorizableLibFunctionCall(I)) {
       // Update the linked list of memory accessing instructions.
----------------
ABataev wrote:
> Why do you need to exclude vectorizable library functions here?
For "normal" function calls, we have to assume that the functions may read or write memory any location in memory, which may alias memory read or written by another instruction in the same bundle. For functions with vector variants, we should be able to assume that they are pure: they won't write to memory (except when the function takes pointer arguments, which I'm not handling correctly now that I think about it; I'll fix that up).

Actually, the calculateDependencies function below might be the less-surprising place to handle this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82550





More information about the llvm-commits mailing list