[PATCH] D147075: [SLP] Only use const args for intrinsic cost if all match.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 13:07:53 PDT 2023


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6270
+
+  bool CanUseArgs = true;
+  for (Value *C : CIs) {
----------------
Unused var?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6271-6279
+  for (Value *C : CIs) {
+    auto *CI = cast<CallInst>(C);
+    if (!all_of(enumerate(CI->args()), [&Args](const auto &A) {
+          return !isa<Constant>(A.value()) || A.value() == Args[A.index()];
+        })) {
+      Args.clear();
+      break;
----------------
So, you're checking that all args have the same value here, right? Looks like this is very target-specific, not sure that it shall affect all targets. You need to adjust the cost of the Const vector, built for this case, not the cost of the vector call. Or pass arguments to CostAttrs and use them for the extra analysis in getIntrinsicInstrCost()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147075



More information about the llvm-commits mailing list