Commit Graph

407855 Commits

Author SHA1 Message Date
Endre Fülöp e0321eb861 [analyzer] Enable move semantics for CallDescriptionMap
CallDescriptionMap is supposed to be immutable and opaque about the
stored CallDescriptions, but moving a CallDescriptionMap does not
violate these principles.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D115931
2021-12-19 13:02:34 +01:00
Nikita Popov 6e30cb7673 [Attributes] Add AttributeList ctor from AttributeSet (NFC)
It was already possible to create an AttributeList from an Index
and an AttributeSet. However, this would actually end up using
the implicit constructor on AttrBuilder, thus doing an unnecessary
conversion from AttributeSet to AttrBuilder to AttributeSet.
Instead we can accept the AttributeSet directly, as that is what
we need anyway.
2021-12-20 11:37:01 +01:00
Pavel Labath 6c2bf01270 [lldb/python] Fix a compile error in 7406d236d8
cannot pass object of non-trivial type
'lldb_private::python::PythonObject' through variadic function
2021-12-20 09:57:29 +01:00
Pavel Labath 7406d236d8 [lldb/python] Fix (some) dangling pointers in our glue code
This starts to fix the other half of the lifetime problems in this code
-- dangling references. SB objects created on the stack will go away
when the function returns, which is a problem if the python code they
were meant for stashes a reference to them somewhere.  Most of the time
this goes by unnoticed, as the code rarely has a reason to store these,
but in case it does, we shouldn't respond by crashing.

This patch fixes the management for a couple of SB objects (Debugger,
Frame, Thread). The SB objects are now created on the heap, and
their ownership is immediately passed on to SWIG, which will ensure they
are destroyed when the last python reference goes away. I will handle
the other objects in separate patches.

I include one test which demonstrates the lifetime issue for SBDebugger.
Strictly speaking, one should create a test case for each of these
objects and each of the contexts they are being used. That would require
figuring out how to persist (and later access) each of these objects.
Some of those may involve a lot of hoop-jumping (we can run python code
from within a frame-format string). I don't think that is
necessary/worth it since the new wrapper functions make it very hard to
get this wrong.

Differential Revision: https://reviews.llvm.org/D115925
2021-12-20 09:42:08 +01:00
LLVM GN Syncbot 3b2fd945b7 [gn build] Port 754ea6fd4d 2021-12-20 08:24:56 +00:00
Konstantin Varlamov 754ea6fd4d [libc++][ranges] Implement `uninitialized_value_construct{,_n}` and `uninitialized_fill{,_n}`.
Also:
- refactor out `__voidify`;
- use the `destroy` algorithm internally;
- refactor out helper classes used in tests for `uninitialized_*`
  algorithms.

Differential Revision: https://reviews.llvm.org/D115626
2021-12-20 00:24:27 -08:00
Kazu Hirata 32de467f85 [ObjectYAML] Use llvm::all_of (NFC) 2021-12-20 00:14:48 -08:00
Marek Kurdej 960712ccc7 [clang-format] Fix wrong indentation of namespace identifiers after a concept declaration.
Before this patch, the code:
```
template <class T>
concept a_concept = X<>;
namespace B {
struct b_struct {};
} // namespace B
```
with config:
```
NamespaceIndentation: None
```

was wrongly indented inside namespace B, giving:
```
template <class T>
concept a_concept = X<>;
namespace B {
  struct b_struct {};
} // namespace B
```

Fixes https://github.com/llvm/llvm-project/issues/50645

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D116008
2021-12-20 09:13:32 +01:00
Kazu Hirata 93d79cac2e [ARM] Use range-based for loops (NFC) 2021-12-20 00:04:53 -08:00
Mehdi Amini 6963be1276 Revert "[MLIR] rewrite AffineStructures and Presburger tests to use the parser"
This reverts commit b0e8667b1d.

ASAN/UBSAN bot is broken with this trace:

