platform/upstream/llvm.git
2 years ago[ObjectYAML] Use llvm::all_of (NFC)
Kazu Hirata [Mon, 20 Dec 2021 08:14:45 +0000 (00:14 -0800)]
[ObjectYAML] Use llvm::all_of (NFC)

2 years ago[clang-format] Fix wrong indentation of namespace identifiers after a concept declara...
Marek Kurdej [Mon, 20 Dec 2021 08:12:35 +0000 (09:12 +0100)]
[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

2 years ago[ARM] Use range-based for loops (NFC)
Kazu Hirata [Mon, 20 Dec 2021 08:04:52 +0000 (00:04 -0800)]
[ARM] Use range-based for loops (NFC)

2 years agoRevert "[MLIR] rewrite AffineStructures and Presburger tests to use the parser"
Mehdi Amini [Mon, 20 Dec 2021 07:20:31 +0000 (07:20 +0000)]
Revert "[MLIR] rewrite AffineStructures and Presburger tests to use the parser"

This reverts commit b0e8667b1dbdb45bdc2738e4bec1c69fe3790a27.

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

2 years agoMove getAsmBlockArgumentNames from OpAsmDialectInterface to OpAsmOpInterface
Mehdi Amini [Mon, 20 Dec 2021 07:17:26 +0000 (07:17 +0000)]
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

2 years ago[Clang][RISCV] Fix upper bound of RISC-V V type in debug info
jacquesguan [Mon, 20 Dec 2021 06:25:06 +0000 (14:25 +0800)]
[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

2 years ago[Clang] Add helper text to fopenmp_version_EQ to make it show in help menu
Shilei Tian [Mon, 20 Dec 2021 03:07:15 +0000 (22:07 -0500)]
[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

2 years ago[DebugInfo][Clang] record the access flag for class/struct/union types.
Esme-Yi [Mon, 20 Dec 2021 02:40:42 +0000 (02:40 +0000)]
[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

2 years ago[RISCV] Remove Zvamo Extention
Shao-Ce SUN [Tue, 14 Dec 2021 09:33:51 +0000 (17:33 +0800)]
[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

2 years ago[ARM] Fold away CMP/CSINC from CMOV
David Green [Sun, 19 Dec 2021 21:53:50 +0000 (21:53 +0000)]
[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

2 years ago[clangd] Fix undefined behavior when generating error message at rename with an inval...
Aleksandr Platonov [Sun, 19 Dec 2021 19:23:45 +0000 (22:23 +0300)]
[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

2 years ago[CodeGen] remove creation of FP cast function attribute
Sanjay Patel [Sun, 19 Dec 2021 16:53:56 +0000 (11:53 -0500)]
[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

2 years ago[InstCombine] add tests for icmp with mul operand; NFC
Sanjay Patel [Fri, 17 Dec 2021 21:03:08 +0000 (16:03 -0500)]
[InstCombine] add tests for icmp with mul operand; NFC

2 years ago[MLIR] Simplex: split some basic functionality out into a SimplexBase class
Arjun P [Thu, 16 Dec 2021 12:41:31 +0000 (18:11 +0530)]
[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

2 years agoMake AsyncParallelForRewrite parameterizable with a cost model which drives deciding...
bakhtiyar [Sun, 19 Dec 2021 16:35:37 +0000 (08:35 -0800)]
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

2 years ago[X86][AVX512] cvt_by_vec_width - don't hardcode the schedule class. NFC.
Simon Pilgrim [Sun, 19 Dec 2021 16:40:06 +0000 (16:40 +0000)]
[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

2 years ago[DAGCombiner] Avoid combining adjacent stores at -O0 to improve debug experience
Shivam Gupta [Sun, 19 Dec 2021 15:27:55 +0000 (20:57 +0530)]
[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

2 years ago[clang-format] add regression tests for braced lists
Krasimir Georgiev [Sun, 19 Dec 2021 15:06:55 +0000 (16:06 +0100)]
[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

2 years agoRevert "[clang-format] Adjust braced list detection"
Krasimir Georgiev [Sun, 19 Dec 2021 15:04:20 +0000 (16:04 +0100)]
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 c41b3b0fa0f4f70aad8deaf48bcd42a04385066c.

Reviewed By: MyDeveloperDay

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

2 years ago[MLIR] rewrite AffineStructures and Presburger tests to use the parser
Christian Ulmann [Sun, 19 Dec 2021 13:56:25 +0000 (19:26 +0530)]
[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

2 years ago[Bazel] update build files for
Krasimir Georgiev [Sun, 19 Dec 2021 13:37:05 +0000 (14:37 +0100)]
[Bazel] update build files for
https://github.com/llvm/llvm-project/commit/65d7fd0239bf301c5dcaa26ed474200845966136

2 years ago[DAG] visitADDSAT/visitSUBSAT - merge scalar/vector canonicalization and constant...
Simon Pilgrim [Sun, 19 Dec 2021 13:19:40 +0000 (13:19 +0000)]
[DAG] visitADDSAT/visitSUBSAT - merge scalar/vector canonicalization and constant folding.

Match order of most of the other integer opcode combines

2 years ago[X86] Adjust some IceLake fp shuffle schedule classes (PR48110)
Simon Pilgrim [Sun, 19 Dec 2021 13:00:11 +0000 (13:00 +0000)]
[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

2 years ago[DAG] Improve FMINNUM/FMAXNUM/FMINIMUM/FMAXIMUM constant folding
Simon Pilgrim [Sat, 18 Dec 2021 22:28:53 +0000 (22:28 +0000)]
[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

2 years ago[NFC][Clang] Remove trailing spaces in `clang/include/clang/Driver/Options.td`
Shilei Tian [Sun, 19 Dec 2021 02:32:49 +0000 (21:32 -0500)]
[NFC][Clang] Remove trailing spaces in `clang/include/clang/Driver/Options.td`

2 years ago[llvm-tapi-diff] rename tests for clarity, NFC
Cyndy Ishida [Sun, 19 Dec 2021 00:42:00 +0000 (16:42 -0800)]
[llvm-tapi-diff] rename tests for clarity, NFC

2 years ago[RISCV] Remove stale comments from tests. NFC
Craig Topper [Sat, 18 Dec 2021 21:35:18 +0000 (13:35 -0800)]
[RISCV] Remove stale comments from tests. NFC

The tests no longer generate the instructions that are mentioned
in the comments.

2 years ago[AMDGPU] Use enum_seq to iterator over InstCounterTypes. NFC.
Jakub Kuderski [Sat, 18 Dec 2021 21:07:03 +0000 (16:07 -0500)]
[AMDGPU] Use enum_seq to iterator over InstCounterTypes. NFC.

Reviewed By: arsenm

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

2 years ago[AMDGPU] Fix data race in SIInsertWaitcnts
Jakub Kuderski [Sat, 18 Dec 2021 21:02:45 +0000 (16:02 -0500)]
[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

2 years ago[RISCV] Rename a Zfh and put it in the same order as the same test for F and D. NFC
Craig Topper [Sat, 18 Dec 2021 20:53:24 +0000 (12:53 -0800)]
[RISCV] Rename a Zfh and put it in the same order as the same test for F and D. NFC

Drop stale FIXME.

2 years ago[RISCV] Add target specific loop unrolling and peeling preferences
Michael Berg [Sat, 18 Dec 2021 02:31:29 +0000 (18:31 -0800)]
[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

2 years agoFix warning "comparison of integers of different signs" (NFC)
Mehdi Amini [Sat, 18 Dec 2021 20:38:06 +0000 (20:38 +0000)]
Fix warning "comparison of integers of different signs" (NFC)

2 years agoRevert "[ConstantFolding] Unify handling of load from uniform value"
Nikita Popov [Sat, 18 Dec 2021 19:40:42 +0000 (20:40 +0100)]
Revert "[ConstantFolding] Unify handling of load from uniform value"

This reverts commit 9fd4f80e33a4ae4567483819646650f5735286e2.

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.

2 years ago[lit] Flush stderr manually on Windows after printing messages
Martin Storsjö [Thu, 9 Dec 2021 21:40:25 +0000 (23:40 +0200)]
[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 7e3ee09ad24cbca3ea7687c50b53be5269127fb1 / 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

2 years ago[llvm-tapi-diff] Replicate diff utility error handling
Cyndy Ishida [Sat, 18 Dec 2021 17:42:40 +0000 (09:42 -0800)]
[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

2 years ago[AA] Handle callbr instructions in alias analysis
Ricky Zhou [Sat, 18 Dec 2021 17:49:17 +0000 (18:49 +0100)]
[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

2 years ago[LLParser] Avoid unnecessary AttrBuilder<->AttributeSet roundtrip (NFC)
Nikita Popov [Sat, 18 Dec 2021 16:55:39 +0000 (17:55 +0100)]
[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.

2 years agoAMDGPU: Regenerate more mir test checks with -NEXT
Matt Arsenault [Sat, 18 Dec 2021 16:36:43 +0000 (11:36 -0500)]
AMDGPU: Regenerate more mir test checks with -NEXT

2 years agoAMDGPU: Regenerate some mir test checks with -NEXT
Matt Arsenault [Sat, 18 Dec 2021 15:07:00 +0000 (10:07 -0500)]
AMDGPU: Regenerate some mir test checks with -NEXT

2 years ago[clang-format] extern with new line brace without indentation
mydeveloperday [Sat, 18 Dec 2021 14:10:14 +0000 (14:10 +0000)]
[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

2 years ago[libcxx][test][NFC] noexcept tests for std::array
Konstantin Boyarinov [Sat, 18 Dec 2021 13:05:16 +0000 (16:05 +0300)]
[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

2 years ago[clang-format] Extra spaces surrounding arrow in templated member call in variable...
mydeveloperday [Fri, 17 Dec 2021 18:33:17 +0000 (18:33 +0000)]
[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

2 years agoRevert "[DSE] Remove calls with known writes to dead memory"
Nikita Popov [Sat, 18 Dec 2021 08:11:33 +0000 (09:11 +0100)]
Revert "[DSE] Remove calls with known writes to dead memory"

This reverts commit a8a51fe55649f5e07f9f2973507dc20bc4e40765.

This breaks the strncpy-overflow.cpp test case.

2 years ago[ELF] Parallelize MergeNoTailSection::writeTo
Fangrui Song [Sat, 18 Dec 2021 07:30:42 +0000 (23:30 -0800)]
[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

2 years ago[clang] Strip redundant lambda (NFC)
Kazu Hirata [Sat, 18 Dec 2021 04:55:10 +0000 (20:55 -0800)]
[clang] Strip redundant lambda (NFC)

2 years ago[ELF] Use SmallVector for many SyntheticSections. NFC
Fangrui Song [Sat, 18 Dec 2021 03:22:15 +0000 (19:22 -0800)]
[ELF] Use SmallVector for many SyntheticSections. NFC

This decreases struct sizes and usually decreases the lld executable
size (39KiB for my x86-64 executable) (unless in some cases smaller
SmallVector leads to more inlining, e.g. StringTableBuilder).
For --gdb-index, there may be memory usage saving.

2 years ago[doc] Fix regex in ClangFormatStyleOptions for IncludeCategories
Joshua Huels [Sat, 18 Dec 2021 02:37:55 +0000 (18:37 -0800)]
[doc] Fix regex in ClangFormatStyleOptions for IncludeCategories

This fixes the regex in ClangFormatStyleOptions for IncludeCategories
to match anything starting with < or starting with | AND followed by
(gtest|gmock|isl|json) then /.

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

2 years agoUse DenseMap::lookup (NFC)
Kazu Hirata [Sat, 18 Dec 2021 02:19:24 +0000 (18:19 -0800)]
Use DenseMap::lookup (NFC)

2 years ago[lldb] Remove reproducer replay functionality
Jonas Devlieghere [Fri, 17 Dec 2021 22:45:24 +0000 (14:45 -0800)]
[lldb] Remove reproducer replay functionality

This is part of a bigger rework of the reproducer feature. See [1] for
more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

2 years ago[clang] Use llvm::reverse (NFC)
Kazu Hirata [Sat, 18 Dec 2021 00:51:42 +0000 (16:51 -0800)]
[clang] Use llvm::reverse (NFC)

2 years agoWinMsvc.cmake: try lower-case include/lib when searching for windows SDK
Yuanfang Chen [Sat, 18 Dec 2021 00:26:08 +0000 (16:26 -0800)]
WinMsvc.cmake: try lower-case include/lib when searching for windows SDK

if the pascal case ones failed. Some tools, like msvc-wine/xwin, use the
lower case.

2 years ago[TSan][Darwin] Fix shadow mapping for iOS simulator on Apple Silicon
Julian Lettner [Thu, 16 Dec 2021 03:33:51 +0000 (19:33 -0800)]
[TSan][Darwin] Fix shadow mapping for iOS simulator on Apple Silicon

With the introduction of Apple Silicon `defined(__aarch64__)` is not a
reliable way to check for the platform anymore.

We want to use the "normal" `Mapping48AddressSpace` mapping everywhere
except devices, including the iOS simulators on AS.

Relevant revisions:
https://reviews.llvm.org/D35147
https://reviews.llvm.org/D86377
https://reviews.llvm.org/D107743
https://reviews.llvm.org/D107888

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

2 years ago[TSan][Darwin] Make malloc_size interceptor more robust
Julian Lettner [Fri, 17 Dec 2021 03:33:12 +0000 (19:33 -0800)]
[TSan][Darwin] Make malloc_size interceptor more robust

Previously we would crash in the TSan runtime if the user program passes
a pointer to `malloc_size()` that doesn't point into app memory.

In these cases, `malloc_size()` should return 0.

For ASan, we fixed a similar issue here:
https://reviews.llvm.org/D15008

Radar-Id: rdar://problem/86213149

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

2 years ago[runtimes] Remove LLVM_ENABLE_LLD
Vitaly Buka [Fri, 17 Dec 2021 23:03:57 +0000 (15:03 -0800)]
[runtimes] Remove LLVM_ENABLE_LLD

It was added D115852 and related patches and it brakes https://lab.llvm.org/buildbot/#/builders/fuchsia-x86_64-linux

2 years ago[Hexagon] Use is_contained (NFC)
Kazu Hirata [Fri, 17 Dec 2021 22:34:30 +0000 (14:34 -0800)]
[Hexagon] Use is_contained (NFC)

2 years ago[libomptarget][nfc] Refactor dlwrap.h for easier reuse in D115966 and upcoming patches
Jon Chesterfield [Fri, 17 Dec 2021 22:23:56 +0000 (22:23 +0000)]
[libomptarget][nfc] Refactor dlwrap.h for easier reuse in D115966 and upcoming patches

2 years ago[InstrProf][NFC] Require zlib for debug info tests
Ellis Hoag [Fri, 17 Dec 2021 21:44:16 +0000 (13:44 -0800)]
[InstrProf][NFC] Require zlib for debug info tests

There was a build failure on the `instrprof-debug-info-correlate.c` test
because zlib was missing so we need to require it to run the test.

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

2 years ago[clang-format] Refactor common handling of attributes. NFC.
Marek Kurdej [Fri, 17 Dec 2021 22:02:16 +0000 (23:02 +0100)]
[clang-format] Refactor common handling of attributes. NFC.

Reviewed By: MyDeveloperDay

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

2 years ago[llvm] Use none_of instead of \!any_of (NFC)
Kazu Hirata [Fri, 17 Dec 2021 21:48:56 +0000 (13:48 -0800)]
[llvm] Use none_of instead of \!any_of (NFC)

2 years ago[DSE] Remove calls with known writes to dead memory
Philip Reames [Fri, 17 Dec 2021 21:41:25 +0000 (13:41 -0800)]
[DSE] Remove calls with known writes to dead memory

The majority of this change is sinking logic from instcombine into MemoryLocation such that it can be generically reused. If we have a call with a single analyzable write to an argument, we can treat that as-if it were a store of unknown size.

Merging the code in this was unblocks DSE in the store to dead memory code paths. In theory, it should also enable classic DSE of such calls, but the code appears to not know how to use object sizes to refine unknown access bounds (yet).

In addition, this does make the isAllocRemovable path slightly stronger by reusing the libfunc and additional intrinsics bits which are already in getForDest.

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

2 years ago[lld-macho] Handle $ld$hide[$os] symbols.
Vy Nguyen [Wed, 15 Dec 2021 02:07:06 +0000 (21:07 -0500)]
[lld-macho] Handle $ld$hide[$os] symbols.

PR/52708

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

2 years ago[runtimes] Fix type on flag name in D115852
Vitaly Buka [Fri, 17 Dec 2021 21:36:25 +0000 (13:36 -0800)]
[runtimes] Fix type on flag name in D115852

2 years ago[SDAG] remove FP-to-int cast attribute check in fold to FTRUNC
Sanjay Patel [Fri, 17 Dec 2021 15:58:48 +0000 (10:58 -0500)]
[SDAG] remove FP-to-int cast attribute check in fold to FTRUNC

We were using a function attribute to indicate a non-standard FP mode,
but now we can use intrinsics for that job as shown in the new tests.
Presumably the x86 asm could be improved for that IR with intrinsics,
but I have not worked out exactly how to do that. Note that the
transform to FTRUNC still requires a hacky check for "nsz" (because
FMF are not applied to FP casts).

This is a cleanup based on the clang change in D115804 / 8c7f2a4f87192 .
This is effectively a revert of 5a90285bd98d2 + D46237 .

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

2 years ago[mlir][vscode] Highlight inside c++ raw strings
Jacques Pienaar [Fri, 17 Dec 2021 20:55:44 +0000 (12:55 -0800)]
[mlir][vscode] Highlight inside c++ raw strings

Within C++ raw strings with mlir delimitter use MLIR syntax.

Reviewed By: mehdi_amini

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

2 years ago[SLP][NFC]Adjust type in debug output loop.
Alexey Bataev [Fri, 17 Dec 2021 20:41:47 +0000 (12:41 -0800)]
[SLP][NFC]Adjust type in debug output loop.

The ReuseShuffleIndices indeces are integer, not unsigned, need to fix
the type in the debug print loop.

2 years ago[tests] Precommit tests from D115904
Philip Reames [Fri, 17 Dec 2021 20:42:42 +0000 (12:42 -0800)]
[tests] Precommit tests from D115904

2 years ago[lld/mac] Don't lose "weak ref" bit when doing LTO
Nico Weber [Fri, 17 Dec 2021 17:35:52 +0000 (12:35 -0500)]
[lld/mac] Don't lose "weak ref" bit when doing LTO

Fixes #52778.

Probably fixes Chromium crashing on startup on macOS 10.15 (and older) systems
when building with LTO, but I haven't verified that yet.

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

2 years ago[lldb] Remove --reproducer-finalize and associated functionality
Jonas Devlieghere [Fri, 17 Dec 2021 20:18:22 +0000 (12:18 -0800)]
[lldb] Remove --reproducer-finalize and associated functionality

This is part of a bigger rework of the reproducer feature. See [1] for
more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

2 years agoFix macOS buildbots after https://reviews.llvm.org/D115324.
Greg Clayton [Fri, 17 Dec 2021 20:14:44 +0000 (12:14 -0800)]
Fix macOS buildbots after https://reviews.llvm.org/D115324.

The test was attempting to make a universal x86_64/arm64 binary, but some older bots don't have a macOS SDK that can handle this. Switching over to using a yaml file instead should solve the problem.

2 years ago[SLP][NFC]Use 'llvm::copy' instead of element-by-elemen copying.
Alexey Bataev [Fri, 17 Dec 2021 18:57:44 +0000 (10:57 -0800)]
[SLP][NFC]Use 'llvm::copy' instead of element-by-elemen copying.

2 years ago[DSE] Make isRemovable() for calls more robust (NFCI)
Nikita Popov [Fri, 17 Dec 2021 19:44:15 +0000 (20:44 +0100)]
[DSE] Make isRemovable() for calls more robust (NFCI)

We can only drop calls if they have an analyzable write, the return
value is not used, they don't throw and they don't diverge. The last
two conditions were previously not checked, because all the libcalls
with analyzable writes already happened to satisfy those conditions
anyway. This may not be true for generalizations (with D115904 in mind).

No test changes because the necessary attributes are already inferred
for currently supported libcalls.

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

2 years ago[Bitcode] Avoid setting invalid comdat pointer (NFC)
Nikita Popov [Fri, 17 Dec 2021 19:25:32 +0000 (20:25 +0100)]
[Bitcode] Avoid setting invalid comdat pointer (NFC)

Instead track global objects with implicit comdat in a separate
set. The current approach of temporarily assigning an invalid
comdat pointer is incompatible with D115864.

2 years ago[gn build] Port 65d7fd0239bf
LLVM GN Syncbot [Fri, 17 Dec 2021 18:52:31 +0000 (18:52 +0000)]
[gn build] Port 65d7fd0239bf

2 years ago[llvm] Strip redundant lambda (NFC)
Kazu Hirata [Fri, 17 Dec 2021 18:51:39 +0000 (10:51 -0800)]
[llvm] Strip redundant lambda (NFC)

2 years ago[openmp][amdgpu][nfc] Mark all external functions extern C to get type checking
Jon Chesterfield [Fri, 17 Dec 2021 18:32:17 +0000 (18:32 +0000)]
[openmp][amdgpu][nfc] Mark all external functions extern C to get type checking

2 years ago[Try2][InstrProf] Add Correlator class to read debug info
Ellis Hoag [Thu, 16 Dec 2021 22:45:54 +0000 (14:45 -0800)]
[Try2][InstrProf] Add Correlator class to read debug info

Extend `llvm-profdata` to read in a `.proflite` file and also a debug info file to generate a normal `.profdata` profile. This reduces the binary size by 8.4% when building an instrumented Clang binary without value profiling (164 MB vs 179 MB).

This work is part of the "lightweight instrumentation" RFC: https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

This was first landed in https://reviews.llvm.org/D114566 but had to be reverted due to build errors.

Reviewed By: kyulee

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

2 years ago[clang-format] Fix formatting of the code that follows C# Lambda Expressions
Peter Stys [Fri, 17 Dec 2021 18:26:29 +0000 (10:26 -0800)]
[clang-format] Fix formatting of the code that follows C# Lambda Expressions

The alignment fix introduced by https://reviews.llvm.org/D104388 caused a regression whereby formatting of code that follows the lambda block is incorrect i.e. separate expressions are put on the same line.

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

2 years ago[gn build] Port cc324af0d64c
LLVM GN Syncbot [Fri, 17 Dec 2021 18:41:48 +0000 (18:41 +0000)]
[gn build] Port cc324af0d64c

2 years agoRevert "Port __sanitizer::StopTheWorld to Windows"
Martin Storsjö [Fri, 17 Dec 2021 18:37:25 +0000 (20:37 +0200)]
Revert "Port __sanitizer::StopTheWorld to Windows"

This reverts commit 3f5f687e2e8bf8b68c8a6ae0e000a8a78bfa70e5.

That commit broke building for mingw, where the sanitizers are
built with -nostdinc++, while the added source file includes
the C++ standard library's <algorithm>.

Additionally, the new code fails to build for i386, as it
unconditionally uses the CONTEXT member Rsp.

2 years ago[libc][Obvious] Change func_ to <func>_ in add_math_function.md.
Tue Ly [Fri, 17 Dec 2021 18:30:41 +0000 (13:30 -0500)]
[libc][Obvious] Change func_ to <func>_ in add_math_function.md.

2 years ago[clang-format] Formatter does not handle c++11 string literal prefix with stringize #
mydeveloperday [Fri, 17 Dec 2021 18:26:55 +0000 (18:26 +0000)]
[clang-format] Formatter does not handle c++11 string literal prefix with stringize #

https://github.com/llvm/llvm-project/issues/27740

Ensure
```
```
behave the same as
```
```

when formatted, ensure clang-format follows the conventions for `L` `u` `U` `u8`

https://docs.microsoft.com/en-us/cpp/cpp/string-and-character-literals-cpp?redirectedfrom=MSDN&view=msvc-170

Fixes #27740

Reviewed By: curdeius, owenpan

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

2 years ago[OPENMP]Look through member function call base during implicit DSA analysis.
Alexey Bataev [Thu, 16 Dec 2021 21:25:24 +0000 (13:25 -0800)]
[OPENMP]Look through member function call base during implicit DSA analysis.

Need to look through the base of the member function calls at the DSA
analysis stage to correctly capture implicit class instances.

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

2 years ago[Target] Use range-based for loops (NFC)
Kazu Hirata [Fri, 17 Dec 2021 18:11:08 +0000 (10:11 -0800)]
[Target] Use range-based for loops (NFC)

2 years ago[funcattrs] Use early return to clarify code in determinePointerAccessAttrs [NFC]
Philip Reames [Fri, 17 Dec 2021 17:52:05 +0000 (09:52 -0800)]
[funcattrs] Use early return to clarify code in determinePointerAccessAttrs [NFC]

Instead of having the speculative path be the untaken path in the branch, explicitly have it return.  This does require tail duplicating one call, but the resulting code is shorter and easier to understand.  Also rewrite the condition using appropriate accessors.

2 years ago[OpenMP][NFC] update status for 5.1 'fail' atomic extension
Deepak Eachempati [Fri, 17 Dec 2021 17:44:46 +0000 (11:44 -0600)]
[OpenMP][NFC] update status for 5.1 'fail' atomic extension

Update status for the atomic 'fail' clause to "worked on".

Reviewed By: cchen

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

2 years ago[CodeGen] Fix an unused variable warning
Kazu Hirata [Fri, 17 Dec 2021 17:43:42 +0000 (09:43 -0800)]
[CodeGen] Fix an unused variable warning

This patch fixes:

  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22617:11: error:
  unused variable 'Ops' [-Werror,-Wunused-variable]

2 years ago[funcattrs] Use getDataOperandNo where appropriate [NFC]
Philip Reames [Fri, 17 Dec 2021 17:34:40 +0000 (09:34 -0800)]
[funcattrs] Use getDataOperandNo where appropriate [NFC]

We'd manually duplicated the same logic and assertions; we can use the utility instead.

2 years agoFix MSVC shadow variable warning. NFC.
Simon Pilgrim [Fri, 17 Dec 2021 17:31:39 +0000 (17:31 +0000)]
Fix MSVC shadow variable warning. NFC.

2 years ago[DAG] SimplifyVBinOp - remove FoldConstantArithmetic call.
Simon Pilgrim [Fri, 17 Dec 2021 17:22:10 +0000 (17:22 +0000)]
[DAG] SimplifyVBinOp - remove FoldConstantArithmetic call.

Constant folding (scalar/vector) is now consistently handled before the SimplifyVBinOp calls.

2 years ago[capturetracking] Explicitly check for callee operand [NFC]
Philip Reames [Fri, 17 Dec 2021 17:20:10 +0000 (09:20 -0800)]
[capturetracking] Explicitly check for callee operand [NFC]

Pull out an explicit check rather than relying on the fact that the callee operand is not a data operand.  The only real value is it gives us a clear place to move the comment, and makes the code slightly more understandable.

2 years ago[RISCV} Add FSGNJ_H to isAsCheapAsAMove and isCopyInstrImpl.
Craig Topper [Fri, 17 Dec 2021 16:58:28 +0000 (08:58 -0800)]
[RISCV} Add FSGNJ_H to isAsCheapAsAMove and isCopyInstrImpl.

This matches FSGNJ_S and FSGNJ_D.

2 years ago[DAG] Constant fold + canonicalize fp binops before SimplifyVBinOp call
Simon Pilgrim [Fri, 17 Dec 2021 17:01:17 +0000 (17:01 +0000)]
[DAG] Constant fold + canonicalize fp binops before SimplifyVBinOp call

Replace custom constant scalar/splat folding with FoldConstantArithmetic call and canonicalize commutative constant ops to the RHS before the SimplifyVBinOp call

2 years ago[libc++] Add a bunch of missing inline and _LIBCPP_HIDE_FROM_ABI in __threading_support
Louis Dionne [Thu, 16 Dec 2021 21:59:56 +0000 (16:59 -0500)]
[libc++] Add a bunch of missing inline and _LIBCPP_HIDE_FROM_ABI in __threading_support

The inline keyword is required on those functions because they are defined
in the headers, so we need them to be inline to avoid ODR violations.
While we're at it, slap _LIBCPP_HIDE_FROM_ABI on them because they are
implementation details and we don't want them to be part of our ABI under
any circumstances.

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

2 years ago[funcattrs] Consistently treat calling a function pointer as a non-capturing read
Philip Reames [Fri, 17 Dec 2021 16:32:43 +0000 (08:32 -0800)]
[funcattrs] Consistently treat calling a function pointer as a non-capturing read

We were being wildly inconsistent about what memory access was implied by an indirect function call. Depending on the call site attributes, you could get anything from a read, to unknown, to none at all. (The last was a miscompile.)

We were also always traversing the uses of a readonly indirect call. This is entirely unneeded as the indirect call does not capture. The callee might capture itself internally, but that has no implications for this caller. (See the nice explanation in the CaptureTracking comments if that case is confusing.)

Note that elsewhere in the same file, we were correctly computing the nocapture attribute for indirect calls. The changed case only resulted in conservatism when computing memory attributes if say the return value was written to.

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

2 years ago[AArch64][SVE] Improve code generation for VLS i1 masks
David Truby [Fri, 17 Dec 2021 15:46:19 +0000 (15:46 +0000)]
[AArch64][SVE] Improve code generation for VLS i1 masks

This patch partially resolves an issue for VLS code generation
where a mask is generated from a smaller width integer comparison
than the instruction using the mask requires.

Instead of sign extending a p register by converting it to a z
register, extending that, and converting back, we instead just
do an unpack of the p register.

A separate issue causes the code generation to still be poor when
the mask generation would fit in a neon register, as we then use
a neon comparison operation and have to convert that to a p register.
This will be resolved in a separate patch.

Reviewed By: peterwaller-arm

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

2 years ago[DAG] Move foldConstantFPMath() inside FoldConstantArithmetic
Simon Pilgrim [Fri, 17 Dec 2021 16:00:30 +0000 (16:00 +0000)]
[DAG] Move foldConstantFPMath() inside FoldConstantArithmetic

Further merging of integer and fp constant folding paths.

This allows us to handle undef vector arguments the same as scalar cases.

2 years ago[X86] Rename funnel-shift X32 check prefixes to X86
Simon Pilgrim [Fri, 17 Dec 2021 15:54:53 +0000 (15:54 +0000)]
[X86] Rename funnel-shift X32 check prefixes to X86

We try to use X32 for gnux32 triple checks only

2 years ago[X86] Rename lzcnt/tzcnt X32 check prefixes to X86
Simon Pilgrim [Fri, 17 Dec 2021 15:53:26 +0000 (15:53 +0000)]
[X86] Rename lzcnt/tzcnt X32 check prefixes to X86

We try to use X32 for gnux32 triple checks only

2 years ago[ConstantFolding] Unify handling of load from uniform value
Nikita Popov [Fri, 17 Dec 2021 09:31:50 +0000 (10:31 +0100)]
[ConstantFolding] Unify handling of load from uniform value

There are a number of places that specially handle loads from a
uniform value where all the bits are the same (zero, one, undef,
poison), because we a) don't care about the load offset in that
case and b) it bypasses casts that might not be legal generally
but do work with uniform values.

We had multiple implementations of this, with a different set of
supported values each time, as well as incomplete type checks in
some cases. In particular, this fixes the assertion reported in
https://reviews.llvm.org/D114889#3198921, as well as a similar
assertion that could be triggered via constant folding.

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

2 years ago[OpenMP][libomptarget] Fix __tgt_rtl_run_target_team_region_async API with missing...
Carlo Bertolli [Fri, 17 Dec 2021 15:56:57 +0000 (15:56 +0000)]
[OpenMP][libomptarget] Fix __tgt_rtl_run_target_team_region_async API with missing parameter
I missed the async info parameter in the first version of this API.

Reviewed By: JonChesterfield

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