Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
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
|
|
As a way of writing atIndex(I).deref<T>(), which creates an intermediate
Pointer, which in turn adds (and removes) that pointer from the pointer
list of the Block. This way we can avoid that.
|
|
|
|
|
|
|
|
|
|
Only initialize pointers that can be initialized.
|
|
Since the result should not be an array element.
|
|
Even if we only allocate one element, we still need to allocate it as a
single-element array. This matches what the current interpreter does.
|
|
Static analysis flagged multiple places we could move instead of copy.
In one case I realized we could avoid computing the same thing multiple
times and did that fix instead.
|
|
(#145207)
|
|
|
|
(#145014)
…types usi… (#144676)"
This reverts commit 68471d29eed2c49f9b439e505b3f24d387d54f97.
IntegralAP contains a union:
union {
uint64_t *Memory = nullptr;
uint64_t Val;
};
On 64bit systems, both Memory and Val have the same size. However, on 32
bit system, Val is 64bit and Memory only 32bit. Which means the default
initializer for Memory will only zero half of Val. We fixed this by
zero-initializing Val explicitly in the IntegralAP(unsigned BitWidth)
constructor.
See also the discussion in
https://github.com/llvm/llvm-project/pull/144246
|
|
usi… (#144676)"
This reverts commit 7c15edb306932e41c159f3d69c161ed0d89d47b7.
This still breaks clang-armv8-quick:
https://lab.llvm.org/buildbot/#/builders/154/builds/17587
|
|
(#144676)
…ng an allocator (#144246)"
This reverts commit 57828fec760f086b334ce0cb1c465fc559dcaea4.
|
|
allocator (#144246)"
This reverts commit c66be289901b3f035187d391e80e3610d7d6232e.
This breaks the armv8-quick builder:
https://lab.llvm.org/buildbot/#/builders/154/builds/17549
|
|
(#144246)
Both `APInt` and `APFloat` will heap-allocate memory themselves using
the system allocator when the size of their data exceeds 64 bits.
This is why clang has `APNumericStorage`, which allocates its memory
using an allocator (via `ASTContext`) instead. Calling `getValue()` on
an ast node like that will then create a new `APInt`/`APFloat` , which
will copy the data (in the `APFloat` case, we even copy it twice).
That's sad but whatever.
In the bytecode interpreter, we have a similar problem. Large integers
and floating-point values are placement-new allocated into the
`InterpStack` (or into the bytecode, which is a `vector<std::byte>`).
When we then later interrupt interpretation, we don't run the destructor
for all items on the stack, which means we leak the memory the
`APInt`/`APFloat` (which backs the `IntegralAP`/`Floating` the
interpreter uses).
Fix this by using an approach similar to the one used in the AST. Add an
allocator to `InterpState`, which is used for temporaries and local
values. Those values will be freed at the end of interpretation. For
global variables, we need to promote the values to global lifetime,
which we do via `InitGlobal` and `FinishInitGlobal` ops.
Interestingly, this results in a slight _improvement_ in compile times:
https://llvm-compile-time-tracker.com/compare.php?from=6bfcdda9b1ddf0900f82f7e30cb5e3253a791d50&to=88d1d899127b408f0fb0f385c2c58e6283195049&stat=instructions:u
(but don't ask me why).
Fixes https://github.com/llvm/llvm-project/issues/139012
|
|
(#144271)
Discard all the parameters we don't care about.
|
|
by value (#143578)
Static analysis flagged that we could move APInt instead of copy, indeed
it has a move constructor and so we should move into values for APInt.
|
|
/llvm-project/clang/lib/AST/ByteCode/InterpBuiltin.cpp:26:13:
error: unused function 'isNoopBuiltin' [-Werror,-Wunused-function]
static bool isNoopBuiltin(unsigned ID) {
^
1 error generated.
|
|
Instead of just peek()ing the values when evaluating the builtins and
later classify()ing all the call args once again to remove them, just do
it while evaluating. This saves quite a bit of code.
|
|
A previous change to InterpBuiltin.cpp fixed an unused variable warning
by using [[maybe unused]] and (void).
The code actually serves no useful purpose in non-debug builds, so let's
not include it there.
|
|
This patch fixes:
clang/lib/AST/ByteCode/InterpBuiltin.cpp:767:12: error: unused
variable 'PtrT' [-Werror,-Wunused-variable]
|
|
|
|
For some builtins, we dont' need to do anything, but due to the cleanup
code being the same for all builtins, we still had to duplicate the
value on the stack. Remove that and get rid of all the unnecessary
pressure on the InterpStack.
|
|
See the added comment.
This improves compile times a bit:
https://llvm-compile-time-tracker.com/compare.php?from=ac62f73f19ae9fb415d3fc423949b8d7543e8717&to=0d6cf47197a4ee11cdd1ee4a48ea38a2907c3d45&stat=instructions:u
|
|
|
|
We have to copy the entire thing, not just one of the bases.
|
|
|
|
RHS is followed by another Pointer.
|
|
Now that we don't use them anymore in InterpBuiltin.cpp and we don't
create frames for them anymore anyway, just don't create Function
instances.
|
|
They don't have local variables etc. so don't create frames for them.
|
|
Prepare for the ultimate removal of Function instances for builtin
functions.
|
|
With std::allocator::deallocate() calls
|
|
For
```c++
struct S {
constexpr S(int=0) : i(1) {}
int i;
};
constexpr volatile S vs;
```
reading from `vs.i` is not allowed, even though `i` is not volatile
qualified. Propagate the IsVolatile bit down the hierarchy, so we know
reading from `vs.i` is a volatile read.
|
|
Otherwise, add the missing diagnostic.
|
|
Compute the offset from the record layout.
Unfortunately, not all the test cases from the current interpreter work.
|
|
|
|
(#136141)
This is only permitted in a std::allocator::deallocate frame.
|
|
Add a test for type punning and tests and the necessary checks for
non-trivially-copyable types and incomplete types.
|
|
|
|
We don't need this anymore since we don't return it from classify()
anymore.
|
|
When copying unions, we need to only copy the active field of the source
union, which we were already doing. However, we also need to zero out
the (now) inactive fields, so we don't end up with dangling pointers in
those inactive fields.
|
|
So the diagnostic output matches with the current interpreter
|
|
(#132963)
…723)"
This reverts commit 1e2ad6793ac205607e7c809283cf69e1cc36a69a.
Fix the previous commit on big-endian hosts by _not_ falling through to
the `uint8_t` code path.
|
|
See the attached test case.
|
|
This reverts commit f7aea4d081f77dba48b0fc019f59b678fb679aa8.
This broke the clang-solaris11-sparcv9 builder:
https://lab.llvm.org/buildbot/#/builders/13/builds/6151
|
|
|
|
Like the current interpreter does.
|