[Mlir-commits] [mlir] [mlir][LLVM] PromotableOpInterface for PtrToIntOp and IntToPtrOp (PR #234309)

Andy Kaylor llvmlistbot at llvm.org
Wed Oct 21 13:54:41 PDT 2026


================
@@ -1226,6 +1226,55 @@ llvm.func @indirect_blocking_use_in_different_region(%arg0 : i1) {
 
 // -----
 
+// CHECK-LABEL: @dead_ptrtoint_inttoptr
+llvm.func @dead_ptrtoint_inttoptr() {
+  %0 = llvm.mlir.constant(1 : i32) : i32
+  // CHECK-NOT: llvm.alloca
+  // CHECK-NOT: llvm.ptrtoint
+  // CHECK-NOT: llvm.inttoptr
+  %1 = llvm.alloca %0 x i32 : (i32) -> !llvm.ptr
+  %2 = llvm.ptrtoint %1 : !llvm.ptr to i64
+  %3 = llvm.inttoptr %2 : i64 to !llvm.ptr
----------------
andykaylor wrote:

Why don't these just get folded by the canonicalizer?

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


More information about the Mlir-commits mailing list