Commit Graph

404603 Commits

Author SHA1 Message Date
Brian Cain 2d0aede515 [libcxx] Change the type of __size to correspond
__size was declared as unsigned which was compatible with
2021-11-12 08:30:38 -08:00
Joel E. Denny c9dfe322ee [OpenMP] Fix main thread barrier for Pascal and amdgpu
Fixes what's left of https://bugs.llvm.org/show_bug.cgi?id=51781.

Reviewed By: jdoerfert, JonChesterfield, tianshilei1992

Differential Revision: https://reviews.llvm.org/D113602
2021-11-12 11:18:45 -05:00
Florian Hahn 30ebdf8a6d
[LV] Precommit test case from PR52485. 2021-11-12 16:09:19 +00:00
Jay Foad a70bbb5f7a [AMDGPU] Simplify 64-bit division/remainder expansion
The old expansion open-coded a 64-bit addition in a strange way, by
adding the high parts *without* carry-in from the low part, and then
adding the carry back in later on. Fixing this saves a couple of
instructions and makes the code much easier to understand.

Differential Revision: https://reviews.llvm.org/D113679
2021-11-12 15:48:41 +00:00
Zarko Todorovski 05f34ffa21 [clang] Inclusive language: change instances of blacklist/whitelist to allowlist/ignorelist
Change the error message to use ignorelist, and changed some variable and function
names in related code and test.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D113189
2021-11-12 15:46:16 +00:00
Kazu Hirata 99d5cbbd7e [CodeGen] Use SDNode::uses (NFC) 2021-11-12 07:33:29 -08:00
Roman Lebedev 8d35c054e3
[NFC][SROA] Add more tests for non-capturing pointer-escaping calls 2021-11-12 18:08:39 +03:00
Nicolas Vasilache 0e185ceafb [mlir] NFC - Address post-commit comments
Address comments from https://reviews.llvm.org/D113745
which landed as aa37318067
2021-11-12 15:01:29 +00:00
Justas Janickas 388e8110db [OpenCL] Constructor address space test adjusted for C++ for OpenCL 2021
Reuses C++ for OpenCL constructor address space test so that it
supports optional generic address spaces in version 2021.

Differential Revision: https://reviews.llvm.org/D110184
2021-11-12 14:31:50 +00:00
Alexey Bataev 1513ca339b [Feature][NFC]Improve test checks to avoid possible false postitive test
failures, NFC.
2021-11-12 06:28:44 -08:00
Kerry McLaughlin 7647822156 [AArch64][SVE] Remove i1 type from isElementTypeLegalForScalableVector
`collectElementTypesForWidening` collects the types of load, store and
reduction Phis in a loop. These types are later checked using
`isElementTypeLegalForScalableVector` to prevent vectorisation of
loops with instruction types that are unsupported.

This patch removes i1 from the list of types supported for scalable
vectors. This fixes an assert ("Cannot yet scalarize uniform stores") in
`setCostBasedWideningDecision` when we have a loop containing a uniform
i1 store and a scalable VF, which we cannot create a scatter for.

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D113680
2021-11-12 14:24:38 +00:00
Alexey Bataev 352c46e707 [SLP]Improve vectorization of split loads.
Need to fix ther cost estimation for split loads, since we look at the
subregs already, no need to permute them, need just to estimate
subregister insert, if it is smaller than the real register. Also, using
split loads, it might be profitable already to vectorize smaller trees
with gathering of the loads.

Differential Revision: https://reviews.llvm.org/D107188
2021-11-12 06:13:22 -08:00
Simon Pilgrim 59087dce3b [X86] combineX86ShufflesConstants - constant fold from target shuffles unless optsize = true
Currently we only constant fold target shuffles if any of the sources has one use, or it would remove a variable shuffle mask - the aim being to avoid constant pool bloat.

This patch proposes we should constant fold by default and only limit this if optsize is enabled - I've added a basic test for this in vector-mul.ll (the pmuludq case is by far the most common), I can add other specific test cases if people need them.

This should permit further constant folding, break some instruction dependencies and help reduce shuffle port pressure.

Differential Revision: https://reviews.llvm.org/D113748
2021-11-12 14:02:43 +00:00
Kadir Cetinkaya ebda5e1e52
[clangd] Fix use-after-free in test 2021-11-12 14:50:23 +01:00
Dmitry Vyukov ac95b8d954 tsan: new runtime (v3)
This change switches tsan to the new runtime which features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutimes

Depends on D112602.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112603
2021-11-12 14:31:49 +01:00
Raphael Isemann cef1e07cc6 [lldb] Fix that the embedded Python REPL crashes if it receives SIGINT
When LLDB receives a SIGINT while running the embedded Python REPL it currently
just crashes in `ScriptInterpreterPythonImpl::Interrupt` with an error such as
the one below:

