- Mar 05, 2021
-
-
Martin Storsjö authored
Opening a path like \\server (without a trailing share name and path) produces this error, while opening e.g. \\server\share (for a nonexistent server/share) produces ERROR_BAD_NETPATH (which already is mapped). This happens in some testcases (in fs.op.proximate); as proximate() calls weakly_canonical() on the inputs, weakly_canonical() checks whether the path exists or not. When the error code wasn't recognized (it mapped to errc::invalid_argument), the stat operation wasn't conclusive and weakly_canonical() errored out. With the proper error code mapping, this isn't considered an error, just a nonexistent path, and weakly_canonical() can proceed. This roughly matches what MS STL does - it doesn't have ERROR_BAD_PATHNAME in its error code mapping table, but it checks for this error code specifically in the return of their correspondence of the stat function. Differential Revision: https://reviews.llvm.org/D97619
-
Martin Storsjö authored
Differential Revision: https://reviews.llvm.org/D97618
-
Martin Storsjö authored
Also add WIN32_LEAN_AND_MEAN before including windows.h, for consistency with other sources. Differential Revision: https://reviews.llvm.org/D97539
-
Rainer Orth authored
One ASan test currently `XPASS`es on Solaris: AddressSanitizer-i386-sunos :: TestCases/Posix/unpoison-alternate-stack.cpp It was originally `XFAIL`ed in D88501 <https://reviews.llvm.org/D88501> because `longjmp` from a signal handled is highly unportable, warned against in XPG7, and was not supported by Solaris `libc` at the time. However, since then support has been added for some cases including the current one, so the `XFAIL` can go. Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`. Differential Revision: https://reviews.llvm.org/D97933
-
Rainer Orth authored
One ASan test currently `XPASS`es on Solaris: AddressSanitizer-i386-sunos :: TestCases/Posix/no_asan_gen_globals.c It was originally `XFAIL`ed in D88218 <https://reviews.llvm.org/D88218> because Solaris `ld`, unlike GNU `ld`, doesn't strip local labels. Since then, the integrated assembler has stopped emitting those local labels, so the difference becomes moot and the `XFAIL` can go. Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`. Differential Revision: https://reviews.llvm.org/D97932
-
Luo, Yuanke authored
This pass runs in any situations but we skip it when it is not O0 and the function doesn't have optnone attribute. With -O0, the def of shape to amx intrinsics is near the amx intrinsics code. We are not able to find a point which post-dominate all the shape and dominate all amx intrinsics. To decouple the dependency of the shape, we transform amx intrinsics to scalar operation, so that compiling doesn't fail. In long term, we should improve fast register allocation to allocate amx register. Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D93594
-
Yang Fan authored
GCC warning: ``` In file included from /usr/include/c++/9/cassert:44, from /home/vsts/work/1/llvm-project/llvm/include/llvm/ADT/BitVector.h:21, from /home/vsts/work/1/llvm-project/llvm/include/llvm/Support/Program.h:17, from /home/vsts/work/1/llvm-project/llvm/include/llvm/Support/Process.h:32, from /home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp:11: /home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp: In member function ‘virtual llvm::Expected<std::unique_ptr<llvm::jitlink::JITLinkMemoryManager::Allocation> > llvm::jitlink::InProcessMemoryManager::allocate(const llvm::jitlink::JITLinkDylib*, const SegmentsRequestMap&)’: /home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp:129:40: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 129 | assert(SlabRemaining.allocatedSize() >= 0 && "Mapping exceeds allocation"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ ``` The return type of `allocatedSize()` is `size_t`, thus the expression `SlabRemaining.allocatedSize() >= 0` always evaluate to `true`. -
Craig Topper authored
[SelectionDAG] Assert that operands to SelectionDAG::getNode are not DELETED_NODE to catch issues like PR49393 earlier. I'm not sure this would catch all such issues, but it would catch some. The problem for PR49393 was that we were holding a reference to a node that wasn't connect edto the DAG across a function that could delete unused nodes. In this particular case we managed to try to use the deleted node while it was in the deleted state before its memory got recycled. It could also happen that we delete the node, something allocates a new node which recycles the memory. Then we try to use the reference we were holding and it is now a completely different node with different valid opcode. This patch would not catch that. Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D97969
-
Craig Topper authored
[TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by recursive calls in getNegatedExpression. For binary or ternary ops we call getNegatedExpression multiple times and then compare costs. While we're doing this we need to hold a node from the first call across the second call, but its not yet attached to the DAG. Its possible the second call creates an identical node and then decides it didn't need it so will try to delete it if it has no uses. This can cause a reference to the node we're holding further up the call stack to become invalidated. To prevent this, we can use a HandleSDNode to artifically give the node a use without connecting it to the DAG. I've used a std::list of HandleSDNodes so we can create handles only when we have a node to hold. HandleSDNode does not have default constructor and cannot be copied or moved. Fixes PR49393. Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D97914
-
Fangrui Song authored
-
Fangrui Song authored
-
Christopher Di Bella authored
* moves `std::copy_constructible` so it comes before `std::equality_comparable_with` * replaces a few uses of `auto`
-
Fangrui Song authored
-
Fangrui Song authored
r250405 deleted the functions from DILexicalBlockBase.
-
Dave Lee authored
Minor change for naming consistency. Differential Revision: https://reviews.llvm.org/D97985
-
Michael Kruse authored
An enum was unhandled after landing of D94973. Add the new OMPCanonicalLoopClass to the list of unhandled cases.
-
Vitaly Buka authored
-
Michael Kruse authored
Initial support for using the OpenMPIRBuilder by clang to generate loops using the OpenMPIRBuilder. This initial support is intentionally limited to: * Only the worksharing-loop directive. * Recognizes only the nowait clause. * No loop nests with more than one loop. * Untested with templates, exceptions. * Semantic checking left to the existing infrastructure. This patch introduces a new AST node, OMPCanonicalLoop, which becomes parent of any loop that has to adheres to the restrictions as specified by the OpenMP standard. These restrictions allow OMPCanonicalLoop to provide the following additional information that depends on base language semantics: * The distance function: How many loop iterations there will be before entering the loop nest. * The loop variable function: Conversion from a logical iteration number to the loop variable. These allow the OpenMPIRBuilder to act solely using logical iteration numbers without needing to be concerned with iterator semantics between calling the distance function and determining what the value of the loop variable ought to be. Any OpenMP logical should be done by the OpenMPIRBuilder such that it can be reused MLIR OpenMP dialect and thus by flang. The distance and loop variable function are implemented using lambdas (or more exactly: CapturedStmt because lambda implementation is more interviewed with the parser). It is up to the OpenMPIRBuilder how they are called which depends on what is done with the loop. By default, these are emitted as outlined functions but we might think about emitting them inline as the OpenMPRuntime does. For compatibility with the current OpenMP implementation, even though not necessary for the OpenMPIRBuilder, OMPCanonicalLoop can still be nested within OMPLoopDirectives' CapturedStmt. Although OMPCanonicalLoop's are not currently generated when the OpenMPIRBuilder is not enabled, these can just be skipped when not using the OpenMPIRBuilder in case we don't want to make the AST dependent on the EnableOMPBuilder setting. Loop nests with more than one loop require support by the OpenMPIRBuilder (D93268). A simple implementation of non-rectangular loop nests would add another lambda function that returns whether a loop iteration of the rectangular overapproximation is also within its non-rectangular subset. Reviewed By: jdenny Differential Revision: https://reviews.llvm.org/D94973
-
Vitaly Buka authored
-
Juneyoung Lee authored
from Philip's comments
-
Yang Fan authored
GCC warning: ``` /llvm-project/clang-tools-extra/clangd/SemanticHighlighting.cpp: In function ‘bool clang::clangd::{anonymous}::canHighlightName(clang::DeclarationName)’: /llvm-project/clang-tools-extra/clangd/SemanticHighlighting.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type] 64 | } | ^ ``` -
Luke authored
By implementing the method "unsigned RISCVTTIImpl::getRegisterBitWidth(bool Vector)", fixed-length vectorization is enabled when possible. Without this method, the "#pragma clang loop" directive is needed to enable vectorization(or the cost model may inform LLVM that "Vectorization is possible but not beneficial"). Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D97549
-
Wei Mi authored
sample loader pass. In https://reviews.llvm.org/rG5fb65c02ca5e91e7e1a00e0efdb8edc899f3e4b9, to prevent repeated indirect call promotion for the same indirect call and the same target, we used zero-count value profile to indicate an indirect call has been promoted for a certain target. We removed PromotedInsns cache in the same patch. However, there was a problem in that patch described below, and that problem led me to add PromotedInsns back as a mitigation in https://reviews.llvm.org/rG4ffad1fb489f691825d6c7d78e1626de142f26cf. When we get value profile from metadata by calling getValueProfDataFromInst, we need to specify the maximum possible number of values we expect to read. We uses MaxNumPromotions in the last patch so the maximum number of value information extracted from metadata is MaxNumPromotions. If we have many values including zero-count values when we write the metadata, some of them will be dropped when we read them beca...
-
Christopher Di Bella authored
Implements parts of: - P0898R3 Standard Library Concepts - P1754 Rename concepts to standard_case for C++20, while we still can Depends on D96660 Reviewed By: ldionne, #libc, Quuxplusone Differential Revision: https://reviews.llvm.org/D97176 -
Chen Zheng authored
Reviewed By: jasonliu Differential Revision: https://reviews.llvm.org/D95518
-
George Balatsouras authored
As a preparation step for fast8 support, we need to update the tests to pass in both modes. That requires generalizing the shadow width and remove any hard coded references that assume it's always 2 bytes. Reviewed By: stephan.yichao.zhao Differential Revision: https://reviews.llvm.org/D97988
-
Yonghong Song authored
Lorenz Bauer from Cloudflare tried to use "const struct <name>" as the type for __builtin_btf_type_id(*(const struct <name>)0, 1) relocation and hit a llvm BPF fatal error. https://lore.kernel.org/bpf/a3782f71-3f6b-1e75-17a9-1827822c2030@fb.com/ ... fatal error: error in backend: Empty type name for BTF_TYPE_ID_REMOTE reloc Currently, we require the debuginfo type itself must have a name. In this case, the debuginfo type is "const" which points to "struct <name>". The "const" type does not have a name, hence the above fatal error will be triggered. Let us permit "const" and "volatile" type modifiers. We skip modifiers in some other cases as well like structure member type tracing. This can aviod the above fatal error. Differential Revision: https://reviews.llvm.org/D97986
-
David Blaikie authored
-
David Blaikie authored
This is included from IR files, and IR doesn't/can't depend on Analysis (because Analysis depends on IR). Also fix the implementation - don't use non-member static in headers, as it leads to ODR violations, inaccurate "unused function" warnings, etc. And fix the header protection macro name (we don't generally include "LIB" in the names, so far as I can tell).
-
Nico Weber authored
-
Jianzhou Zhao authored
This is a part of https://reviews.llvm.org/D95835. Reviewed By: morehouse, gbalats Differential Revision: https://reviews.llvm.org/D97789
-
Philip Reames authored
We dropped support for the non-bundle form a while back, but I apparently missed updating one place in the docs.
-
Philip Reames authored
-
Amara Emerson authored
This is actually two changes. One is to avoid copies when fp values are fed into a build_vector, without being able to tell from the opcode. The other is that build_vectors are also marked as only defining FP, since they produce vector results. Differential Revision: https://reviews.llvm.org/D97968
-
Heejin Ahn authored
This is a case D97677 missed. When taking out remaining BBs that are reachable from already-taken-out exceptions (because they are not subexcptions but unwind destinations), I assumed the remaining BBs are not EH pads, but they can be. For example, ``` try { try { throw 0; } catch (int) { // (a) } } catch (int) { // (b) } try { foo(); } catch (int) { // (c) } ``` In this code, (b) is the unwind destination of (a) so its exception is taken out of (a)'s exception, But even though the next try-catch is not inside the first two-level try-catches, because the first try always throws, its continuation BB is unreachable and the whole rest of the function is dominated by EH pad (a), including EH pad (c). So after we take out of (b)'s exception out of (a)'s, we also need to take out (c)'s exception out of (a)'s, because (c) is reachable from (b). This adds one more step before what we did for remaining BBs in D97677; it traverses EH pads first to take subexceptions out of their incorrect parent exception. It's the same thing as D97677, but because we can do this before we add BBs to exceptions' sets, we don't need to fix sets and only need to fix parent exception pointers. Other changes are variable name changes (I changed `WE` -> `SrcWE`, `UnwindWE` -> `DstWE` for clarity), some comment changes, and a drive-by fix in a bug in a `LLVM_DEBUG` print statement. Fixes https://github.com/emscripten-core/emscripten/issues/13588. Reviewed By: dschuff Differential Revision: https://reviews.llvm.org/D97929 -
LLVM GN Syncbot authored
-
Heejin Ahn authored
Background: Wasm EH, while using Windows EH (catchpad/cleanuppad based) IR, uses Itanium-based libraries and ABIs with some modifications. `__clang_call_terminate` is a wrapper generated in Clang's Itanium C++ ABI implementation. It contains this code, in C-style pseudocode: ``` void __clang_call_terminate(void *exn) { __cxa_begin_catch(exn); std::terminate(); } ``` So this function is a wrapper to call `__cxa_begin_catch` on the exception pointer before termination. In Itanium ABI, this function is called when another exception is thrown while processing an exception. The pointer for this second, violating exception is passed as the argument of this `__clang_call_terminate`, which calls `__cxa_begin_catch` with that pointer and calls `std::terminate` to terminate the program. The spec (https://libcxxabi.llvm.org/spec.html) for `__cxa_begin_catch` says, ``` When the personality routine encounters a termination condition, it will call __cxa_begin_catch() to mark the exception as handled and then call terminate(), which shall not return to its caller. ``` In wasm EH's Clang implementation, this function is called from cleanuppads that terminates the program, which we also call terminate pads. Cleanuppads normally don't access the thrown exception and the wasm backend converts them to `catch_all` blocks. But because we need the exception pointer in this cleanuppad, we generate `wasm.get.exception` intrinsic (which will eventually be lowered to `catch` instruction) as we do in the catchpads. But because terminate pads are cleanup pads and should run even when a foreign exception is thrown, so what we have been doing is: 1. In `WebAssemblyLateEHPrepare::ensureSingleBBTermPads()`, we make sure terminate pads are in this simple shape: ``` %exn = catch call @__clang_call_terminate(%exn) unreachable ``` 2. In `WebAssemblyHandleEHTerminatePads` pass at the end of the pipeline, we attach a `catch_all` to terminate pads, so they will be in this form: ``` %exn = catch call @__clang_call_terminate(%exn) unreachable catch_all call @std::terminate() unreachable ``` In `catch_all` part, we don't have the exception pointer, so we call `std::terminate()` directly. The reason we ran HandleEHTerminatePads at the end of the pipeline, separate from LateEHPrepare, was it was convenient to assume there was only a single `catch` part per `try` during CFGSort and CFGStackify. --- Problem: While it thinks terminate pads could have been possibly split or calls to `__clang_call_terminate` could have been duplicated, `WebAssemblyLateEHPrepare::ensureSingleBBTermPads()` assumes terminate pads contain no more than calls to `__clang_call_terminate` and `unreachable` instruction. I assumed that because in LLVM very limited forms of transformations are done to catchpads and cleanuppads to maintain the scoping structure. But it turned out to be incorrect; passes can merge cleanuppads into one, including terminate pads, as long as the new code has a correct scoping structure. One pass that does this I observed was `SimplifyCFG`, but there can be more. After this transformation, a single cleanuppad can contain any number of other instructions with the call to `__clang_call_terminate` and can span many BBs. It wouldn't be practical to duplicate all these BBs within the cleanuppad to generate the equivalent `catch_all` blocks, only with calls to `__clang_call_terminate` replaced by calls to `std::terminate`. Unless we do more complicated transformation to split those calls to `__clang_call_terminate` into a separate cleanuppad, it is tricky to solve. --- Solution (?): This CL just disables the generation and use of `__clang_call_terminate` and calls `std::terminate()` directly in its place. The possible downside of this approach can be, because the Itanium ABI intended to "mark" the violating exception handled, we don't do that anymore. What `__cxa_begin_catch` actually does is increment the exception's handler count and decrement the uncaught exception count, which in my opinion do not matter much given that we are about to terminate the program anyway. Also it does not affect info like stack traces that can be possibly shown to developers. And while we use a variant of Itanium EH ABI, we can make some deviations if we choose to; we are already different in that in the current version of the EH spec we don't support two-phase unwinding. We can possibly consider a more complicated transformation later to reenable this, but I don't think that has high priority. Changes in this CL contains: - In Clang, we don't generate a call to `wasm.get.exception()` intrinsic and `__clang_call_terminate` function in terminate pads anymore; we simply generate calls to `std::terminate()`, which is the default implementation of `CGCXXABI::emitTerminateForUnexpectedException`. - Remove `WebAssembly::ensureSingleBBTermPads() function and `WebAssemblyHandleEHTerminatePads` pass, because terminate pads are already `catch_all` now (because they don't need the exception pointer) and we don't need these transformations anymore. - Change tests to use `std::terminate` directly. Also removes tests that tested `LateEHPrepare::ensureSingleBBTermPads` and `HandleEHTerminatePads` pass. - Drive-by fix: Add some function attributes to EH intrinsic declarations Fixes https://github.com/emscripten-core/emscripten/issues/13582. Reviewed By: dschuff, tlively Differential Revision: https://reviews.llvm.org/D97834 -
William S. Moses authored
This reverts commit 51bd42ef.
-
Sanjay Patel authored
This code assumed that FP math was only permissable if it was fully "fast", so it hard-coded "fast" when creating new instructions. The underlying code already allows matching recurrences/reductions that are only "reassoc", so this change should prevent the potential miscompile seen in the test diffs (we created "fast" ops even though none existed in the original code). I don't know if we need to create the temporary IRBuilder objects used here, so that could be follow-up clean-up. There's an open question about whether we should require "nsz" in addition to "reassoc" here. InstCombine uses that combo for its reassociative folds, but I think codegen is not as strict.
-
William S. Moses authored
Enable Attributor's heap-to-stack to lower unbounded allocations given a max size of -1 Differential Revision: https://reviews.llvm.org/D97873
-