[PATCH] D80787: [VPlan] Support extracting lanes for defs managed in VPTransformState.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 04:18:34 PDT 2020


fhahn created this revision.
fhahn added reviewers: Ayal, rengolin, gilr.
Herald added subscribers: vkmr, psnobl, rogfer01, rkruppe, bollu, hiraditya.
Herald added a project: LLVM.

Currently extracting a lane for a VPValue def is not supported, if it is
managed directly by VPTransformState (e.g. because it is created by a
VPInstruction or an external VPValue def).

For now, simply extract the requested lane. In the future, we should
also cache the extracted scalar values, similar to LV.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80787

Files:
  llvm/lib/Transforms/Vectorize/VPlan.h


Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -270,10 +270,17 @@
     return Callback.getOrCreateVectorValues(VPValue2Value[Def], Part);
   }
 
-  /// Get the generated Value for a given VPValue and given Part and Lane. Note
-  /// that as per-lane Defs are still created by ILV and managed in its ValueMap
-  /// this method currently just delegates the call to ILV.
+  /// Get the generated Value for a given VPValue and given Part and Lane.
   Value *get(VPValue *Def, const VPIteration &Instance) {
+    // If values have been set for this Def, extract the lane from the relevant
+    // part.
+    // TODO: Cache created scalar values.
+    if (Data.PerPartOutput.count(Def)) {
+      auto *VecPart = Data.PerPartOutput[Def][Instance.Part];
+      return Builder.CreateExtractElement(VecPart,
+                                          Builder.getInt32(Instance.Lane));
+    }
+
     return Callback.getOrCreateScalarValue(VPValue2Value[Def], Instance);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80787.267171.patch
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200529/465f1769/attachment.bin>


More information about the llvm-commits mailing list