[ RUN      ] FlatAffineConstraintsTest.FindSampleTest
llvm-project/mlir/include/mlir/Support/MathExtras.h:27:15: runtime error: signed integer overflow: 1229996100002 * 809999700000 cannot be represented in type 'long'
    #0 0x7f63ace960e4 in mlir::ceilDiv(long, long) llvm-project/mlir/include/mlir/Support/MathExtras.h:27:15
    #1 0x7f63ace8587e in ceil llvm-project/mlir/include/mlir/Analysis/Presburger/Fraction.h:57:42
    #2 0x7f63ace8587e in operator* llvm-project/llvm/include/llvm/ADT/STLExtras.h:347:42
    #3 0x7f63ace8587e in uninitialized_copy<llvm::mapped_iterator<mlir::Fraction *, long (*)(mlir::Fraction), long>, long *> include/c++/v1/__memory/uninitialized_algorithms.h:36:62
    #4 0x7f63ace8587e in uninitialized_copy<llvm::mapped_iterator<mlir::Fraction *, long (*)(mlir::Fraction), long>, long *> llvm-project/llvm/include/llvm/ADT/SmallVector.h:490:5
    #5 0x7f63ace8587e in append<llvm::mapped_iterator<mlir::Fraction *, long (*)(mlir::Fraction), long>, void> llvm-project/llvm/include/llvm/ADT/SmallVector.h:662:5
    #6 0x7f63ace8587e in SmallVector<llvm::mapped_iterator<mlir::Fraction *, long (*)(mlir::Fraction), long> > llvm-project/llvm/include/llvm/ADT/SmallVector.h:1204:11
    #7 0x7f63ace8587e in mlir::FlatAffineConstraints::findIntegerSample() const llvm-project/mlir/lib/Analysis/AffineStructures.cpp:1171:27
    #8 0x7f63ae95a84d in mlir::checkSample(bool, mlir::FlatAffineConstraints const&, mlir::TestFunction) llvm-project/mlir/unittests/Analysis/AffineStructuresTest.cpp:37:23
    #9 0x7f63ae957545 in mlir::FlatAffineConstraintsTest_FindSampleTest_Test::TestBody() llvm-project/mlir/unittests/Analysis/AffineStructuresTest.cpp:222:3
2021-12-20 07:20:31 +00:00
Mehdi Amini 7f9e9c7fc3 Move getAsmBlockArgumentNames from OpAsmDialectInterface to OpAsmOpInterface
This method is more suitable as an opinterface: it seems intrinsic to
individual instances of the operation instead of the dialect.
Also remove the restriction on the interface being applicable to the entry block only.

Differential Revision: https://reviews.llvm.org/D116018
2021-12-20 07:18:01 +00:00
jacquesguan 9c11e95286 [Clang][RISCV] Fix upper bound of RISC-V V type in debug info
The UpperBound of RVV type in debug info should be elements count minus one,
as the LowerBound start from zero.

Reviewed By: HsiangKai

Differential Revision: https://reviews.llvm.org/D115430
2021-12-20 14:25:06 +08:00
Shilei Tian 0060060fef [Clang] Add helper text to fopenmp_version_EQ to make it show in help menu
For now if we check `clang --help`, it doesn't show `-fopenmp-version`. This option
should be visible to users. In addition, it is not set to hidden in
`clang/include/clang/Driver/Options.td` as well. The reason it doesn't show is
there is no corresponding helper text. This patch simply adds it.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D115998
2021-12-19 22:07:24 -05:00
Esme-Yi 18f087c21c [DebugInfo][Clang] record the access flag for class/struct/union types.
Summary: This patch records the access flag for
class/struct/union types in the clang part.

The summary of binary size change and debug info size change due to the DW_AT_accessibility attribute are as the following table. They are built with flags of `clang -O0 -g` (no -gz).

| section | before | after | change | % |
| .debug_loc | 929821 | 929821 |0|0|
|.debug_abbrev | 5885289 | 5971547 |+86258|+1.466%|
|.debug_info | 497613455 | 498122074 |+508619|+0.102%|
|.debug_ranges | 45731664 | 45731664 |0|0|
|.debug_str | 233842595 | 233839388 |-3207| -0.001%|
|.debug_line | 149773166 | 149764583 |-8583|-0.006%|
|total (debug) |933775990 |934359077|+583087 |+0.062%|

|total (binary) |1394617288 | 1395200024| +582736|+0.042%|

Reviewed By: dblaikie, shchenz

