platform/upstream/llvm.git
2 years ago[mlir] Allow RegionRange to accept ArrayRef<Region *>
Mogball [Fri, 25 Mar 2022 22:44:34 +0000 (22:44 +0000)]
[mlir] Allow RegionRange to accept ArrayRef<Region *>

Adds another pointer to the union in RegionRange to allow RegionRange to work on ArrayRef<Region *> (i.e. vectors of Region *).

Reviewed By: rriddle

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

2 years ago[mlir][cf-sink] Accept a callback for sinking operations
Mogball [Fri, 25 Mar 2022 21:13:30 +0000 (21:13 +0000)]
[mlir][cf-sink] Accept a callback for sinking operations

(This was a TODO from the initial patch).

The control-flow sink utility accepts a callback that is used to sink an operation into a region.
The `moveIntoRegion` is called on the same operation and region that return true for `shouldMoveIntoRegion`.
The callback must preserve the dominance of the operation within the region. In the default control-flow
sink implementation, this is moving the operation to the start of the entry block.

Reviewed By: mehdi_amini

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

2 years ago[AMDGPU][NFC]: Remove unnecessary MFI functions
Changpeng Fang [Mon, 28 Mar 2022 19:13:33 +0000 (12:13 -0700)]
[AMDGPU][NFC]: Remove unnecessary MFI functions

Summary:
  hasHostcallPtr() and hasHeapPtr() are only used in metadata emit.
However, we can use the corresponding function attributes directly
instead introducing the functions.

Reviewers: arsenm

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

2 years ago[clang][NFC] Remove unused parameter in `Sema::ActOnDuplicateDefinition`.
Volodymyr Sapsai [Fri, 25 Mar 2022 22:05:00 +0000 (15:05 -0700)]
[clang][NFC] Remove unused parameter in `Sema::ActOnDuplicateDefinition`.

2 years ago[AIX][XCOFF] address post-commit review comments of patch https://reviews.llvm.org...
zhijian [Mon, 28 Mar 2022 19:05:41 +0000 (15:05 -0400)]
[AIX][XCOFF] address post-commit review comments of patch https://reviews.llvm.org/D82549
Summary:
Address post-commit review comments in the https://reviews.llvm.org/D82549, including

changed file name from llvm/test/tools/llvm-readobj/XCOFF/xcoff-auxiliary-header.test --> llvm/test/tools/llvm-readobj/XCOFF/auxiliary-header.test
replaced macro define by using lambda function.
added a helper function to reduce the duplicated check and print error code.

Reviewer : James Henderson
Differential Revision: https://reviews.llvm.org/D116220

2 years ago[compiler-rt][AArch64] Initialize __aarch64_have_lse_atomics for Fuchsia
Roland McGrath [Wed, 2 Feb 2022 20:18:23 +0000 (12:18 -0800)]
[compiler-rt][AArch64] Initialize __aarch64_have_lse_atomics for Fuchsia

Use Fuchsia's zx_system_get_features API to determine
whether LSE atomics are available on the machine.

Reviewed By: abrachet

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

2 years agoFix template instantiation of UDLs
Aaron Ballman [Mon, 28 Mar 2022 18:46:14 +0000 (14:46 -0400)]
Fix template instantiation of UDLs

Previously, we would instantiate the UDL by marking the function as
referenced and potentially binding to a temporary; this skipped
transforming the call when the UDL was dependent on a template
parameter.

Now, we defer all the work to instantiating the call expression for the
UDL. This ensures that constant evaluation occurs at compile time
rather than deferring until runtime.

Fixes Issue 54578.

2 years agoAdd stub DirectX backend
Chris Bieneman [Mon, 28 Mar 2022 18:21:02 +0000 (13:21 -0500)]
Add stub DirectX backend

This is the bare minimum needed to get the DirectX target compiling,
but does not actually do anything.

Reviewed By: pete, rnk, arsenm, jaebaek

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

2 years ago[libTooling] Fix indentation. NFC.
Eric Li [Mon, 28 Mar 2022 18:29:31 +0000 (18:29 +0000)]
[libTooling] Fix indentation. NFC.

2 years ago[flang] Fold NEAREST() and its relatives
Peter Klausler [Thu, 24 Mar 2022 16:03:07 +0000 (09:03 -0700)]
[flang] Fold NEAREST() and its relatives

Implement constant folding for the intrinsic function NEAREST()
and the related functions IEEE_NEXT_AFTER(), IEEE_NEXT_UP(), and
IEEE_NEXT_DOWN().

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

2 years ago[OpenMP] Fix library path missing when using OpenMP
Joseph Huber [Mon, 28 Mar 2022 16:23:21 +0000 (12:23 -0400)]
[OpenMP] Fix library path missing when using OpenMP

The changes in D122444 caused OpenMP programs built with the
LLVM_ENABLE_RUNTIMES options to stop finding the libraries. We generally
expect to link against the libraries associated with the clang
installation itself but we no longer implicitly included that directory.
This patch adds in the include path of the clang installations library
to ensure we can find them.

Reviewed By: jdoerfert, MaskRay

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

2 years ago[mlir] Flip Vector dialect accessors used to prefixed form.
Jacques Pienaar [Mon, 28 Mar 2022 18:24:47 +0000 (11:24 -0700)]
[mlir] Flip Vector dialect accessors used to prefixed form.

