[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 05:49:03 PST 2025


================
@@ -1468,6 +1468,15 @@ class TargetTransformInfo {
                                      TTI::TargetCostKind CostKind,
                                      unsigned Index = -1) const;
 
+  /// \return The expected of aggregate inserts and extracts. Use an empty
+  /// ArrayRef to indicate that there is no information on the indices. This is
+  /// used when the instruction is not available; a typical use case is to
+  /// provision the cost of vectorization/scalarization in vectorizer passes.
+  InstructionCost getInsertExtractValueCost(unsigned Opcode, Type *AggType,
----------------
MacDue wrote:

It was based on @fhahn's comment here: https://github.com/llvm/llvm-project/pull/109833#discussion_r1923299198. The idea of passing `AggDef` came from that, so you could cost the `extractvalue` differently based on the source of the aggregate. If the aggregate comes from a call return value that is passed on the stack, then you would want to cost the `extractvalue` like a load. 

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


More information about the llvm-commits mailing list