vikramRH wrote:
@yuanfang-chen , any plans to continue with this PR ?
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AaronBallman commented:
Sorry, this fell off my radar for a while. The only concern I have is with
accidentally allowing `[0]` to mean something; it would be good to reject
that and add a test for that situation. Otherwise, this looks reasonable to me.
@@ -437,6 +442,16 @@ namespace {
MostDerivedArraySize = 2;
MostDerivedPathLength = Entries.size();
}
+void addVectorUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+ Entries.push_back(PathEntry::ArrayIndex(Idx));
+
+ // This is
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/shafik commented:
This mostly makes sense to me, @AaronBallman does this look good to you?
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -144,6 +144,9 @@ sections with improvements to Clang's support for those
languages.
C++ Language Changes
+- Allow single element access of vector object to be constant expression.
+ Supports the `V.xyzw` syntax and other tidbits as seen in OpenCL.
@@ -437,6 +442,16 @@ namespace {
MostDerivedArraySize = 2;
MostDerivedPathLength = Entries.size();
}
+void addVectorUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+ Entries.push_back(PathEntry::ArrayIndex(Idx));
+
+ // This is
@@ -437,6 +442,16 @@ namespace {
MostDerivedArraySize = 2;
MostDerivedPathLength = Entries.size();
}
+void addVectorUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+ Entries.push_back(PathEntry::ArrayIndex(Idx));
+
+ // This is
@@ -437,6 +442,16 @@ namespace {
MostDerivedArraySize = 2;
MostDerivedPathLength = Entries.size();
}
+void addVectorUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+ Entries.push_back(PathEntry::ArrayIndex(Idx));
+
+ // This is
@@ -144,6 +144,9 @@ sections with improvements to Clang's support for those
languages.
C++ Language Changes
+- Allow single element access of vector object to be constant expression.
+ Supports the `V.xyzw` syntax and other tidbits as seen in OpenCL.
https://github.com/sethp commented:
Thanks for looking into this! I was surprised to find that `clang` didn't
support element accesses in a `constexpr` context, I'm glad you've put the
effort in to get it working!
Two minor notes below, otherwise LGTM.
https://github.com/sethp edited https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
tbaederr wrote:
This basically looks good to me, but I don't know much about vector types.
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
yuanfang-chen wrote:
ping?
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/yuanfang-chen updated
https://github.com/llvm/llvm-project/pull/72607
>From 471f87e727d71e3984d533eeb9db9ebab40e63ff Mon Sep 17 00:00:00 2001
From: Yuanfang Chen
Date: Fri, 17 Nov 2023 03:16:38 +
Subject: [PATCH] [clang][ExprConst] allow single element access of vector
@@ -221,6 +221,12 @@ namespace {
ArraySize = 2;
MostDerivedLength = I + 1;
IsArray = true;
+ } else if (Type->isVectorType()) {
+const auto *VT = Type->castAs();
AaronBallman wrote:
```suggestion
} else if (const
@@ -8721,15 +8771,63 @@ bool LValueExprEvaluator::VisitMemberExpr(const
MemberExpr *E) {
return LValueExprEvaluatorBaseTy::VisitMemberExpr(E);
}
+bool LValueExprEvaluator::VisitExtVectorElementExpr(
+const ExtVectorElementExpr *E) {
+ bool Success = true;
+
+ APValue
@@ -8721,15 +8771,63 @@ bool LValueExprEvaluator::VisitMemberExpr(const
MemberExpr *E) {
return LValueExprEvaluatorBaseTy::VisitMemberExpr(E);
}
+bool LValueExprEvaluator::VisitExtVectorElementExpr(
+const ExtVectorElementExpr *E) {
+ bool Success = true;
+
+ APValue
https://github.com/AaronBallman commented:
You should also add a release note about the changes.
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -3806,6 +3840,21 @@ findSubobject(EvalInfo , const Expr *E, const
CompleteObject ,
return handler.found(Index ? O->getComplexFloatImag()
: O->getComplexFloatReal(), ObjType);
}
+} else if (ObjType->isVectorType()) {
+
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
yuanfang-chen wrote:
ping ..
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/yuanfang-chen updated
https://github.com/llvm/llvm-project/pull/72607
>From b7d7c5fc70ffb792f67d007ec1bd71bcaed868fc Mon Sep 17 00:00:00 2001
From: Yuanfang Chen
Date: Fri, 17 Nov 2023 03:16:38 +
Subject: [PATCH] [clang][ExprConst] allow single element access of vector
yuanfang-chen wrote:
ping?
https://github.com/llvm/llvm-project/pull/72607
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/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 b034da7dad150a54661557cc3f712948b1e474e4
26a20b1c3594676b138395f91143356d87ec72cd --
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Yuanfang Chen (yuanfang-chen)
Changes
Supports both v[0] and v.x/v.r/v.s0 syntax.
Selecting multiple elements is left as a future work.
---
Full diff: https://github.com/llvm/llvm-project/pull/72607.diff
4 Files Affected:
- (modified)
https://github.com/yuanfang-chen created
https://github.com/llvm/llvm-project/pull/72607
Supports both v[0] and v.x/v.r/v.s0 syntax.
Selecting multiple elements is left as a future work.
>From 26a20b1c3594676b138395f91143356d87ec72cd Mon Sep 17 00:00:00 2001
From: Yuanfang Chen
Date: Fri, 17
27 matches
Mail list logo