platform/upstream/llvm.git
2 years ago[flang] Lower command and environment intrinsics
Valentin Clement [Thu, 17 Mar 2022 13:34:58 +0000 (14:34 +0100)]
[flang] Lower command and environment intrinsics

This patch adds lowering for command and environment
related intrinsics:
- `get_command_argument`
- `get_environment_variable`
- `command_argument_count`

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Josh Mottley <Josh.Mottley@arm.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[LV] Use usesScalars in widenPHIInstruction.
Florian Hahn [Thu, 17 Mar 2022 13:16:32 +0000 (13:16 +0000)]
[LV] Use usesScalars in widenPHIInstruction.

This uses the existing VPlan helpers to check whether there are scalar
uses of a phi recipe. It remove one of the few remaining dependencies on
the cost model from VPlan code generation.

Depends on D121612.

Reviewed By: Ayal

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

2 years ago[Flang] Lower the transpose intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 13:05:16 +0000 (13:05 +0000)]
[Flang] Lower the transpose intrinsic

Tranpose intrinsic performs the transpose matrix operation for arrays
of rank 2. The intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[x86] try harder to use shift instead of test if it can save some immediate bytes
Sanjay Patel [Thu, 17 Mar 2022 13:09:42 +0000 (09:09 -0400)]
[x86] try harder to use shift instead of test if it can save some immediate bytes

We favor 'and' and 'test' in earlier phases of optimization,
and that's usually the better option, but we can save a few
instruction bytes by converting a mask constant to a shift here.

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

2 years ago[pseudo] Tweak some docs, NFC
Haojian Wu [Wed, 16 Mar 2022 15:45:24 +0000 (16:45 +0100)]
[pseudo] Tweak some docs, NFC

Consitently use the "nonterminal", "pseudoparser" terms.

2 years ago[clangd] Re-enable clang-tidy's nolint blocks
Haojian Wu [Thu, 17 Mar 2022 12:48:47 +0000 (13:48 +0100)]
[clangd] Re-enable clang-tidy's nolint blocks

The previous inefficient implementation is polished.

Reviewed By: kadircet

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

2 years ago[pseudo] Split greatergreater token.
Haojian Wu [Thu, 17 Mar 2022 12:42:31 +0000 (13:42 +0100)]
[pseudo] Split greatergreater token.

For a >> token (a right shift operator, or a nested template?), the clang
lexer always returns a single greatergreater token, as a result,
the grammar-based GLR parser never try to parse the nested template
case.

We derive a token stream by always splitting the >> token, so that the
GLR parser is able to pursue both options during parsing (usually 1
path fails).

Reviewed By: sammccall

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

2 years ago[Flang] Lower the trim intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 12:33:53 +0000 (12:33 +0000)]
[Flang] Lower the trim intrinsic

The trim intrinsic removes trailing blank spaces from a string. The
intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[Flang] Lower Matmul intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 12:30:05 +0000 (12:30 +0000)]
[Flang] Lower Matmul intrinsic

The Matmul intrinsic performs matrix multiplication on rank 2 arrays.
The intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[Sema] add warning for tautological FP compare with literal
Sanjay Patel [Thu, 17 Mar 2022 11:40:03 +0000 (07:40 -0400)]
[Sema] add warning for tautological FP compare with literal

If we are equality comparing an FP literal with a value cast from a type
where the literal can't be represented, that's known true or false and
probably a programmer error.

Fixes issue #54222.
https://github.com/llvm/llvm-project/issues/54222

Note - I added the optimizer change with:
9397bdc67eb2
...and as discussed in the post-commit comments, that transform might be
too dangerous without this warning in place, so it was reverted to allow
this change first.

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

2 years ago[flang] Lower misc intrinsics
Valentin Clement [Thu, 17 Mar 2022 12:20:13 +0000 (13:20 +0100)]
[flang] Lower misc intrinsics

This patch adds lowering for couple of intrinsics:
- `btest`
- `ceiling`
- `nearest`
- `scale`

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

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: AlexisPerry <aperry@lanl.gov>
2 years ago[flang] Lower present intrinsic
Valentin Clement [Thu, 17 Mar 2022 12:18:53 +0000 (13:18 +0100)]
[flang] Lower present intrinsic

This patch adds lowering for the `present` intrinsic.

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

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower exit intrinsic
Valentin Clement [Thu, 17 Mar 2022 12:16:53 +0000 (13:16 +0100)]
[flang] Lower exit intrinsic

This patch adds lowering for the `exit`
intrinsic.

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

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Josh Mottley <Josh.Mottley@arm.com>
2 years ago[flang][lowering] Add support for lowering of the `index` intrinsics
Andrzej Warzynski [Wed, 16 Mar 2022 18:27:12 +0000 (18:27 +0000)]
[flang][lowering] Add support for lowering of the `index` intrinsics

This patch adds support for lowering of the `index` intrinsics from
Fortran to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[VPlan] VPInterleaveRecipe only requires the first lane of the address.
Florian Hahn [Thu, 17 Mar 2022 11:56:43 +0000 (11:56 +0000)]
[VPlan] VPInterleaveRecipe only requires the first lane of the address.

VPInterleaveRecipe only uses the first lane of the address. Add
onlyFirstLaneUsed implementation. This is needed for a follow-up patch.

Reviewed By: Ayal

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

2 years ago[flang][nfc] Update comment in test
Andrzej Warzynski [Thu, 17 Mar 2022 11:54:02 +0000 (11:54 +0000)]
[flang][nfc] Update comment in test

2 years ago[AMDGPU][MC] A fix for commit 5977dfb
Dmitry Preobrazhensky [Thu, 17 Mar 2022 11:40:01 +0000 (14:40 +0300)]
[AMDGPU][MC] A fix for commit 5977dfb

The commit code https://github.com/llvm/llvm-project/commit/5977dfba64099e224cba12f580b6867e7a3d149a
failed to compile with GCC5. This patch addresses the issue.
For a related discussion, see https://reviews.llvm.org/D121696

2 years ago[clang-tidy][run-clang-tidy.py] Add --config-file=<string> option
Shreyas Atre [Thu, 17 Mar 2022 11:29:26 +0000 (07:29 -0400)]
[clang-tidy][run-clang-tidy.py] Add --config-file=<string> option

Link to the GitHub Issue: https://github.com/llvm/llvm-project/issues/53745

Added config_path variable within the python script which makes the
required call to the clang-tidy binary with --config-file option.
If the config_path is None then config will be used. No error is raised
if both are given but silently chooses config_path over config

2 years ago[clang-tidy] Don't check decltype return types in `readability-const-return-type`
Evgeny Shulgin [Thu, 10 Feb 2022 19:59:24 +0000 (22:59 +0300)]
[clang-tidy] Don't check decltype return types in `readability-const-return-type`

The checker removes `const`s that are superfluos and badly affect
readability. `decltype(auto)`/`decltype(expr)` are often const-qualified, but
have no effect on readability and usually can't stop being const-qualified
without significant code change.

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

Reviewed By: aaron.ballman

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

2 years ago[SLP] Avoid unnecessary getIncomingValueForBlock() call (NFC)
Nikita Popov [Thu, 17 Mar 2022 11:22:16 +0000 (12:22 +0100)]
[SLP] Avoid unnecessary getIncomingValueForBlock() call (NFC)

This code just wants to check all incoming values, we don't care
care what the incoming block is here.

2 years agoRevert "[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64"
David Spickett [Thu, 17 Mar 2022 09:36:55 +0000 (09:36 +0000)]
Revert "[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64"

This reverts commit 406d418c0c831287b41c83150369fd8485c3d700.

Our regular bots are now using clang-13. The previous set will remain
online for a while to check reviews that haven't rebased to include
this change yet.

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

2 years ago[X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments...
Simon Pilgrim [Thu, 17 Mar 2022 10:42:29 +0000 (10:42 +0000)]
[X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments (PR20670)

Extension to 4390c721cba09597037578100948bbc83cc41b16 - similar to the vanilla load/store intrinsics, _mm_lddqu_si128/_mm256_lddqu_si256 should take an unaligned pointer, but were using the aligned m128i/m256i types which can cause alignment warnings.

The existing sse3-builtins.c and avx-builtins.c tests in llvm-project\clang\test\CodeGen\X86 should cover this.

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

2 years ago[mlir][bazel] make .pyi files available to Bazel
Alex Zinenko [Wed, 16 Mar 2022 14:59:59 +0000 (15:59 +0100)]
[mlir][bazel] make .pyi files available to Bazel

These files are necessary for various type checking and autocompletion
tooling to work.

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

2 years ago[flang] handle allocatable components when creating array temps
Jean Perier [Thu, 17 Mar 2022 09:55:56 +0000 (10:55 +0100)]
[flang] handle allocatable components when creating array temps

When creating an array temporary in the array copy pass, care must be
taken with allocatable components. The element components needs to be
given a clean unallocated status before being used in the assignments.
This is because assignment of allocatable components makes deep copy,
and may cause deallocation of the previous value if it was allocated.
Hence the previous allocation status cannot be let undefined.

On top of that, when cleaning-up the temp, all allocatable components
that may have been allocated must be deallocated.

This patch implements this by centralizing the code making and cleaning
array temps in ArrayValueCopy.cpp, and by calling Initialize and Destroy
runtime entry points when they are allocatable components.

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

2 years ago[Bazel] Update Bazel build to add symbol_graph.
Adrian Kuegel [Thu, 17 Mar 2022 07:49:27 +0000 (08:49 +0100)]
[Bazel] Update Bazel build to add symbol_graph.

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

2 years ago[Clang][VE] Add vector mask intrinsics to clang
Kazushi (Jam) Marukawa [Wed, 16 Mar 2022 15:20:38 +0000 (00:20 +0900)]
[Clang][VE] Add vector mask intrinsics to clang

Add vector mask intrinsics instructions to clang.

Reviewed By: simoll

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

2 years ago[LegacyPassManager] Move structural hashing into Pass classes. NFC.
Jay Foad [Fri, 18 Feb 2022 10:53:32 +0000 (10:53 +0000)]
[LegacyPassManager] Move structural hashing into Pass classes. NFC.

Move structural hashing into virtual methods on Pass. This will
allow MachineFunctionPass to override the method to add hashing of
the MachineFunction.

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

2 years ago[AArch64] Combine ISD::AND into AArch64ISD::ANDS
David Green [Thu, 17 Mar 2022 09:44:11 +0000 (09:44 +0000)]
[AArch64] Combine ISD::AND into AArch64ISD::ANDS

If we already have a AArch64ISD::ANDS node with identical operands, we
can merge any ISD::AND into it, reducing the instruction count by
calculating the value and the flags in a single operation. This code is
taken from the X86 backend, and could also handle AArch64ISD::ADDS and
AArch64ISD::SUBS, but I couldn't find any test cases where it came up.

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

2 years ago[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Thu, 17 Mar 2022 09:24:59 +0000 (10:24 +0100)]
[mlir][Bazel] Add missing dependency.

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

2 years ago[mlir][Bazel] Adapt BUILD.bazel for move of lsp-server support files.
Adrian Kuegel [Thu, 17 Mar 2022 08:52:56 +0000 (09:52 +0100)]
[mlir][Bazel] Adapt BUILD.bazel for move of lsp-server support files.

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

2 years agoReapply [InstCombine] Support switch in phi to cond fold
Nikita Popov [Wed, 2 Mar 2022 09:54:57 +0000 (10:54 +0100)]
Reapply [InstCombine] Support switch in phi to cond fold

Reapply with an explicit check for multi-edges, as the expected
behavior of multi-edge dominance is unclear (D120811).

-----

For conditional branches, we know the value is i1 0 or i1 1 along
the outgoing edges. For switches we can apply exactly the same
optimization, just with the known values determined by the switch
cases.

2 years ago[pseudo] Fix some naming-style violations.
Haojian Wu [Thu, 17 Mar 2022 08:08:25 +0000 (09:08 +0100)]
[pseudo] Fix some naming-style violations.

2 years ago[clang-format][docs] Regenerate ClangFormatStyleOptions.rst
Krystian Kuzniarek [Thu, 17 Mar 2022 08:43:37 +0000 (09:43 +0100)]
[clang-format][docs] Regenerate ClangFormatStyleOptions.rst

Misalignment of clang/docs/ClangFormatStyleOptions.rst and
clang/include/clang/Format/Format.h was introduced in c24b3db45.

Regenerated with:
python clang/docs/tools/dump_format_style.py

Reviewed By: sstwcw, curdeius, HazardyKnusperkeks

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

2 years ago[mlir][Bazel] Also fix mlir/unittests/BUILD.bazel.
Adrian Kuegel [Thu, 17 Mar 2022 08:40:47 +0000 (09:40 +0100)]
[mlir][Bazel] Also fix mlir/unittests/BUILD.bazel.

2 years ago[clang-format] Correctly recognize binary operators in template arguments with parent...
Marek Kurdej [Wed, 16 Mar 2022 20:50:26 +0000 (21:50 +0100)]
[clang-format] Correctly recognize binary operators in template arguments with parenthesized literals.

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

Before, code like `foo<b & 1>` was formatted correctly but `foo<b & (1)>` wasn't.
This patch fixes this inconsistency.

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years agoReland "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"
Yi Kong [Wed, 16 Mar 2022 06:06:23 +0000 (14:06 +0800)]
Reland "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"

This reverts commit ba59476515cf4598dd25bcfacfbca11b4f4da3d4.

2 years ago[clang-format] Reformat. NFC.
Marek Kurdej [Thu, 17 Mar 2022 08:01:37 +0000 (09:01 +0100)]
[clang-format] Reformat. NFC.

2 years ago[mlir][Bazel] Adapt to move of FuncOp.
Adrian Kuegel [Thu, 17 Mar 2022 08:24:53 +0000 (09:24 +0100)]
[mlir][Bazel] Adapt to move of FuncOp.

2 years ago[mlir] Make header standalone (NFC)
Adrian Kuegel [Thu, 17 Mar 2022 08:20:18 +0000 (09:20 +0100)]
[mlir] Make header standalone (NFC)

2 years ago[RISCV] Add patterns for vnsrl.wi and vnsra.wi instructions
Lian Wang [Wed, 16 Mar 2022 08:42:19 +0000 (08:42 +0000)]
[RISCV] Add patterns for vnsrl.wi and vnsra.wi instructions

Reviewed By: craig.topper

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

2 years ago[mlir][NFC] Move the LSP agnostic files to a new lsp-server directory
River Riddle [Fri, 11 Mar 2022 07:17:24 +0000 (23:17 -0800)]
[mlir][NFC] Move the LSP agnostic files to a new lsp-server directory

This allows for sharing the implementation of key components across multiple
MLIR language servers. These will be used in a followup to help implement
a PDLL language server.

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

2 years ago[PDLL] Add proper expansive documentation for PDLL
River Riddle [Tue, 15 Feb 2022 23:43:00 +0000 (15:43 -0800)]
[PDLL] Add proper expansive documentation for PDLL

This commit adds detailed documentation for PDLL, its language design, and
captures a bit of the rationale. This document captures everything in-tree at present,
and is intended to be an all encompassing manual for interacting with and understanding
PDLL.

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

2 years ago[flang] Lower array related intrinsics
Valentin Clement [Thu, 17 Mar 2022 06:17:10 +0000 (07:17 +0100)]
[flang] Lower array related intrinsics

This patch adds lowering for somw array related intrinsics:
- `reshape`
- `spread`

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

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[lldb] Migrate runtime instrumentation plugins to ReportWarning
Jonas Devlieghere [Thu, 17 Mar 2022 06:09:59 +0000 (23:09 -0700)]
[lldb] Migrate runtime instrumentation plugins to ReportWarning

2 years ago[flang] Lower character related intrinsics
Valentin Clement [Thu, 17 Mar 2022 06:13:40 +0000 (07:13 +0100)]
[flang] Lower character related intrinsics

This patch adds lowering for some character related
intrinsics:
- `scan`
- `verify`

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[lldb] Remove commented-out code in CommandObjectExpression (NFC)
Jonas Devlieghere [Thu, 17 Mar 2022 06:02:24 +0000 (23:02 -0700)]
[lldb] Remove commented-out code in CommandObjectExpression (NFC)

2 years ago[lldb] Migrate condition evaluation failure to ReportError
Jonas Devlieghere [Thu, 17 Mar 2022 05:38:39 +0000 (22:38 -0700)]
[lldb] Migrate condition evaluation failure to ReportError

Migrate to using ReportError to report a failure to evaluate a
watchpoint condition. I had already done so for the parallel code for
breakpoints.

In the process, I noticed that I accidentally regressed the error
reporting for breakpoint conditions by dropping the call to
GetDescription. This patch rectifies that and adds a test.

Because the call to GetDescription expects a Stream*, I also switches
from using a raw_string_ostream to a StreamString for both breakpoints
and watchpoints.

2 years ago[mlir] Refactor DialectRegistry delayed interface support into a general DialectExten...
River Riddle [Tue, 22 Feb 2022 22:49:12 +0000 (14:49 -0800)]
[mlir] Refactor DialectRegistry delayed interface support into a general DialectExtension mechanism

The current dialect registry allows for attaching delayed interfaces, that are added to attrs/dialects/ops/etc.
when the owning dialect gets loaded. This is clunky for quite a few reasons, e.g. each interface type has a
separate tracking structure, and is also quite limiting. This commit refactors this delayed mutation of
dialect constructs into a more general DialectExtension mechanism. This mechanism is essentially a registration
callback that is invoked when a set of dialects have been loaded. This allows for attaching interfaces directly
on the loaded constructs, and also allows for loading new dependent dialects. The latter of which is
extremely useful as it will now enable dependent dialects to only apply in the contexts in which they
are necessary. For example, a dialect dependency can now be conditional on if a user actually needs the
interface that relies on it.

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

2 years ago[lldb] Fix flakiness in command-disassemble-process.yaml (2/2)
Jonas Devlieghere [Thu, 17 Mar 2022 05:09:59 +0000 (22:09 -0700)]
[lldb] Fix flakiness in command-disassemble-process.yaml (2/2)

I split up the test so we could stop redirecting stderr to stdout but I
forgot to include that part in the previous commit.

2 years ago[mlir][vscode] Don't inject inside strings
Jacques Pienaar [Thu, 17 Mar 2022 04:57:04 +0000 (21:57 -0700)]
[mlir][vscode] Don't inject inside strings

Avoids matching R"mlir( while already inside a string.

2 years ago[AMDGPU] Select buffer_atomic_cmpswap* in tblgen
Abinav Puthan Purayil [Tue, 15 Mar 2022 18:14:03 +0000 (23:44 +0530)]
[AMDGPU] Select buffer_atomic_cmpswap* in tblgen

This change replaces the manual selection of buffer_atomic_cmpswap*
instructions in SelectionDAG and GlobalISel with a tblgen based
selection in BUFInstructions.td. This allows us to select the return and
no-return variants in tblgen.

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

2 years ago[lldb] Fix flakyness in command-disassemble-process.yaml
Jonas Devlieghere [Thu, 17 Mar 2022 04:27:54 +0000 (21:27 -0700)]
[lldb] Fix flakyness in command-disassemble-process.yaml

2 years ago[lldb] Fix flakyness in Minidump/no-process-id.yaml
Jonas Devlieghere [Thu, 17 Mar 2022 04:21:11 +0000 (21:21 -0700)]
[lldb] Fix flakyness in Minidump/no-process-id.yaml

2 years ago[lldb] Update TargetProperties::CheckJITObjectsDir to use ReportError
Jonas Devlieghere [Thu, 17 Mar 2022 03:55:59 +0000 (20:55 -0700)]
[lldb] Update TargetProperties::CheckJITObjectsDir to use ReportError

2 years ago[LTO][ELF] Add --stats-file= option.
wangliushuai [Thu, 17 Mar 2022 03:53:44 +0000 (11:53 +0800)]
[LTO][ELF] Add --stats-file= option.

This patch adds a StatsFile option supported by gold to lld, related patch https://reviews.llvm.org/D45531.

Reviewed By: tejohnson, MaskRay

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

2 years ago[WebAssembly] Disable SimplifyDemandedVectorElts after legalization
Heejin Ahn [Wed, 16 Mar 2022 08:39:30 +0000 (01:39 -0700)]
[WebAssembly] Disable SimplifyDemandedVectorElts after legalization

This fixes a reported bug that caused an infinite loop during the
SelectionDAG optimization phase in ISel, by creating an overridable hook
in `TargetLowering` that allows us to bail out from running
`SimplifyDemandedVectorElts`.

Reviewed By: tlively

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

2 years ago[WebAssembly] Improve EH/SjLj error messages
Heejin Ahn [Sat, 26 Feb 2022 05:40:27 +0000 (21:40 -0800)]
[WebAssembly] Improve EH/SjLj error messages

This includes a function name and a relevant instruction in error
messages when possible, making them more helpful.

Reviewed By: dschuff

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

2 years ago[NFC][MLIR][Affine] Add todo for adding affine namespace
William S. Moses [Thu, 17 Mar 2022 03:44:52 +0000 (23:44 -0400)]
[NFC][MLIR][Affine] Add todo for adding affine namespace

2 years ago[MLIR][Affine] Expose region-based isTopLevelValue
William S. Moses [Thu, 17 Mar 2022 03:29:42 +0000 (23:29 -0400)]
[MLIR][Affine] Expose region-based isTopLevelValue

This PR exposes the region-based isTopLevelValue,
which is useful for other code that performs Affine transformations,
but is not within AffineOps.cpp

Reviewed By: bondhugula

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

2 years ago[MLIR][Affine] Expose getAffineScope as a utility function
William S. Moses [Wed, 16 Mar 2022 16:58:28 +0000 (12:58 -0400)]
[MLIR][Affine] Expose getAffineScope as a utility function

The getAffineScope function is currently internal
to AffineOps.cpp. However, as the comment on the function
itself notes, this is useful in a variety of other places
externally. This PR allows other files to use the function.

Reviewed By: bondhugula

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

2 years ago[AMDGPU][SIFoldOperands] Consider the alignment constraints
Christudasan Devadasan [Wed, 16 Mar 2022 12:38:48 +0000 (18:08 +0530)]
[AMDGPU][SIFoldOperands] Consider the alignment constraints

Enforced an alignment check while folding the operands.

2 years ago[AMDGPU][MachineVerifier] Alignment check for fp32 packed math instructions
Christudasan Devadasan [Wed, 16 Mar 2022 12:03:02 +0000 (17:33 +0530)]
[AMDGPU][MachineVerifier] Alignment check for fp32 packed math instructions

The fp32 packed math instructions are introduced in gfx90a.
If their vector register operands are not properly aligned, the
verifier should flag them. Currently, the verifier failed to
report it and the compiler ended up emitting a broken assembly.
This patch fixes that missed case in TII::verifyInstruction.

Reviewed By: arsenm

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

2 years ago[RISCV][NFC] Replace redundant code with VLOpFrag
Lian Wang [Thu, 17 Mar 2022 02:04:39 +0000 (02:04 +0000)]
[RISCV][NFC] Replace redundant code with VLOpFrag

Reviewed By: craig.topper

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

2 years agoStricter use-after-dtor detection for trivial members.
Evgenii Stepanov [Wed, 16 Mar 2022 01:43:38 +0000 (18:43 -0700)]
Stricter use-after-dtor detection for trivial members.

Poison trivial class members one-by-one in the reverse order of their
construction, instead of all-at-once at the very end.

For example, in the following code access to `x` from `~B` will
produce an undefined value.

struct A {
  struct B b;
  int x;
};

Reviewed By: kda

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

2 years agoUse-after-dtor detection for trivial base classes.
Evgenii Stepanov [Wed, 16 Mar 2022 01:43:30 +0000 (18:43 -0700)]
Use-after-dtor detection for trivial base classes.

-fsanitize-memory-use-after-dtor detects memory access after a
subobject is destroyed but its memory is not yet deallocated.
This is done by poisoning each object memory near the end of its destructor.

Subobjects (members and base classes) do this in their respective
destructors, and the parent class does the same for its members with
trivial destructors.

Inexplicably, base classes with trivial destructors are not handled at
all. This change fixes this oversight by adding the base class poisoning logic
to the parent class destructor.

Reviewed By: vitalybuka

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

2 years ago[Clang] [P2025] More exhaustive tests for NRVO
Evgeny Shulgin [Wed, 16 Feb 2022 10:40:05 +0000 (13:40 +0300)]
[Clang] [P2025] More exhaustive tests for NRVO

This is a preliminary patch ahead of D119792 (I'll rebase that one on top of this).
This shows what Clang's _current_ behaviour is for calculating NRVO in various
common cases. Then, in D119792 (and future patches), I'll be able to demostrate
exactly how LLVM IR for each of these cases changes.

Reviewed By: Quuxplusone

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

2 years ago[FIX][NFC] Fix a test case in clang/SymbolGraph
Zixu Wang [Thu, 17 Mar 2022 00:19:35 +0000 (17:19 -0700)]
[FIX][NFC] Fix a test case in clang/SymbolGraph

The clang/SymbolGraph/global_record.c test case explicitly diffs the
clang version in use, which causes failures. Fix the issue by normalize
the `generator` field before checking the output.

2 years ago[mlir:FunctionOpInterface] Rename the "type" attribute to "function_type"
River Riddle [Wed, 16 Mar 2022 00:36:15 +0000 (17:36 -0700)]
[mlir:FunctionOpInterface] Rename the "type" attribute to "function_type"

This removes any potential confusion with the `getType` accessors
which correspond to SSA results of an operation, and makes it
clear what the intent is (i.e. to represent the type of the function).

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

2 years ago[mlir] Move the Builtin FuncOp to the Func dialect
River Riddle [Tue, 8 Mar 2022 03:16:03 +0000 (19:16 -0800)]
[mlir] Move the Builtin FuncOp to the Func dialect

This commit moves FuncOp out of the builtin dialect, and into the Func
dialect. This move has been planned in some capacity from the moment
we made FuncOp an operation (years ago). This commit handles the
functional aspects of the move, but various aspects are left untouched
to ease migration: func::FuncOp is re-exported into mlir to reduce
the actual API churn, the assembly format still accepts the unqualified
`func`. These temporary measures will remain for a little while to
simplify migration before being removed.

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

2 years ago[mlir] Add C API for ControlFlow dialect
Martin Erhart [Wed, 16 Mar 2022 23:17:53 +0000 (00:17 +0100)]
[mlir] Add C API for ControlFlow dialect

Add basic C API for the ControlFlow dialect. Follows the format of the other dialects.

Reviewed By: mehdi_amini

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

2 years ago[gn build] Port 22077627ae20
LLVM GN Syncbot [Wed, 16 Mar 2022 23:23:57 +0000 (23:23 +0000)]
[gn build] Port 22077627ae20

2 years ago[CodeGen] Inline _byteswap_* builtins.
Eli Friedman [Wed, 16 Mar 2022 22:35:57 +0000 (15:35 -0700)]
[CodeGen] Inline _byteswap_* builtins.

As discussed in D57915.

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

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

2 years ago[gn build] (manually) port 5aab45f43066 (SymbolGraph)
Nico Weber [Wed, 16 Mar 2022 23:18:27 +0000 (19:18 -0400)]
[gn build] (manually) port 5aab45f43066 (SymbolGraph)

2 years ago[libc++] Remove <utility> includes
Nikolas Klauser [Mon, 7 Mar 2022 15:31:33 +0000 (16:31 +0100)]
[libc++] Remove <utility> includes

Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits, arphaman

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

2 years ago[libc++] Add warning pragma macros in the test suite
Nikolas Klauser [Mon, 14 Mar 2022 13:30:24 +0000 (14:30 +0100)]
[libc++] Add warning pragma macros in the test suite

Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, libcxx-commits

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

2 years ago[flang] Remove unused code and redundant assertion.
Eric Schweitz [Wed, 16 Mar 2022 22:23:25 +0000 (15:23 -0700)]
[flang] Remove unused code and redundant assertion.

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

2 years ago[FIX][clang-extract-api] Fix scope naming violation
Zixu Wang [Wed, 16 Mar 2022 23:01:50 +0000 (16:01 -0700)]
[FIX][clang-extract-api] Fix scope naming violation

2 years ago[lldb/crashlog] Create artificial frames for non-crashed scripted threads
Med Ismail Bennani [Wed, 16 Mar 2022 22:44:31 +0000 (15:44 -0700)]
[lldb/crashlog] Create artificial frames for non-crashed scripted threads

This patch pipes down the `-a|--load-all` crashlog command option to the
Scripted Process initializer to load all the images used by crashed
process instead of only loading the images related to the crashed
thread.

This allows us to recreate artificial frames also for the non-crashed
scripted threads.

rdar://90396265

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[bazel] Port 50f82e68470c
Benjamin Kramer [Wed, 16 Mar 2022 22:46:35 +0000 (23:46 +0100)]
[bazel] Port 50f82e68470c

2 years agoRevert "[OpenMP][FIX] Allow device constructors for AMD GPU"
Johannes Doerfert [Wed, 16 Mar 2022 22:35:25 +0000 (17:35 -0500)]
Revert "[OpenMP][FIX] Allow device constructors for AMD GPU"

This reverts commit 07b176646134c3d88a4cecef5e0058e2de6b2409 as it broke
the buildbots:
    https://lab.llvm.org/buildbot#builders/193/builds/8594

2 years agoMinor refactor and renaming:
Jakob Johnson [Tue, 15 Mar 2022 13:06:55 +0000 (06:06 -0700)]
Minor refactor and renaming:
  - Rename IntelPTManager class and files to IntelPTCollector
  - Change GetTimestampCounter API to general trace counter API,
    GetCounter

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

2 years ago[clang][extract-api] Add global record support
Zixu Wang [Thu, 10 Feb 2022 21:42:35 +0000 (13:42 -0800)]
[clang][extract-api] Add global record support

Add facilities for extract-api:
- Structs/classes to hold collected API information: `APIRecord`, `API`
- Structs/classes for API information:
  - `AvailabilityInfo`: aggregated availbility information
  - `DeclarationFragments`: declaration fragments
    - `DeclarationFragmentsBuilder`: helper class to build declaration
      fragments for various types/declarations
  - `FunctionSignature`: function signature
- Serialization: `Serializer`
- Add output file for `ExtractAPIAction`
- Refactor `clang::RawComment::getFormattedText` to provide an
  additional `getFormattedLines` for a more detailed view of comment lines
  used for the SymbolGraph format

Add support for global records (global variables and functions)
- Add `GlobalRecord` based on `APIRecord` to store global records'
  information
- Implement `VisitVarDecl` and `VisitFunctionDecl` in `ExtractAPIVisitor` to
  collect information
- Implement serialization for global records
- Add test case for global records

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

2 years ago[OpenMP][FIX] Allow device constructors for AMD GPU
Johannes Doerfert [Wed, 16 Mar 2022 18:26:25 +0000 (13:26 -0500)]
[OpenMP][FIX] Allow device constructors for AMD GPU

In AMD GPU device code the globals are in AS(1). Before, we crashed if
the global was a structure. Now we simply cast away the AS before we
generate the code to initialize the global.

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

2 years ago[lldb] Expose diagnostic events through the SB API
Jonas Devlieghere [Wed, 16 Mar 2022 17:17:44 +0000 (10:17 -0700)]
[lldb] Expose diagnostic events through the SB API

Expose diagnostic events through the SB API. Unlike the progress events,
I opted to use a SBStructuredData so that we can add fields in the
future.

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

2 years ago[RISCV] Remove stale FIXME from a test. NFC
Craig Topper [Wed, 16 Mar 2022 21:42:25 +0000 (14:42 -0700)]
[RISCV] Remove stale FIXME from a test. NFC

2 years ago[RISCV] Improve detection of when to skip (and (srl x, c2) c1) -> (srli (slli x,...
Craig Topper [Wed, 16 Mar 2022 20:57:21 +0000 (13:57 -0700)]
[RISCV] Improve detection of when to skip (and (srl x, c2) c1) -> (srli (slli x, c3-c2), c3) isel.

We have a special case to skip this transform if c1 is 0xffffffff
and x is sext_inreg in order to use sraiw+zext.w. But we were only
checking that we have a sext_inreg opcode, not how many bits are
being sign extended.

This commit adds a check that it is a sext_inreg from i32 so we know for
sure that an sraiw can be created.

2 years ago[mlir] Fix missing verification after running an OpToOpAdaptorPass
River Riddle [Wed, 16 Mar 2022 18:45:14 +0000 (11:45 -0700)]
[mlir] Fix missing verification after running an OpToOpAdaptorPass

The current decision of when to run the verifier is running on the
assumption that nested passes can't affect the validity of the parent
operation, which isn't true. Parent operations may attach any number
of constraints on nested operations, which may not necessarily be
captured (or shouldn't be captured) at a smaller granularity.

This commit rectifies this by properly running the verifier after an
OpToOpAdaptor pass. To avoid an explosive increase in compile time,
we only run verification on the parent operation itself. To do this, a
flag to mlir::verify is added to avoid recursive verification if it isn't
desired.

Fixes #54288

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

2 years ago[OpenMP] Initial parsing/sema for the 'omp teams loop' construct
Mike Rice [Tue, 15 Mar 2022 15:35:59 +0000 (08:35 -0700)]
[OpenMP] Initial parsing/sema for the 'omp teams loop' construct

Adds basic parsing/sema/serialization support for the #pragma omp teams loop
directive.

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

2 years ago[lld-macho] Extend lto-internalize-unnamed-addr.ll
Jez Ng [Wed, 16 Mar 2022 21:28:31 +0000 (17:28 -0400)]
[lld-macho] Extend lto-internalize-unnamed-addr.ll

* Test the case where a symbol is sometimes linkonce_odr and sometimes weak_odr
* Test the visibility of the symbols at the IR level, after the internalize
  stage of LTO is done. (Previously we only checked the visibility of
  symbols in the final output binary.)

Reviewed By: modimo

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

2 years ago[libc++][NFC] Reindent release notes bullet points
Louis Dionne [Wed, 16 Mar 2022 21:26:26 +0000 (17:26 -0400)]
[libc++][NFC] Reindent release notes bullet points

2 years ago[OpaquePtr][ARM] Use elementtype on ldrex/ldaex/stlex/strex
Arthur Eubanks [Wed, 16 Mar 2022 18:21:27 +0000 (11:21 -0700)]
[OpaquePtr][ARM] Use elementtype on ldrex/ldaex/stlex/strex

Includes verifier changes checking the elementtype, clang codegen
changes to emit the elementtype, and ISel changes using the elementtype.

Basically the same as D120527.

Reviewed By: #opaque-pointers, nikic

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

2 years ago[CODE_OWNERS/CREDITS] Update my email address
Alex Bradbury [Wed, 16 Mar 2022 21:07:15 +0000 (21:07 +0000)]
[CODE_OWNERS/CREDITS] Update my email address

2 years agoRevert "[SLP]Do not schedule instructions with constants/argument/phi operands and...
Alexey Bataev [Wed, 16 Mar 2022 20:53:36 +0000 (13:53 -0700)]
Revert "[SLP]Do not schedule instructions with constants/argument/phi operands and external users."

This reverts commit 1eeb2bfe727323332800e8d390f2f8c63c953779 to fix
a bug reported in https://reviews.llvm.org/D121121

2 years ago[clang-format] Reformat. NFC.
Marek Kurdej [Wed, 16 Mar 2022 20:53:52 +0000 (21:53 +0100)]
[clang-format] Reformat. NFC.

2 years ago[SCCP] update test to NPM, update_test_checks. NFC
Nick Desaulniers [Wed, 16 Mar 2022 20:49:58 +0000 (13:49 -0700)]
[SCCP] update test to NPM, update_test_checks. NFC

Pre-committing a test update to make changes in D121744 more visible.

2 years ago[flang] Include missing internal interfaces in .mod files
Emil Kieri [Tue, 15 Mar 2022 17:40:06 +0000 (18:40 +0100)]
[flang] Include missing internal interfaces in .mod files

Interfaces which are internal to a procedure need to be included in
module files if (and only if) they are referenced in the interface of
the procedure. That is, they are needed if they are the interfaces of
dummy or return value procedures.

Fixes #53420

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

2 years ago[WebAssembly] Fix names of SIMD instructions containing '_zero'
Thomas Lively [Wed, 16 Mar 2022 20:34:56 +0000 (13:34 -0700)]
[WebAssembly] Fix names of SIMD instructions containing '_zero'

Fix the instruction names to match the WebAssembly spec:

 - `i32x4.trunc_sat_zero_f64x2_{s,u}` => `i32x4.trunc_sat_f64x2_{s,u}_zero`
 - `f32x4.demote_zero_f64x2` => `f32x4.demote_f64x2_zero`

Also rename related things like intrinsics, builtins, and test functions to
match.

Reviewed By: aheejin

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

2 years ago[flang] Lower pack|unpack intrinsics
Valentin Clement [Wed, 16 Mar 2022 20:11:57 +0000 (21:11 +0100)]
[flang] Lower pack|unpack intrinsics

This patch adds lowering for the `pack` and `unpack`
intrinsics.

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

Reviewed By: schweitz

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

Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2 years ago[ConstraintElimination] Add missing dominance check.
Florian Hahn [Wed, 16 Mar 2022 20:01:24 +0000 (20:01 +0000)]
[ConstraintElimination] Add missing dominance check.

When dealing with an unconditional branch, the condition can only added
if BB properly dominates the successor.

2 years ago[AMDGPU] Define new feature HasFlatScratchSVSMode. NFC.
Jay Foad [Wed, 16 Mar 2022 14:10:49 +0000 (14:10 +0000)]
[AMDGPU] Define new feature HasFlatScratchSVSMode. NFC.

This is by analogy with HasFlatScratchSTMode and is slightly more
informative than using isGFX940Plus.

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