Differential Revision: https://reviews.llvm.org/D115503
2021-12-20 02:40:42 +00:00
Shao-Ce SUN 68bc6d7cae [RISCV] Remove Zvamo Extention
Based on D111692. Zvamo is not part of the 1.0 V spec. Remove it.

Reviewed By: arcbbb

Differential Revision: https://reviews.llvm.org/D115709
2021-12-20 10:28:39 +08:00
David Green 4ece4cd77e [ARM] Fold away CMP/CSINC from CMOV
This makes use of the code in D114013 to fold away unnecessary
CMPZ/CSINC starting from a CMOV, in a similar way to how we fold away
CSINV/CSINC/etc

Differential Revision: https://reviews.llvm.org/D115185
2021-12-19 21:53:50 +00:00
Aleksandr Platonov 555eacf75f [clangd] Fix undefined behavior when generating error message at rename with an invalid name
`Message()` lambda uses `Reason.Details` as an input parameter for `llvm::formatv()`, but `Reason` in `Message()` is a local object.
Return value of `llvm::formatv()` contains references to its input arguments, thus `Message()` returns an object which contains a reference to `Details` field of the local object `Reason`.
This patch fixes this behavior by passing `Reason` as a reference to `Message()` to ensure that return value of `Message()` contains references to alive object and also prevents copying of `InvalidName` structure at passing it to `makeError()`.

Provided test passes on Linux+GCC with or without this patch, but fails on Windows+VisualStudio without this patch.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D115959
2021-12-19 22:28:26 +03:00
Sanjay Patel 1965cc4695 [CodeGen] remove creation of FP cast function attribute
This is the last cleanup step resulting from D115804 .
Now that clang uses intrinsics when we're in the special FP mode,
we don't need a function attribute as an indicator to the backend.
The LLVM part of the change is in D115885.

Differential Revision: https://reviews.llvm.org/D115886
2021-12-19 11:55:00 -05:00
Sanjay Patel 5bb21cea84 [InstCombine] add tests for icmp with mul operand; NFC 2021-12-19 11:55:00 -05:00
Arjun P 4fa96b7eca [MLIR] Simplex: split some basic functionality out into a SimplexBase class
This is a purely mechanical patch moving some functionality out from the
`Simplex` class out into a `SimplexBase` class. This pavees the way for
a future patch adding support for lexicographic optimization with a class
`LexSimplex`, which will inherit from `SimplexBase`. Inheriting directly
from `Simplex` would bring many additional functions that would not work in
`LexSimplex` because it operates slighty differently from `Simplex`. So We
split out only the basic functionality it needs to inherit into `SimplexBase`.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D115831
2021-12-19 22:24:40 +05:30
bakhtiyar ec0e4545ca Make AsyncParallelForRewrite parameterizable with a cost model which drives deciding the parallelization granularity.
Reviewed By: ezhulenev, mehdi_amini

Differential Revision: https://reviews.llvm.org/D115423
2021-12-19 08:41:01 -08:00
Simon Pilgrim 47bd9ebda4 [X86][AVX512] cvt_by_vec_width - don't hardcode the schedule class. NFC.
Pull out the WriteMove schedule class into the cvt_mask_by_elt_width wrapper
2021-12-19 16:40:12 +00:00
Shivam Gupta 731bde1ed3 [DAGCombiner] Avoid combining adjacent stores at -O0 to improve debug experience
When the source has a series of assignments, users reasonably want to
have the debugger step through each one individually. Turn off the combine
for adjacent stores so we get this behavior at -O0.

Similar to D7181.

Differential Revision: https://reviews.llvm.org/D115808
2021-12-19 20:58:49 +05:30
Krasimir Georgiev 3a3fcd6a23 [clang-format] add regression tests for braced lists
Depends on https://reviews.llvm.org/D116000.

Added test cases from the comments on https://reviews.llvm.org/D114583.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D116001
2021-12-19 16:07:07 +01:00
Krasimir Georgiev d96bf6ea46 Revert "[clang-format] Adjust braced list detection"
It appears that this regressed the formatting of initializer lists in some
cases, see comments on https://reviews.llvm.org/D114583. I'll follow-up
by adding regression tests for these.

This reverts commit c41b3b0fa0.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D116000
2021-12-19 16:04:42 +01:00
Christian Ulmann b0e8667b1d [MLIR] rewrite AffineStructures and Presburger tests to use the parser
This commit rewrites most existing unittests involving FlatAffineConstraints to use the parsing utility. This helps to make the tests more understandable.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D115920
2021-12-19 19:26:47 +05:30
Krasimir Georgiev eeed24e766 [Bazel] update build files for
65d7fd0239
2021-12-19 14:37:05 +01:00
Simon Pilgrim efec3a26b4 [DAG] visitADDSAT/visitSUBSAT - merge scalar/vector canonicalization and constant folding.
Match order of most of the other integer opcode combines
2021-12-19 13:19:40 +00:00
Simon Pilgrim 67cce1ceee [X86] Adjust some IceLake fp shuffle schedule classes (PR48110)
The IceLake scheduler model is still mainly a copy of the SkylakeServer model.

This patch adjusts the fp shuffle classes to account for most instructions now working on Port 1 as well as Port 5.

This is based off Agner + uops.info as well as the PR48110 report.

Differential Revision: https://reviews.llvm.org/D115752
2021-12-19 13:00:11 +00:00
Simon Pilgrim c1340b9e78 [DAG] Improve FMINNUM/FMAXNUM/FMINIMUM/FMAXIMUM constant folding
Merge the node combines into a common DAGCombiner::visitFMinMax (like we do for IMINMAX).

Move the constant folding into SelectionDAG::foldConstantFPMath.

This allows us to fold the vecreduce-propagate-sd-flags.ll test as it reduces constants - so I've refactored it to take variables instead.

Differential Revision: https://reviews.llvm.org/D115952
2021-12-19 11:45:51 +00:00
Shilei Tian 56b2b1b8fd [NFC][Clang] Remove trailing spaces in `clang/include/clang/Driver/Options.td` 2021-12-18 21:32:49 -05:00
Cyndy Ishida 4a878c14c4 [llvm-tapi-diff] rename tests for clarity, NFC 2021-12-18 16:42:45 -08:00
Craig Topper 683cbc12b3 [RISCV] Remove stale comments from tests. NFC
The tests no longer generate the instructions that are mentioned
in the comments.
2021-12-18 13:36:03 -08:00
Jakub Kuderski 1e93f3895f [AMDGPU] Use enum_seq to iterator over InstCounterTypes. NFC.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D115900
2021-12-18 16:07:28 -05:00
Jakub Kuderski d9ae852fcc [AMDGPU] Fix data race in SIInsertWaitcnts
The race condition happened when two pass managers ran on two different modules but modified/read the global variables.

To address this, I considered using singletons and freestanding functions to allow getting/setting `HardwareLimits` and `RegisterEncoding`, or making it local to the pass. I chose the latter and made it a member of `WaitcntsBrackets`, to minimizes the amount of global state.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D115896
2021-12-18 16:03:09 -05:00
Craig Topper 2da5af16ac [RISCV] Rename a Zfh and put it in the same order as the same test for F and D. NFC
Drop stale FIXME.
2021-12-18 12:58:35 -08:00
Michael Berg f95ee6074a [RISCV] Add target specific loop unrolling and peeling preferences
Both these preference helper functions have initial support with
this change. The loop unrolling preferences are set with initial
settings to control thresholds, size and attributes of loops to
unroll with some tuning done.  The peeling preferences may need
some tuning as well as the initial support looks much like what
other architectures utilize.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D113798
2021-12-18 12:54:50 -08:00
Mehdi Amini cc4781464f Fix warning "comparison of integers of different signs" (NFC) 2021-12-18 20:38:32 +00:00
Nikita Popov aeb36ae0f4 Revert "[ConstantFolding] Unify handling of load from uniform value"
This reverts commit 9fd4f80e33.

This breaks SingleSource/Regression/C/gcc-c-torture/execute/pr19687.c
in test-suite. Either the test is incorrect, or clang is generating
incorrect union initialization code. I've submitted
https://reviews.llvm.org/D115994 to fix the test, assuming my
interpretation is correct. Reverting this in the meantime as it
may take some time to resolve.
2021-12-18 20:46:52 +01:00
Martin Storsjö 2ec75a0869 [lit] Flush stderr manually on Windows after printing messages
When run in a git bash terminal, sys.stderr isn't flushed implicitly
after printing each line. Manually flush it after each printout,
to avoid getting broken/misordered output.

