[llvm] [CostModel][AArch64] Make extractelement, with fmul user, free whenev… (PR #111479)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 09:53:59 PDT 2024


================
@@ -11633,6 +11633,13 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
   std::optional<DenseMap<Value *, unsigned>> ValueToExtUses;
   DenseMap<const TreeEntry *, DenseSet<Value *>> ExtractsCount;
   SmallPtrSet<Value *, 4> ScalarOpsFromCasts;
+  // Keep track {Scalar, Index, User} tuple.
+  // On AArch64, this helps in fusing a mov instruction, associated with
+  // extractelement, with fmul in the backend so that extractelement is free.
+  SmallVector<std::tuple<Value *, User *, int>, 4> ScalarUserAndIdx;
+  for (ExternalUser &EU : ExternalUses) {
+    ScalarUserAndIdx.emplace_back(std::make_tuple(EU.Scalar, EU.User, EU.Lane));
----------------
alexey-bataev wrote:

`ScalarUserAndIdx.emplace_back(EU.Scalar, EU.User, EU.Lane);`

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


More information about the llvm-commits mailing list