[PATCH] D132477: Improve cost model for some 128-bit vector operations that use SVE

Hassnaa Hamdi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 02:29:05 PDT 2022


hassnaa-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:2068
+        // consider the cost of legalizaiton
+        Cost *= LT.first;
+      } else {
----------------
david-arm wrote:
> I am so sorry about this @hassnaa-arm, but I made a mistake previously asking you to multiply by the legalisation cost. It seems that `BaseT::getArithmeticInstrCost` already takes this into account.
> 
> Also, I didn't spot this before, but I think we should actually return the cost here, i.e.
> 
>   return Cost;
> 
> because otherwise we fall through to code below that doubles the cost again, i.e.
> 
>   Cost += Cost;
so what is the problem of doubling the cost ? I understand that because there are 2 operands, and the same work should be done for both of them, and the code calculates the cost of one of them, so, we have to double the cost to consider the needed work for both operands.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132477



More information about the llvm-commits mailing list