[llvm] [VPlan] Model address separately. (PR #72164)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 1 07:17:46 PST 2024


================
@@ -1205,6 +1205,59 @@ void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
 }
 #endif
 
+void VPVectorPointerRecipe ::execute(VPTransformState &State) {
+  auto &Builder = State.Builder;
+  State.setDebugLocFrom(getDebugLoc());
+  for (unsigned Part = 0; Part < State.UF; ++Part) {
+    // Calculate the pointer for the specific unroll-part.
+    Value *PartPtr = nullptr;
+    // Use i32 for the gep index type when the value is constant,
+    // or query DataLayout for a more suitable index type otherwise.
+    const DataLayout &DL =
+        Builder.GetInsertBlock()->getModule()->getDataLayout();
+    Type *IndexTy = State.VF.isScalable() && (IsReverse || Part > 0)
+                        ? DL.getIndexType(IndexedTy->getPointerTo())
+                        : Builder.getInt32Ty();
----------------
ayalz wrote:

The recipe holds IndexTy to avoid the need to look it up.
Note that DL is overloaded - as a member of recipe it stands for Debug Location.
```suggestion
```

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


More information about the llvm-commits mailing list