[llvm] [LV] Cache call vectorization decisions (PR #66521)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 06:44:42 PDT 2023


================
@@ -6970,6 +6968,122 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {
   }
 }
 
+void LoopVectorizationCostModel::setVectorizedCallDecision(ElementCount VF) {
+  if (VF.isScalar())
+    return;
+
+  for (BasicBlock *BB : TheLoop->blocks()) {
+    // For each instruction in the old loop.
+    for (Instruction &I : *BB) {
+      CallInst *CI = dyn_cast<CallInst>(&I);
+
+      if (!CI || CallWideningDecisions.contains(std::make_pair(CI, VF)))
----------------
david-arm wrote:

Is it even possible for CallWideningDecisions to already contain CI - would it not be unique for each line of IR?

https://github.com/llvm/llvm-project/pull/66521


More information about the llvm-commits mailing list