[PATCH] D115646: [DAG][TLI][X86][ARM][AArch64] Add `isExtractSubvectorFree` / use it in `foldExtractSubvectorFromShuffleVector()`

David Greene via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 07:52:11 PST 2022


greened added a comment.

We do need an X86 test for this.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:20795
+              // and that replacing one non-cheap subvector extract
+              // with two cheap ones is a win.
+  };
----------------
The values here make it seem like replacing a non-cheap operation with two cheap ones yields the same performance (1+1 = 2). contrary to the comment.  Is this intentional?


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:12899
+  return isExtractSubvectorFree(ResVT, SrcVT, Index);
+}
+
----------------
So here, it seems like even if the extract is "free" (cost 0) it'll be counted as "cheap" (cost 1).

I wonder if it would be better to combine these functions into a single "getExtractSubvectorCost" target hook.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115646



More information about the llvm-commits mailing list