This has been on _Both for a couple of weeks. Flip usages in core with
intention to flip flag to _Prefixed in follow up. Needed to add a couple
of helper methods in AffineOps and Linalg to facilitate a pure flag flip
in follow up as some of these classes are used in templates and so
sensitive to Vector dialect changes.

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

2 years ago[demangler] Add StringView conversion operator
Nathan Sidwell [Tue, 1 Mar 2022 16:36:24 +0000 (08:36 -0800)]
[demangler] Add StringView conversion operator

The OutputBuffer class tries to present a NUL-terminated string API to
consumers.  But several of them would prefer a StringView.  In
particular the Microsoft demangler, juggles between NUL-terminated and
StringView, which is confusing.

This adds a StringView conversion, and adjusts the Demanglers that can
benefit from that.

Reviewed By: dblaikie

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

2 years agoPass -disable-llvm-passes to avoid running llvm passes
Akira Hatanaka [Mon, 28 Mar 2022 18:14:44 +0000 (11:14 -0700)]
Pass -disable-llvm-passes to avoid running llvm passes

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

2 years ago[mlir] Simplify LoopLikeOpInterface
Mogball [Mon, 28 Mar 2022 18:09:26 +0000 (18:09 +0000)]
[mlir] Simplify LoopLikeOpInterface

- Adds default implementations of `isDefinedOutsideOfLoop` and `moveOutOfLoop` since 99% of all implementations of these functions were identical
- `moveOutOfLoop` takes one operation and doesn't return anything anymore. 100% of all implementations of this function would always return `success` and uses would either respond with a pass failure or an `llvm_unreachable`.

2 years ago[RISCV] Add lowering for vp.fptosi and vp.sitofp.
Craig Topper [Mon, 28 Mar 2022 15:52:15 +0000 (08:52 -0700)]
[RISCV] Add lowering for vp.fptosi and vp.sitofp.

This as an alternative version of D120641. Starting from the code here
https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi/-/raw/EPI/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
but with some modifications to how the interim types are calculated,
and adding support for f16.

Still need to add fptosi for mask vectors.

Lots of masked isel patterns added so we can pass the mask through
the type changes.

Reviewed By: frasercrmck, arcbbb

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

2 years ago[ELF] Fix llvm_unreachable failure when COMMON is placed in SHT_PROGBITS output section
Fangrui Song [Mon, 28 Mar 2022 18:05:52 +0000 (11:05 -0700)]
[ELF] Fix llvm_unreachable failure when COMMON is placed in SHT_PROGBITS output section

Fix a regression in aa27bab5a1a17e9c4168a741a6298ecaa92c1ecb: COMMON in an
SHT_PROGBITS output section caused llvm_unreachable failure.

2 years ago[MLIR][LLVM] Mark read/write behavior of memcpy/memset/memmove
William S. Moses [Mon, 28 Mar 2022 01:59:52 +0000 (21:59 -0400)]
[MLIR][LLVM] Mark read/write behavior of memcpy/memset/memmove

This commit adds MemWrite (and MemRead, as appropriate) to the arugments of the memset/memcpy/memmove intrinsics within the LLVM dialect

Reviewed By: ftynse

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

2 years agosanitizer_common: Remove Fuchsia support for reading flags from files
Roland McGrath [Fri, 25 Mar 2022 00:02:20 +0000 (17:02 -0700)]
sanitizer_common: Remove Fuchsia support for reading flags from files

This has never really been used in practice.  Fuchsia is moving
away from the support this requires, so don't use it.

Reviewed By: phosek

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