```

Fatal Python error: PyThreadState_Get: the function must be called with the GIL
held, but the GIL is released (the current Python thread state is NULL)

```

The faulty code that causes this error is this part of `ScriptInterpreterPythonImpl::Interrupt`:
```
    PyThreadState *state = PyThreadState_GET();
    if (!state)
      state = GetThreadState();
    if (state) {
      long tid = state->thread_id;
      PyThreadState_Swap(state);
      int num_threads = PyThreadState_SetAsyncExc(tid, PyExc_KeyboardInterrupt);
```

The obvious fix I tried is to just acquire the GIL before this code is running
which fixes the crash but the `KeyboardInterrupt` we want to raise immediately
is actually just queued and would only be raised once the next line of input has
been parsed (which e.g. won't interrupt Python code that is currently waiting on
a timer or IO from what I can see). Also none of the functions we call here is
marked as safe to be called from a signal handler from what I can see, so we
might still end up crashing here with some bad timing.

Python 3.2 introduced `PyErr_SetInterrupt` to solve this and the function takes
care of all the details and avoids doing anything that isn't safe to do inside a
signal handler. The only thing we need to do is to manually setup our own fake
SIGINT handler that behaves the same way as the standalone Python REPL signal
handler (which raises a KeyboardInterrupt).

From what I understand the old code used to work with Python 2 so I kept the old
code around until we officially drop support for Python 2.

There is a small gap here with Python 3.0->3.1 where we might still be crashing,
but those versions have reached their EOL more than a decade ago so I think we
don't need to bother about them.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D104886
2021-11-12 14:19:15 +01:00
Sanjay Patel bf5748a1af [x86] fold vector (X > -1) & Y to shift+andn
and (pcmpgt X, -1), Y --> pandn (vsrai X, BitWidth-1), Y

This avoids the -1 constant vector in favor of an arithmetic shift
instruction if it exists (the ISA is still not complete after all
these years...).

We catch this pattern late in combining by matching PCMPGT, so it
should not interfere with more general folds.

Differential Revision: https://reviews.llvm.org/D113603
2021-11-12 08:17:46 -05:00
Jan Svoboda ab6ef58727 [clang] NFC: Format a loop in CompilerInstance
This code will be moved to a separate function in a future patch. Reformatting now to prevent a bunch of clang-format complains on Phabricator.
2021-11-12 14:16:06 +01:00
Nicolas Vasilache 99ff697bf7 [mlir][Vector] Add support for 1D depthwise conv vectorization
At this time the 2 flavors of conv are a little too different to allow significant code sharing and other will likely come up.
so we go the easy route first by duplicating and adapting.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D113758
2021-11-12 13:14:09 +00:00
Dmitry Vyukov 19c1d03f97 tsan: ignore some errors in the clone_setns test
Some bots failed with:
unshare failed: 1
https://lab.llvm.org/buildbot/#/builders/70/builds/14101

Look only for the target EINVAL error.

Differential Revision: https://reviews.llvm.org/D113759
2021-11-12 14:12:36 +01:00
Phoebe Wang 4721ee7029 Add nounwind for tests. NFC 2021-11-12 21:09:05 +08:00
Kadir Cetinkaya 7d668ae38d
[clangd] Mark macros from preamble for code completion
If the main file is a header, mark the marcos defined in its preamble
section as code-completion ready.

Fixes https://github.com/clangd/clangd/issues/921.

Differential Revision: https://reviews.llvm.org/D113555
2021-11-12 14:01:14 +01:00
Adrian Kuegel 1d7fdbbc18 Revert "[clang] retain type sugar in auto / template argument deduction"
This reverts commit 9b6036deed.
Breaks two libc++ tests.
2021-11-12 13:21:59 +01:00
Adrian Kuegel c30c37c00a Revert "[lldb] fix test expectation broken by clang fix at D110216"
This reverts commit 5508595217.
The patch it depends on is reverted.
2021-11-12 13:21:30 +01:00
Florian Hahn 819bca9b90
[SCEV] Use APIntOps::umin to select best max BC count (NFC).
Suggested in D102267, but I missed this in the committed version.
2021-11-12 12:20:01 +00:00
Florian Hahn 69c1cbe20f
[SCEV] Add test case where applying zext info pessimizes BTC.
Add an additional test case for D113578.
2021-11-12 12:19:35 +00:00
Dmitry Vyukov e91595bf94 tsan: don't start background thread after clone
Start the background thread only after fork, but not after clone.
For fork we did this always and it's known to work (or user code has adopted).
But if we do this for the new clone interceptor some code (sandbox2) fails.
So model we used to do for years and don't start the background thread after clone.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D113744
2021-11-12 12:58:49 +01:00
Nicolas Vasilache aa37318067 [mlir][Linalg] Rewrite DownscaleSizeOneWindowed2DConvolution to use rank-reducing insert/extract slices.
This rewriting enables better bufferization and canonicalizations.

