[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-05-01 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/138041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-05-01 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/138041 >From ae1fd50a03a0e5f7c0c40463dc6a07f981f79f66 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 30 Apr 2025 11:10:53 -0700 Subject: [PATCH 1/4] [CIR] Upstream pointer arithmetic support This adds suppor

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-05-01 Thread Henrich Lauko via cfe-commits
https://github.com/xlauko approved this pull request. lgtm, besides Erich's comments https://github.com/llvm/llvm-project/pull/138041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-05-01 Thread Henrich Lauko via cfe-commits
@@ -185,6 +185,15 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { } bool isInt(mlir::Type i) { return mlir::isa(i); } + // + // Constant creation helpers + // - + // + cir::ConstantOp getSInt32(int32_t c, mlir::Location loc) { +au

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-05-01 Thread Henrich Lauko via cfe-commits
https://github.com/xlauko edited https://github.com/llvm/llvm-project/pull/138041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/138041 >From ae1fd50a03a0e5f7c0c40463dc6a07f981f79f66 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 30 Apr 2025 11:10:53 -0700 Subject: [PATCH 1/3] [CIR] Upstream pointer arithmetic support This adds suppor

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- clang/test/CIR/CodeGen/pointers.cpp clang/lib/CIR/C

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/138041 >From ae1fd50a03a0e5f7c0c40463dc6a07f981f79f66 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 30 Apr 2025 11:10:53 -0700 Subject: [PATCH 1/2] [CIR] Upstream pointer arithmetic support This adds suppor

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Once comment + assert are in place, I'm happy. https://github.com/llvm/llvm-project/pull/138041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/138041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +// Should generate basic pointer arithmetics. +void foo(int *iptr, char *cptr, unsigned ustride) { + iptr + 2; + // CHECK: %[[#STR

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +// Should generate basic pointer arithmetics. +void foo(int *iptr, char *cptr, unsigned ustride) { + iptr + 2; + // CHECK: %[[#STR

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Erich Keane via cfe-commits
@@ -1152,8 +1169,72 @@ getUnwidenedIntegerType(const ASTContext &astContext, const Expr *e) { static mlir::Value emitPointerArithmetic(CIRGenFunction &cgf, const BinOpInfo &op, bool isSubtraction

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This adds support for explicit pointer arithmetic, including unary increment and decrement of pointer values. --- Full diff: https://github.com/llvm/llvm-project/pull/138041.diff 3 Files Affected: - (

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/138041 This adds support for explicit pointer arithmetic, including unary increment and decrement of pointer values. >From ae1fd50a03a0e5f7c0c40463dc6a07f981f79f66 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: