platform/upstream/llvm.git
19 months ago[Inliner][NFC] Remove redundant nullptr check
Alex MacLean [Wed, 8 Mar 2023 01:10:15 +0000 (17:10 -0800)]
[Inliner][NFC] Remove redundant nullptr check

Remove the null pointer check on Callee since it is guaranteed to pass by the check
at the top of the loop which continues if Callee is null. While this change is somewhat
trivial, for what it's worth this check triggers Coverity warnings because it implies that
Callee might be null at this point even though it is dereferenced in the preceding code.

Reviewed By: mtrofin

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

19 months ago[lldb] Add missing switch case for SveCount in TypeSystemClang::GetEncoding (NFC)
Jie Fu [Wed, 8 Mar 2023 01:08:42 +0000 (09:08 +0800)]
[lldb] Add missing switch case for SveCount in TypeSystemClang::GetEncoding (NFC)

/data/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4841:13: error: enumeration value 'SveCount' not handled in switch [-Werror,-Wswitch]
    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

19 months ago[lld-macho][nfc] Convert more alignTo() to alignToPowerOf2()
Jez Ng [Fri, 3 Mar 2023 18:22:40 +0000 (10:22 -0800)]
[lld-macho][nfc] Convert more alignTo() to alignToPowerOf2()

Reviewed By: #lld-macho, smeenai

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

19 months ago[libc] Add riscv64 syscall implementation.
Siva Chandra [Wed, 8 Mar 2023 00:46:08 +0000 (21:46 -0300)]
[libc] Add riscv64 syscall implementation.

All syscall wrapper functions which have unit tests have been enabled.

Reviewed By: kito-cheng

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

19 months ago[libc][docs] add link to join the discord
Michael Jones [Sat, 4 Mar 2023 00:06:29 +0000 (16:06 -0800)]
[libc][docs] add link to join the discord

Previously we only linked to the channel within the discord.

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

19 months agoMake mlir-opt --show-dialects option print on a single line
Mehdi Amini [Mon, 6 Mar 2023 17:09:51 +0000 (18:09 +0100)]
Make mlir-opt --show-dialects option print on a single line

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

19 months ago[lldb] Copy log files into diagnostic directory
Jonas Devlieghere [Tue, 7 Mar 2023 23:59:30 +0000 (15:59 -0800)]
[lldb] Copy log files into diagnostic directory

This patch copies over log files to the diagnostic directory. The caveat
here is that this only works for logs that are redirected to a file. The
implementation piggybacks of the mapping kept by the debugger. The
advantage is that it's free until you generate the diagnostics, at which
point you only pay the price of copying over the file.

Differential revision: https://reviews.llvm.org/D135631

19 months ago[RISCV] Don't accept '-min', '-inf' or '-nan' in RISCVAsmParser::parseFPImm.
Craig Topper [Tue, 7 Mar 2023 23:33:50 +0000 (15:33 -0800)]
[RISCV] Don't accept '-min', '-inf' or '-nan' in RISCVAsmParser::parseFPImm.

We need to check for identifier before optionally parsing a minus sign.

19 months ago[clang-format][NFC] Remove isCpp11AttributeSpecifier()
Owen Pan [Tue, 7 Mar 2023 23:12:18 +0000 (15:12 -0800)]
[clang-format][NFC] Remove isCpp11AttributeSpecifier()

See https://reviews.llvm.org/D137486#3910570.

19 months ago[clang][DependencyScanner] Cache modulemap stat failures
Michael Spencer [Tue, 7 Mar 2023 22:45:29 +0000 (14:45 -0800)]
[clang][DependencyScanner] Cache modulemap stat failures

Add `module.modulemap` as a file we cache stat failures for as there
are a lot of stats for this file.

Clang currently uses the files it should minimize as a proxy for files
it should cache stat failures for, but really we should cache stat
failures for all paths we don't expect to change during the build.
Unfortunately the VFS API does not know _why_ clang is trying to stat
a path, so we use the filename as a proxy.

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

19 months ago[Fuchsia] Add LLDB options to stage 1 cmake.
Daniel Thornburgh [Tue, 7 Mar 2023 00:02:29 +0000 (16:02 -0800)]
[Fuchsia] Add LLDB options to stage 1 cmake.

LLVM_ENABLE_PROJECTS is automatically forwarded from stage 1 builds to
stage 2 builds, so setting FUCHSIA_ENABLE_LLDB has no effect on
two-stage builds.

Instead, add FUCHSIA_ENABLE_LLDB to the stage one build as well.

This also disables curses and libedit by default for now in both stage1
and stage 2 builds; these should be opt-in.

Reviewed By: haowei

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

19 months ago[lld-macho] Warn on method name collisions from category definitions
Jez Ng [Tue, 7 Mar 2023 19:09:01 +0000 (11:09 -0800)]
[lld-macho] Warn on method name collisions from category definitions

This implements ld64's checks for duplicate method names in categories &
classes.

In addition, this sets us up for implementing Obj-C category merging.
This diff handles the most of the parsing work; what's left is rewriting
those category / class structures.

Numbers for chromium_framework:

             base           diff           difference (95% CI)
  sys_time   2.182 ± 0.027  2.200 ± 0.047  [  -0.2% ..   +1.8%]
  user_time  6.451 ± 0.034  6.479 ± 0.062  [  -0.0% ..   +0.9%]
  wall_time  6.841 ± 0.048  6.885 ± 0.105  [  -0.1% ..   +1.4%]
  samples    33             22

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

Reviewed By: #lld-macho, thevinster, oontvoo

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

19 months agoAdd a new SBDebugger::SetDestroyCallback() API
Jeffrey Tan [Sat, 4 Feb 2023 01:09:09 +0000 (17:09 -0800)]
Add a new SBDebugger::SetDestroyCallback() API

Adding a new SBDebugger::SetDestroyCallback() API.
This API can be used by any client to query for statistics/metrics before
exiting debug sessions.

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

19 months ago[RISCV] Return MatchOperand_ParseFail instead of MatchOperand_NoMatch from parseFPImm.
Craig Topper [Tue, 7 Mar 2023 22:36:17 +0000 (14:36 -0800)]
[RISCV] Return MatchOperand_ParseFail instead of MatchOperand_NoMatch from parseFPImm.

MatchOperand_NoMatch will fall back to regular operand parsing.
Returning MatchOperand_ParseFail will prevent this.

We also printed our own error message which we should only do for
MatchOperand_ParseFail.

19 months ago[mlir][sparse] Cleaning up code style for genCast
wren romano [Tue, 7 Mar 2023 20:26:20 +0000 (12:26 -0800)]
[mlir][sparse] Cleaning up code style for genCast

Reviewed By: aartbik

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

19 months ago[clang-format][NFC] Remove an obsolete case in parsing concepts
Owen Pan [Tue, 7 Mar 2023 22:34:50 +0000 (14:34 -0800)]
[clang-format][NFC] Remove an obsolete case in parsing concepts

See https://reviews.llvm.org/D142412#4078127.

19 months ago[SROA] Fix bug where RankVectorTypes is used in std::unique
Han Zhu [Thu, 16 Feb 2023 23:19:50 +0000 (15:19 -0800)]
[SROA] Fix bug where RankVectorTypes is used in std::unique

`RankVectorTypes` is a not an equivalence relation so when it is used in
`std::unique`, the behavior is undefined. Create `RankVectorTypesEq` and use
that instead.

19 months ago[scudo] Simplify markFreeBlocks
Chia-hung Duan [Sat, 4 Mar 2023 01:25:18 +0000 (01:25 +0000)]
[scudo] Simplify markFreeBlocks

With memory group, we always mark the free blocks from the same region.
Therefore, we don't need to calculate the offset from base and determine
the region index. Also improve the way we deal with the last block in
the region so that the loop body is simpler.

Reviewed By: cferris

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

19 months ago[mlir][sparse] deduplicate non-unique coordinates when coiterating COO tensors
Peiming Liu [Tue, 7 Mar 2023 17:14:17 +0000 (17:14 +0000)]
[mlir][sparse] deduplicate non-unique coordinates when coiterating COO tensors

Reviewed By: aartbik

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

19 months ago[AArch64] Prefer to fold dup into fmul/fma as opposed to ld1r
David Green [Tue, 7 Mar 2023 21:24:16 +0000 (21:24 +0000)]
[AArch64] Prefer to fold dup into fmul/fma as opposed to ld1r

There is a fold to create LD1DUPpost from dup(load) that can be postinc. If the
dup is used by a "by element" operation such as fmul or fma then it can be
slightly better to fold the dup into the fmul instead, which produces slightly
fast code.

  ld1r { v1.4s }, [x0], #4
  fmul v0.4s, v1.4s, v0.4s
vs
  ldr s1, [x0], #4
  fmul v0.4s, v0.4s, v1.s[0]

This could also be done with integer operations such as smull/umull too, so
long as the load/dup gets correctly combined into the mul operation. Currently
this just operates on foating point types.

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

19 months ago[ControlHeightReduction] Freeze potentially poisonous conditions
Kazu Hirata [Tue, 7 Mar 2023 21:20:21 +0000 (13:20 -0800)]
[ControlHeightReduction] Freeze potentially poisonous conditions

This patch freezes potentially poisonous conditions in conditional
branches so that we do not "move up" conditional branches
"br i1 poison".

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

19 months agoUpdate the C status page for WG14 N2844
Aaron Ballman [Tue, 7 Mar 2023 21:08:24 +0000 (16:08 -0500)]
Update the C status page for WG14 N2844

The proposal is about the behavior of the _Float16,
_Float32, and _Float64 types and whether they
undergo default argument promotions (they don't).

Clang doesn't yet support TS 18661 or the parts
that made it into C2x, so we don't implement this
paper.

19 months agoRecommit "[lldb] Redefine p alias to dwim-print command"
Dave Lee [Sat, 18 Feb 2023 03:53:16 +0000 (19:53 -0800)]
Recommit "[lldb] Redefine p alias to dwim-print command"

Redefine the `p` alias to the `dwim-print` command instead of `expression`.

See https://reviews.llvm.org/D138315 for the introduction of `dwim-print`.

To summarize, `dwim-print` is, as the name suggests, a command for printing. How a value
gets printed, is decided by `dwim-print`. In some cases, `dwim-print` will print values
using the same means as `frame variable` (because it's generally more reliable and
faster that `expression` evaluation), and in other cases `dwim-print` uses the same code
path as `expression`.

This change has been tested in two different ways:

1. Re-aliasing `p` to `dwim-print`, as in this patch
2. Redefinining the `expression` command to `CommandObjectDWIMPrint`

Previously, many of the lldb's tests used `p`, and which meant a test run with `p`
aliases to `dwim-print` was a good way to test `dwim-print`. However most of those tests
were updated to use `expression` explicitly (in anticipation of this change). Now, the
best way to test `dwim-print` is the second approach:

```
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 373c894f34f5..9c943cd30c7c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -539,7 +539,7 @@ void CommandInterpreter::LoadCommandDictionary() {
   REGISTER_COMMAND_OBJECT("diagnostics", CommandObjectDiagnostics);
   REGISTER_COMMAND_OBJECT("disassemble", CommandObjectDisassemble);
   REGISTER_COMMAND_OBJECT("dwim-print", CommandObjectDWIMPrint);
-  REGISTER_COMMAND_OBJECT("expression", CommandObjectExpression);
+  REGISTER_COMMAND_OBJECT("expression", CommandObjectDWIMPrint);
   REGISTER_COMMAND_OBJECT("frame", CommandObjectMultiwordFrame);
   REGISTER_COMMAND_OBJECT("gui", CommandObjectGUI);
   REGISTER_COMMAND_OBJECT("help", CommandObjectHelp);
```

When the test suite is run with this change, there are two main categories of test
failures for specific to features that `dwim-print` intentionally doesn't support:

1. Top level expressions (`--top-level`/`-p`)
2. Multiline expressions

In cases where the behavior of `expression` is needed, users can use `expression` at
those times.

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

19 months ago[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.
Alexey Bataev [Mon, 20 Feb 2023 21:26:11 +0000 (13:26 -0800)]
[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.

Previously only the very first gather/buildvector node might be probed for reshuffling of other nodes.
But the compiler may do the same for other gather/buildvector nodes too, just need to check the
dependency and postpone the emission of the dependent nodes, if the origin nodes were not emitted yet.

Part of D110978

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

19 months ago[memprof] Update the isRuntime symbolization check.
Snehasish Kumar [Tue, 7 Mar 2023 19:34:57 +0000 (19:34 +0000)]
[memprof] Update the isRuntime symbolization check.

Update the isRuntime check to only match against known memprof filenames
where interceptors are defined. This avoid issues where the path does
not include the directory based on how the runtime was compiled. Also
update the unittest.

Reviewed By: tejohnson

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

19 months ago[libc++] Fixes transitive includes.
Mark de Wever [Tue, 7 Mar 2023 20:13:15 +0000 (21:13 +0100)]
[libc++] Fixes transitive includes.

Since the CI is broken, I didn't investigate why it happened. It just
fixes it.

19 months agoSplit getCompileUnitFor{Data,Code}Address.
Mitch Phillips [Tue, 7 Mar 2023 19:29:49 +0000 (11:29 -0800)]
Split getCompileUnitFor{Data,Code}Address.

Getting compile units for data addresses is much slower, as it often
requires a slow fallback path to walk every DWARF entry, as
data addresses don't fall into the compilation unit ranges.

Most lookups are code addresses, and don't need this logic. Split the
functionality out so that we restore the fast-path behaviour for the
code lookups.

More context at:
https://discourse.llvm.org/t/llvm-symbolizer-has-gotten-extremely-slow/67262

Reviewed By: dblaikie

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

19 months ago[TableGen] Delete support for deprecated positional matching.
James Y Knight [Wed, 8 Feb 2023 15:47:11 +0000 (10:47 -0500)]
[TableGen] Delete support for deprecated positional matching.

After the work in a538d1f13a13 5351878ba196 372240dfe3d5, and
subsequently cleanup of all the in-tree targets, we can now delete the
support for positional operand matching!

This removes three options which could previously be set in a
Target's "InstrInfo" tablegen definition:
- useDeprecatedPositionallyEncodedOperands
- decodePositionallyEncodedOperands
- noNamedPositionallyEncodedOperands

(Also announced at https://discourse.llvm.org/t/tablegen-deleting-deprecated-positional-instruction-operand-matching-support/68524)

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

19 months ago[mlir][python] Capture error diagnostics in exceptions
Rahul Kayaith [Tue, 7 Feb 2023 21:07:50 +0000 (16:07 -0500)]
[mlir][python] Capture error diagnostics in exceptions

This updates most (all?) error-diagnostic-emitting python APIs to
capture error diagnostics and include them in the raised exception's
message:
```
>>> Operation.parse('"arith.addi"() : () -> ()'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
mlir._mlir_libs.MLIRError: Unable to parse operation assembly:
error: "-":1:1: 'arith.addi' op requires one result
 note: "-":1:1: see current operation: "arith.addi"() : () -> ()
```

The diagnostic information is available on the exception for users who
may want to customize the error message:
```
>>> try:
...   Operation.parse('"arith.addi"() : () -> ()')
... except MLIRError as e:
...   print(e.message)
...   print(e.error_diagnostics)
...   print(e.error_diagnostics[0].message)
...
Unable to parse operation assembly
[<mlir._mlir_libs._mlir.ir.DiagnosticInfo object at 0x7fed32bd6b70>]
'arith.addi' op requires one result
```

Error diagnostics captured in exceptions aren't propagated to diagnostic
handlers, to avoid double-reporting of errors. The context-level
`emit_error_diagnostics` option can be used to revert to the old
behaviour, causing error diagnostics to be reported to handlers instead
of as part of exceptions.

API changes:
- `Operation.verify` now raises an exception on verification failure,
  instead of returning `false`
- The exception raised by the following methods has been changed to
  `MLIRError`:
  - `PassManager.run`
  - `{Module,Operation,Type,Attribute}.parse`
  - `{RankedTensorType,UnrankedTensorType}.get`
  - `{MemRefType,UnrankedMemRefType}.get`
  - `VectorType.get`
  - `FloatAttr.get`

closes #60595

depends on D144804, D143830

Reviewed By: stellaraccident

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

19 months agoReland "[lldb][TypeSystemClang] Use the CXXFunctionPointerSummaryProvider for member...
Michael Buch [Tue, 7 Mar 2023 15:59:33 +0000 (15:59 +0000)]
Reland "[lldb][TypeSystemClang] Use the CXXFunctionPointerSummaryProvider for member-function pointers"

With this patch member-function pointers are formatted using
`CXXFunctionPointerSummaryProvider`.

This turns,
```
(lldb) v pointer_to_member_func
(void (Foo::*)()) ::pointer_to_member_func = 0x00000000000000000000000100003f94
```
into
```
(lldb) v pointer_to_member_func
(void (Foo::*)()) ::pointer_to_member_func = 0x00000000000000000000000100003f94 (a.out`Foo::member_func() at main.cpp:3)
```

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

19 months agoReland "[lldb][TypeSystemClang] Format pointers to member functions as eFormatHex"
Michael Buch [Tue, 7 Mar 2023 15:52:59 +0000 (15:52 +0000)]
Reland "[lldb][TypeSystemClang] Format pointers to member functions as eFormatHex"

Before this patch, LLDB used to format pointers to members, such as,
```
void (Foo::*pointer_to_member_func)() = &Foo::member_func;
```
as `eFormatBytes`. E.g.,
```
(lldb) v pointer_to_member_func
(void (Foo::*)()) $1 = 94 3f 00 00 01 00 00 00 00 00 00 00 00 00 00 00
```

This patch makes sure we format pointers to member functions the same
way we do regular function pointers.

After this patch we format member pointers as:
```
(lldb) v pointer_to_member_func
(void (Foo::*)()) ::pointer_to_member_func = 0x00000000000000000000000100003f94
```

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

19 months ago[lldb] Respect empty arguments in target.run-args
Alex Langford [Tue, 7 Mar 2023 00:04:35 +0000 (16:04 -0800)]
[lldb] Respect empty arguments in target.run-args

Currently empty arguments are not respected. They are silently dropped
in two places: (1) when extracting them from the target.run-args
setting and (2) when constructing the lldb-argdumper invocation.

(1) is actually a regression from a few years ago. We did not always
drop empty arguments. See 31d97a5c8ab78c619deada0cdb1fcf64021d25dd.

rdar://106279228

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

19 months ago[lldb-vscode] Use `expression` command for completion
Dave Lee [Mon, 6 Mar 2023 23:06:25 +0000 (15:06 -0800)]
[lldb-vscode] Use `expression` command for completion

Change lldb-vscode to use the `expression` command for generating completions, instead
of the `p` alias.

Aliases are user overrideable, and even deletable, but the `expression` command is
unchangeable.

See D141539 where a similar replacement was done to tests.

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

19 months ago[Flang][OpenMP][MLIR][Driver][bbc] Add -fopenmp-is-device flag to Flang -fc1 & the...
Andrew Gozillon [Tue, 7 Mar 2023 18:39:16 +0000 (12:39 -0600)]
[Flang][OpenMP][MLIR][Driver][bbc] Add -fopenmp-is-device flag to Flang -fc1 & the bbc tool, and omp.is_device attribute

Adds the -fopenmp-is-device flag to bbc and Flang's -fc1 (but not flang-new) and in addition adds an omp.is_device attribute onto the module when fopenmp is passed, this is a boolean attribute that is set to false or true dependent on if fopenmp-is-device is specified alongside the fopenmp flag on the commandline when invoking flang or bbc.

Reviewers:
awarzynski
kiranchandramohan

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

19 months ago[clang-tidy][NFC] Fix link in RelaseNotes
Piotr Zegar [Tue, 7 Mar 2023 18:39:45 +0000 (18:39 +0000)]
[clang-tidy][NFC] Fix link in RelaseNotes

19 months ago[ELF][RISCV] Make .sdata and .sbss closer
Fangrui Song [Tue, 7 Mar 2023 18:37:04 +0000 (10:37 -0800)]
[ELF][RISCV] Make .sdata and .sbss closer

GNU ld's internal linker scripts for RISC-V place .sdata and .sbss close.
This makes GP relaxation more profitable.

While here, when .sbss is present, set `__bss_start` to the start of
.sbss instead of .bss, to match GNU ld.

Note: GNU ld's internal linker scripts have symbol assignments and input
section descriptions which are not relevant for modern systems. We only
add things that make sense.

Reviewed By: craig.topper

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

19 months ago[libc++] Addresses LWG3358
Mark de Wever [Sun, 29 Jan 2023 15:40:02 +0000 (16:40 +0100)]
[libc++] Addresses LWG3358

  LWG3358 §[span.cons] is mistaken that to_address can throw

Since last - first has to throw tests are added to make sure this always
happens.

Depends on D142808

Reviewed By: #libc, ldionne

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

19 months ago[libc++][format] Addresses LWG3839.
Mark de Wever [Fri, 17 Feb 2023 18:57:58 +0000 (19:57 +0100)]
[libc++][format] Addresses LWG3839.

  LWG3839 range_formatter's set_separator, set_brackets, and
  underlying functions should be noexcept

Adds tests for:

  template<ranges::input_range R, class charT>
     struct range-default-formatter<range_format::sequence, R, charT>

These were missing, the format functions tests for the sequences
are already present.

Reviewed By: #libc, ldionne

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

19 months ago[libc] Add a note about using assertions in the libc runtime code.
Siva Chandra Reddy [Tue, 7 Mar 2023 04:52:58 +0000 (20:52 -0800)]
[libc] Add a note about using assertions in the libc runtime code.

Reviewed By: lntue

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

19 months ago[libc] Add fenv functions to arm32 baremetal config.
Siva Chandra Reddy [Tue, 7 Mar 2023 06:24:10 +0000 (06:24 +0000)]
[libc] Add fenv functions to arm32 baremetal config.

Also, an "arm" subfolder for baremetal config has been added.

Reviewed By: lntue

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

19 months ago[libc++][format] Addresses LWG3881.
Mark de Wever [Fri, 17 Feb 2023 17:55:48 +0000 (18:55 +0100)]
[libc++][format] Addresses LWG3881.

  LWG3881 Incorrect formatting of container adapters backed by std::string

Reviewed By: #libc, ldionne

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

19 months ago[libc] Move math.h and fenv.h macro definitions to llvm-libc-macros.
Siva Chandra Reddy [Tue, 7 Mar 2023 07:44:26 +0000 (07:44 +0000)]
[libc] Move math.h and fenv.h macro definitions to llvm-libc-macros.

Reviewed By: lntue

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

19 months agoUse explicit target in clang/test/Preprocessor/directives_asm.S
John Brawn [Tue, 7 Mar 2023 18:02:15 +0000 (18:02 +0000)]
Use explicit target in clang/test/Preprocessor/directives_asm.S

This prevents the test from failing when the default target doesn't
support the .warning directive.

19 months ago[libc++] Fixes basic_string operator& hijacking.
Mark de Wever [Fri, 3 Mar 2023 18:41:36 +0000 (19:41 +0100)]
[libc++] Fixes basic_string operator& hijacking.

Avoids using operator& in basic_string since an evil char-like type can
hijack this operator. Added some more evil operators, this found a place
where equality was compared directly and not via the traits.

This adds a helper test string. This is now only used in a few tests,
but the intention is to use this in more tests for basic_string.

Reviewed By: #libc, ldionne

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

19 months ago[libc++][format] Fixes invalid usage of m type.
Mark de Wever [Sat, 4 Mar 2023 19:00:42 +0000 (20:00 +0100)]
[libc++][format] Fixes invalid usage of m type.

The m type in a range formatter may only be used when a pair or a tuple
with two elements is used. This was not correctly validated as reported
in llvm.org/PR60995.

Reviewed By: ldionne, #libc

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

19 months ago[libc++][format] Fix floating point formatting.
Mark de Wever [Sat, 5 Nov 2022 17:33:25 +0000 (18:33 +0100)]
[libc++][format] Fix floating point formatting.

Fixes llvm.org/PR58714 reported by @jwakely and a similar issue
reported privately by @vitaut.

Reviewed By: ldionne, #libc

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

19 months ago[libc] Fix integer conversion error in test
Alex Brachet [Tue, 7 Mar 2023 17:49:22 +0000 (17:49 +0000)]
[libc] Fix integer conversion error in test

19 months ago[MLIR] Fix affine analysis check for ops with no common block
Uday Bondhugula [Tue, 7 Mar 2023 02:41:58 +0000 (08:11 +0530)]
[MLIR] Fix affine analysis check for ops with no common block

Fix affine analysis check for ops with no common block in their affine
scope. Clean up some out of date comments and naming.

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

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

19 months ago[ELF] Add REVERSE input section description keyword
Justin Cady [Mon, 6 Mar 2023 14:35:39 +0000 (09:35 -0500)]
[ELF] Add REVERSE input section description keyword

The `REVERSE` keyword is described here:

https://sourceware.org/bugzilla/show_bug.cgi?id=27565

It complements `SORT` by allowing the order of input sections to be reversed.

This is particularly useful for order-dependent sections such as .init_array,
where `REVERSE` can be used to either detect static initialization order fiasco
issues or as a mechanism to maintain .ctors element order while transitioning to
the modern .init_array. Such a transition is described here:

https://discourse.llvm.org/t/is-it-possible-to-manually-specify-init-array-order/68649

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

19 months ago[flang] Lower complex part
Ethan Luis McDonough [Tue, 7 Mar 2023 17:38:50 +0000 (11:38 -0600)]
[flang] Lower complex part

Implements HLFIR lowering for %im and %re.

Reviewed By: jeanPerier

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

19 months ago[RISCV] Teach performCombineVMergeAndVOps to combine unmasked TU vpmerge with a maske...
Craig Topper [Tue, 7 Mar 2023 16:59:48 +0000 (08:59 -0800)]
[RISCV] Teach performCombineVMergeAndVOps to combine unmasked TU vpmerge with a masked MU TA op.

We can form a MU TU operation and remove the merge if they use the
same merge value.

My primary interest was a case involving VP intrinsics from our downstream,
but it requires another optimization that isn't in upstream yet. So I've used
RVV intrinsics to get the desired instructions.

Co-authored-by: Nitin John Raj <nitin.raj@sifive.com>
Reviewed By: fakepaper56

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

19 months ago[clang] Treat function parameter scope as an immediate function context
Mariya Podchishchaeva [Tue, 7 Mar 2023 16:33:57 +0000 (11:33 -0500)]
[clang] Treat function parameter scope as an immediate function context

This results in expressions that appear in default function argument not
being checked for being actual constant expressions.
This aligns clang's behavior with the standard and fixes one of the
examples from https://wg21.link/P1073R3.

Reviewed By: shafik, cor3ntin

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

19 months agoDriver: introduce GNU spellings to control MSVC paths
Saleem Abdulrasool [Tue, 28 Feb 2023 22:21:08 +0000 (14:21 -0800)]
Driver: introduce GNU spellings to control MSVC paths

Add a set of `-Xmicrosoft` flags to control the Windows SDK and VisualC
tools directories.  This allows control over the selection of the SDK
and tools when using the GNU driver.

Differential Revision: https://reviews.llvm.org/D145007
Reviewed By: mstorjo

19 months ago[clang] Update test according to P1937
Mariya Podchishchaeva [Tue, 7 Mar 2023 16:17:12 +0000 (11:17 -0500)]
[clang] Update test according to P1937

https://wg21.link/p1937 proposes that in unevaluated contexts, consteval
functions should not be immediately evaluated.
Clang implemented p1937 a while ago, its behavior is correct and the
test needs an update.

Reviewed By: aaron.ballman, shafik

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

19 months ago[libc++] Fix ranges::binary_search() returning true for cases where the element is...
Nikolas Klauser [Sat, 4 Mar 2023 00:39:27 +0000 (01:39 +0100)]
[libc++] Fix ranges::binary_search() returning true for cases where the element is not in the range

Fixes #61160

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

19 months ago[Lex] Use line markers in preprocessed assembly predefines file
John Brawn [Wed, 1 Mar 2023 14:53:23 +0000 (14:53 +0000)]
[Lex] Use line markers in preprocessed assembly predefines file

GNU line marker directives are not recognised when preprocessing
assembly files, meaning they can't be used in the predefines file
meaning macros defined on the command line are reported as being
built-in.

Change this to permit line markers but only in the predefines file,
so we can correctly report command line macros as coming from the
command line.

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

19 months ago[SCEV] Strengthen nowrap flags via ranges for ARs on construction.
Florian Hahn [Tue, 7 Mar 2023 16:10:34 +0000 (17:10 +0100)]
[SCEV] Strengthen nowrap flags via ranges for ARs on construction.

At the moment, proveNoWrapViaConstantRanges is only used when creating
SCEV[Zero,Sign]ExtendExprs. We can get significant improvements by
strengthening flags after creating the AddRec.

I'll also share a follow-up patch that removes the code to strengthen
flags when creating SCEV[Zero,Sign]ExtendExprs. Modifying AddRecs while
creating those can lead to surprising changes.

Compile-time looks neutral:
https://llvm-compile-time-tracker.com/compare.php?from=94676cf8a13c511a9acfc24ed53c98964a87bde3&to=aced434e8b103109104882776824c4136c90030d&stat=instructions:u

Reviewed By: mkazantsev, nikic

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

19 months ago[clangd] Add support for missing includes analysis.
Viktoriia Bakalova [Thu, 2 Feb 2023 11:56:01 +0000 (11:56 +0000)]
[clangd] Add support for missing includes analysis.

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

19 months agoMove tosa.reshape lowering patterns from TosaToLinalg to TosaToTensor
Krzysztof Drewniak [Wed, 1 Mar 2023 22:05:48 +0000 (22:05 +0000)]
Move tosa.reshape lowering patterns from TosaToLinalg to TosaToTensor

Converting tosa.reshape to tensor.expand_shape and
tensor.collapse_shape logically belongs in the tosa-to-tensor
conversion process. In addition, we (rocMLIR downstream) want to use
the reshape -> expand/collapse_shape logic to simplify parts of our
Tosa integration without using the full tosa-to-linalg flow, further
motivating moving these patterns.

The downside to this change is that it means you need to run
tosa-to-tensor after tosa-to-linalg, which is probably a breaking
change.

Reviewed By: rsuderman

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

19 months ago[clang] Fix single-element array initialization in constexpr
Mariya Podchishchaeva [Tue, 7 Mar 2023 15:57:23 +0000 (10:57 -0500)]
[clang] Fix single-element array initialization in constexpr

https://reviews.llvm.org/D130791 added an improvement that in case array
element has a trivial constructor, it is evaluated once and the result is
re-used for remaining elements. Make sure the constructor is evaluated
for single-elements arrays too.

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

Reviewed By: aaron.ballman

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

19 months ago[lldb][test] TestDataFormatterCpp.py: set breakpoint after all locals have been initi...
Michael Buch [Tue, 7 Mar 2023 15:44:33 +0000 (15:44 +0000)]
[lldb][test] TestDataFormatterCpp.py: set breakpoint after all locals have been initialized

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

19 months ago[X86] Lower vector umax(x,1) -> sub(x,cmpeq(x,0))
Simon Pilgrim [Tue, 7 Mar 2023 15:38:46 +0000 (15:38 +0000)]
[X86] Lower vector umax(x,1) -> sub(x,cmpeq(x,0))

With suitable BooleanContent handling we could move this to TargetLowering::expandIntMINMAX, but this is good enough for X86

Fixes #61225

19 months ago[lldb][test] TestDataFormatterCpp.py: split assertions failing on Windows
Michael Buch [Tue, 7 Mar 2023 15:25:24 +0000 (15:25 +0000)]
[lldb][test] TestDataFormatterCpp.py: split assertions failing on Windows

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

19 months ago[Clang] Create opaque type for AArch64 SVE2p1/SME2 svcount_t.
Sander de Smalen [Tue, 7 Mar 2023 13:57:18 +0000 (13:57 +0000)]
[Clang] Create opaque type for AArch64 SVE2p1/SME2 svcount_t.

This patch adds the builtin type __SVCount_t to Clang, which is an opaque
scalable type defined in the SME2 C and C++ Language Extensions.

The type maps to the `target("aarch64.svcount")` LLVM IR type.

Reviewed By: paulwalker-arm

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

19 months ago[X86] Add umax(x,1) vector test coverage for Issue #61225
Simon Pilgrim [Tue, 7 Mar 2023 14:33:58 +0000 (14:33 +0000)]
[X86] Add umax(x,1) vector test coverage for Issue #61225

19 months ago[IndVars] Add test for PR60944 (NFC)
Nikita Popov [Tue, 7 Mar 2023 14:31:41 +0000 (15:31 +0100)]
[IndVars] Add test for PR60944 (NFC)

19 months agoFix build failures with libclang unittest; NFC
Aaron Ballman [Tue, 7 Mar 2023 14:31:45 +0000 (09:31 -0500)]
Fix build failures with libclang unittest; NFC

This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/57/builds/25217
https://lab.llvm.org/buildbot/#/builders/36/builds/31018

19 months ago[mlir][complex] Minor fixes in ComplexToStandard test cases.
Ingo Müller [Tue, 7 Mar 2023 13:56:23 +0000 (13:56 +0000)]
[mlir][complex] Minor fixes in ComplexToStandard test cases.

One FileCheck line was hard-coding variable names. Another line
mis-indented the second line of a function header.

Reviewed By: akuegel

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

19 months ago[lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format
Michael Buch [Tue, 7 Mar 2023 12:08:07 +0000 (12:08 +0000)]
[lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format

This patch adds a test for formatting of member function pointers.
This was split from https://reviews.llvm.org/D145242, which caused
this test case to fail on Windows buildbots.

I split this out in order to make sure that this indeed works on Windows
without the D145242 patch.

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

19 months ago[ConstraintElimination] Decompose or instruction if the constant operand < 2^known_ze...
Zain Jaffal [Tue, 7 Mar 2023 14:03:35 +0000 (14:03 +0000)]
[ConstraintElimination] Decompose or instruction if the constant operand < 2^known_zero_bits of the first operand.

The or operation can be represented as an add instruction.

Reviewed By: fhahn

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

19 months ago[IR] Add operator<< overload for CmpInst::Predicate (NFC)
Nikita Popov [Tue, 7 Mar 2023 13:57:06 +0000 (14:57 +0100)]
[IR] Add operator<< overload for CmpInst::Predicate (NFC)

I regularly try and fail to use this while debugging.

19 months ago[libc++] Extract std::fprintf into a function for use within the test suite
Louis Dionne [Mon, 6 Mar 2023 19:04:22 +0000 (14:04 -0500)]
[libc++] Extract std::fprintf into a function for use within the test suite

This provides a single place for downstream to customize (or turn off)
printing information to stderr within the test suite.

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

19 months ago[DAG] isNarrowingProfitable - consistently use SrcVT/DestVT argument names. NFC.
Simon Pilgrim [Tue, 7 Mar 2023 13:59:54 +0000 (13:59 +0000)]
[DAG] isNarrowingProfitable - consistently use SrcVT/DestVT argument names. NFC.

Make it more obvious what order the narrowing types are in.

19 months agoRevert D143678 "[bazel] Add layering-check"
Guillaume Chatelet [Tue, 7 Mar 2023 13:26:29 +0000 (13:26 +0000)]
Revert D143678 "[bazel] Add layering-check"

This broke build bots with MPFR issue.
This reverts commit 5916decfc2ba3f5ce5c5c0fe8de72ea2f8b4c3bf.

19 months ago[libclang] Add API to override preamble storage path
Igor Kushnir [Tue, 7 Mar 2023 13:24:23 +0000 (08:24 -0500)]
[libclang] Add API to override preamble storage path

TempPCHFile::create() calls llvm::sys::fs::createTemporaryFile() to
create a file named preamble-*.pch in a system temporary directory. This
commit allows overriding the directory where these often many and large
preamble-*.pch files are stored.

The referenced bug report requests the ability to override the temporary
directory path used by libclang. However, overriding the return value of
llvm::sys::path::system_temp_directory() was rejected during code review
as improper and because it would negatively affect multithreading
performance. Finding all places where libclang uses the temporary
directory is very difficult. Therefore this commit is limited to
override libclang's single known use of the temporary directory.

This commit allows to override the preamble storage path only during
CXIndex construction to avoid multithreading issues and ensure that all
preambles are stored in the same directory. For the same multithreading
and consistency reasons, this commit deprecates
clang_CXIndex_setGlobalOptions() and
clang_CXIndex_setInvocationEmissionPathOption() in favor of specifying
these options during CXIndex construction.

Adding a new CXIndex constructor function each time a new initialization
argument is needed leads to either a large number of function parameters
unneeded by most libclang users or to an exponential number of overloads
that support different usage requirements. Therefore this commit
introduces a new extensible struct CXIndexOptions and a general function
clang_createIndexWithOptions().

A libclang user passes a desired preamble storage path to
clang_createIndexWithOptions(), which stores it in
CIndexer::PreambleStoragePath. Whenever
clang_parseTranslationUnit_Impl() is called, it passes
CIndexer::PreambleStoragePath to ASTUnit::LoadFromCommandLine(), which
stores this argument in ASTUnit::PreambleStoragePath. Whenever
ASTUnit::getMainBufferWithPrecompiledPreamble() is called, it passes
ASTUnit::PreambleStoragePath to PrecompiledPreamble::Build().
PrecompiledPreamble::Build() forwards the corresponding StoragePath
argument to TempPCHFile::create(). If StoragePath is not empty,
TempPCHFile::create() stores the preamble-*.pch file in the directory at
the specified path rather than in the system temporary directory.

The analysis below proves that this passing around of the
PreambleStoragePath string is sufficient to guarantee that the libclang
user override is used in TempPCHFile::create(). The analysis ignores API
uses in test code.

TempPCHFile::create() is called only in PrecompiledPreamble::Build().
PrecompiledPreamble::Build() is called only in two places: one in
clangd, which is not used by libclang, and one in
ASTUnit::getMainBufferWithPrecompiledPreamble().
ASTUnit::getMainBufferWithPrecompiledPreamble() is called in 3 places:

ASTUnit::LoadFromCompilerInvocation() [analyzed below].
ASTUnit::Reparse(), which in turn is called only from
clang_reparseTranslationUnit_Impl(), which in turn is called only from
clang_reparseTranslationUnit(). clang_reparseTranslationUnit() is never
called in LLVM code, but is part of public libclang API. This function's
documentation requires its translation unit argument to have been built
with clang_createTranslationUnitFromSourceFile().
clang_createTranslationUnitFromSourceFile() delegates its work to
clang_parseTranslationUnit(), which delegates to
clang_parseTranslationUnit2(), which delegates to
clang_parseTranslationUnit2FullArgv(), which delegates to
clang_parseTranslationUnit_Impl(), which passes
CIndexer::PreambleStoragePath to the ASTUnit it creates.

ASTUnit::CodeComplete() passes AllowRebuild = false to
ASTUnit::getMainBufferWithPrecompiledPreamble(), which makes it return
nullptr before calling PrecompiledPreamble::Build().

Both ASTUnit::LoadFromCompilerInvocation() overloads (one of which
delegates its work to another) call
ASTUnit::getMainBufferWithPrecompiledPreamble() only if their argument
PrecompilePreambleAfterNParses > 0. LoadFromCompilerInvocation() is
called in:

ASTBuilderAction::runInvocation() keeps the default parameter value
of PrecompilePreambleAfterNParses = 0, meaning that the preamble file is
never created from here.

ASTUnit::LoadFromCommandLine().
ASTUnit::LoadFromCommandLine() is called in two places:

CrossTranslationUnitContext::ASTLoader::loadFromSource() keeps the
default parameter value of PrecompilePreambleAfterNParses = 0, meaning
that the preamble file is never created from here.

clang_parseTranslationUnit_Impl(), which passes
CIndexer::PreambleStoragePath to the ASTUnit it creates.

Therefore, the overridden preamble storage path is always used in
TempPCHFile::create().

TempPCHFile::create() uses PreambleStoragePath in the same way as
LibclangInvocationReporter() uses InvocationEmissionPath. The existing
documentation for clang_CXIndex_setInvocationEmissionPathOption() does
not specify ownership, encoding, separator or relative vs absolute path
requirements. So the documentation for
CXIndexOptions::PreambleStoragePath doesn't either. The assumptions are:

no ownership transfer;
UTF-8 encoding;
native separators.
Both relative and absolute paths are supported.

The added API works as expected in KDevelop:
https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283

Fixes: https://github.com/llvm/llvm-project/issues/51847
Differential Revision: https://reviews.llvm.org/D143418

19 months ago[bazel] Add layering-check
Guillaume Chatelet [Thu, 9 Feb 2023 21:36:59 +0000 (21:36 +0000)]
[bazel] Add layering-check

In the same vein as https://reviews.llvm.org/D141553
Enable the feature globally to ensure layering and catch circular dependencies
(https://llvm.org/docs/CodingStandards.html#library-layering).

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

19 months agoFix DISABLE-NOT: cc1 check in debug-info-codeview-buildinfo.c test
Matt Devereau [Tue, 7 Mar 2023 13:15:07 +0000 (13:15 +0000)]
Fix DISABLE-NOT: cc1 check in debug-info-codeview-buildinfo.c test

This check is checking for the cc1 flag but this test has been seen to fail
when FILEPATHVAL has contained cc1 in generated SHAs

19 months ago[libc][bazel] Fix missing dependency for math tests
Guillaume Chatelet [Tue, 7 Mar 2023 13:18:46 +0000 (13:18 +0000)]
[libc][bazel] Fix missing dependency for math tests

19 months ago[AArch64] Tests for dup in load vs mul. NFC
David Green [Tue, 7 Mar 2023 13:21:18 +0000 (13:21 +0000)]
[AArch64] Tests for dup in load vs mul. NFC

See D145184.

19 months ago[GlobalOpt] Use structured bindings to access TypesVector (NFC).
Florian Hahn [Tue, 7 Mar 2023 12:59:13 +0000 (13:59 +0100)]
[GlobalOpt] Use structured bindings to access TypesVector (NFC).

This helps to reduce the diff of a follow-up change and improves
readability of the existing code.

19 months agoFix "compatiable" typos
Jay Foad [Tue, 7 Mar 2023 12:57:39 +0000 (12:57 +0000)]
Fix "compatiable" typos

19 months ago[TableGen] add !toupper and !tolower operators to change the casing of strings.
Zain Jaffal [Tue, 7 Mar 2023 12:38:40 +0000 (12:38 +0000)]
[TableGen] add !toupper and !tolower operators to change the casing of strings.

Reviewed By: fpetrogalli

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

19 months ago[RISCV] Enable ordered reduction.
Mel Chen [Tue, 21 Feb 2023 07:11:54 +0000 (23:11 -0800)]
[RISCV] Enable ordered reduction.

Reviewed By: craig.topper

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

19 months ago[AArch64] Don't map llvm sqrt intrinsics to veclib functions
Graham Hunter [Mon, 6 Mar 2023 16:12:33 +0000 (16:12 +0000)]
[AArch64] Don't map llvm sqrt intrinsics to veclib functions

Since AArch64 has sqrt instructions, we want to use those instead of
calls to vector math routines for llvm sqrt intrinsics (since those
don't imply some of the constraints that libm calls might have) so
we just remove the mappings.

Code originally written by mgabka

Reviewed By: danielkiss, paulwalker-arm

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

19 months agoRevert "[lldb] Ignore libcxx std::ranges global variables in frame var"
Michael Buch [Tue, 7 Mar 2023 11:25:36 +0000 (11:25 +0000)]
Revert "[lldb] Ignore libcxx std::ranges global variables in frame var"

Reverting because Xcode requires this to be handled elsewhere.
The global variable list gets constructed using the SBAPI

This reverts commit de10c1a824405833a0f49b22e7fa3f32a1393cc3.

19 months agoRevert "[lldb] Build fix: variable name typo"
Michael Buch [Tue, 7 Mar 2023 11:25:24 +0000 (11:25 +0000)]
Revert "[lldb] Build fix: variable name typo"

Reverted because dependecy had to be reverted.

This reverts commit 4d909c556e2caa8e150b892384fe8d42e774f8b0.

19 months agoRevert "[lldb][TypeSystemClang] Format pointers to member functions as eFormatHex"
Michael Buch [Tue, 7 Mar 2023 11:16:14 +0000 (11:16 +0000)]
Revert "[lldb][TypeSystemClang] Format pointers to member functions as eFormatHex"

Reverted because Windows buildbot started failing

This reverts commit b642fd5ee250247ccefb38099169b4ee8ac4112b.

19 months agoRevert "[lldb][TypeSystemClang] Use the CXXFunctionPointerSummaryProvider for member...
Michael Buch [Tue, 7 Mar 2023 11:16:12 +0000 (11:16 +0000)]
Revert "[lldb][TypeSystemClang] Use the CXXFunctionPointerSummaryProvider for member-function pointers"

Reverted because Windows buildbot started failing

This reverts commit 6bd46e713c6d8deda7bdae8b1efadb99c88b4443.

19 months agoRevert "[lldb][test] NativePDB/ast-types: fix expected pointer format"
Michael Buch [Tue, 7 Mar 2023 11:16:10 +0000 (11:16 +0000)]
Revert "[lldb][test] NativePDB/ast-types: fix expected pointer format"

Reverted because dependecies had to be reverted.

This reverts commit 96e39fdbb90b26191fc79b6226f299e3c10e559b.

19 months ago[SCEV] Add test for PR54191 (NFC)
Nikita Popov [Tue, 7 Mar 2023 11:15:50 +0000 (12:15 +0100)]
[SCEV] Add test for PR54191 (NFC)

19 months ago[LV][AArch64] Resolve test failure due use of unordered container
sgokhale [Tue, 7 Mar 2023 11:12:21 +0000 (16:42 +0530)]
[LV][AArch64] Resolve test failure due use of unordered container

AArch64/reg-usage.ll has an issue with the output ordering due to use of unordered container. This was discovered by -DLLVM_REVERSE_ITERATION:BOOL=ON
cmake option.
This patch tries to address it by making use of ordered container.

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

19 months ago[AArch64TargetParser] reinstate assert for optional
Tomas Matheson [Mon, 6 Mar 2023 12:59:03 +0000 (12:59 +0000)]
[AArch64TargetParser] reinstate assert for optional

D145206 changed value() to value_or(0), removing the assert that checks
that there is a minor version. Add it back explicitly.

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

19 months ago[AMDGPU] Match med3 for (max (min ..))
pvanhout [Thu, 2 Mar 2023 14:42:24 +0000 (15:42 +0100)]
[AMDGPU] Match med3 for (max (min ..))

We previously only matched (min (max ...))

Depends on D144728

Reviewed By: arsenm

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

19 months ago[GlobalOpt] Extend logic in SRA heuristic to skip stores of initializer.
Florian Hahn [Tue, 7 Mar 2023 10:08:06 +0000 (11:08 +0100)]
[GlobalOpt] Extend logic in SRA heuristic to skip stores of initializer.

If all stores only store the initializer value of a global, consider it
as not stored in the heuristic. GlobalOpt will remove such stores later
on.

Depends on D129857.

Reviewed By: nikic

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

19 months ago[AMDGPU] Precommit test: v_sat_pk_u8_i16.ll
pvanhout [Fri, 24 Feb 2023 13:46:35 +0000 (14:46 +0100)]
[AMDGPU] Precommit test: v_sat_pk_u8_i16.ll

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

19 months ago[RISCV] Enable machine copy propagation for copy-like instructions
wangpc [Tue, 7 Mar 2023 08:22:39 +0000 (16:22 +0800)]
[RISCV] Enable machine copy propagation for copy-like instructions

Like what has been done in AArch64 (D125335).

We enable this under `-O2` to show the codegen diffs here but we
may only do this under `-O3` like AArch64.

There are two cases that we may produce these eliminable copies:
1. ISel of `FrameIndex`. Like `rvv/fixed-vectors-calling-conv.ll`.
2. Tail duplication. Like `select-optimize-multiple.ll`.

Reviewed By: craig.topper

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

19 months ago[RISCV] Add classes to define SchedWrite list
wangpc [Wed, 1 Mar 2023 08:49:28 +0000 (16:49 +0800)]
[RISCV] Add classes to define SchedWrite list

SchedWrites are relevant to LMUL for most instructions, so we have
to enumerate all defined SchedWrites when defining ReadAdcance.
This patch adds some classes to simplify these definitions.

Reviewed By: michaelmaitland

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

19 months ago[UTC] Enable --function-signature by default
Nikita Popov [Thu, 2 Mar 2023 09:25:48 +0000 (10:25 +0100)]
[UTC] Enable --function-signature by default

This patch enables --function-signature by default under --version 2
and makes --version 2 the default. This means that all newly created
tests will check the function signature, while leaving old tests alone.

There's two motivations for this change:

* Without --function-signature, the generated check lines may fail
  in a very hard to understand way if the test both includes a
  function definition and a call to that function. (Though we could
  address this by making the CHECK-LABEL stricter, without checking
  the full signature.)
* This actually checks that uses of the arguments in the function
  body use the correct argument, instead of matching against any
  variable.

This is a replacement for D139006 and D140212 based on the
--version mechanism.

I did not include an opt-out flag --no-function-signature because
I'm not sure we need it. Would be happy to include it though,
if desired.

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

19 months agorun-clang-tidy.py should only search for the clang-apply-replacements if really needed
Anonymous [Tue, 7 Mar 2023 08:56:00 +0000 (14:26 +0530)]
run-clang-tidy.py should only search for the clang-apply-replacements if really needed

run-clang-tidy.py should only search for the clang-apply-replacements if really needed.

Reviewed By: carlosgalvezp

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

19 months ago[SCEV] Use fallthoughs in predicate switch when collecting rewrites for loop guard...
Dmitry Makogon [Mon, 6 Mar 2023 11:58:31 +0000 (18:58 +0700)]
[SCEV] Use fallthoughs in predicate switch when collecting rewrites for loop guard (NFC)