Differential Revision: https://reviews.llvm.org/D113745
2021-11-12 11:57:12 +00:00
Dmitry Vyukov a6728382c6 tsan: fix XMM register corruption in hacky call
The compiler does not recognize HACKY_CALL as a call
(we intentionally hide it from the compiler so that it can
compile non-leaf functions as leaf functions).
To compensate for that hacky call thunk saves and restores
all caller-saved registers. However, it saves only
general-purposes registers and does not save XMM registers.
This is a latent bug that was masked up until a recent "NFC" commit
d736002e90 ("tsan: move memory access functions to a separate file"),
which allowed more inlining and exposed the 10-year bug.
Save and restore caller-saved XMM registers (all) as well.

Currently the bug manifests as e.g. frexp interceptor messes the
return value and the added test fails with:
  i=8177 y=0.000000 exp=4

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D113742
2021-11-12 12:53:47 +01:00
Tomasz Miąsko c3e07df607 [llvm-nm] Demangle Rust symbols
Add support for demangling Rust v0 symbols to llvm-nm by reusing
nonMicrosoftDemangle which supports both Itanium and Rust mangling.

Reviewed By: dblaikie, jhenderson

Differential Revision: https://reviews.llvm.org/D111937
2021-11-12 12:46:59 +01:00
Jan Svoboda c57ca33547 [clang] NFC: Use range-based for loop 2021-11-12 12:13:12 +01:00
Jan Svoboda 269baa7bfc [clang] NFC: Remove benign condition 2021-11-12 12:13:12 +01:00
Salman Javed 9089a1dff0 [clang-tidy] Re-apply 0076957 with fix for failing ASan tests
Re-apply "Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
with fixes for the failing ASan tests.

This reverts commit 74add1b6d6.
2021-11-13 00:01:12 +13:00
Gabor Marton 01c9700aaa [analyzer][solver] Remove reference to RangedConstraintManager
We no longer need a reference to RangedConstraintManager, we call top
level `State->assume` functions.

Differential Revision: https://reviews.llvm.org/D113261
2021-11-12 11:44:49 +01:00
Gabor Marton 806329da07 [analyzer][solver] Iterate to a fixpoint during symbol simplification with constants
D103314 introduced symbol simplification when a new constant constraint is
added. Currently, we simplify existing equivalence classes by iterating over
all existing members of them and trying to simplify each member symbol with
simplifySVal.

At the end of such a simplification round we may end up introducing a
new constant constraint. Example:
```
  if (a + b + c != d)
    return;
  if (c + b != 0)
    return;
  // Simplification starts here.
  if (b != 0)
    return;
```
The `c == 0` constraint is the result of the first simplification iteration.
However, we could do another round of simplification to reach the conclusion
that `a == d`. Generally, we could do as many new iterations until we reach a
fixpoint.

We can reach to a fixpoint by recursively calling `State->assume` on the
newly simplified symbol. By calling `State->assume` we re-ignite the
whole assume machinery (along e.g with adjustment handling).

Why should we do this? By reaching a fixpoint in simplification we are capable
of discovering infeasible states at the moment of the introduction of the
**first** constant constraint.
Let's modify the previous example just a bit, and consider what happens without
the fixpoint iteration.
```
  if (a + b + c != d)
    return;
  if (c + b != 0)
    return;
  // Adding a new constraint.
  if (a == d)
    return;
  // This brings in a contradiction.
  if (b != 0)
    return;
  clang_analyzer_warnIfReached(); // This produces a warning.
              // The path is already infeasible...
  if (c == 0) // ...but we realize that only when we evaluate `c == 0`.
    return;
```
What happens currently, without the fixpoint iteration? As the inline comments
suggest, without the fixpoint iteration we are doomed to realize that we are on
an infeasible path only after we are already walking on that. With fixpoint
iteration we can detect that before stepping on that. With fixpoint iteration,
the `clang_analyzer_warnIfReached` does not warn in the above example b/c
during the evaluation of `b == 0` we realize the contradiction. The engine and
the checkers do rely on that either `assume(Cond)` or `assume(!Cond)` should be
feasible. This is in fact assured by the so called expensive checks
(LLVM_ENABLE_EXPENSIVE_CHECKS). The StdLibraryFuncionsChecker is notably one of
the checkers that has a very similar assertion.

Before this patch, we simply added the simplified symbol to the equivalence
class. In this patch, after we have added the simplified symbol, we remove the
old (more complex) symbol from the members of the equivalence class
(`ClassMembers`). Removing the old symbol is beneficial because during the next
iteration of the simplification we don't have to consider again the old symbol.

