Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
This doesn't seem to be needed anymore and causes problems.
Fixes #159787
|
|
As happens in C.
Fixes #158482
|
|
So the static invoker's Function still points to the static invoker
instead of the call operator of the lambda record. This is important for
a later commit.
|
|
Reject bitcasts to pointer types unless it's to `nullptr_t` and always
reject bitcasts to member pointer types.
Fixes #156174
|
|
This is not implemented at compile time and asserts in assertion builds,
so reject it here.
Fixed the coding style in `BuiltinShuffleVector` at the same time.
Fixes #158471
|
|
Unused these days.
|
|
We just called `getInit()`, which isn't always correct and used the
wrong initializer in the module test case.
|
|
|
|
|
|
|
|
We already checked that `IsStatic` is true above.
|
|
We only call this when we just pushed a new pointer to the stack, so try
to save the folling PopPtr op by removing the pointer inside
emitDestruction directly, e.g. by letting the Call op just remove it.
|
|
If we create an implicit local variable for a derived-to-base cast, we
still should allocate enough space for the entire derived type.
Fixes #156219
|
|
`!E->getType()->isAnyComplexType()` is implied by `!canClassify()`.
|
|
Our comparison ops always return bool, and we do the pop before the
conversion to in in C.
Fixes #156178
|
|
This happens for e.g. arm's float8 types.
|
|
Fixes #152899
|
|
|
|
|
|
TagDecls (#155463)
And make use of those.
These changes are split from prior PR #155028, in order to decrease the
size of that PR and facilitate review.
|
|
Shouldn't happen, but does.
Fixes #155147
|
|
Check for missing VLA size expressions (e.g. in int a[*][10]) before
evaluation to avoid crashes in _Countof and constant expression checks.
Fixes #152826
|
|
Initialize the `OldToLValue` member with the actual old value of
`ToLValue`.
Pointed out by Shafik in
https://github.com/llvm/llvm-project/pull/153601#discussion_r2294319428
|
|
(#154286)
…rNone
|
|
Fixes #152885
|
|
Fixes #154110
|
|
This has been a long-standing problem, but we didn't use to call the
destructors of items on the stack unless we explicitly `pop()` or
`discard()` them.
When interpretation was interrupted midway-through (because something
failed), we left `Pointer`s on the stack. Since all `Block`s track what
`Pointer`s point to them (via a doubly-linked list in the `Pointer`),
that meant we potentially leave deallocated pointers in that list. We
used to work around this by removing the `Pointer` from the list before
deallocating the block.
However, we now want to track pointers to global blocks as well, which
poses a problem since the blocks are never deallocated and thus those
pointers are always left dangling.
I've tried a few different approaches to fixing this but in the end I
just gave up on the idea of never knowing what items are in the stack.
We already have an `ItemTypes` vector that we use for debugging
assertions. This patch simply enables this vector unconditionally and
uses it in the abort case to properly `discard()` all elements from the
stack. That's a little sad IMO but I don't know of another way of
solving this problem.
As expected, this is a slight hit to compile times:
https://llvm-compile-time-tracker.com/compare.php?from=574d0a92060bf4808776b7a0239ffe91a092b15d&to=0317105f559093cfb909bfb01857a6b837991940&stat=instructions:u
|
|
(#153601)
|
|
The isGLValue() check made us ignore expressions we shouldn't ignore.
|
|
We might create a local temporary variable for a ParmVarDecl, in which
case a DeclRefExpr for that ParmVarDecl should _still_ result in us
choosing the parameter, not that local.
|
|
The element initializer is known to be an IntegerLiteral, the previous
signature of the lambda just didn't specify that. So we can also do the
cast directly instead of doing it via a Cast op.
|
|
This results in diagnostics that are closer to what the current
interpreter produces.
|
|
This way, we can check a single uint8_t for != 0 to know whether this
block is accessible or not. If not, we still need to figure out why not
and diagnose appropriately of course.
|
|
Sometimes we don't need the return value of a classsify() call, we only
need to know if we can map the given Expr/Type to a primitive type. Add
canClassify() for that.
|
|
This is a major change on how we represent nested name qualifications in
the AST.
* The nested name specifier itself and how it's stored is changed. The
prefixes for types are handled within the type hierarchy, which makes
canonicalization for them super cheap, no memory allocation required.
Also translating a type into nested name specifier form becomes a no-op.
An identifier is stored as a DependentNameType. The nested name
specifier gains a lightweight handle class, to be used instead of
passing around pointers, which is similar to what is implemented for
TemplateName. There is still one free bit available, and this handle can
be used within a PointerUnion and PointerIntPair, which should keep
bit-packing aficionados happy.
* The ElaboratedType node is removed, all type nodes in which it could
previously apply to can now store the elaborated keyword and name
qualifier, tail allocating when present.
* TagTypes can now point to the exact declaration found when producing
these, as opposed to the previous situation of there only existing one
TagType per entity. This increases the amount of type sugar retained,
and can have several applications, for example in tracking module
ownership, and other tools which care about source file origins, such as
IWYU. These TagTypes are lazily allocated, in order to limit the
increase in AST size.
This patch offers a great performance benefit.
It greatly improves compilation time for
[stdexec](https://github.com/NVIDIA/stdexec). For one datapoint, for
`test_on2.cpp` in that project, which is the slowest compiling test,
this patch improves `-c` compilation time by about 7.2%, with the
`-fsyntax-only` improvement being at ~12%.
This has great results on compile-time-tracker as well:

This patch also further enables other optimziations in the future, and
will reduce the performance impact of template specialization resugaring
when that lands.
It has some other miscelaneous drive-by fixes.
About the review: Yes the patch is huge, sorry about that. Part of the
reason is that I started by the nested name specifier part, before the
ElaboratedType part, but that had a huge performance downside, as
ElaboratedType is a big performance hog. I didn't have the steam to go
back and change the patch after the fact.
There is also a lot of internal API changes, and it made sense to remove
ElaboratedType in one go, versus removing it from one type at a time, as
that would present much more churn to the users. Also, the nested name
specifier having a different API avoids missing changes related to how
prefixes work now, which could make existing code compile but not work.
How to review: The important changes are all in
`clang/include/clang/AST` and `clang/lib/AST`, with also important
changes in `clang/lib/Sema/TreeTransform.h`.
The rest and bulk of the changes are mostly consequences of the changes
in API.
PS: TagType::getDecl is renamed to `getOriginalDecl` in this patch, just
for easier to rebasing. I plan to rename it back after this lands.
Fixes #136624
Fixes https://github.com/llvm/llvm-project/issues/43179
Fixes https://github.com/llvm/llvm-project/issues/68670
Fixes https://github.com/llvm/llvm-project/issues/92757
|
|
We can just check NonNullArgs.empty().
|
|
Do it only if we will end up skipping the initializer anyway because
it's a trivial copy or move constructor.
|
|
|
|
Only do this if the function really has a NonNullArg.
|
|
|
|
Instead of doing a GetPtrLocal + Load or GetPtrGlobal + Load pair, try
to load the value directly.
|
|
HLSL is using CK_FloatingToIntegral casts to cast to vectors, which we
don't support (neither does the current interpreter). Also fix a crash
when trying to promote the HLSL bool, which can't be promoted it seems.
|
|
getRecord() can return nullptr if any one of the fields does, in this
case because the array is too large for us to allocate.
|
|
It did almost nothing
|
|
This has been explicitly forbidden since C++11, but somehow the edge
case of converting a function pointer to void* using a cast like
`(void*)f` wasn't handled.
Fixes #150340 .
|
|
|
|
The initializer itself might need the field to be active.
|
|
trivially-default-constructible union members (#149835)
See
https://github.com/llvm/llvm-project/commit/faee39baa87e43f4b746dd77e479268391163658
|
|
We use this construct a lot. Use something similar to clang's
UnsignedOrNone.
This results in some slighy compile time improvements:
https://llvm-compile-time-tracker.com/compare.php?from=17a4b0399d161a3b89d8f0ce82add1638f23f5d4&to=a251d81ecd0ed45dd190462663155fdb303ef04d&stat=instructions:u
|