[llvm] [LV][VPlan] Not adding shuffle cost when store loop invariant value. (PR #109644)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 05:43:21 PDT 2024
================
@@ -5666,7 +5666,10 @@ LoopVectorizationCostModel::getConsecutiveMemOpCost(Instruction *I,
}
bool Reverse = ConsecutiveStride < 0;
- if (Reverse)
+ const StoreInst *SI = dyn_cast<StoreInst>(I);
+ bool IsLoopInvariantStoreValue =
+ SI && Legal->isInvariant(const_cast<StoreInst *>(SI)->getValueOperand());
----------------
ElvisWang123 wrote:
You are right, using this implementation may introduce extra divergences.
I think the implementation in the legacy cost model is what we want but we cannot get the analysis in the VPlanRecipes.
Do you have other better methods to figure out if the value is loop invariant in the VPlanRecipes?
https://github.com/llvm/llvm-project/pull/109644
More information about the llvm-commits
mailing list