A similar fix had been done in the old libcxx test config, committed
as part of 7e3ee09ad2 / D28725; this
generalizes the fix, making it available in the new libcxx test
configs too, and for any other test that uses lit_config.note().

Differential Revision: https://reviews.llvm.org/D115761
2021-12-18 21:41:40 +02:00
Cyndy Ishida 982604cc08 [llvm-tapi-diff] Replicate diff utility error handling
For scripting purposes, use different error code for cases that aren't a
result of different tbd files, e.g. bad input like a path to a broken
symlink. This behaves more similiarly to how the unix `diff` command behaves.
This also includes minor tweaks on error messages.

Reviewed By: ributzka, JDevlieghere

Differential Revision: https://reviews.llvm.org/D115905
2021-12-18 09:54:37 -08:00
Ricky Zhou 9927a06f74 [AA] Handle callbr instructions in alias analysis
Before this change, AAResults::getModRefInfo() was missing a case for
callbr instructions (asm goto), which may read/write memory. In PR52735,
this led to a miscompile where a load was incorrect eliminated.

Add this missing case, as well as an assert verifying that all
memory-accessing instructions are handled properly.

Fixes #52735.

Differential Revision: https://reviews.llvm.org/D115992
2021-12-18 18:49:17 +01:00
Nikita Popov 474b20b450 [LLParser] Avoid unnecessary AttrBuilder<->AttributeSet roundtrip (NFC)
This was creating an AttributeSet from an AttrBuilder, and then
(implicitly) constructing an AttrBuilder from the AttributeSet,
and then the method would internally convert that back into an
AttributeSet. Instead, directly pass the AttrBuilder.
2021-12-18 17:57:15 +01:00
Matt Arsenault 37a203f63e AMDGPU: Regenerate more mir test checks with -NEXT 2021-12-18 11:38:30 -05:00
Matt Arsenault 591371f7df AMDGPU: Regenerate some mir test checks with -NEXT 2021-12-18 10:46:15 -05:00
mydeveloperday 3362fa59ec [clang-format] extern with new line brace without indentation
https://github.com/llvm/llvm-project/issues/49804

Interaction between IndentExternBlock and AfterExternBlock means you cannot have AfterExternBlock = true and IndentExternBlock = NoIndent/Indent

This patch resolves that
```
BraceWrapping:
  AfterExternBlock: true
IndentExternBlock: AfterExternBlock
```
Fixes: #49804

Reviewed By: HazardyKnusperkeks, curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D115879
2021-12-18 14:10:14 +00:00
Konstantin Boyarinov ff94bd1bc9 [libcxx][test][NFC] noexcept tests for std::array
Minor change - add tests that std::array methods (data, (c/r)begin,
(c/r)end) are noexcept

Reviewed By: ldionne, rarutyun, #libc

Differential Revision: https://reviews.llvm.org/D115717
2021-12-18 16:06:56 +03:00
mydeveloperday 936a67f089 [clang-format] Extra spaces surrounding arrow in templated member call in variable decl
https://github.com/llvm/llvm-project/issues/43196

Fixes #43196

-> is incorrectly interpreted as a TrailingReturnArrow if we've seen an auto

```
auto p = new A;
auto x = p -> foo<1>();
```

Reviewed By: curdeius

Differential Revision: https://reviews.llvm.org/D115903
2021-12-18 11:38:29 +00:00
Nikita Popov 1ba99eaf70 Revert "[DSE] Remove calls with known writes to dead memory"
This reverts commit a8a51fe556.

This breaks the strncpy-overflow.cpp test case.
2021-12-18 09:23:41 +01:00
Fangrui Song 3aae04c744 [ELF] Parallelize MergeNoTailSection::writeTo
With this patch, writing .debug_str is significantly for a program with
1.5G .debug_str:

* .debug_info 1.22s
* .debug_str 2.57s decreases to 0.66
2021-12-17 23:30:42 -08:00