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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 14:37:18 PST 2025


================
@@ -745,6 +745,19 @@ class TargetTransformInfoImplBase {
     return 1;
   }
 
+  InstructionCost getInsertExtractValueCost(unsigned Opcode, Type *AggType,
+                                            TTI::TargetCostKind CostKind,
+                                            ArrayRef<unsigned> Indices,
+                                            Value *AggDef) const {
+    // Extract/insert values are generally assumed to be free (as the aggregates
+    // will be removed e.g. by SROA). A target may want to override this to cost
+    // an extract operation differently based on the producer (AggDef). E.g. if
+    // AggDef is a call, the result may be returned via the stack (so the
+    // extract acts like a load). However, generally, that cost is included in
+    // the producer's cost.
+    return 0;
----------------
fhahn wrote:

Case handling `Extractvalue` in `getInstructionCost` should probably be updated to use this. Same for `InsertValue`?


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


More information about the llvm-commits mailing list