[clang] [CIR] [Upstream local initialization for ArrayType (PR #132974)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 15:52:38 PDT 2025


================
@@ -229,6 +236,40 @@ def CastOp : CIR_Op<"cast",
   let hasFolder = 1;
 }
 
+
+//===----------------------------------------------------------------------===//
+// PtrStrideOp
+//===----------------------------------------------------------------------===//
+
+def PtrStrideOp : CIR_Op<"ptr_stride",
+                         [Pure, SameFirstOperandAndResultType]> {
+  let summary = "Pointer access with stride";
+  let description = [{
+    Given a base pointer as first operand, provides a new pointer after applying
+    a stride (second operand).
+
+    ```mlir
+    %3 = cir.const 0 : i32
+    %4 = cir.ptr_stride(%2 : !cir.ptr<i32>, %3 : i32), !cir.ptr<i32>
+    ```
+  }];
+
+  let arguments = (ins CIR_PointerType:$base, PrimitiveInt:$stride);
+  let results = (outs CIR_PointerType:$result);
+
+  let assemblyFormat = [{
+    `(` $base `:` qualified(type($base)) `,` $stride `:` qualified(type($stride)) `)`
----------------
bcardosolopes wrote:

80-col

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


More information about the cfe-commits mailing list