@@ -198,6 +198,19 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
return create(loc, cir::BinOpKind::Div, lhs, rhs);
}
+
+ /// Create a cir.ptr_stride operation to get access to an array element.
+ /// idx is the index of the element to access, shouldDecay is
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -157,6 +157,15 @@ class ScalarExprEmitter : public
StmtVisitor {
mlir::Value VisitCastExpr(CastExpr *e);
+ mlir::Value VisitArraySubscriptExpr(ArraySubscriptExpr *e) {
+if (e->getBase()->getType()->isVectorType()) {
+ assert(!cir::MissingFeatures::scalableVect
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -198,6 +198,19 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
return create(loc, cir::BinOpKind::Div, lhs, rhs);
}
+
+ /// Create a cir.ptr_stride operation to get access to an array element.
+ /// idx is the index of the element to access, shouldDecay is
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -29,8 +29,15 @@ int f[5] = {1, 2};
void func() {
int arr[10];
-
// CHECK: %[[ARR:.*]] = cir.alloca !cir.array,
!cir.ptr>, ["arr"]
+
+ int e = arr[1];
andykaylor wrote:
Can you add a test case for `arr[0]`? That's a special case in terms of
resultin
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/134536
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
https://github.com/AmrDeveloper updated
https://github.com/llvm/llvm-project/pull/134536
>From 81e1cd76594d3eaeda67d5888e5e5daa63fb0e12 Mon Sep 17 00:00:00 2001
From: AmrDeveloper
Date: Sun, 6 Apr 2025 14:31:35 +0200
Subject: [PATCH 1/2] [CIR] Upstream ArraySubscriptExpr for fixed size array
-
https://github.com/erichkeane commented:
This also seems to be missing a test that does:
C++->CIR
C++->CIR->LLVM
C++->LLVM
all in teh same file? (See files iwth `OGCG` in them).
https://github.com/llvm/llvm-project/pull/134536
___
cfe-commits maili
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be
llvmbot wrote:
@llvm/pr-subscribers-clangir
Author: Amr Hesham (AmrDeveloper)
Changes
This change adds ArraySubscriptExpr for fixed size ArrayType
Issue #130197
---
Full diff: https://github.com/llvm/llvm-project/pull/134536.diff
10 Files Affected:
- (modified) clang/include/clang/CIR
https://github.com/AmrDeveloper created
https://github.com/llvm/llvm-project/pull/134536
This change adds ArraySubscriptExpr for fixed size ArrayType
Issue #130197
>From 81e1cd76594d3eaeda67d5888e5e5daa63fb0e12 Mon Sep 17 00:00:00 2001
From: AmrDeveloper
Date: Sun, 6 Apr 2025 14:31:35 +0200
S
19 matches
Mail list logo