[Mlir-commits] [mlir] [mlir][ptr] Add the `ptradd` and `type_offset` ops, and `int_space` attr (PR #136434)

Tobias Gysi llvmlistbot at llvm.org
Sat Apr 19 12:11:52 PDT 2025


================
@@ -0,0 +1,31 @@
+// RUN: mlir-opt --canonicalize %s | FileCheck %s
+
+/// Check `ptradd` and `type_offset` canonicalizer patterns.
+
+// CHECK-LABEL: @ops0
+func.func @ops0(%ptr: !ptr.ptr<#ptr.int_space<3>>, %c: i1) -> !ptr.ptr<#ptr.int_space<3>> {
----------------
gysit wrote:

Should there be a test that verifies that a ptradd with offset zero folds away? 

This test seems to mainly test that type_offset is constant like and thus materialized at the beginning of the function and replaced by a single value. Wouldn't a test function with two equivalent `ptr.ptradd` be good enough to test this?

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


More information about the Mlir-commits mailing list