Contrary to how we handle `ClassMembers`, we don't remove the old Sym->Class
relation from the `ClassMap`. This is important for two reasons: The
constraints of the old symbol can still be found via it's equivalence class
that it used to be the member of (1). We can spare one removal and thus one
additional tree in the forest of `ClassMap` (2).

Performance and complexity: Let us assume that in a State we have N non-trivial
equivalence classes and that all constraints and disequality info is related to
non-trivial classes. In the worst case, we can simplify only one symbol of one
class in each iteration. The number of symbols in one class cannot grow b/c we
replace the old symbol with the simplified one. Also, the number of the
equivalence classes can decrease only, b/c the algorithm does a merge operation
optionally. We need N iterations in this case to reach the fixpoint. Thus, the
steps needed to be done in the worst case is proportional to `N*N`. Empirical
results (attached) show that there is some hardly noticeable run-time and peak
memory discrepancy compared to the baseline. In my opinion, these differences
could be the result of measurement error.
This worst case scenario can be extended to that cases when we have trivial
classes in the constraints and in the disequality map are transforming to such
a State where there are only non-trivial classes, b/c the algorithm does merge
operations. A merge operation on two trivial classes results in one non-trivial
class.

Differential Revision: https://reviews.llvm.org/D106823
2021-11-12 11:44:49 +01:00
Neubauer, Sebastian d1f45ed58f [AMDGPU][NFC] Fix typos
Differential Revision: https://reviews.llvm.org/D113672
2021-11-12 11:37:21 +01:00
Florian Hahn 5dfe60d171
[SCEV] Add tests where guards limit both %n and (zext %n).
Suggested in D113577.
2021-11-12 10:31:35 +00:00
Kiran Chandramohan aa26119b82 [Flang] Add type conversion for FIR integer kind
Convert fir.int<kind> to their llvm equivalent type

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: clementval, awarzynski

Differential Revision: https://reviews.llvm.org/D113660

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2021-11-12 10:15:21 +00:00
Adrian Kuegel bb4934601d Revert "Implement target_clones multiversioning"
This reverts commit 9deab60ae7.
There is a possibly unintended semantic change.
2021-11-12 11:05:58 +01:00
Salman Javed 379935e5a4 Re-land commit 735e433 after fixing buildbot issue
This reverts commit d73e27d.
2021-11-12 22:59:50 +13:00
Kiran Chandramohan 2b247941ca [Flang] Add type conversion for FIR heap type
Convert fir.heap type to its llvm equivalent type (llvm.ptr)

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D113670

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2021-11-12 09:49:54 +00:00
Salman Javed d73e27d91f Revert "Make minor fixes to docs based on post-commit review of commit 5de69e1"
Sphinx buildbot failing.
This reverts commit 735e4332e2.
2021-11-12 22:42:38 +13:00
Florian Hahn 9c00afe926
[DSE] Add test case with multiple inbounds stores, followed by OOB.
This patch extends the existing out-of-bounds store tests with a case
with a bigger object and multiple inbounds stores, followed by an OOB
store. The OOB store is not used to remove the inbounds stores in this
case at the moment.
2021-11-12 09:40:03 +00:00
Salman Javed 735e4332e2 Make minor fixes to docs based on post-commit review of commit 5de69e1
- Jaro–Winkler and Sørensen–Dice should use en-dashes not regular
  dashes. In reStructuredText this is typed as `--`.
- Letters at the beginning of a sentence should be capitalized.
2021-11-12 22:39:16 +13:00
Jean Perier 1fda7baf8a [flang] fix unused variable warning from D113659 2021-11-12 09:34:02 +01:00
Jean Perier 6544d9a4a0 [flang] Fix vector cshift runtime with non zero lower bounds
The source index should not be compared to zero after applying the
shift with the modulo, it must be compared to the lower bound.
Otherwise, the extent is not added in case it should and the computed
source index may be less than the lower bound, causing invalid results.

Differential Revision: https://reviews.llvm.org/D113659
2021-11-12 09:26:08 +01:00
Vitaly Buka 64d4420824 [NFC][lsan] Simplify root_regions initialization 2021-11-11 23:42:46 -08:00
Simon Moll 496e7f330c [VE] Disable incompatible compiler-rt tests
Some compiler-rt tests are inherently incompatible with VE because..

* No consistent denormal support on VE. We skip denormal fp inputs in builtin tests.
* `madvise` unsupported on VE.
* Instruction alignment requirements.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D113093
2021-11-12 08:40:03 +01:00
Mehdi Amini f5f11e6b16 Add a cppType string in AttrDef to make it possible to use them as parameters in other attributes
Differential Revision: https://reviews.llvm.org/D113737
2021-11-12 07:26:06 +00:00
Simon Moll 751aa6c280 [VE][NFCi] Remove unused tablegen parameters
TableGen has started warning about unused template parameters in the isel patterns.  Remove those.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D113675
2021-11-12 08:19:50 +01:00