- Feb 15, 2022
-
-
Dávid Bolvanský authored
``` always_inline foo() { } bar () { noinline foo(); } ``` We should prefer call site attribute over attribute on decl. Related to https://reviews.llvm.org/D119061 Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D119579 -
LLVM GN Syncbot authored
-
Alex Lorenz authored
Recently we observed high memory pressure caused by clang during some parallel builds. We discovered that we have several projects that have a large number of #define directives in their TUs (on the order of millions), which caused huge memory consumption in clang due to a lot of allocations for MacroInfo. We would like to reduce the memory overhead of clang for a single #define to reduce the memory overhead for these files, to allow us to reduce the memory pressure on the system during highly parallel builds. This change achieves that by removing the SmallVector in MacroInfo and instead storing the tokens in an array allocated using the bump pointer allocator, after all tokens are lexed. The added unit test with 1000000 #define directives illustrates the problem. Prior to this change, on arm64 macOS, clang's PP bump pointer allocator allocated 272007616 bytes, and used roughly 272 bytes per #define. After this change, clang's PP bump pointer allocator allocates 120002016 bytes, and uses only roughly 120 bytes per #define. For an example test file that we have internally with 7.8 million #define directives, this change produces the following improvement on arm64 macOS: Persistent allocation footprint for this test case file as it's being compiled to LLVM IR went down 22% from 5.28 GB to 4.07 GB and the total allocations went down 14% from 8.26 GB to 7.05 GB. Furthermore, this change reduced the total number of allocations made by the system for this clang invocation from 1454853 to 133663, an order of magnitude improvement. The recommit fixes the LLDB build failure. Differential Revision: https://reviews.llvm.org/D117348
-
Fangrui Song authored
Reported by scan-build.
-
Aart Bik authored
Rationale: empty line between main include for this file moved include that actually defines code into right section Note that this revision started as breaking up ops/attrs even more (for bug https://github.com/llvm/llvm-project/issues/52748), but due the the connection in Dialect.initalize(), this cannot be split further). All heavy lifting refactoring was already done by River in previous cleanup. Reviewed By: bixia Differential Revision: https://reviews.llvm.org/D119617
-
Simon Pilgrim authored
-
Siva Chandra Reddy authored
Also modified operator[] to return a reference to the array element. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D119725
-
Kai Nacke authored
With XPLINK, a no-op with information about the call type is emitted after each call instruction. Centralizing it has the advantage that it is easy to document all cases, and it makes it easier to extend it later (e.g. dynamic stack allocation, 32 bit mode). Also add a test checking the call types emitted so far. Reviewed By: uweigand Differential Revision: https://reviews.llvm.org/D119557
-
Kevin P. Neal authored
Currently the fsub optimizations in InstSimplify don't know how to fold X - +0.0 to X when using the constrained intrinsics. This adds the support. This review is split out from D107285. Differential Revision: https://reviews.llvm.org/D118928
-
Marius Brehler authored
Adds a pointer type to EmitC. The emission of pointers is so far only possible by using the `emitc.opaque` type Co-authored-by:
Simon Camphausen <simon.camphausen@iml.fraunhofer.de> Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D119337
-
Dave Lee authored
Replace forms of `assertTrue(err.Success())` with `assertSuccess(err)` (added in D82759). * `assertSuccess` prints out the error's message * `assertSuccess` expresses explicit higher level semantics, both to the reader and for test failure output * `assertSuccess` seems not to be well known, using it where possible will help spread knowledge * `assertSuccess` statements are more succinct Differential Revision: https://reviews.llvm.org/D119616
-
Arthur O'Dwyer authored
when the function declaration's return type is already invalid for some reason. This is relevant to https://github.com/llvm/llvm-project/issues/49188 because another way that the declaration's return type could become invalid is that it might be `C auto` where `C<void>` is false. Differential Revision: https://reviews.llvm.org/D119094
-
Arthur O'Dwyer authored
Reviewed as part of D119094.
-
Arthur O'Dwyer authored
-
- Feb 14, 2022
-
-
Momchil Velikov authored
Depending on toolchain and ABI, a target might not output DWARF unwind tables by default. Run the test for a target with a known behaviour, test coverage is not reduced. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D119724
-
Igor Zhukov authored
Differential Revision: https://reviews.llvm.org/D119694
-
Balazs Benics authored
There was a typo in the rule. `{{0}, ReturnValueIndex}` meant that the discrete index is `0` and the variadic index is `-1`. What we wanted instead is that both `0` and `-1` are in the discrete index list. Instead of this, we wanted to express that both `0` and the `ReturnValueIndex` is in the discrete arg list. The manual inspection revealed that `setproctitle_init` also suffered a probably incomplete propagation rule. Reviewed By: Szelethus, gamesh411 Differential Revision: https://reviews.llvm.org/D119129 -
Balazs Benics authored
Fixes the issue D118987 by mapping the propagation to the callsite's LocationContext. This way we can keep track of the in-flight propagations. Note that empty propagation sets won't be inserted. Reviewed By: NoQ, Szelethus Differential Revision: https://reviews.llvm.org/D119128
-
Balazs Benics authored
Recently we uncovered a serious bug in the `GenericTaintChecker`. It was already flawed before D116025, but that was the patch that turned this silent bug into a crash. It happens if the `GenericTaintChecker` has a rule for a function, which also has a definition. char *fgets(char *s, int n, FILE *fp) { nested_call(); // no parameters! return (char *)0; } // Within some function: fgets(..., tainted_fd); When the engine inlines the definition and finds a function call within that, the `PostCall` event for the call will get triggered sooner than the `PostCall` for the original function. This mismatch violates the assumption of the `GenericTaintChecker` which wants to propagate taint information from the `PreCall` event to the `PostCall` event, where it can actually bind taint to the return value **of the same call**. Let's get back to the example and go through step-by-step. The `GenericTaintChecker` will see the `PreCall<fgets(..., tainted_fd)>` event, so it would 'remember' that it needs to taint the return value and the buffer, from the `PostCall` handler, where it has access to the return value symbol. However, the engine will inline fgets and the `nested_call()` gets evaluated subsequently, which produces an unimportant `PreCall<nested_call()>`, then a `PostCall<nested_call()>` event, which is observed by the `GenericTaintChecker`, which will unconditionally mark tainted the 'remembered' arg indexes, trying to access a non-existing argument, resulting in a crash. If it doesn't crash, it will behave completely unintuitively, by marking completely unrelated memory regions tainted, which is even worse. The resulting assertion is something like this: Expr.h: const Expr *CallExpr::getArg(unsigned int) const: Assertion `Arg < getNumArgs() && "Arg access out of range!"' failed. The gist of the backtrace: CallExpr::getArg(unsigned int) const SimpleFunctionCall::getArgExpr(unsigned int) CallEvent::getArgSVal(unsigned int) const GenericTaintChecker::checkPostCall(const CallEvent &, CheckerContext&) const Prior to D116025, there was a check for the argument count before it applied taint, however, it still suffered from the same underlying issue/bug regarding propagation. This path does not intend to fix the bug, rather start a discussion on how to fix this. --- Let me elaborate on how I see this problem. This pre-call, post-call juggling is just a workaround. The engine should by itself propagate taint where necessary right where it invalidates regions. For the tracked values, which potentially escape, we need to erase the information we know about them; and this is exactly what is done by invalidation. However, in the case of taint, we basically want to approximate from the opposite side of the spectrum. We want to preserve taint in most cases, rather than cleansing them. Now, we basically sanitize all escaping tainted regions implicitly, since invalidation binds a fresh conjured symbol for the given region, and that has not been associated with taint. IMO this is a bad default behavior, we should be more aggressive about preserving taint if not further spreading taint to the reachable regions. We have a couple of options for dealing with it (let's call it //tainting policy//): 1) Taint only the parameters which were tainted prior to the call. 2) Taint the return value of the call, since it likely depends on the tainted input - if any arguments were tainted. 3) Taint all escaped regions - (maybe transitively using the cluster algorithm) - if any arguments were tainted. 4) Not taint anything - this is what we do right now :D The `ExprEngine` should not deal with taint on its own. It should be done by a checker, such as the `GenericTaintChecker`. However, the `Pre`-`PostCall` checker callbacks are not designed for this. `RegionChanges` would be a much better fit for modeling taint propagation. What we would need in the `RegionChanges` callback is the `State` prior invalidation, the `State` after the invalidation, and a `CheckerContext` in which the checker can create transitions, where it would place `NoteTags` for the modeled taint propagations and report errors if a taint sink rule gets violated. In this callback, we could query from the prior State, if the given value was tainted; then act and taint if necessary according to the checker's tainting policy. By using RegionChanges for this, we would 'fix' the mentioned propagation bug 'by-design'. Reviewed By: Szelethus Differential Revision: https://reviews.llvm.org/D118987 -
Guillaume Chatelet authored
-
Arthur O'Dwyer authored
-
Arthur O'Dwyer authored
git grep $(printf '\xc2\xad') ../libcxx -
phyBrackets authored
There is different bug types for different types of bugs but the **emitAdditionOverflowbug** seems to use bugtype **BT_NotCSting** but actually it have to use **BT_AdditionOverflow** . Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D119462
-
Aaron Ballman authored
Add a heading to appease the Sphinx bot, and add some basic documentation for [[_Noreturn]].
-
Aaron Ballman authored
This adds support for http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf, which was adopted at the Feb 2022 WG14 meeting. That paper adds [[noreturn]] and [[_Noreturn]] to the list of supported attributes in C2x. These attributes have the same semantics as the [[noreturn]] attribute in C++. The [[_Noreturn]] attribute was added as a deprecated feature so that translation units which include <stdnoreturn.h> do not get an error on use of [[noreturn]] because the macro expands to _Noreturn. Users can use -Wno-deprecated-attributes to silence the diagnostic. Use of <stdnotreturn.h> or the noreturn macro were both deprecated. Users can define the _CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro to suppress the deprecation diagnostics coming from the header file.
-
Momchil Velikov authored
We have the `clang -cc1` command-line option `-funwind-tables=1|2` and the codegen option `VALUE_CODEGENOPT(UnwindTables, 2, 0) ///< Unwind tables (1) or asynchronous unwind tables (2)`. However, this is encoded in LLVM IR by the presence or the absence of the `uwtable` attribute, i.e. we lose the information whether to generate want just some unwind tables or asynchronous unwind tables. Asynchronous unwind tables take more space in the runtime image, I'd estimate something like 80-90% more, as the difference is adding roughly the same number of CFI directives as for prologues, only a bit simpler (e.g. `.cfi_offset reg, off` vs. `.cfi_restore reg`). Or even more, if you consider tail duplication of epilogue blocks. Asynchronous unwind tables could also restrict code generation to having only a finite number of frame pointer adjustments (an example of *not* having a finite number of `SP` adjustments is on AArch64 when untagging the stack (MTE) in some...
-
Florian Hahn authored
Adds tests for #53800.
-
Simon Pilgrim authored
-
Nikita Popov authored
-
Serguei Katkov authored
-
Nikita Popov authored
Use CreateElementBitCast() instead, or don't work on Address where not necessary.
-
Aaron Ballman authored
When forming the function type from a declarator, we look for an overloadable attribute before issuing a diagnostic in C about a function signature containing only .... When the attribute is present, we allow such a declaration for compatibility with the overloading rules in C++. However, we were not looking for the attribute in all of the places it is legal to write it on a declarator and so we only accepted the signature in some forms and incorrectly rejected the signature in others. We now check for the attribute preceding the declarator instead of only being applied to the declarator directly.
-
David Spickett authored
This test is still seemingly randomly segfaulting on Arm: https://lab.llvm.org/buildbot/#/builders/178/builds/1547 Though it seems to fail earlier in the test than on AArch64. Investigation continues.
-
gysit authored
Adapt the region builder signature to hand in the attributes of the created ops. The revision is a preparation step the support named ops that need access to the operation attributes during op creation. Depends On D119692 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D119693
-
Nikita Popov authored
If the function types differ, the call arguments don't necessarily correspon to the function arguments. It's likely not worthwhile to handle this more precisely, but at least we shouldn't crash.
-
Marek Kurdej authored
-
gysit authored
Group and reorder the classed defined by comprehension.py and add type annotations. Depends On D119126 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D119692
-
gysit authored
Index attributes had no default value, which means the attribute values had to be set on the operation. This revision adds a default parameter to `IndexAttrDef`. After the change, every index attribute has to define a default value. For example, we may define the following strides attribute: ``` ``` When using the operation the default stride is used if the strides attribute is not set. The mechanism is implemented using `DefaultValuedAttr`. Additionally, the revision uses the naming index attribute instead of attribute more consistently, which is a preparation for follow up revisions that will introduce function attributes. Depends On D119125 Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D119126
-
Nathan Sidwell authored
We have to special-case 'u 8__uuidof [tz]' demangling for legacy support. That handling is a little duplicative. * It seems better to just push the single expected node. * We can also use 'consumeIf' rather than open-coding the peeking and increment. * We don't need the numLeft < 2 check, as if there are few than that other paths will end up with detecting the error. FWIW This simplifies a future change adding operator precedence. Reviewed By: ChuanqiXu Differential Revision: https://reviews.llvm.org/D119543
-
Nathan Sidwell authored
The output buffer growth algorithm had a few issues: a) An off-by-one error in the initial size check, which uses '>='. This error was safe, but could cause us to reallocate when there was no need. b) An inconsistency between the initial size check (>=) and the post-doubling check (>). The latter was somewhat obscured by the swapped operands. c) There would be many reallocs with an initially-small buffer. Add a little initialization hysteresis. Reviewed By: ChuanqiXu Differential Revision: https://reviews.llvm.org/D119177
-