bwendling wrote:
Friendly ping for any further comments.
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
> I still think we may need to triple check how this extension behaves with
> count fields that do not get extended AND are negative at runtime (if we
> don't already have tests for that), but perhaps is orthogonal to this initial
> refactoring.
I'll look into test cases with
bwendling wrote:
@nickdesaulniers I understand what you're saying, and it was addressed in the
original patch. I do my best to carry the signed-ness of the variables through
to the end so that the checks work out (i.e. the checks for negatives aren't
removed after optimizations, which they wou
@@ -1049,236 +1050,362 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1060,236 +1061,362 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
bwendling wrote:
Friendly Ping.
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Are there anymore comments?
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,358 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,358 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,236 +1061,355 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/122198
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,348 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,331 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,331 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,331 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1060,238 +1061,331 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
@@ -1343,6 +1430,12 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E,
unsigned Type,
assert(Ptr->getType()->isPointerTy() &&
"Non-pointer passed to __builtin_object_size?");
+ if (IsDynamic)
bwendling wrote:
At this point, we know that `Em
@@ -1060,238 +1061,331 @@
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
}
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-ASTContext &Ctx, const
bwendling wrote:
Howdy!
This is essentially a complete rewrite of
00b6d032a22196bc14e4e30e413c040eb1b65da4. The original was overly complex and
fragile. The main difference with this PR is basing the calculations off of the
already emitted `Expr` instead of doing it within this function. It a
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/119275
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/119275
None
>From 7db6b68013c70e0b048171bb11f17bdc703b5bb7 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Mon, 9 Dec 2024 13:59:02 -0800
Subject: [PATCH] [Clang][CodeGen] Remove extraneous dot prefixes [NFC]
--
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/116719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Fine.
https://github.com/llvm/llvm-project/pull/116719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/9] [Clang] Improve Sema diagnostic performance for
__builtin
@@ -14690,6 +14690,13 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
}
}
+ // The result of __builtin_counted_by_ref cannot be assigned to a variable.
+ // It allows leaking and modification of bounds safety information.
+ if (IsBuiltinCountedByRef(VD->getInit())
bwendling wrote:
Ah, okay. Thanks.
https://github.com/llvm/llvm-project/pull/116719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Yeah, but I'd like to get this off my plate. :-)
https://github.com/llvm/llvm-project/pull/116719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
I image @AaronBallman is on vacation this week. @Sirraide would you be willing
to LGTM this so that I can move it along? It's certainly better than what we
have and I can address any concerns Aaron has afterwards.
https://github.com/llvm/llvm-project/pull/116719
__
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/8] [Clang] Improve Sema diagnostic performance for
__builtin
bwendling wrote:
> I think this might honestly be fine the way it is now
Yeah. It's going kind of the opposite way from what you suggested with the
placeholder, just instead of allowing for different uses at various places in
Sema we disallow without using the placeholder.
https://github.com/
@@ -14690,6 +14690,14 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
}
}
+ // The result of __builtin_counted_by_ref cannot be assigned to a variable.
+ // It allows leaking and modification of bounds safety information.
+ if (const auto *CE = dyn_cast_if_present
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/4] [Clang] Improve Sema diagnostic performance for
__builtin
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/5] [Clang] Improve Sema diagnostic performance for
__builtin
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/6] [Clang] Improve Sema diagnostic performance for
__builtin
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/7] [Clang] Improve Sema diagnostic performance for
__builtin
bwendling wrote:
> > Could you point to a place in the code where it creates a placeholder?
>
> I mean, e.g. `CheckPointerToMemberOperands()` can return `BoundMemberTy` as
> the type of a `.*` expression, and `CreateBuiltinMatrixSubscriptExpr()`
> creates a `MatrixSubscriptExpr` with type `Inc
bwendling wrote:
> The main thing I’m concerned about here is that I feel like there ought to be
> a better way of doing this than checking for and disallowing it in every
> place where we can have a subexpression in C.
Yeah, but we don't have such a method, partially due to the languages Clan
bwendling wrote:
I removed the Placeholder code. It's a much smaller patch and has the better
timing profile. PTAL.
https://github.com/llvm/llvm-project/pull/116719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/3] [Clang] Improve Sema diagnostic performance for
__builtin
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/116719
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Fri, 15 Nov 2024 15:41:48 -0800
Subject: [PATCH 1/2] [Clang] Improve Sema diagnostic performance for
__builtin
@@ -14690,6 +14690,17 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
}
}
+ // The result of __builtin_counted_by_ref cannot be assigned to a variable.
+ // It allows leaking and modification of bounds safety information.
+ if (const auto *CE = dyn_cast_if_present
@@ -755,6 +755,7 @@ static ExprResult BuiltinDumpStruct(Sema &S, CallExpr
*TheCall) {
case BuiltinType::PseudoObject:
case BuiltinType::UnknownAny:
case BuiltinType::BuiltinFn:
+case BuiltinType::BuiltinCountedByRef:
bwendling wrote:
Then shou
bwendling wrote:
> Hmm, I don’t think this is the right way of going about it—copy-pasting the
> check across 6 or so different places seems like it’s missing the point of
> using a placeholder in the first place.
Could you point to a place in the code where it creates a placeholder? I'm
unab
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/116719
Implement the sema checks with a placeholder. We then check for that
placeholder in all of the places we care to emit a diagnostic.
Fixes: #115520
>From 2dcf18163de2ccce959f46bf82df1fa40e3fd1fc Mon Sep 17 0
@@ -13,7 +13,10 @@ void init(void *
__attribute__((pass_dynamic_object_size(0;
// CHECK-LABEL: define dso_local void @_ZN3foo3barC1Ev(
// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(1) [[THIS:%.*]])
unnamed_addr #[[ATTR0:[0-9]+]] align 2 {
// CHECK-NEXT: entr
@@ -16,6 +16,8 @@ void test1(struct fam_struct *ptr, int size, int idx) {
*__builtin_counted_by_ref(ptr->array) = size; // ok
*__builtin_counted_by_ref(&ptr->array[idx]) = size; // ok
+ *__builtin_counted_by_ref(&ptr->array) = size;// ok
@@ -4914,3 +4914,9 @@ def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}
+
+def CountedByRef : Builtin {
+ let Spellings = ["__builtin_counted_by_ref"];
+ let Attributes = [NoThrow, CustomT
@@ -16,6 +16,8 @@ void test1(struct fam_struct *ptr, int size, int idx) {
*__builtin_counted_by_ref(ptr->array) = size; // ok
*__builtin_counted_by_ref(&ptr->array[idx]) = size; // ok
+ *__builtin_counted_by_ref(&ptr->array) = size;// ok
@@ -0,0 +1,182 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O2 -emit-llvm -o - %s |
FileCheck %s --check-prefix=X86_64
+// RUN: %clang_cc1 -triple i386-unknown-unknown
bwendling wrote:
-ast-print testcase added.
https://github.com/llvm/llvm-project/pull/114495
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
@AaronBallman @rapidsna -- I think I covered all of the comments you made on
the other PR (stupid git!). PTAL.
https://github.com/llvm/llvm-project/pull/114495
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm
bwendling wrote:
This is a new PR, because GitHub messed up. Here's the original:
https://github.com/llvm/llvm-project/pull/102549
https://github.com/llvm/llvm-project/pull/114495
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.l
@@ -197,6 +197,18 @@ static bool CanElideOverflowCheck(const ASTContext &Ctx,
const BinOpInfo &Op) {
if (!Op.mayHaveIntegerOverflow())
return true;
+ if (Op.Ty->isSignedIntegerType() &&
bwendling wrote:
Does this (and the following if-then) need a com
bwendling wrote:
I think the calculation in
https://github.com/llvm/llvm-project/pull/112636#issuecomment-2436559387 is
correct. It's probably worthwhile to perform some analysis to see if using that
to calculate the new size results in allocation size changes in the kernel. If
not, then perh
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/112636
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/112636
>From d3c689f5b0ece80eba784afe67e3412e2dc6d595 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 16 Oct 2024 17:03:23 -0700
Subject: [PATCH 1/2] [Clang] Disable use of the counted_by attribute for whole
@@ -1013,6 +1013,24 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr
*E, unsigned Type,
// Can't find the field referenced by the "counted_by" attribute.
return nullptr;
+ if (isa(Base))
bwendling wrote:
It's possibly a bug, but we current
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/112636
>From d3c689f5b0ece80eba784afe67e3412e2dc6d595 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Wed, 16 Oct 2024 17:03:23 -0700
Subject: [PATCH 1/2] [Clang] Disable use of the counted_by attribute for whole
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/112636
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/112636
The whole struct is specificed in the __bdos. The calculation of the whole size
of the structure can be done in two ways:
1) sizeof(struct S) + count * sizeof(typeof(fam))
2) offsetof(struct S, fam) +
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/83204
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
> > This is why I believe the gcc behavior is correct. When it knows the size
> > given to `malloc` it uses that. When it doesn't know that it simply returns
> > INT_MAX. When you ask gcc for the `__bdos` of the FAM it will use the
> > `count` to calculate the size.
>
> (nit:
bwendling wrote:
> So, we would actually get gcc's behavior with this patch:
>
> ```
> diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
> index c864714182e0..21ffe7b46a6e 100644
> --- a/clang/lib/CodeGen/CGBuiltin.cpp
> +++ b/clang/lib/CodeGen/CGBuiltin.cpp
> @@ -10
bwendling wrote:
> After looking at the assembly produced by gcc more, it actually looks like
> it's using the allocation size if it's known in the current context (for
> example if the struct was just malloced in the same function) and otherwise
> returns INT_MAX for the __bdos of a struct co
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/111448
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1095,6 +1095,8 @@ class StructAccessBase
return Visit(E->getBase());
}
const Expr *VisitCastExpr(const CastExpr *E) {
+if (E->getCastKind() == CK_LValueToRValue)
+ return E;
bwendling wrote:
See https://github.com/llvm/llvm-project/pull/11
https://github.com/bwendling created
https://github.com/llvm/llvm-project/pull/111448
Ensure we have the correct RecordDecl before returning the Expr we're looking
for.
>From 1936cd507a38d3085fa13016fb40a9a7df35a821 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Mon, 7 Oct 2024 15:25:47 -
@@ -1095,6 +1095,8 @@ class StructAccessBase
return Visit(E->getBase());
}
const Expr *VisitCastExpr(const CastExpr *E) {
+if (E->getCastKind() == CK_LValueToRValue)
+ return E;
bwendling wrote:
It might be a good sanity check, though I think
bwendling wrote:
I wrote a similar conclusion to @efriedma-quic in the email thread.
The problem with your example is that, in the absence of the `counted_by`
attribute, the `__builtin_dynamic_object_size` uses the `alloc_size` attribute
that's implicit on the `malloc` call.
https://github.co
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/110487
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling closed
https://github.com/llvm/llvm-project/pull/110497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling approved this pull request.
Thanks for the patch!
https://github.com/llvm/llvm-project/pull/110497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10,6 +10,7 @@
//
//===--===//
+#include
bwendling wrote:
Please don't include this (I know it's left from debugging). If you want to
debug things, you can use:
```c++
llvm::errs() <<
bwendling wrote:
The problem we're faced with here is that the `Base` pointer could point to
anywhere within the structure. We already jump through several hoops to get the
flexible array member's `Decl` and the counter's `Decl`.
So because `Base` could be a pointer to anywhere in the struct,
bwendling wrote:
> @bwendling I think you accidentally compiled the wrong branch. Looks like
> that is in `builtin_get_counted_by`, but this PR is in
> `bdos-member-expr-error`
Yeah, sorry about that.
https://github.com/llvm/llvm-project/pull/110487
___
bwendling wrote:
> > I reverted my last commit. This leaves the original patch, which seems to
> > work. @efriedma-quic, would you be okay with this patch while I work to
> > improve the code in follow-up?
>
> The original (and current) patch in this PR still introduces a regression. So
> it
bwendling wrote:
I reverted my last commit. This leaves the original patch, which seems to work.
@efriedma-quic, would you be okay with this patch while I work to improve the
code in follow-up?
https://github.com/llvm/llvm-project/pull/110487
___
cfe
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/110487
>From 375a71d114fffb94c16455f476364a7de9e08191 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Mon, 30 Sep 2024 03:41:15 -0700
Subject: [PATCH 1/3] [Clang][CodeGen] Emit load of value
We were missing a loa
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/110487
>From 375a71d114fffb94c16455f476364a7de9e08191 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Mon, 30 Sep 2024 03:41:15 -0700
Subject: [PATCH 1/2] [Clang][CodeGen] Emit load of value
We were missing a loa
bwendling wrote:
> > If I return the LValueToRValue cast and run EmitLValue on it
>
> I'm surprised EmitLValue didn't error out on that. The result of an
> LValueToRValue cast is an rvalue. Calling EmitPointerWithAlignment on it
> should work, I think.
>
> > I understand, but there are ~30 di
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/110487
>From 375a71d114fffb94c16455f476364a7de9e08191 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Mon, 30 Sep 2024 03:41:15 -0700
Subject: [PATCH 1/2] [Clang][CodeGen] Emit load of value
We were missing a loa
bwendling wrote:
> This is sort of the same comment I've made on other related patches... but I
> think the fundamental issue here is that StructAccessBase is skipping over
> CK_LValueToRValue casts. Once you jump over such a cast, you're looking at
> expressions which are at a different level
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/110487
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
Thanks for this, but I think the issue is more basic. We should be issuing a
"load" instruction after the `EmitMemberExpr` call. (That's what happens
outside of using this in `__builtin_dynamic_object_size`.)
https://github.com/llvm/llvm-project/pull/110437
___
https://github.com/bwendling milestoned
https://github.com/llvm/llvm-project/pull/110487
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/110487
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
1 - 100 of 647 matches
Mail list logo