2 years ago[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition
Fangrui Song [Mon, 28 Mar 2022 17:27:16 +0000 (10:27 -0700)]
[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition

Many options (-fsyntax-only, -E, -S, etc) skip the link action phase which the
existing condition does not account for.

Since the code no longer specifies OPT_c, I think a single RUN line about -c
not leading to a warning is sufficient. Adding one for all of -E,
-fsyntax-only, -S would be excessive.

Reviewed By: benshi001

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

2 years ago[Flang] Options to lower math intrinsics to relaxed, precise variants
Kiran Chandramohan [Mon, 28 Mar 2022 17:05:59 +0000 (17:05 +0000)]
[Flang] Options to lower math intrinsics to relaxed, precise variants

Enable lowering to the relaxed and precise variants in the pgmath
library.

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Reviewed By: clementval

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

2 years agoRevert "[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition"
Fangrui Song [Mon, 28 Mar 2022 17:11:45 +0000 (10:11 -0700)]
Revert "[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition"

This reverts commit 16524d2f1bdc2e74ca34425edf43ac8ef5d39531.

The test caused some warnings when avr-gcc was not installed.

2 years ago[ELF] Simplify MergeInputSection::getParentOffset. NFC
Fangrui Song [Mon, 28 Mar 2022 17:02:35 +0000 (10:02 -0700)]
[ELF] Simplify MergeInputSection::getParentOffset. NFC

and remove overly verbose comments.

2 years ago[ConstraintElimination] Add tests with signed predicates and ADDs.
Florian Hahn [Mon, 28 Mar 2022 17:00:18 +0000 (18:00 +0100)]
[ConstraintElimination] Add tests with signed predicates and ADDs.

2 years ago[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition
Fangrui Song [Mon, 28 Mar 2022 16:43:36 +0000 (09:43 -0700)]
[Driver][AVR] Fix warn_drv_avr_stdlib_not_linked condition

Many options (-fsyntax-only, -E, -S, etc) skip the link action phase which the
existing condition does not account for.

Since the code no longer specifies OPT_c, I think a single RUN line about -c
not leading to a warning is sufficient. Adding one for all of -E,
-fsyntax-only, -S would be excessive.

Reviewed By: benshi001

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

2 years ago[llvm] Fix string copy confusion
Nathan Sidwell [Thu, 24 Mar 2022 11:21:52 +0000 (04:21 -0700)]
[llvm] Fix string copy confusion

The microsoft demangler makes copies of the demangled strings, but has
some confusion between StringView representation (sans NUL), and
C-strings (with NUL).  Here we also have a use of strcpy, which
happens to work because the incoming string view happens to have a
trailing NUL.  But a simple memcpy excluding the NUL is sufficient.

Reviewed By: dblaikie, erichkeane

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

2 years ago[X86] lowerV64I8Shuffle - attempt to match with lowerShuffleAsLanePermuteAndPermute
Simon Pilgrim [Mon, 28 Mar 2022 16:21:11 +0000 (17:21 +0100)]
[X86] lowerV64I8Shuffle - attempt to match with lowerShuffleAsLanePermuteAndPermute

Fixes #54562

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in SampleProfReader...
Kazu Hirata [Mon, 28 Mar 2022 16:18:39 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in SampleProfReader.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in InstrProfReader...
Kazu Hirata [Mon, 28 Mar 2022 16:18:38 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in InstrProfReader.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in TapiUniversal.cpp...
Kazu Hirata [Mon, 28 Mar 2022 16:18:36 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in TapiUniversal.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in MachOUniversalWriter...
Kazu Hirata [Mon, 28 Mar 2022 16:18:35 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in MachOUniversalWriter.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in MCContext.cpp (NFC)
Kazu Hirata [Mon, 28 Mar 2022 16:18:33 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in MCContext.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in SummaryBasedOptimiza...
Kazu Hirata [Mon, 28 Mar 2022 16:18:31 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in SummaryBasedOptimizations.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in GsymReader.cpp ...
Kazu Hirata [Mon, 28 Mar 2022 16:18:30 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in GsymReader.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-smartptr-get in DwarfTransformer...
Kazu Hirata [Mon, 28 Mar 2022 16:18:28 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-smartptr-get in DwarfTransformer.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-redundant-member-init in Module.cpp (NFC)
Kazu Hirata [Mon, 28 Mar 2022 16:18:27 +0000 (09:18 -0700)]
Apply clang-tidy fixes for readability-redundant-member-init in Module.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-equals-default in ELFObject.cpp (NFC)
Kazu Hirata [Mon, 28 Mar 2022 16:18:25 +0000 (09:18 -0700)]
Apply clang-tidy fixes for modernize-use-equals-default in ELFObject.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-equals-default in InputFile.cpp (NFC)
Kazu Hirata [Mon, 28 Mar 2022 16:18:23 +0000 (09:18 -0700)]
Apply clang-tidy fixes for modernize-use-equals-default in InputFile.cpp (NFC)

2 years ago[AMDGPU] Fix adding modifiers when creating v_cmpx instructions.
Thomas Symalla [Fri, 25 Mar 2022 16:31:33 +0000 (17:31 +0100)]
[AMDGPU] Fix adding modifiers when creating v_cmpx instructions.

Revision https://reviews.llvm.org/D122332 added a pattern transformation
where v_cmpx instructions are introduced. However, the modifiers are
not correctly inherited from the original operands. The patch
adds the source modifiers, if they are exist, or sets them to 0.

Reviewed By: foad

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

2 years ago[mlir][emitc] Adapt to move of FuncOp
Marius Brehler [Wed, 23 Mar 2022 11:47:59 +0000 (11:47 +0000)]
[mlir][emitc] Adapt to move of FuncOp

Reviewed By: rriddle

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

2 years ago[libTooling] Support TransformerResult<void> in consumer callbacks
Eric Li [Mon, 28 Mar 2022 15:39:02 +0000 (15:39 +0000)]
[libTooling] Support TransformerResult<void> in consumer callbacks

Support `TransformerResult<void>` in the consumer callback, which
allows generic code to more naturally use the `Transformer` interface
(instead of needing to specialize on `void`).

This also delete the specialization that existed within `Transformer`
itself, instead replacing it with an `std::function` adapter.

Reviewed By: ymandel

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

2 years ago[Hexagon] Create an intrinsic to profile using a custom handler
Jyotsna Verma [Thu, 24 Mar 2022 21:38:27 +0000 (16:38 -0500)]
[Hexagon] Create an intrinsic to profile using a custom handler

The intrinsic is lowered into a hexagon pseudo instruction which
after register allocation is expanded into A2_tfrsi and J2_call.

2 years ago[LV] Move code to place induction increment to VPlan post-processing.
Florian Hahn [Mon, 28 Mar 2022 15:20:02 +0000 (16:20 +0100)]
[LV] Move code to place induction increment to VPlan post-processing.

This patch moves the code to set the correct incoming block for the
backedge value to VPlan::execute.

When generating the phi node, the backedge value is temporarily added
using the pre-header as incoming block. The invalid phi node will be
fixed up during VPlan::execute after main VPlan code generation.
At the same time, the backedge value is also moved to the latch.

This change removes the requirement to create the latch block up-front
for VPWidenIntOrFpInductionRecipe::execute, which in turn will enable
modeling the pre-header in VPlan.

As an alternative, the increment could be modeled as separate recipe,
but that would require more work and a bit of redundant code, as we need
to create the step-vector during VPWidenIntOrFpInductionRecipe::execute
anyways, to create the values for different parts.

Reviewed By: Ayal

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

2 years ago[mlir][NFC] Fix codestyle issues introduced in D121988
Markus Böck [Mon, 28 Mar 2022 14:54:34 +0000 (16:54 +0200)]
[mlir][NFC] Fix codestyle issues introduced in D121988

These were noticed in the post commit review of https://reviews.llvm.org/D121988

2 years ago[mlir][linalg] Control dimensions to pad.
gysit [Mon, 28 Mar 2022 14:36:47 +0000 (14:36 +0000)]
[mlir][linalg] Control dimensions to pad.

This revision supports padding only a subset of the iteration dimensions via an additional padding-dimensions parameter. This control allows us to pad an operation in multiple steps. For example, one may want to pad only the output dimensions of a producer matmul fused into a consumer loop nest, before tiling and padding its reduction dimension.

Depends On D122309

Reviewed By: nicolasvasilache

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

2 years ago[NVPTX] Fix poorly designed assertion introduced in D120129
Daniil Kovalev [Mon, 28 Mar 2022 14:33:48 +0000 (17:33 +0300)]
[NVPTX] Fix poorly designed assertion introduced in D120129

NVPTXTargetLowering::getFunctionParamOptimizedAlign, which was introduces in
D120129, contained a poorly designed assertion checking that a function with
internal or private linkage is not a kernel. It relied on invariants that
were not actually guaranteed, and that resulted in compiler crash with some
CUDA versions (see discussion with @jdoerfert in D120129). This patch changes
that assertion and makes it use isKernelFunction which is designed exactly for
such checks. This patch also includes a test with IR that caused compiler crash
before.

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

2 years agoExpose MlirOperationClone in Python bindings.
Dominik Grewe [Mon, 28 Mar 2022 13:45:40 +0000 (15:45 +0200)]
Expose MlirOperationClone in Python bindings.

Expose MlirOperationClone in Python bindings.

Reviewed By: ftynse

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

2 years ago[mlir][linalg] Use arrays to pass padding options.
gysit [Mon, 28 Mar 2022 13:41:39 +0000 (13:41 +0000)]
[mlir][linalg] Use arrays to pass padding options.

Pass the padding options using arrays instead of lambdas. In particular pass the padding value as string and use the argument parser to create the padding value. Arrays are a more natural choice that matches the current use cases and avoids converting arrays to lambdas.

Reviewed By: nicolasvasilache

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

2 years ago[ARM] Make testcase warning pattern match more specific
Ranjeet Singh [Mon, 28 Mar 2022 13:40:36 +0000 (14:40 +0100)]
[ARM] Make testcase warning pattern match more specific

Make the warning more specific as downstream compilers could produce other warnings.

Reviewed By: tstellar

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

2 years ago[NFC][tests][AIX] XFAIL test for lack of visibility support
Jake Egan [Mon, 28 Mar 2022 13:43:21 +0000 (09:43 -0400)]
[NFC][tests][AIX] XFAIL test for lack of visibility support

With the addition of `__attribute__((visibility("hidden")))` to the test, the test fails because AIX's current default behaviour is to ignore hidden visibility, so the expected error is not seen. This patch marks the test `XFAIL` on AIX for now.

Reviewed By: cebowleratibm

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

2 years agoUpdate www_status/add test for P1972:
Erich Keane [Mon, 28 Mar 2022 13:28:13 +0000 (06:28 -0700)]
Update www_status/add test for P1972:

This seems to have been implemented/supported correctly back in Clang
10, so update the documentation and add the test from the paper.

2 years ago[demangler] Add operator precedence
Nathan Sidwell [Fri, 4 Feb 2022 19:45:23 +0000 (11:45 -0800)]
[demangler] Add operator precedence

The demangler had no concept of operator precendence, and would
parenthesize many more subexpressions than necessary.  In particular
it would parenthesize primary-expressions, such as '4', which just
looks strange.  It would also parenthesize '>' expressions, just in
case they were inside a template parameter list.

This patch fixes both issues.

* Add operator precedence to the OpInfo structure, and add a
  subexpression helper that will parenthesize a lower precedence
  subexpression.

* Add a 'greater-than is greater-than' indicator to the output buffer,
  so the expression printer knows whether it is immediately inside a
  template parameter list (and must therefore parenthesize 'expr >
  expr').  This is a counter, so that ...

* Add open and close printers to the output buffer, that increment and
  decrement the gt-is-gt indicator.

* Parenthesize comma operators inside comma-separated lists. (probably
  a rare case, but still).

This dramatically reduces the extraneous parentheses being printed.

Reviewed By: dblaikie, bruno

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

2 years agoRemove a top-level using-directive from EPCDebugObjectRegistrar.h
Pavel Labath [Tue, 15 Mar 2022 13:17:28 +0000 (14:17 +0100)]
Remove a top-level using-directive from EPCDebugObjectRegistrar.h

The directive pollutes the namespace of all files which include the
header.

Use alternate ways to reference the namespace constituents instead.

2 years ago[lldb] Remove some unused functions from PosixApi.h
Pavel Labath [Mon, 21 Mar 2022 14:35:49 +0000 (15:35 +0100)]
[lldb] Remove some unused functions from PosixApi.h

There are better llvm replacements for all of these.

2 years ago[X86] Add shuffle tests from Issue #54562
Simon Pilgrim [Mon, 28 Mar 2022 12:54:07 +0000 (13:54 +0100)]
[X86] Add shuffle tests from Issue #54562

2 years ago[GlobalOpt] Handle non-instruction MTI source (PR54572)
Nikita Popov [Mon, 28 Mar 2022 12:26:24 +0000 (14:26 +0200)]
[GlobalOpt] Handle non-instruction MTI source (PR54572)

This was reusing a cast to GlobalVariable to check for an
Instruction, which means we'll try to dereference a null pointer
if it's not actually a GlobalVariable. We should be casting
MTI->getSource() instead.

I don't think this problem is really specific to opaque pointers,
but it certainly makes it a lot easier to reproduce.

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

2 years ago[flang] Lower some coarray statements to their runtime functions
Valentin Clement [Mon, 28 Mar 2022 11:36:10 +0000 (13:36 +0200)]
[flang] Lower some coarray statements to their runtime functions

This patch adds the lowering of coarray statements to the runtime
functions. The runtime functions are currently not implemented.

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

Reviewed By: jeanPerier

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

2 years agoCorrect a minor point with the Phabricator docs
Aaron Ballman [Mon, 28 Mar 2022 11:13:56 +0000 (07:13 -0400)]
Correct a minor point with the Phabricator docs

The repository field we want to leave blank is on the page as the
`Create Diff` button, so merged the instructions about leaving the
field blank and clicking the button.

2 years ago[FuncSpec] Support function specialization across multiple arguments.
Alexandros Lamprineas [Wed, 23 Mar 2022 14:51:16 +0000 (14:51 +0000)]
[FuncSpec] Support function specialization across multiple arguments.

The current implementation of Function Specialization does not allow
specializing more than one arguments per function call, which is a
limitation I am lifting with this patch.

My main challenge was to choose the most suitable ADT for storing the
specializations. We need an associative container for binding all the
actual arguments of a specialization to the function call. We also
need a consistent iteration order across executions. Lastly we want
to be able to sort the entries by Gain and reject the least profitable
ones.

MapVector fits the bill but not quite; erasing elements is expensive
and using stable_sort messes up the indices to the underlying vector.
I am therefore using the underlying vector directly after calculating
the Gain.

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

2 years agoRevert "[flang] Add & use a better visit()"
Andrzej Warzynski [Mon, 28 Mar 2022 10:46:47 +0000 (10:46 +0000)]
Revert "[flang] Add & use a better visit()"

This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has
caused multiple build failures:
*  https://lab.llvm.org/buildbot/#/builders/177/builds/4346
*  https://lab.llvm.org/buildbot/#/builders/180/builds/3803
*  https://lab.llvm.org/buildbot/#/builders/175/builds/10419
*  https://lab.llvm.org/buildbot/#/builders/191/builds/4318
*  https://lab.llvm.org/buildbot/#/builders/173/builds/4274
*  https://lab.llvm.org/buildbot/#/builders/181/builds/4297

All these bots failed with a time-out:
```
command timed out: 1200 seconds without output running [b'ninja', b'-j', b'32'], attempting to kill
```
I'm guessing that that's due to template instantiations failing at some
point (https://reviews.llvm.org/D122441 introduced a custom
implementation of std::visit). Everything seems fine when either:
* building on X86 with GCC or Clang (tested with GCC 9.3 and Clang 12)
* building on AArch64 with GCC (tested with GCC 11)

2 years agoReturn -no-canonical-prefixes for riskv32/64 test
Mikhail Goncharov [Mon, 28 Mar 2022 09:23:14 +0000 (11:23 +0200)]
Return -no-canonical-prefixes for riskv32/64 test

W/o -no-canonical-prefixes CC1: clang{{.*}} "-cc1" "-triple" "riscv32"
does not match clang output for some setups.

See da62a5c6610dd2087ce2f527ca84ba43e93d5e30.

2 years ago[clang][ASTImporter] Fix a bug when importing CXXDefaultInitExpr.
Balázs Kéri [Mon, 28 Mar 2022 06:57:11 +0000 (08:57 +0200)]
[clang][ASTImporter] Fix a bug when importing CXXDefaultInitExpr.

The "in-class initializer" expression should be set in the field of a
default initialization expression before this expression node is created.
The `CXXDefaultInitExpr` objects are created after the AST is loaded and
at import not present in the "To" AST. And the in-class initializers of
the used fields can be missing too, these must be set at import.

This fixes a github issue #54061.

Reviewed By: martong

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

2 years ago[mlir][OpenMP] Added ReductionClauseInterface
Shraiysh Vaishay [Mon, 28 Mar 2022 08:06:32 +0000 (13:36 +0530)]
[mlir][OpenMP] Added ReductionClauseInterface

This patch adds the ReductionClauseInterface and also adds reduction
support for `omp.parallel` operation.

Reviewed By: kiranchandramohan

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

2 years ago[AMDGPU] Split waterfall loop exec manipulation
Carl Ritson [Mon, 28 Mar 2022 08:30:09 +0000 (17:30 +0900)]
[AMDGPU] Split waterfall loop exec manipulation

Split waterfall loops into multiple blocks so that exec mask
manipulation (s_and_saveexec) does not occur in the middle of
a block.

VGPR live range optimizer is updated to handle waterfall loops
spanning multiple blocks.

Reviewed By: ruiling

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

2 years ago[gn build] Port c0eb9b4cdef6
LLVM GN Syncbot [Mon, 28 Mar 2022 08:27:36 +0000 (08:27 +0000)]
[gn build] Port c0eb9b4cdef6

2 years ago[Object][test] Fix invalid.test
Fangrui Song [Mon, 28 Mar 2022 08:27:16 +0000 (01:27 -0700)]
[Object][test] Fix invalid.test

2 years ago[flang][runtime] Ensure PointerDeallocate actually deallocate pointers
Jean Perier [Mon, 28 Mar 2022 08:21:36 +0000 (10:21 +0200)]
[flang][runtime] Ensure PointerDeallocate actually deallocate pointers

PointerDeallocate was silently doing nothing because it relied on
Destroy that doe not do anything for Pointers. Add an option to Destroy
in order to destroy pointers.

Add a unit test for PointerDeallocate.

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

2 years agoRevert D121984 "[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support"
Fangrui Song [Mon, 28 Mar 2022 08:17:37 +0000 (01:17 -0700)]
Revert D121984 "[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support"

This reverts commit ad57e10dbca2fdeff1448afc0aa1cf23d6df8736 and 1967fd8d5e7e40a987d8f65d163c7eb8f4b9e76f

llvm/lib/Support/RISCVVIntrinsicUtils.cpp introduced llvm/TableGen includes,
a circular dependency https://llvm.org/docs/CodingStandards.html#library-layering
I think this particular instance is serious and should be reverted.

2 years agoRevert "Revert "[RISCV][NFC] Remove unused header includes.""
Adrian Kuegel [Mon, 28 Mar 2022 07:49:18 +0000 (09:49 +0200)]
Revert "Revert "[RISCV][NFC] Remove unused header includes.""

Reland Remove unused header includes.
Add header includes that are needed, but previously were pulled in
transitively.

2 years ago[llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping
Fangrui Song [Mon, 28 Mar 2022 08:00:43 +0000 (01:00 -0700)]
[llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping

Fix #54456: `objcopy --only-keep-debug` produces a linked image with invalid
empty dynamic section. llvm-objdump -p currently reports an error which seems
excessive.

```
% llvm-readelf -l a.out
llvm-readelf: warning: 'a.out': no valid dynamic table was found
...
```

Follow the spirit of llvm-readelf -l (D64472) and report a warning instead.
This allows later files to be dumped despite warnings for an input file, and
improves objdump compatibility in that the exit code is now 0 instead of 1.

```
% llvm-objdump -p a.out  # new behavior
...
Program Header:
llvm-objdump: warning: 'a.out': invalid empty dynamic section
% objdump -p a.out
...
Dynamic Section:

```

Reviewed By: jhenderson, raj.khem

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

2 years ago[llvm-objdump][test] dos2unix some files
Fangrui Song [Mon, 28 Mar 2022 07:58:14 +0000 (00:58 -0700)]
[llvm-objdump][test] dos2unix some files

2 years ago[RISCV] Remove using namespace llvm from public header after D121984
Fangrui Song [Mon, 28 Mar 2022 07:51:58 +0000 (00:51 -0700)]
[RISCV] Remove using namespace llvm from public header after D121984

2 years agoRevert "[RISCV][NFC] Remove unused header includes."
Adrian Kuegel [Mon, 28 Mar 2022 07:48:14 +0000 (09:48 +0200)]
Revert "[RISCV][NFC] Remove unused header includes."

This reverts commit 4edd7576dbb4917162c22e371c2464df90883bd1.
It seems we rely on transitive header includes here.

2 years ago[RISCV][NFC] Remove unused header includes.
Adrian Kuegel [Mon, 28 Mar 2022 06:44:40 +0000 (08:44 +0200)]
[RISCV][NFC] Remove unused header includes.

Keeping those includes would cause a dependency cycle between Support
and TableGen targets.

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

2 years ago[LLDB] Skip TestProcessIOHandlerInterrupt Arm/AArch64 Linux
Muhammad Omair Javaid [Mon, 28 Mar 2022 07:32:44 +0000 (12:32 +0500)]
[LLDB] Skip TestProcessIOHandlerInterrupt Arm/AArch64 Linux

This patch skips TestProcessIOHandlerInterrupt on Arm/AArch64.
PExpect tests are not stable when run in containerized machine.

2 years ago[gn build] Port ad57e10dbca2
LLVM GN Syncbot [Mon, 28 Mar 2022 06:40:50 +0000 (06:40 +0000)]
[gn build] Port ad57e10dbca2

2 years ago[C++20][Modules][HU 5/5] Add fdirectives-only mode for preprocessing output.
Iain Sandoe [Fri, 31 Jul 2020 09:44:12 +0000 (10:44 +0100)]
[C++20][Modules][HU 5/5] Add fdirectives-only mode for preprocessing output.

When the -fdirectives-only option is used together with -E, the preprocessor
output reflects evaluation of if/then/else directives.

As such, it preserves defines and undefs of macros that are still live after
such processing.  The intent is that this output could be consumed as input
to generate considered a C++20 header unit.

We strip out any (unused) defines that come from built-in, built-in-file or
command line; these are re-added when the preprocessed source is consumed.

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

2 years ago[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support
Kito Cheng [Mon, 28 Mar 2022 02:00:02 +0000 (10:00 +0800)]
[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support

This patch is split from https://reviews.llvm.org/D111617, we need those
stuffs on clang, so must moving those stuff to llvm/Support.

Reviewed By: khchen

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

2 years ago[Target] Apply clang-tidy fixes for readability-redundant-member-init (NFC)
Kazu Hirata [Mon, 28 Mar 2022 05:22:37 +0000 (22:22 -0700)]
[Target] Apply clang-tidy fixes for readability-redundant-member-init (NFC)

2 years ago[docs][Lexicon] Add new explanation for some shortcomings(WPD, CFI) for lexicon
lizhengxian.123 [Mon, 28 Mar 2022 04:39:44 +0000 (12:39 +0800)]
[docs][Lexicon] Add new explanation for some shortcomings(WPD, CFI) for lexicon

Add explanations for WPD(whole program devirtualization) and another meaning for CFI(control flow Integrity).

Reviewed By: tejohnson

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

2 years ago[BOLT] Align constant islands to 8 bytes
Vladislav Khmelevsky [Sat, 19 Mar 2022 10:26:38 +0000 (13:26 +0300)]
[BOLT] Align constant islands to 8 bytes

AArch64 requires CI to be aligned to 8 bytes due to access instructions
restrictions. E.g. the ldr with imm, where imm must be aligned to 8 bytes.

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

2 years ago[Clang,TBAA] Add test cases for nested pointers and TBAA data.
Florian Hahn [Sun, 27 Mar 2022 18:59:37 +0000 (19:59 +0100)]
[Clang,TBAA] Add test cases for nested pointers and TBAA data.

2 years ago[Support] Skip attempts to access /proc/self/fd on FreeBSD
Mateusz Guzik [Sun, 27 Mar 2022 18:17:56 +0000 (20:17 +0200)]
[Support] Skip attempts to access /proc/self/fd on FreeBSD

In contrast to Linux it does not provide entries which can be readlinked
-- these are just regular files, not giving the expected outcome. That's
on top of procfs not being mounted by default to begin with.

This is probably the case on other BSDs as well, so I expect there will
be more ifdefs added down the road.

Reviewed By: emaste, dim

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

2 years ago[libc++][doc] Update format implementation status.
Mark de Wever [Sun, 27 Mar 2022 15:14:27 +0000 (17:14 +0200)]
[libc++][doc] Update format implementation status.

2 years ago[InstCombine] add baseline tests for logical and/or folds; NFC
chenglin.bi [Sun, 27 Mar 2022 13:34:58 +0000 (09:34 -0400)]
[InstCombine] add baseline tests for logical and/or folds; NFC

Extracted from D122152

2 years ago[AArch64][SelectionDAG] Refactor to support more scalable vector extending loads
zhongyunde [Sun, 27 Mar 2022 13:17:35 +0000 (21:17 +0800)]
[AArch64][SelectionDAG] Refactor to support more scalable vector extending loads

Accord the discussion in D120953, we should firstly exclude all scalable vector
extending loads and then selectively enable those which we directly support.

This patch is intend to refactor for above (truncating stores is not touched),and
more scalable vector types will try to reduce the number of masked loads in favour
of more unpklo/hi instructions.

Reviewed By: paulwalker-arm

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

2 years ago[InstCombine] add baseline tests for fold of ctpop + icmp; NFC
Hirochika Matsumoto [Sun, 27 Mar 2022 13:11:20 +0000 (09:11 -0400)]
[InstCombine] add baseline tests for fold of ctpop + icmp; NFC

Extracted from D122077.

2 years ago[C++20][Modules][HU 4/5] Handle pre-processed header units.
Iain Sandoe [Wed, 2 Mar 2022 20:18:10 +0000 (20:18 +0000)]
[C++20][Modules][HU 4/5] Handle pre-processed header units.

We wish to support emitting a pre-processed output for an importable
header unit, that can be consumed to produce the same header units as
the original source.

This means that ee need to find the original filename used to produce
the re-preprocessed output, so that it can be assigned as the module
name.  This is peeked from the first line of the pre-processed source
when the action sets up the files.

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

2 years ago[X86] Refactor X86ScalarSSEf16/32/64 with hasFP16/SSE1/SSE2. NFCI
Phoebe Wang [Sun, 27 Mar 2022 04:23:21 +0000 (12:23 +0800)]
[X86] Refactor X86ScalarSSEf16/32/64 with hasFP16/SSE1/SSE2. NFCI

This is used for f16 emulation. We emulate f16 for SSE2 targets and
above. Refactoring makes the future code to be more clean.

Reviewed By: LuoYuanke

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

2 years agoVerify parameter alignment attribute
Luo, Yuanke [Thu, 17 Mar 2022 09:48:02 +0000 (17:48 +0800)]
Verify parameter alignment attribute

In DAGISel, the parameter alignment only have 4 bits to hold the value.
The encode(alignment) would plus the value by 1, so the max aligment that
ISel can support is 2^14. This patch verify align attribute for parameter.

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

2 years ago[X86][tablgen] Extract common functions in X86EVEX2VEXTablesEmitter.cpp and X86FoldTa...
Shengchen Kan [Sun, 27 Mar 2022 00:41:17 +0000 (08:41 +0800)]
[X86][tablgen] Extract common functions in X86EVEX2VEXTablesEmitter.cpp and X86FoldTablesEmitter.cpp to avoid duplicated code. NFC

2 years ago[Verifier] Verify parameter alignment.
Luo, Yuanke [Thu, 17 Mar 2022 09:48:02 +0000 (17:48 +0800)]
[Verifier] Verify parameter alignment.

In DAGISel, the parameter alignment only have 4 bits to hold the value.
The encode(alignment) would plus the shift value by 1, so the max aligment
ISel can support is 2^14. This patch verify the parameter and return
value for alignment.

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

2 years ago[X86][tablgen] Remove PointerLikeRegClass from isRegisterOperand b/c getRegOperandSiz...
Shengchen Kan [Sat, 26 Mar 2022 23:35:47 +0000 (07:35 +0800)]
[X86][tablgen] Remove PointerLikeRegClass from isRegisterOperand b/c getRegOperandSize crashes for it. NFCI

2 years ago[AArch64] Lower 3 and 4 sources buildvectors to TBL
David Green [Sat, 26 Mar 2022 21:10:43 +0000 (21:10 +0000)]
[AArch64] Lower 3 and 4 sources buildvectors to TBL

The default expansion for buildvectors is to extract each element and
insert them into a new vector. That involves a lot of copying to/from
the GPR registers. TLB3 and TLB4 can be relatively slow instructions
with the mask needing to be loaded from a constant pool, but they should
always be better than all the moves to/from GPRs.

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

2 years ago[lldb] Fix interpreting absolute Windows paths with forward slashes
Martin Storsjö [Thu, 24 Mar 2022 08:42:37 +0000 (10:42 +0200)]
[lldb] Fix interpreting absolute Windows paths with forward slashes

In practice, Windows paths can use either backslashes or forward slashes.

This fixes an issue reported downstream at
https://github.com/mstorsjo/llvm-mingw/issues/266.

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

2 years ago[lldb] Fix building for mingw after changes to sigtstp_handler
Martin Storsjö [Fri, 25 Mar 2022 15:39:48 +0000 (17:39 +0200)]
[lldb] Fix building for mingw after changes to sigtstp_handler

Some signal handlers were set up within an !_MSC_VER condition,
i.e. omitted in MSVC builds but included in mingw builds. Previously
sigtstp_handler was defined in all builds, but since
4bcadd66864bf4af929ac8753a51d7ad408cdef0 / D120320 it's only
defined non platforms other than Windows.

Change the condition to !_WIN32 for consistency between the MSVC
and mingw builds, fixing the build for mingw.

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

2 years ago[docs][ORC] Simplify paragraph on hardcoding process addresses.
Lang Hames [Sat, 26 Mar 2022 20:14:26 +0000 (13:14 -0700)]
[docs][ORC] Simplify paragraph on hardcoding process addresses.

2 years ago[docs][ORC] Reword "How to Add Process and Library Symbols to the JITDylibs".
Lang Hames [Sat, 26 Mar 2022 20:02:01 +0000 (13:02 -0700)]
[docs][ORC] Reword "How to Add Process and Library Symbols to the JITDylibs".

Now opens with advice on what to do, rather than what *not* to do.

2 years ago[intelpt] Refactoring instruction decoding for flexibility
Alisamar Husain [Sat, 26 Mar 2022 15:53:50 +0000 (08:53 -0700)]
[intelpt] Refactoring instruction decoding for flexibility

Now the decoded thread has Append methods that provide more flexibility
in terms of the underlying data structure that represents the
instructions. In this case, we are able to represent the sporadic errors
as map and thus reduce the size of each instruction.

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

2 years ago[C++20][Modules][HU 3/5] Emit module macros for header units.
Iain Sandoe [Wed, 23 Sep 2020 14:58:58 +0000 (15:58 +0100)]
[C++20][Modules][HU 3/5] Emit module macros for header units.

For header units we build the top level module directly from the header
that it represents and macros defined in this TU need to be emitted (when
such a definition is live at the end of the TU).

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