[PATCH] D157628: [AArch64][SVE2] Change the cost of extends with S/URHADD to 0

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 06:46:09 PDT 2023


kmclaughlin reopened this revision.
kmclaughlin added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:2088
+  // The add should only have one user, a right shift of 1.
+  auto *Add = cast<Instruction>(*I->user_begin());
+  if (Add->getOpcode() != Instruction::Add || !Add->hasOneUser())
----------------
sdesmalen wrote:
> Is it possible for I to have no users? (if so, should it return?)
If we have reached this point then we can assume there is only one user, as there are checks above which return if `!I->hasOneUser()`


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/sve2-ext-rhadd-costs.ll:44
+
+for.body:
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
----------------
sdesmalen wrote:
> Is there a way to test this without requiring a loop? (and without requiring these tests to be in llvm/test/Transforms/LoopVectorize)
I've rewritten these tests so that they don't need a loop and moved them to `Analysis/CostModel/AArch64/sve2-ext-rhadd.ll`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157628



More information about the llvm-commits mailing list