David Green [Thu, 2 Dec 2021 17:10:26 +0000 (17:10 +0000)]
[ARM] Introduce i8neg and i8pos addressing modes
Some instructions with i8 immediate ranges can only hold negative values
(like t2LDRHi8), only hold positive values (like t2STRT) or hold +/-
depending on the U bit (like the pre/post inc instructions. e.g
t2LDRH_POST). This patch splits the AddrModeT2_i8 into AddrModeT2_i8,
AddrModeT2_i8pos and AddrModeT2_i8neg to make this clear.
This allows us to get the offset ranges of t2LDRHi8 correct in the
load/store optimizer, fixing issues where we could end up creating
instructions with positive offsets (which may then be encoded as ldrht).
Differential Revision: https://reviews.llvm.org/D114638
Nico Weber [Thu, 2 Dec 2021 14:12:50 +0000 (09:12 -0500)]
[clang-cl] Define _MSVC_LANG for -std=c++2b
This matches the value that msvc v19.29 VS16.11 uses for
_MSVC_LANG with /std:c++latest.
Differential Revision: https://reviews.llvm.org/D114952
Paul Robinson [Thu, 2 Dec 2021 16:34:16 +0000 (08:34 -0800)]
Reapply "[TLI checker] Add more tests"
This reverts commit
8cd61aac0030b8add686a98b8902ea49ec9c1deb.
I had missed one place in a test that needed updating; it passed on my
dirty build tree but not on a clean one.
Original commit message:
D114478 identified testing gaps; this patch fills them.
Differential Revision: https://reviews.llvm.org/D114913
Dmitry Vyukov [Thu, 2 Dec 2021 12:35:04 +0000 (13:35 +0100)]
tsan: tolerate munmap with invalid arguments
We call UnmapShadow before the actual munmap, at that point we don't yet
know if the provided address/size are sane. We can't call UnmapShadow
after the actual munmap becuase at that point the memory range can
already be reused for something else, so we can't rely on the munmap
return value to understand is the values are sane.
While calling munmap with insane values (non-canonical address, negative
size, etc) is an error, the kernel won't crash. We must also try to not
crash as the failure mode is very confusing (paging fault inside of the
runtime on some derived shadow address).
Such invalid arguments are observed on Chromium tests:
https://bugs.chromium.org/p/chromium/issues/detail?id=1275581
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114944
Alexey Bataev [Mon, 15 Nov 2021 17:18:27 +0000 (09:18 -0800)]
[SLP]Improve registering and merging of compatible shuffles.
If several shuffle instructions are emitted, some of them might
same/compatible (less defined) with the previously emitted ones. Such
shuffles can be removed safely, improving the total cost of the
vectorized code.
Differential Revision: https://reviews.llvm.org/D114087
Dmitry Vyukov [Thu, 2 Dec 2021 14:15:14 +0000 (15:15 +0100)]
tsan: fix false positives in dynamic libs with static tls
The added test demonstrates loading a dynamic library with static TLS.
Such static TLS is a hack that allows a dynamic library to have faster TLS,
but it can be loaded only iff all threads happened to allocate some excess
of static TLS space for whatever reason. If it's not the case loading fails with:
dlopen: cannot load any more object with static TLS
We used to produce a false positive because dlopen will write into TLS
of all existing threads to initialize/zero TLS region for the loaded library.
And this appears to be racing with initialization of TLS in the thread
since we model a write into the whole static TLS region (we don't what part
of it is currently unused):
WARNING: ThreadSanitizer: data race (pid=2317365)
Write of size 1 at 0x7f1fa9bfcdd7 by main thread:
0 memset
1 init_one_static_tls
2 __pthread_init_static_tls
[[ this is where main calls dlopen ]]
3 main
Previous write of size 8 at 0x7f1fa9bfcdd0 by thread T1:
0 __tsan_tls_initialization
Fix this by ignoring accesses during dlopen.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114953
Sam Clegg [Thu, 2 Dec 2021 02:10:37 +0000 (18:10 -0800)]
[lld][WebAssembly] Fix for debug relocations against undefined function symbols
This is very similar to https://reviews.llvm.org/D103557 but applies to
symbols which are undefined at link time rather than compile time.
We already have code that handles symbols which were defined at link
time but dead stripped by `--gc-sections` (See
`test/wasm/debug-removed-fn.ll`). In that case the symbols are not live
(!isLive()). However, we can also have live symbols (which are
references by the program) but which are undefined at link time and are
imported by the linker.
In the test case here the symbol `undef` is used but is not defined
in the program but is imported by the linker due to the
`--import-undefined` flag.
Fixes: https://github.com/emscripten-core/emscripten/issues/15528
Differential Revision: https://reviews.llvm.org/D114921
Paul Robinson [Thu, 2 Dec 2021 16:30:47 +0000 (08:30 -0800)]
Revert "[TLI checker] Add more tests"
This reverts commit
2778554971dada8ef7df9ee6954c52a753d90c22.
Some bots are failing on the updated tests.
David Greene [Wed, 6 Oct 2021 19:10:08 +0000 (12:10 -0700)]
[clang] Do not duplicate "EnableSplitLTOUnit" module flag
If clang's output is set to bitcode and LTO is enabled, clang would
unconditionally add the flag to the module. Unfortunately, if the input were a
bitcode or IR file and had the flag set, this would result in two copies of the
flag, which is illegal IR. Guard the setting of the flag by checking whether it
already exists. This follows existing practice for the related "ThinLTO" module
flag.
Differential Revision: https://reviews.llvm.org/D112177
Paul Robinson [Wed, 1 Dec 2021 22:56:00 +0000 (14:56 -0800)]
[TLI checker] Add more tests
D114478 identified testing gaps; this patch fills them.
Differential Revision: https://reviews.llvm.org/D114913
Joseph Huber [Wed, 1 Dec 2021 18:14:40 +0000 (13:14 -0500)]
[OpenMP] Make the new device runtime the default
This patch changes the `-fopenmp-target-new-runtime` option which controls if
the new or old device runtime is used to be true by default. Disabling this to
use the old runtime now requires using `-fno-openmp-target-new-runtime`.
Reviewed By: JonChesterfield, tianshilei1992, gregrodgers, ronlieb
Differential Revision: https://reviews.llvm.org/D114890
Sanjay Patel [Thu, 2 Dec 2021 15:30:06 +0000 (10:30 -0500)]
[InstCombine] add tests for icmp with mul op; NFC
Christian Kühnel [Thu, 2 Dec 2021 13:43:13 +0000 (13:43 +0000)]
[clangd] cleanup of header guard names
Renaming header guards to match the LLVM convention.
This patch was created by automatically applying the fixes from
clang-tidy.
I've removed the [NFC] tag from the title, as we're adding header guards in some files and thus might trigger behavior changes.
Differential Revision: https://reviews.llvm.org/D113896
Florian Hahn [Thu, 2 Dec 2021 15:41:31 +0000 (15:41 +0000)]
[Clang] Fix LTO pipeline test after
770a50b28c00211f9a.
Florian Hahn [Thu, 2 Dec 2021 14:50:14 +0000 (14:50 +0000)]
[AnnotationRemarks] Support generating annotation remarks with -O0.
This matches the legacy pass manager behavior. If remarks are not
enabled the pass is effectively a no-op.
Yitzhak Mandelbaum [Thu, 2 Dec 2021 14:41:00 +0000 (14:41 +0000)]
[clang-tidy] Fix build broken by commit
6a9487df73e917c4faf5e060f2bb33c6ade3f967 (D113148)
Alexey Bataev [Thu, 2 Dec 2021 14:29:27 +0000 (06:29 -0800)]
[SLP][NFC]Add a test for extractelements with many uses vectorization, NFC.
David Stuttard [Tue, 30 Nov 2021 09:29:14 +0000 (09:29 +0000)]
[AMDGPU] Add support for in-order bvh in waitcnt pass
bvh should be handled separately from vmem and vmem with sampler instructions
for waitcnt handling.
Differential Revision: https://reviews.llvm.org/D114794
David Stuttard [Tue, 30 Nov 2021 09:29:14 +0000 (09:29 +0000)]
[AMDGPU] Test for in-order waitcnt insertion for bvh instructions
In-order bvh instructions don't require a waitcnt as order is
guaranteed.
However, waitcnt IS required for other image instruction types vs
bvh.
Pre-commit test for new functionality in https://reviews.llvm.org/D114794
Differential Revision: https://reviews.llvm.org/D114792
Simon Moll [Thu, 2 Dec 2021 12:59:24 +0000 (13:59 +0100)]
[VE][NFC] Cleanup redundant namespace wrapper
Florian Hahn [Thu, 2 Dec 2021 14:18:04 +0000 (14:18 +0000)]
[MemoryLocation] Support strncpy in getForArgument.
The size argument of strncpy can be used as bound for the size of
its pointer arguments.
strncpy is guaranteed to write N bytes and reads up to N bytes.
Reviewed By: xbolva00
Differential Revision: https://reviews.llvm.org/D114871
Tue Ly [Wed, 1 Dec 2021 15:24:57 +0000 (10:24 -0500)]
[libc] Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth).
Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth) and incorrect eps for denormal numbers.
Differential Revision: https://reviews.llvm.org/D114878
Sanjay Patel [Wed, 1 Dec 2021 22:21:19 +0000 (17:21 -0500)]
[PatternMatch] create and use matcher for 'not' that excludes undef elements
We needed a stricter version of m_Not for D114462, but I wasn't
sure if that was going to be required anywhere else, so I didn't bother
to make that reusable.
It turns out we have one more existing simplification that needs
this (currently miscompiles):
https://alive2.llvm.org/ce/z/9-nTKi
And there's at least one more fold in that family that we could add.
Differential Revision: https://reviews.llvm.org/D114882
Florian Hahn [Thu, 2 Dec 2021 13:45:58 +0000 (13:45 +0000)]
[MemoryLocation] Support memset_chk in getForArgument.
The size argument for memset_chk is an upper bound for the size of the
pointer argument. memset_chk may write less than the specified length,
if it exceeds the specified max size and aborts.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D114870
LLVM GN Syncbot [Thu, 2 Dec 2021 13:40:22 +0000 (13:40 +0000)]
[gn build] Port
6a9487df73e9
Jeroen Dobbelaere [Thu, 2 Dec 2021 13:36:11 +0000 (14:36 +0100)]
[flang] GettingInvolved: update LLVM Alias Analysis Technical Call info
The google doc was changed and the calls are now using teams.
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D114145
Anastasia Stulova [Thu, 2 Dec 2021 13:30:05 +0000 (13:30 +0000)]
[HIPSPV] Add CUDA->SPIR-V address space mapping
Add mapping for CUDA address spaces for HIP to SPIR-V
translation. This change allows HIP device code to be
emitted as valid SPIR-V by mapping unqualified pointers
to generic address space and by mapping __device__ and
__shared__ AS to their equivalent AS in SPIR-V
(CrossWorkgroup and Workgroup, respectively).
Cuda's __constant__ AS is handled specially. In HIP
unqualified pointers (aka "flat" pointers) can point to
__constant__ objects. Mapping this AS to ConstantMemory
would produce to illegal address space casts to
generic AS. Therefore, __constant__ AS is mapped to
CrossWorkgroup.
Patch by linjamaki (Henry Linjamäki)!
Differential Revision: https://reviews.llvm.org/D108621
James King [Thu, 2 Dec 2021 13:27:33 +0000 (13:27 +0000)]
Fix documentation for `forEachLambdaCapture` and `hasAnyCapture`
Updates the return types of these matchers' definitions to use
`internal::Matcher<LambdaCapture>` instead of `LambdaCaptureMatcher`. This
ensures that they are categorized as traversal matchers, instead of narrowing
matchers.
Reviewed By: ymandel, tdl-g, aaron.ballman
Differential Revision: https://reviews.llvm.org/D114809
CJ Johnson [Thu, 2 Dec 2021 13:17:12 +0000 (13:17 +0000)]
Add new clang-tidy check for string_view(nullptr)
Checks for various ways that the `const CharT*` constructor of `std::basic_string_view` can be passed a null argument and replaces them with the default constructor in most cases. For the comparison operators, braced initializer list does not compile so instead a call to `.empty()` or the empty string literal are used, where appropriate.
This prevents code from invoking behavior which is unconditionally undefined. The single-argument `const CharT*` constructor does not check for the null case before dereferencing its input. The standard is slated to add an explicitly-deleted overload to catch some of these cases: wg21.link/p2166
https://reviews.llvm.org/D114823 is a companion change to prevent duplicate warnings from the `bugprone-string-constructor` check.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D113148
Valentin Clement [Thu, 2 Dec 2021 13:17:28 +0000 (14:17 +0100)]
[fir] Declare test function inline
Declare functions checkCallOp and checkCallOpFromResultBox inline due to buildbot failure flang-aarch64-latest-clang
Jamie Schmeiser [Thu, 2 Dec 2021 13:16:18 +0000 (08:16 -0500)]
Expand testing of necessary features for print-changed=dot-cfg.
Summary:
Expand the testing for whether the lit tests for print-changed=dot-cfg
are supported to include checking whether dot supports pdf output.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: hvdijk (Harald van Dijk)
Differential Revision: https://reviews.llvm.org/D113187
Matt Devereau [Tue, 30 Nov 2021 15:10:06 +0000 (15:10 +0000)]
[AArch64][SVE] Enable bf16 vector.insert
Allow passthrough bf16 registers for vector.insert
Differential revision: https://reviews.llvm.org/D114858
Simon Moll [Thu, 2 Dec 2021 12:33:46 +0000 (13:33 +0100)]
[VE][Clang][NFC] Disable VE toolchain tests on Windows
VE hardware is unsupported under Windows. Disable the clang VE toolchain
tests here. Tests breaking because of non-POSIX path separators.
Djordje Todorovic [Thu, 2 Dec 2021 11:40:00 +0000 (03:40 -0800)]
Reland "[LICM] Hoist LOAD without sinking the STORE"
When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.
Please consider this small example:
loop {
var = *ptr;
if (var) break;
*ptr= var + 1;
}
After this patch, it will be:
var0 = *ptr;
loop {
var1 = phi (var0, var2);
if (var1) break;
var2 = var1 + 1;
*ptr = var2;
}
This addresses some problems from [0].
[0] https://bugs.llvm.org/show_bug.cgi?id=51193
Differential revision: https://reviews.llvm.org/D113289
Florian Hahn [Thu, 2 Dec 2021 11:50:32 +0000 (11:50 +0000)]
[BasicAA] Add tests for memset_pattern{4,8,16}.
This also removes the existing memset_pattern.ll test, which was relying
on GVN. It is also covered by the new test directly.
Simon Pilgrim [Thu, 2 Dec 2021 11:47:43 +0000 (11:47 +0000)]
[DAG][PowerPC] Enable initial ISD::BITCAST SimplifyDemandedBits/SimplifyMultipleUseDemandedBits big-endian handling
This patch begins extending handling for peeking through bitcast nodes to big-endian targets as well as the existing little-endian case.
Differential Revision: https://reviews.llvm.org/D114676
Djordje Todorovic [Thu, 2 Dec 2021 11:31:53 +0000 (03:31 -0800)]
[LICM] Adding the test as a precommit for the D113289
David Green [Thu, 2 Dec 2021 11:33:40 +0000 (11:33 +0000)]
[ARM] Correct range in isLegalAddressImm
The ranges in isLegalAddressImm were off by one, not allowing the
maximum values for unscaled offsets.
Differential Revision: https://reviews.llvm.org/D114636
Frederic Cambus [Mon, 29 Nov 2021 07:04:04 +0000 (08:04 +0100)]
[llvm-readobj] Add support for machine-independent NetBSD ELF core notes.
Notes generated in NetBSD core files provide additional information about
processes. These notes are described in core.5, which can be viewed here:
https://man.netbsd.org/core.5
Differential Revision: https://reviews.llvm.org/D114635
Florian Hahn [Thu, 2 Dec 2021 11:04:25 +0000 (11:04 +0000)]
[BuildLibCalls] Add support for memset_pattern{4,8}.
Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.
Reviewed By: ab
Differential Revision: https://reviews.llvm.org/D114883
Nikita Popov [Thu, 2 Dec 2021 10:55:56 +0000 (11:55 +0100)]
[GlobalOpt] Fix assertion failure during instruction deletion
This fixes the assertion failure reported in https://reviews.llvm.org/D114889#3166417,
by making RecursivelyDeleteTriviallyDeadInstructionsPermissive()
more permissive. As the function accepts a WeakTrackingVH, even if
originally only Instructions were inserted, we may end up with
different Value types after a RAUW operation. As such, we should
not assume that the vector only contains instructions.
Notably this matches the behavior of the
RecursivelyDeleteTriviallyDeadInstructions() function variant which
accepts a single value rather than vector.
Frederic Cambus [Wed, 24 Nov 2021 12:59:46 +0000 (13:59 +0100)]
Use cc/c++ instead of gcc/g++ on FreeBSD.
All supported FreeBSD platforms do not have GCC in base anymore.
Differential Revision: https://reviews.llvm.org/D114530
David Green [Thu, 2 Dec 2021 10:40:10 +0000 (10:40 +0000)]
[ARM] Add additional postinc distribute tests and regenerate tests. NFC
Kiran Chandramohan [Wed, 1 Dec 2021 22:12:12 +0000 (22:12 +0000)]
[Flang] Replace notifyMatchFailure with TODO hard failures
For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.
For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.
Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.
Reviewed By: clementval, awarzynski
Differential Revision: https://reviews.llvm.org/D114371
Simon Moll [Thu, 2 Dec 2021 10:17:47 +0000 (11:17 +0100)]
Revert "Revert "[VE] Make VE official""
This reverts commit
27c9e8b45b25614a92539ac6787dbb5670d950b3.
Bugs exposed by AddressSanitizer have been reproduced and fixed locally:
* commit
e37000f3bff384
* commit
435d44bf8ab392
Florian Hahn [Thu, 2 Dec 2021 10:11:54 +0000 (10:11 +0000)]
[InferAttrs] Add memset_pattern{4,8} declarations to test.
Fangrui Song [Thu, 2 Dec 2021 05:02:19 +0000 (05:02 +0000)]
[ELF] Discard input .note.gnu.build-id even with default --build-id=none
binutils 2.38 will adopt this behavior
https://sourceware.org/bugzilla/show_bug.cgi?id=28639
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D114910
Florian Hahn [Thu, 2 Dec 2021 09:50:14 +0000 (09:50 +0000)]
[BuildLibCalls] Add additional attrs to memcpy_chk.
`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).
See D114793 for a similar patch for `memset_chk`.
Reviewed By: xbolva00
Differential Revision: https://reviews.llvm.org/D114863
Simon Moll [Thu, 2 Dec 2021 09:35:01 +0000 (10:35 +0100)]
[VE][NFC] Fix use-after-free in PVFMK expansion
There is custom expansion code for packed VFMK Pseudos in the VE
backend. This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo. This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.
Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)
Lang Hames [Thu, 2 Dec 2021 09:40:16 +0000 (20:40 +1100)]
[ORC] Fix ambiguous call to overloaded function.
This should fix the build failure at
https://lab.llvm.org/buildbot#builders/110/builds/8359
Kirill Bobyrev [Thu, 2 Dec 2021 09:21:19 +0000 (10:21 +0100)]
[clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file
This will mark more headers that are unrelated to used symbol but contain its
forawrd declaration. E.g. the following are examples of headers forward
declaring `llvm::StringRef`:
- clang/include/clang/Basic/Cuda.h
- llvm/include/llvm/Support/SHA256.h
- llvm/include/llvm/Support/TrigramIndex.h
- llvm/include/llvm/Support/RandomNumberGenerator.
- ... and more (~50 in total)
This patch is a reduced version of D112707 which was controversial.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D114864
Valentin Clement [Thu, 2 Dec 2021 09:18:38 +0000 (10:18 +0100)]
[fir] Add fir numeric intrinsic runtime call builder
This patch adds the FIR builder to generate the numeric intrinsic
runtime call.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D114477
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Nikita Popov [Wed, 1 Dec 2021 11:12:35 +0000 (12:12 +0100)]
[llvm-c] Make LLVMAddAlias opaque pointer compatible
Deprecate LLVMAddAlias in favor of LLVMAddAlias2, which accepts a
value type and an address space. Previously these were extracted
from the pointer type.
Differential Revision: https://reviews.llvm.org/D114860
Nikita Popov [Thu, 2 Dec 2021 08:13:20 +0000 (09:13 +0100)]
[GlobalOpt] Add test for PR39751 (NFC)
This has been fixed by D114889, as noted in the comments.
mydeveloperday [Thu, 2 Dec 2021 08:05:30 +0000 (08:05 +0000)]
[clang-format] Add better support for co-routinues
Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being formatted from
```for co_await(auto elt : seq)```
to
```
for
co_await(auto elt : seq)
```
Because of the dominance of clang-format in the C++ community, I don't think we should make it the blocker that prevents users from embracing the newer parts of the standard because we butcher the layout of some of the new constucts.
Reviewed By: HazardyKnusperkeks, Quuxplusone, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D114859
Vitaly Buka [Thu, 2 Dec 2021 07:55:04 +0000 (23:55 -0800)]
[NFC][sanitizer] Check &real_pthread_join
It's a weak function which may be undefined.
Jon Chesterfield [Thu, 2 Dec 2021 07:57:01 +0000 (07:57 +0000)]
[openmp][amdgpu] Disable three tests in preparation for new runtime
David Green [Thu, 2 Dec 2021 07:56:27 +0000 (07:56 +0000)]
[ARM] Teach getIntImmCostInst about the cost of saturating fp converts
Given a min(max(fptosi, INT_MIN), INT_MAX) with the correct constants,
we can now generate a fptosi.sat. But in the arm backend, the constant
can be treated as high cost, pulling it out of the basic block in a way
that the DAG combine can no longer see it. This teaches it again that it
is a low cost constant, not worth hoisting out.
Recommitted from
0e98659ea1193c with a fix for APInt comparison.
Differential Revision: https://reviews.llvm.org/D114380
Lang Hames [Tue, 30 Nov 2021 03:46:15 +0000 (14:46 +1100)]
[ORC] Add support for removing JITDylibs.
This allows JITDylibs to be removed from the ExecutionSession. Calling
ExecutionSession::removeJITDylib will disconnect the JITDylib from the
ExecutionSession and clear it (removing all trackers associated with it). The
JITDylib object will then be destroyed as soon as the last JITDylibSP pointing
at it is destroyed.
Lang Hames [Fri, 26 Nov 2021 01:13:11 +0000 (12:13 +1100)]
[ORC] Only use JITDylib::GeneratorsMutex while running generators.
GeneratorsMutex should prevent lookups from proceeding through the
generators of a single JITDylib concurrently (since this could
result in redundant attempts to generate definitions). Mutation of
the generators list itself should be done under the session lock.
Lang Hames [Wed, 1 Dec 2021 23:48:50 +0000 (10:48 +1100)]
[ORC] Hold ResourceTracker in MaterializationResponsibility.
This keeps the tracker alive for the lifetime of the MR. This is needed so that
we can check whether the tracker has become defunct before posting results (or
failure) for the MR.
Austin Kerbow [Wed, 10 Nov 2021 17:59:31 +0000 (09:59 -0800)]
[AMDGPU] Set most sched model resource's BufferSize to one
Using a BufferSize of one for memory ProcResources will result in better
ILP since it more accurately models the dependencies between memory ops
and their consumers on an in-order processor. After this change, the
scheduler will treat the data edges from loads as blocking so that
stalls are guaranteed when waiting for data to be retreaved from memory.
Since we don't actually track waitcnt here, this should do a better job
at modeling their behavior.
Practically, this means that the scheduler will trigger the 'STALL'
heuristic more often.
This type of change needs to be evaluated experimentally. Preliminary
results are positive.
Fixes: SWDEV-282962
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D114777
skc7 [Wed, 1 Dec 2021 06:12:57 +0000 (06:12 +0000)]
[AMDGPU][clang] Fix __builtin_nontemporal_store() failure on AMDGPU
Reviewed By: yaxunl, sameerds
Differential Revision: https://reviews.llvm.org/D114849
Phoebe Wang [Thu, 2 Dec 2021 05:11:07 +0000 (13:11 +0800)]
[X86][FP16] Only generate approximate rsqrt when Reciprocal is true for half type
We have reasonable fast sqrt and accurate rsqrt for half type due to the
limited fractions. So neither do we need multi steps refinement for
rsqrt nor replace sqrt by rsqrt.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D114844
Phoebe Wang [Thu, 2 Dec 2021 05:10:57 +0000 (13:10 +0800)]
[X86] Insert FMUL for estimated non reciprocal SQRT when `RefinementSteps` = 0
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D114843
Jonas Devlieghere [Thu, 2 Dec 2021 05:33:40 +0000 (21:33 -0800)]
[lldb] Skip test_launch_scripted_process_stack_frames with ASan
This test is failing on the sanitized bot because of a
heap-use-after-free. Disabling the test to turn the bot
green again.
rdar://
85954489.
Igor Kudrin [Thu, 2 Dec 2021 05:10:07 +0000 (12:10 +0700)]
[ELF] Prevent internalizing used comdat symbol
When a comdat symbol is defined in both bitcode and regular object
files, which are contained in the same archive, the linker could lose
the flag that the symbol is used in the regular object file and allow
LTO to internalize it, which led to "error: undefined symbol".
The issue was introduced in D79300.
Differential Revision: https://reviews.llvm.org/D114801
Jacques Pienaar [Thu, 2 Dec 2021 04:45:08 +0000 (20:45 -0800)]
[mlir][drr] Simple heuristic to reduce chance of accidental nullptr dereference
When an attribute is optional & is given an additional constraint in
rewrite pattern that could lead to dereferencing null Attribute. Avoid
cases where the constraints checks attribute but has no check if null.
This should be improved to be more uniformly guarded.
Christudasan Devadasan [Sat, 18 Sep 2021 06:46:02 +0000 (02:46 -0400)]
[AMDGPU] Add a regclass flag for scalar registers
Along with vector RC flags, this scalar flag will
make various regclass queries like `isVGPR` more
accurate.
Regclasses other than vectors are currently set
with the new flag even though certain unallocatable
classes aren't truly scalars. It would be ok as long
as they remain unallocatable.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D110053
Joe Loser [Wed, 3 Nov 2021 22:45:04 +0000 (18:45 -0400)]
[libc++] Implement P1989R2: range constructor for string_view
Implement P1989R2 which adds a range constructor for `string_view`.
Adjust `operator/=` in `path` to avoid atomic constraints caching issue
getting provoked from this PR.
Add defaulted template argument to `string_view`'s "sufficient
overloads" to avoid mangling issues in `clang-cl` builds. It is a
MSVC mangling bug that this works around.
Differential Revision: https://reviews.llvm.org/D113161
Vitaly Buka [Thu, 2 Dec 2021 04:06:31 +0000 (20:06 -0800)]
[NFC][sanitizer] Fix "not used" warning in test
Jonas Devlieghere [Thu, 2 Dec 2021 04:01:45 +0000 (20:01 -0800)]
[lldb] Fix DYLD_INSERT_LIBRARIES on AS
Don't make DYLD_INSERT_LIBRARIES conditional on the host triple
containing x86.
Philip Reames [Thu, 2 Dec 2021 03:48:21 +0000 (19:48 -0800)]
[tests] Precommit tests for writeonly argument attribute inference
Matthias Springer [Thu, 2 Dec 2021 02:57:26 +0000 (11:57 +0900)]
[mlir][linalg][bufferize] Bufferization of tensor.insert
This is a lightweight operation, useful for writing unit tests. It will be utilized for testing in subsequent commits.
Differential Revision: https://reviews.llvm.org/D114693
Kevin Athey [Thu, 2 Dec 2021 00:13:22 +0000 (16:13 -0800)]
Revert "[VE] Make VE official"
Breaks fast buildbot.
This reverts commit
a9d1d00b865ab6f6e75dcd649362a7c5cf01d168.
Daniel Sanders [Thu, 2 Dec 2021 00:15:53 +0000 (16:15 -0800)]
[unroll] Fix a functional change in an NFC patch
5c77aa2b917c [unroll] Use early return in shouldFullUnroll [nfc]
wasn't quite NFC since !(x <= y) is x > y rather than x >= y
Credit to Justin Bogner for spotting the bug
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D114894
Steven Wan [Thu, 2 Dec 2021 01:20:09 +0000 (20:20 -0500)]
Revert "[sanitizer] Add compress_stack_depot flag"
This is failing on clang-s390x-linux,
https://lab.llvm.org/buildbot/#/builders/94/builds/6748.
This reverts commit
bf18253b0ee543f98119e5ab6a5b57d05c24d314.
Julian Lettner [Thu, 2 Dec 2021 00:58:36 +0000 (16:58 -0800)]
[TSan][Darwin] Prevent inlining of functions in tests
Prevent inlining of functions so we can FileCheck the generated stack
traces.
Jonas Devlieghere [Thu, 2 Dec 2021 00:58:13 +0000 (16:58 -0800)]
[lldb] Split TestCxxChar8_t
Split TestCxxChar8_t into two parts: one that check reading variables
without a process and another part with. This allows us to skip the
former on Apple Silicon, where lack of support for chained fix-ups
causes the test to fail.
Differential revision: https://reviews.llvm.org/D114819
Fabian Wolff [Thu, 2 Dec 2021 00:34:31 +0000 (01:34 +0100)]
[clang-tidy] Use `hasCanonicalType()` matcher in `bugprone-unused-raii` check
Fixes PR#52217.
Reviewed By: simon.giesecke
Differential Revision: https://reviews.llvm.org/D113429
LLVM GN Syncbot [Thu, 2 Dec 2021 00:48:10 +0000 (00:48 +0000)]
[gn build] Port
170783f991fa
Noah Shutty [Wed, 1 Dec 2021 23:46:57 +0000 (23:46 +0000)]
[llvm] [Support] Add HTTP Client Support library.
This patch implements a small HTTP client library consisting primarily of the `HTTPRequest`, `HTTPResponseHandler`, and `BufferedHTTPResponseHandler` classes. Unit tests of the `HTTPResponseHandler` and `BufferedHTTPResponseHandler` are included.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D112751
Julian Lettner [Wed, 1 Dec 2021 23:49:40 +0000 (15:49 -0800)]
[TSan][Darwin] Mark test unsupported
Arthur Eubanks [Sat, 13 Nov 2021 00:05:31 +0000 (16:05 -0800)]
[llvm-reduce] Assert that the number of chunks does not change with reductions
Followup to D113537.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D113816
Arthur Eubanks [Fri, 12 Nov 2021 23:48:31 +0000 (15:48 -0800)]
[Cloning] Clone metadata on function declarations
Previously we missed cloning metadata on function declarations because
we don't call CloneFunctionInto() on declarations in CloneModule().
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D113812
LLVM GN Syncbot [Wed, 1 Dec 2021 23:31:02 +0000 (23:31 +0000)]
[gn build] Port
7cc2493daaf5
spupyrev [Wed, 1 Dec 2021 23:29:35 +0000 (15:29 -0800)]
profi - a flow-based profile inference algorithm: Part I (out of 3)
The benefits of sampling-based PGO crucially depends on the quality of profile
data. This diff implements a flow-based algorithm, called profi, that helps to
overcome the inaccuracies in a profile after it is collected.
Profi is an extended and significantly re-engineered classic MCMF (min-cost
max-flow) approach suggested by Levin, Newman, and Haber [2008, Complementing
missing and inaccurate profiling using a minimum cost circulation algorithm]. It
models profile inference as an optimization problem on a control-flow graph with
the objectives and constraints capturing the desired properties of profile data.
Three important challenges that are being solved by profi:
- "fixing" errors in profiles caused by sampling;
- converting basic block counts to edge frequencies (branch probabilities);
- dealing with "dangling" blocks having no samples in the profile.
The main implementation (and required docs) are in SampleProfileInference.cpp.
The worst-time complexity is quadratic in the number of blocks in a function,
O(|V|^2). However a careful engineering and extensive evaluation shows that
the running time is (slightly) super-linear. In particular, instances with
1000 blocks are solved within 0.1 second.
The algorithm has been extensively tested internally on prod workloads,
significantly improving the quality of generated profile data and providing
speedups in the range from 0% to 5%. For "smaller" benchmarks (SPEC06/17), it
generally improves the performance (with a few outliers) but extra work in
the compiler might be needed to re-tune existing optimization passes relying on
profile counts.
UPD Dec 1st 2021:
- synced the declaration and definition of the option `SampleProfileUseProfi ` to use type `cl::opt<bool`;
- added `inline` for `SampleProfileInference<BT>::findUnlikelyJumps` and `SampleProfileInference<BT>::isExit` to avoid linking problems on windows.
Reviewed By: wenlei, hoy
Differential Revision: https://reviews.llvm.org/D109860
Konstantin Boyarinov [Wed, 1 Dec 2021 23:04:17 +0000 (02:04 +0300)]
[libcxx][test][NFC] Various tests for std::vector
Add missing tests for std::vector funcionality to improve code coverage:
- Rewrote access tests to check modification of the container using
the reference returned by the non-const overload
- Added tests for reverse iterators: rbegin, rend, etc.
- Added exception test for vector::reserve
- Extended test cases for vector copy assignment
- Fixed insert_iter_value.pass.cpp to use insert overload with const
value_type& (not with value_type&& which is tested in
iter_rvalue.pass.cpp test)
Reviewed By: Quuxplusone, rarutyun, #libc
Differential Revision: https://reviews.llvm.org/D112438
Vitaly Buka [Wed, 1 Dec 2021 22:49:14 +0000 (14:49 -0800)]
[sanitizer] Implement MprotectReadOnly and MprotectNoAccess
MprotectReadOnly for Win and Fuchsia
MprotectNoAccess for Fuchsia
Nikolas Klauser [Tue, 30 Nov 2021 11:02:04 +0000 (12:02 +0100)]
[libc++] Make __wrap_iter constexpr
`__wrap_iter` is currently only constexpr if it's not a debug built, but it isn't used in a constexpr context currently. Making it always constexpr and disabling the debugging utilities at constant evaluation is more usful since it has to be always constexpr to be used in a constexpr context.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D114733
Vitaly Buka [Wed, 1 Dec 2021 20:35:29 +0000 (12:35 -0800)]
[NFC][sanitizer] constexpr in sanitizer_dense_map_info
Kazu Hirata [Wed, 1 Dec 2021 21:43:17 +0000 (13:43 -0800)]
[mlir] Remove extractVectorTypeFromShapedValue
This patch fixes the build by removing
extractVectorTypeFromShapedValue. The last use was removed Dec 1,
2021 in commit extractVectorTypeFromShapedValue.
Peter Klausler [Wed, 1 Dec 2021 00:21:11 +0000 (16:21 -0800)]
[flang] Don't close stderr in runtime (fixes STOP output)
STOP statement output was sometimes failing to appear because
the runtime flushes and shuts down open Fortran units beforehand.
But when file descriptor 2 was closed, the STOP statement output
was suppressed. The fix is to not actually close file descriptors
0-2 if they are connected to Fortran units being closed. This was
already the policy when an OPEN statement was (re-)opening such a
unit, so that logic has been pulled out into a member function and
shared with CLOSE processing.
Differential Revision: https://reviews.llvm.org/D114897
Gabor Marton [Wed, 1 Dec 2021 15:47:22 +0000 (16:47 +0100)]
[Analyzer][solver] Simplification: Do a fixpoint iteration before the eq class merge
This reverts commit
f02c5f3478318075d1a469203900e452ba651421 and
addresses the issue mentioned in D114619 differently.
Repeating the issue here:
Currently, during symbol simplification we remove the original member
symbol from the equivalence class (`ClassMembers` trait). However, we
keep the reverse link (`ClassMap` trait), in order to be able the query
the related constraints even for the old member. This asymmetry can lead
to a problem when we merge equivalence classes:
```
ClassA: [a, b] // ClassMembers trait,
a->a, b->a // ClassMap trait, a is the representative symbol
```
Now let,s delete `a`:
```
ClassA: [b]
a->a, b->a
```
Let's merge ClassA into the trivial class `c`:
```
ClassA: [c, b]
c->c, b->c, a->a
```
Now, after the merge operation, `c` and `a` are actually in different
equivalence classes, which is inconsistent.
This issue manifests in a test case (added in D103317):
```
void recurring_symbol(int b) {
if (b * b != b)
if ((b * b) * b * b != (b * b) * b)
if (b * b == 1)
}
```
Before the simplification we have these equivalence classes:
```
trivial EQ1: [b * b != b]
trivial EQ2: [(b * b) * b * b != (b * b) * b]
```
During the simplification with `b * b == 1`, EQ1 is merged with `1 != b`
`EQ1: [b * b != b, 1 != b]` and we remove the complex symbol, so
`EQ1: [1 != b]`
Then we start to simplify the only symbol in EQ2:
`(b * b) * b * b != (b * b) * b --> 1 * b * b != 1 * b --> b * b != b`
But `b * b != b` is such a symbol that had been removed previously from
EQ1, thus we reach the above mentioned inconsistency.
This patch addresses the issue by making it impossible to synthesise a
symbol that had been simplified before. We achieve this by simplifying
the given symbol to the absolute simplest form.
Differential Revision: https://reviews.llvm.org/D114887
Florian Hahn [Wed, 1 Dec 2021 21:18:19 +0000 (21:18 +0000)]
[TLI] Add memset_pattern4, memset_pattern8 lib functions.
Similar to memset_pattern16, memset_pattern4, memset_pattern8 are
available on Darwin platforms.
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/memset_pattern4.3.html
Reviewed By: ab
Differential Revision: https://reviews.llvm.org/D114881
LLVM GN Syncbot [Wed, 1 Dec 2021 20:41:34 +0000 (20:41 +0000)]
[gn build] Port
a0efb1750065
Christopher Di Bella [Wed, 1 Dec 2021 01:36:32 +0000 (01:36 +0000)]
[libcxx][modularisation] modularises <numeric> header
Differential Revision: https://reviews.llvm.org/D114836
Petar Avramovic [Wed, 1 Dec 2021 16:39:39 +0000 (17:39 +0100)]
AMDGPU/GlobalISel: Fix constant bus restriction errors for med3
Detected on targets older then gfx10 (e.g. gfx9) for constants that are
too large to be inlined (constant are sgpr by default).
In med3 combine it is expected that regbankselect maps all operands of
min/max we try to match to vgpr. However constants are mapped to sgpr
and there will be a sgpr-to-vgpr copy. Matchers look through sgpr-to-vgpr
copies and return sgpr and these break constant bus restriction.
Build med3 with all vgpr operands. Use existing sgpr-to-vgpr copies for
matched sgprs. If there is no such copy (not expected) build one.
Differential Revision: https://reviews.llvm.org/D114700
Paul Robinson [Tue, 23 Nov 2021 18:24:29 +0000 (10:24 -0800)]
[TLI checker] Update for post-commit review comments
Ignore undefined symbols; other minor code cleanup.
Replace test objects and their asm source with a yaml equivalent.
Differential Revision: https://reviews.llvm.org/D114478
Florian Hahn [Wed, 1 Dec 2021 20:30:15 +0000 (20:30 +0000)]
[DSE] Add libcall tests for functions only available on Darwin.
Add a set of tests for memset_pattern{4,8,16} variants.