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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 1 11:10:42 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();
----------------
fhahn wrote:

The recipe stores the indexed  type, which is different to the index type (integer type used for the indices of the generated GEP). Left as is for now.

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


More information about the llvm-commits mailing list