[llvm] [AArch64][TTI] Fix extract cost for scalar fmul users (PR #212739)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 03:14:41 PDT 2026


================
@@ -4433,28 +4433,30 @@ InstructionCost AArch64TTIImpl::getVectorInstrCostHelper(
 
     if (Scalar) {
       DenseMap<User *, unsigned> UserToExtractIdx;
-      for (auto *U : Scalar->users()) {
-        if (!IsUserFMulScalarTy(U))
+      for (auto &[S, U, L] : ScalarUserAndIdx) {
+        if (S != Scalar)
+          continue;
+        if (!U || !IsUserFMulScalarTy(U))
           return false;
         // Recording entry for the user is important. Index value is not
         // important.
         UserToExtractIdx[U];
----------------
sushgokh wrote:

Can you check if recording the lane here itself and removing the next immediate loop serves the purpose ? 
Also, I havent clearly understood why the check `S==OtherOp` in next loop

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


More information about the llvm-commits mailing list