[llvm] [CostModel][AArch64] Make extractelement, with fmul user, free whenev… (PR #111479)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 01:24:07 PDT 2024
================
@@ -11633,6 +11633,17 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
std::optional<DenseMap<Value *, unsigned>> ValueToExtUses;
DenseMap<const TreeEntry *, DenseSet<Value *>> ExtractsCount;
SmallPtrSet<Value *, 4> ScalarOpsFromCasts;
+ // Keep track of {Scalar, Index} -> User and User -> {Scalar, Index}.
+ // On AArch64, this helps in fusing a mov instruction, associated with
+ // extractelement, with fmul in the backend so that extractelement is free.
+ DenseMap<std::pair<Value *, unsigned>, SmallVector<Value *, 4>>
+ ScalarAndIdxToUser;
+ DenseMap<Value *, SmallVector<std::pair<Value *, unsigned>, 4>>
+ UserToScalarAndIdx;
+ for (ExternalUser &EU : ExternalUses) {
----------------
david-arm wrote:
I'm not sure if this is important or not, but as far as I understand `Use` and `User` are different things. I think you can have a single user with multiple uses, i.e. `fadd double %0, %0` is a single user of `%0` but there are two uses, or something like that. Perhaps `ExternalUses` is just a bit misleading and actually refers to `Users`?
https://github.com/llvm/llvm-project/pull/111479
More information about the llvm-commits
mailing list