platform/upstream/llvm.git
2 years agoRemove redundant return statements (NFC)
Kazu Hirata [Fri, 7 Jan 2022 15:42:35 +0000 (07:42 -0800)]
Remove redundant return statements (NFC)

Identified by readability-redundant-control-flow.

2 years ago[mlir][linalg][bufferize][NFC] Add explicit inplaceable attrs to test cases
Matthias Springer [Fri, 7 Jan 2022 15:21:50 +0000 (00:21 +0900)]
[mlir][linalg][bufferize][NFC] Add explicit inplaceable attrs to test cases

This is in preparation of fixing CallOp bufferization. Add explicit linalg.inplaceable attrs to all bbArgs, except for the ones where inplaceability should be decided by the analysis.

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

2 years ago[mlir][linalg][bufferize] Fix copy elision in `getResultBuffer`
Matthias Springer [Fri, 7 Jan 2022 15:07:50 +0000 (00:07 +0900)]
[mlir][linalg][bufferize] Fix copy elision in `getResultBuffer`

A buffer copy may not be elided if the to-be-bufferized op is reading the data.

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

2 years ago[Clang] Implement the rest of __builtin_elementwise_* functions.
Jun Zhang [Fri, 7 Jan 2022 15:11:36 +0000 (15:11 +0000)]
[Clang] Implement the rest of __builtin_elementwise_* functions.

The patch implement the rest of __builtin_elementwise_* functions
specified in D111529, including:
* __builtin_elementwise_floor
* __builtin_elementwise_roundeven
* __builtin_elementwise_trunc

Signed-off-by: Jun <jun@junz.org>
Reviewed By: fhahn

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

2 years ago[clang-format] Use range-for loops. NFC.
Marek Kurdej [Fri, 7 Jan 2022 14:21:57 +0000 (15:21 +0100)]
[clang-format] Use range-for loops. NFC.

* Avoid if check on every element of the loop when printing symbols.

2 years ago[RISCV] Add missing e_flag EF_RISCV_TSO
luxufan [Fri, 7 Jan 2022 15:01:07 +0000 (23:01 +0800)]
[RISCV] Add missing e_flag EF_RISCV_TSO

This flag was defined here https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc

Reviewed By: asb, MaskRay, jhenderson

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

2 years ago[libc++] Add missing templated version of `std::lerp`.
Arthur O'Dwyer [Mon, 27 Dec 2021 03:16:45 +0000 (22:16 -0500)]
[libc++] Add missing templated version of `std::lerp`.

Fixes #50806.

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

2 years ago[SCEVExpand] Only create required predicate checks.
Florian Hahn [Fri, 7 Jan 2022 14:44:03 +0000 (14:44 +0000)]
[SCEVExpand] Only create required predicate checks.

Currently generateOverflowCheck always creates code for Step being
negative and positive, followed by a select at the end depending on
Step's sign.

This patch updates the code to only create either the checks for step
being positive or negative, if the sign is known.

Follow-up to D116696.

Reviewed By: reames

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

2 years ago[LoopVersioning] Move loop-versioning test to correct directory.
Florian Hahn [Fri, 7 Jan 2022 14:35:13 +0000 (14:35 +0000)]
[LoopVersioning] Move loop-versioning test to correct directory.

The moved test was incorrectly placed in Analysis/LoopAccessAnalysis as
it runs loop-versioning.

2 years ago[clangd] Polish clangd/inlayHints and expose them by default.
Sam McCall [Wed, 5 Jan 2022 21:40:50 +0000 (22:40 +0100)]
[clangd] Polish clangd/inlayHints and expose them by default.

This means it's a "real feature" in clangd 14, albeit one that requires special
client support.

- remove "preview" from the flag description
- expose the `clangdInlayHints` capability by default
- provide `position` as well as `range`
- support `InlayHintsParams.range` to restrict the range retrieved
- inlay hint list is in document order (sorted by position)

Still to come: control feature via config rather than flag.

Fixes https://github.com/clangd/clangd/issues/313
Protocol doc is in https://github.com/llvm/clangd-www/pull/56/files

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

2 years agosanitizer_common: prefix thread-safety macros with SANITIZER_
Dmitry Vyukov [Wed, 5 Jan 2022 12:35:13 +0000 (13:35 +0100)]
sanitizer_common: prefix thread-safety macros with SANITIZER_

Currently we use very common names for macros like ACQUIRE/RELEASE,
which cause conflicts with system headers.
Prefix all macros with SANITIZER_ to avoid conflicts.

Reviewed By: vitalybuka

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

2 years ago[X86] Combine reduce(add (mul x, y)) to VNNI instruction.
Luo, Yuanke [Mon, 20 Dec 2021 14:35:27 +0000 (22:35 +0800)]
[X86] Combine reduce(add (mul x, y)) to VNNI instruction.

For below C code, we can use VNNI to combine the mul and add operation.
int usdot_prod_qi(unsigned char *restrict a, char *restrict b, int c,
                  int n) {
  int i;
  for (i = 0; i < 32; i++) {
    c += ((int)a[i] * (int)b[i]);
  }
  return c;
}
We didn't support the combine acoss basic block in this patch.

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

2 years agoRevert "Unaligned Access Warning Added"
Archibald Elliott [Fri, 7 Jan 2022 13:07:30 +0000 (13:07 +0000)]
Revert "Unaligned Access Warning Added"

This reverts commits:
2cd2600abaf3c604889b77ab408fdf89d7a21c48
11c67e5a4e99f51ec66c9781710f81955cfd5e24

Due to test failures on Windows.

2 years ago[AMDGPU] Enable divergence-driven 'ctpop' selection
alex-t [Sun, 26 Dec 2021 12:31:39 +0000 (15:31 +0300)]
[AMDGPU] Enable divergence-driven 'ctpop' selection

This change adds the patterns and divergence predicates for the ctpop (bitcount) nodes
to make them selected according to the divergence.

Reviewed By: foad

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

2 years ago[x86] add tests for select with -1 operand; NFC
Sanjay Patel [Thu, 6 Jan 2022 19:12:02 +0000 (14:12 -0500)]
[x86] add tests for select with -1 operand; NFC

2 years ago[mlir][OpDSL] Separate `ReduceFn` and `ReduceFnUse`.
gysit [Fri, 7 Jan 2022 12:49:44 +0000 (12:49 +0000)]
[mlir][OpDSL] Separate `ReduceFn` and `ReduceFnUse`.

The revision distinguishes `ReduceFn` and `ReduceFnUse`. The latter has the reduction dimensions attached while the former specifies the arithmetic function only. This separation allows us to adapt the reduction syntax a little bit and specify the reduction dimensions using square brackets (in contrast to the round brackets used for the values to reduce). It als is a preparation to add reduction function attributes to OpDSL. A reduction function attribute shall only specify the arithmetic function and not the reduction dimensions.

Example:
```
ReduceFn.max_unsigned(D.kh, D.kw)(...)
```
changes to:
```
ReduceFn.max_unsigned[D.kh, D.kw](...)
```

Depends On D115240

Reviewed By: stellaraccident

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

2 years ago[mlir][OpDSL] Rename `PrimFn` to `ArithFn`.
gysit [Fri, 7 Jan 2022 12:37:52 +0000 (12:37 +0000)]
[mlir][OpDSL] Rename `PrimFn` to `ArithFn`.

The revision renames `PrimFn` to `ArithFn`. The name resembles the newly introduced arith dialect that implements most of the arithmetic functions. An exception are log/exp that are part of the math dialect.

Depends On D115239

Reviewed By: stellaraccident

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

2 years ago[mlir][OpDSL] Add `TypeFn` class.
gysit [Fri, 7 Jan 2022 12:23:11 +0000 (12:23 +0000)]
[mlir][OpDSL] Add `TypeFn` class.

This revision introduces a the `TypeFn` class that similar to the `PrimFn` class contains an extensible set of type conversion functions. Having the same mechanism for both type conversion functions and arithmetic functions improves code consistency. Additionally, having an explicit function class and function name is a prerequisite to specify a conversion or arithmetic function via attribute. In a follow up commits, we will introduce function attributes to make OpDSL operations more generic. In particular, the goal is to handle signed and unsigned computation in one operations. Today, there is a linalg.matmul and a linalg.matmul_unsigned.

The commit implements the following changes:
- Introduce the class of type conversion functions `TypeFn`
- Replace the hardwired cast and cast_unsigned ops by the `TypeFn` counterparts
- Adapt the python and C++ code generation paths to support the new cast operations

Example:
```
cast(U, A[D.m, D.k])
```
changes to
```
TypeFn.cast(U, A[D.m, D.k])
```

Depends On D115237

Reviewed By: stellaraccident

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

2 years ago[mlir][python] Use a named object
Adrian Kuegel [Fri, 7 Jan 2022 12:22:32 +0000 (13:22 +0100)]
[mlir][python] Use a named object

Currently, the object would be immediately destroyed after creation.
Found by ClangTidy bugprone-unused-raii.

2 years ago[mlir][OpDSL] Rename `AttributeDef` to `IndexAttrDef`.
gysit [Fri, 7 Jan 2022 08:59:16 +0000 (08:59 +0000)]
[mlir][OpDSL] Rename `AttributeDef` to `IndexAttrDef`.

Renaming `AttributeDef` to `IndexAttrDef` prepares OpDSL to support different kinds of attributes and more closely reflects the purpose of the attribute.

Reviewed By: nicolasvasilache

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

2 years ago[AMDGPU] Regenerate MIR checks for G_[SU]BFX
Jay Foad [Fri, 7 Jan 2022 11:46:01 +0000 (11:46 +0000)]
[AMDGPU] Regenerate MIR checks for G_[SU]BFX

2 years ago[AMDGPU] Regenerate G_[SU]BFX checks using some common prefixes
Jay Foad [Fri, 7 Jan 2022 11:43:15 +0000 (11:43 +0000)]
[AMDGPU] Regenerate G_[SU]BFX checks using some common prefixes

2 years ago[flang] update to reflect MLIR LLVM::GEPOp changes
Alex Zinenko [Fri, 7 Jan 2022 11:46:01 +0000 (12:46 +0100)]
[flang] update to reflect MLIR LLVM::GEPOp changes

2 years ago[GlobalISel] Fix typo Extact to Extract in function name. NFC.
Jay Foad [Fri, 7 Jan 2022 11:04:25 +0000 (11:04 +0000)]
[GlobalISel] Fix typo Extact to Extract in function name. NFC.

2 years ago[mlir] Provide a home for mlir::LLVM::GEPOp::kDynamicIndex
Benjamin Kramer [Fri, 7 Jan 2022 11:04:17 +0000 (12:04 +0100)]
[mlir] Provide a home for mlir::LLVM::GEPOp::kDynamicIndex

C++14 requires this and will trigger linker errors when optimizations
are disabled.

2 years ago[mlir] Use const reference for loop iteration variable.
Adrian Kuegel [Fri, 7 Jan 2022 11:00:53 +0000 (12:00 +0100)]
[mlir] Use const reference for loop iteration variable.

2 years ago[clang][driver] Don't pass -Wunaligned-access to cc1as
Archibald Elliott [Fri, 7 Jan 2022 10:45:26 +0000 (10:45 +0000)]
[clang][driver] Don't pass -Wunaligned-access to cc1as

This is to fix some failing assembler tests.

2 years ago[clang-format] Use prefix increment and decrement. NFC.
Marek Kurdej [Fri, 7 Jan 2022 10:19:53 +0000 (11:19 +0100)]
[clang-format] Use prefix increment and decrement. NFC.

2 years ago[NFC] Pre-commit case for PowerPC perfect shuffle
Qiu Chaofan [Fri, 7 Jan 2022 10:07:26 +0000 (18:07 +0800)]
[NFC] Pre-commit case for PowerPC perfect shuffle

2 years ago[NFCI][IR] MinMaxIntrinsic: add some more helper methods, and use them
Roman Lebedev [Fri, 7 Jan 2022 09:40:06 +0000 (12:40 +0300)]
[NFCI][IR] MinMaxIntrinsic: add some more helper methods, and use them

2 years ago[RISCV] Supplement PACKH instruction pattern
Lian Wang [Fri, 7 Jan 2022 09:18:33 +0000 (17:18 +0800)]
[RISCV] Supplement PACKH instruction pattern

Optimize (rs1 & 255) | ((rs2 & 255) << 8) -> (PACKH rs1, rs2).

Reviewed By: craig.topper

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

2 years ago[CodeGen] Support opaque pointers for inline asm
Nikita Popov [Fri, 7 Jan 2022 09:55:01 +0000 (10:55 +0100)]
[CodeGen] Support opaque pointers for inline asm

This is the last part of D116531. Fetch the type of the indirect
inline asm operand from the elementtype attribute, rather than
the pointer element type.

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

2 years agoUnaligned Access Warning Added
Mubashar Ahmad [Thu, 23 Dec 2021 16:37:44 +0000 (16:37 +0000)]
Unaligned Access Warning Added

Added warning for potential cases of
unaligned access when option
-mno-unaligned-access has been specified

2 years ago[IR] Add ConstraintInfo::hasArg() helper (NFC)
Nikita Popov [Fri, 7 Jan 2022 09:37:26 +0000 (10:37 +0100)]
[IR] Add ConstraintInfo::hasArg() helper (NFC)

Checking whether a constraint corresponds to an argument is a
recurring pattern.

2 years ago[Clang][Sema] Avoid crashing for va_arg expressions with bool argument
Egor Zhdan [Fri, 7 Jan 2022 09:30:25 +0000 (10:30 +0100)]
[Clang][Sema] Avoid crashing for va_arg expressions with bool argument

This change fixes a compiler crash that was introduced in https://reviews.llvm.org/D103611: `Sema::BuildVAArgExpr` attempted to retrieve a corresponding signed type for `bool` by calling `ASTContext::getCorrespondingSignedType`.

rdar://86580370

Reviewed By: aaron.ballman

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

2 years ago[SystemZ][z/OS] Fix test failure when SystemZ target is not built
Jay Foad [Fri, 7 Jan 2022 09:39:01 +0000 (09:39 +0000)]
[SystemZ][z/OS] Fix test failure when SystemZ target is not built

2 years ago[clang-format] Fix `BraceWrapping: AfterFunction` affecting synchronized blocks in...
Marek Kurdej [Fri, 7 Jan 2022 09:02:45 +0000 (10:02 +0100)]
[clang-format] Fix `BraceWrapping: AfterFunction` affecting synchronized blocks in Java.

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

Before this change, BraceWrapping: AfterFunction would affect synchronized blocks in Java, but they should be formatted w.r.t. BraceWrapping: AfterControlStatement.

Using the config:
```
BreakBeforeBraces: Custom
BraceWrapping:
  AfterControlStatement: false
  AfterFunction: true
```

would result in misformatted code like:
```
class Foo {
  void bar()
  {
    synchronized (this)
    {
      a();
      a();
    }
  }
}
```

instead of:
```
class Foo {
  void bar()
  {
    synchronized (this) {
      a();
      a();
    }
  }
}
```

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[clang-format] Use range-for loops. NFC.
Marek Kurdej [Fri, 7 Jan 2022 08:55:04 +0000 (09:55 +0100)]
[clang-format] Use range-for loops. NFC.

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[mlir] Require struct indices in LLVM::GEPOp to be constant
Alex Zinenko [Thu, 6 Jan 2022 22:30:15 +0000 (23:30 +0100)]
[mlir] Require struct indices in LLVM::GEPOp to be constant

Recent commits added a possibility for indices in LLVM dialect GEP operations
to be supplied directly as constant attributes to ensure they remain such until
translation to LLVM IR happens. Make this required for indexing into LLVM
struct types to match LLVM IR requirements, otherwise the translation would
assert on constructing such IR.

For better compatibility with MLIR-style operation construction interface,
allow GEP operations to be constructed programmatically using Values pointing
to known constant operations as struct indices.

Depends On D116758

Reviewed By: wsmoses

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

2 years ago[mlir] Add ConstantLike trait to LLVM::ConstantOp
Alex Zinenko [Thu, 6 Jan 2022 22:29:52 +0000 (23:29 +0100)]
[mlir] Add ConstantLike trait to LLVM::ConstantOp

This make LLVM dialect constants to work with `m_constant` matches. Implement
the folding hook for this operation as required by the trait. This in turn
allows LLVM::ConstantOp to properly participate in constant-folding.

Depends On D116757

Reviewed By: wsmoses

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

2 years ago[mlir] Make it possible to directly supply constant values to LLVM GEPOp
Alex Zinenko [Thu, 6 Jan 2022 22:29:15 +0000 (23:29 +0100)]
[mlir] Make it possible to directly supply constant values to LLVM GEPOp

In LLVM IR, the GEP indices that correspond to structures are required to be
i32 constants. MLIR models constants as just values defined by special
operations, and there is no verification that it is the case for structure
indices in GEP. Furthermore, some common transformations such as control flow
simplification may lead to the operands becoming non-constant. Make it possible
to directly supply constant values to LLVM GEPOp to guarantee they remain
constant until the translation to LLVM IR. This is not yet a requirement and
the verifier is not modified, this will be introduced separately.

Reviewed By: wsmoses

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

2 years ago[LibCalls] Infer same attrs for reallocf() as realloc()
Nikita Popov [Fri, 7 Jan 2022 08:48:10 +0000 (09:48 +0100)]
[LibCalls] Infer same attrs for reallocf() as realloc()

reallocf() is the same as realloc() but frees the input pointer
on failure as well. We can infer the same attributes.

Also combine some cases that infer the same attributes and are
logically related.

2 years ago[LegalizeTypes][VP] Add splitting support for vp.select
Victor Perez [Fri, 7 Jan 2022 07:54:08 +0000 (07:54 +0000)]
[LegalizeTypes][VP] Add splitting support for vp.select

Split vp.select in a similar way as vselect, splitting also the length
parameter.

Reviewed By: craig.topper

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

2 years ago[llvm] Use true/false instead of 1/0 (NFC)
Kazu Hirata [Fri, 7 Jan 2022 08:39:13 +0000 (00:39 -0800)]
[llvm] Use true/false instead of 1/0 (NFC)

Identified with modernize-use-bool-literals.

2 years ago[MLIR][Arith] Fold repeated xor and trunc
William S. Moses [Wed, 29 Dec 2021 19:30:34 +0000 (14:30 -0500)]
[MLIR][Arith] Fold repeated xor and trunc

This patch adds two folds. One for a repeated xor (e.g. xor(xor(x, a), a)) and one for a repeated trunc (e.g. trunc(trunc(x))).

Reviewed By: ftynse

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

2 years ago[LoopUnroll] Remove unrelated passes from test (NFC)
Nikita Popov [Fri, 7 Jan 2022 08:20:23 +0000 (09:20 +0100)]
[LoopUnroll] Remove unrelated passes from test (NFC)

Manually run these and use the result as the initial input for
the test.

2 years ago[ModuleUtils] Remove dead arg from filterDeadComdatFunctions() (NFC)
Nikita Popov [Fri, 7 Jan 2022 08:12:16 +0000 (09:12 +0100)]
[ModuleUtils] Remove dead arg from filterDeadComdatFunctions() (NFC)

The module argument is no longer used.

2 years ago[SystemZ] Add missing elementtype in python test (NFC)
Nikita Popov [Fri, 7 Jan 2022 08:07:28 +0000 (09:07 +0100)]
[SystemZ] Add missing elementtype in python test (NFC)

Missed this originally because it does not run locally.

2 years ago[NFC] Fix endif comments to match with include guard
Qiu Chaofan [Fri, 7 Jan 2022 07:52:59 +0000 (15:52 +0800)]
[NFC] Fix endif comments to match with include guard

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Fri, 7 Jan 2022 07:44:02 +0000 (23:44 -0800)]
Ensure newlines at the end of files (NFC)

2 years ago[X86] add dwarf information for loop stack probe
Erik Desjardins [Fri, 7 Jan 2022 07:02:45 +0000 (15:02 +0800)]
[X86] add dwarf information for loop stack probe

This patch is based on https://reviews.llvm.org/D99585.

While inside the stack probing loop, temporarily change the CFA
to be based on r11/eax, which are already used to hold the loop bound.
The stack pointer cannot be used for CFI here as it changes during the loop,
so it does not have a constant offset to the CFA.

Co-authored-by: YangKeao <keao.yang@yahoo.com>
Reviewed By: nagisa

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

2 years ago[Target] Remove redundant member initialization (NFC)
Kazu Hirata [Fri, 7 Jan 2022 06:01:44 +0000 (22:01 -0800)]
[Target] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years ago[mlir][OpenMP] Added omp.atomic.write lowering to LLVM IR
Shraiysh Vaishay [Wed, 5 Jan 2022 11:31:30 +0000 (17:01 +0530)]
[mlir][OpenMP] Added omp.atomic.write lowering to LLVM IR

This patch adds omp.atomic.write lowering to LLVM IR.
Also, changed the syntax to have equal symbol instead of the comma to
make it more intuitive.

Reviewed By: kiranchandramohan, peixin

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

2 years ago[RISCV][NFC] Use sub operator to generate register list
wangpc [Fri, 7 Jan 2022 04:29:25 +0000 (12:29 +0800)]
[RISCV][NFC] Use sub operator to generate register list

There are several duplicated lines for generating GPRXXX's
register list that can be eliminated by using `sub` operator.

Reviewed By: asb

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

2 years agoRevert "[lldb] Compute fully qualified command names in FindCommandsForApropos"
Dave Lee [Fri, 7 Jan 2022 04:15:19 +0000 (20:15 -0800)]
Revert "[lldb] Compute fully qualified command names in FindCommandsForApropos"

This reverts commit b3bfd595a548cd85b12e4e83729436cb73b26f29.

2 years ago[lldb] Compute fully qualified command names in FindCommandsForApropos
Dave Lee [Sun, 2 Jan 2022 04:07:07 +0000 (20:07 -0800)]
[lldb] Compute fully qualified command names in FindCommandsForApropos

Fixes incomplete command names in `apropos` results.

The full command names given by `apropos` have come from command name string
literals given to `CommandObject` constructors. For most commands, this has
been accurate, but some commands have incorrect strings. This results in
`apropos` output that doesn't tell the user the full command name they might
want learn more about. These strings can be fixed.

There's a seperate issue that can't be fixed as easily: plugin commands. With
the way they're implemented, plugin commands have to exclude the root command
from their command name string. To illustrate, the `language objc` subcommand
has to set its command name string to "objc", which results in apropos printing
results as `objc ...` instead of `language objc ...`.

To fix both of these issues, this commit changes `FindCommandsForApropos` to
derive the fully qualified command name using the keys of subcommand maps.

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

2 years ago[NFC][RISCV] Make the macro names more uniform
Shao-Ce SUN [Fri, 7 Jan 2022 03:09:15 +0000 (11:09 +0800)]
[NFC][RISCV] Make the macro names more uniform

Reviewed By: craig.topper

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

2 years agoRevert "Extract utility function for checking initial value of allocation [NFC]"
Philip Reames [Fri, 7 Jan 2022 03:05:16 +0000 (19:05 -0800)]
Revert "Extract utility function for checking initial value of allocation [NFC]"

This reverts commit 9ce30fe86f58df45b2c5daa601802593601c471d.  Appears to be causing a problem on a buildbot, revert while investigating.

https://green.lab.llvm.org/green//job/clang-stage1-RA/26818/consoleFull#-1502953973d489585b-5106-414a-ac11-3ff90657619c

2 years ago[M68k][NFC] Fix typo. BCNG->BCHG
Jim Lin [Fri, 7 Jan 2022 02:00:21 +0000 (10:00 +0800)]
[M68k][NFC] Fix typo. BCNG->BCHG

2 years ago[mlir] Fix a warning
Kazu Hirata [Fri, 7 Jan 2022 02:41:07 +0000 (18:41 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h:913:30:
  error: private field 'options' is not used
  [-Werror,-Wunused-private-field]

2 years ago[SystemZ][z/OS] Add entry point marker to PPA
Yusra Syeda [Fri, 7 Jan 2022 02:29:14 +0000 (21:29 -0500)]
[SystemZ][z/OS] Add entry point marker to PPA

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

2 years ago[RISCV] Support immediate vtype of VSETVLI/VSETIVLI in asm parser
Liqin Weng [Fri, 7 Jan 2022 01:56:13 +0000 (01:56 +0000)]
[RISCV] Support immediate vtype of VSETVLI/VSETIVLI in asm parser

Reviewed By: craig.topper

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

2 years agoExtract utility function for checking initial value of allocation [NFC]
Philip Reames [Fri, 7 Jan 2022 01:59:19 +0000 (17:59 -0800)]
Extract utility function for checking initial value of allocation [NFC]

This is a reoccuring pattern, we can consolidate three copies into one.  The main motivation is to reduce usages of isMallocLike.

2 years agoRemove unused LookThroughBitCast param in isXAllocLike functions [NFC]
Philip Reames [Fri, 7 Jan 2022 01:03:59 +0000 (17:03 -0800)]
Remove unused LookThroughBitCast param in isXAllocLike functions [NFC]

This parameter took the non-default value exactly twice, and neither had semantic effect.

2 years agoMove getMallocAllocatedType and getMallocArraySize to GlobalOpt [NFC]
Philip Reames [Fri, 7 Jan 2022 00:48:45 +0000 (16:48 -0800)]
Move getMallocAllocatedType and getMallocArraySize to GlobalOpt [NFC]

These are implementation details of the global-opt transform and not easily reuseable, so remove them from the analysis header.

2 years agoInline extractMallocCall to sole use and delete [NFC]
Philip Reames [Fri, 7 Jan 2022 00:42:51 +0000 (16:42 -0800)]
Inline extractMallocCall to sole use and delete [NFC]

2 years agoDelete unused extractCallocCall routine [NFC]
Philip Reames [Fri, 7 Jan 2022 00:38:00 +0000 (16:38 -0800)]
Delete unused extractCallocCall routine [NFC]

2 years agoDemote getMallocType to implementation routine in MemoryBuiltins [NFC]
Philip Reames [Fri, 7 Jan 2022 00:35:56 +0000 (16:35 -0800)]
Demote getMallocType to implementation routine in MemoryBuiltins [NFC]

2 years ago[mlir][Linalg] Fix invalid FailureOr construction from LogicalResult::success
Nicolas Vasilache [Thu, 6 Jan 2022 23:43:23 +0000 (18:43 -0500)]
[mlir][Linalg] Fix invalid FailureOr construction from LogicalResult::success

2 years ago[libc++] Implement P1072R10 (std::basic_string::resize_and_overwrite)
Nikolas Klauser [Thu, 6 Jan 2022 20:43:26 +0000 (21:43 +0100)]
[libc++] Implement P1072R10 (std::basic_string::resize_and_overwrite)

Reviewed By: Quuxplusone, #libc, Mordante

Spies: mzeren-vmw, ckennelly, arichardson, ldionne, Mordante, libcxx-commits, Quuxplusone

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

2 years ago[NFC][DFSan] Cleanup code to use align functions.
Andrew Browne [Thu, 6 Jan 2022 18:56:34 +0000 (10:56 -0800)]
[NFC][DFSan] Cleanup code to use align functions.

Reviewed By: morehouse

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

2 years ago[mlir][Linalg] NFC - Modernize more transformation patterns.
Nicolas Vasilache [Thu, 6 Jan 2022 17:58:57 +0000 (12:58 -0500)]
[mlir][Linalg] NFC - Modernize more transformation patterns.

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

2 years ago[NFC][SCEV][IndVars] Add more tests for exit count w/ `select`
Roman Lebedev [Thu, 6 Jan 2022 22:25:53 +0000 (01:25 +0300)]
[NFC][SCEV][IndVars] Add more tests for exit count w/ `select`

See https://github.com/llvm/llvm-project/issues/53020

2 years agoAdd Rust to CodeView SourceLanguage (CV_CFL_LANG) enum
Arlo Siemsen [Thu, 6 Jan 2022 22:24:15 +0000 (14:24 -0800)]
Add Rust to CodeView SourceLanguage (CV_CFL_LANG) enum

Microsoft has added several new entries to the CV_CFL_LANG enum, including Rust:
    https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang

This change adds Rust to the corresponding LLVM enum and translates `dwarf::DW_LANG_Rust` to `SourceLanguage::Rust` in the CodeView AsmPrinter.

This means that Rust will no longer emit as Masm.

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

2 years ago[Hexagon] Some compound opportunities missed in presence of branches
Colin LeMahieu [Thu, 6 Jan 2022 17:24:31 +0000 (09:24 -0800)]
[Hexagon] Some compound opportunities missed in presence of branches

The lld testcase change from ddf1fb1f should take care of the build
breakage from before.

2 years ago[Hexagon] Save results from partial compound
Brian Cain [Mon, 18 Jun 2018 17:25:40 +0000 (12:25 -0500)]
[Hexagon] Save results from partial compound

Previously compounding was all-or-nothing.  Now, the
compounding attempts will iterate and yield the most
compounds that still result in a valid packet.

2 years ago[mlir][linalg][bufferize] LinalgOp: Move existing region to new op
Matthias Springer [Thu, 6 Jan 2022 21:59:45 +0000 (06:59 +0900)]
[mlir][linalg][bufferize] LinalgOp: Move existing region to new op

This has two advantages.

1. It is more efficient. No need to clone the entire region.
2. Recreating ops (via cloning) invalidates analysis results. Previously, an OpResult could have bufferized out-of-place, even though the analysis requested an in-place bufferization. That is because BufferizationState keeps track of OpResults for storing bufferization analysis results (and cloned ops have new OpResults).

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

2 years agoSilence warning with MSVC compiler.
Alexandre Ganea [Thu, 6 Jan 2022 17:39:34 +0000 (12:39 -0500)]
Silence warning with MSVC compiler.

D:\git\llvm-project\clang\unittests\Analysis\FlowSensitive\MultiVarConstantPropagationTest.cpp(104) : warning C4715: 'clang::dataflow::`anonymous namespace'::operator<<': not all control paths return a value

2 years ago[mlir][linalg][bufferize][NFC] Change allocationFn return type to FailureOr<Value>
Matthias Springer [Thu, 6 Jan 2022 21:32:35 +0000 (06:32 +0900)]
[mlir][linalg][bufferize][NFC] Change allocationFn return type to FailureOr<Value>

In addition, all functions that call `allocationFn` now return FailureOr<Value>. This resolves a few TODOs in the code base.

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

2 years ago[mlir][Linalg] NFC - Modernize APIs and get rid of unnecessary tiling paterns.
Nicolas Vasilache [Thu, 6 Jan 2022 10:58:45 +0000 (05:58 -0500)]
[mlir][Linalg] NFC - Modernize APIs and get rid of unnecessary tiling paterns.

Tiling patterns can be reduced to a single pattern by using interface-based patterns.

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

2 years ago[mlir][linalg][bufferize][NFC] Clean up comments and minor code refactorings
Matthias Springer [Thu, 6 Jan 2022 21:21:46 +0000 (06:21 +0900)]
[mlir][linalg][bufferize][NFC] Clean up comments and minor code refactorings

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

2 years agoUpdate mlir GDB printers
Christian Sigg [Wed, 5 Jan 2022 10:32:01 +0000 (11:32 +0100)]
Update mlir GDB printers

Update prettyprinters.py to match MLIR changes.

This has gone unnoticed because no build bot is running tests with debug info.

I will look into what we can do about this separately. There is
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/,
from Apple. The Debug Info tests are failing despite the green result.

See https://github.com/llvm/llvm-project/issues/48872.

Note: the llvm-support.gdb test only works with Debug,
but not RelWithDebInfo because some checked symbols are stripped.

Reviewed By: dblaikie

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

2 years ago[mlir][linalg][bufferize] Add `createDealloc` options
Matthias Springer [Thu, 6 Jan 2022 21:10:55 +0000 (06:10 +0900)]
[mlir][linalg][bufferize] Add `createDealloc` options

If `createDealloc` is deactivated (enabled by default), newly allocated buffers are not deallocated anymore. In such a case, the missing deallocations can be inserted by the existing "BufferDeallocation" pass.

This change is needed for unifying core bufferization and Comprehensive Bufferize. Core bufferization has a separate pass for generating deallocations.

Note: In the future, this will evolve towards generating deallocation ops only for buffer allocations that do not escape block boundaries (i.e., that are in destination passing style).

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

2 years agoRe-land "[Clang][ScanDeps] Use the virtual path for module maps"
Michael Spencer [Thu, 6 Jan 2022 17:40:36 +0000 (17:40 +0000)]
Re-land "[Clang][ScanDeps] Use the virtual path for module maps"

This re-lands:
04192422c4e3b730c580498b8e948088cb15580b
015e08c6badad6b27404d6f94569e25c18d79049

Which I reverted in ea835171389aa356b865bf9cb72ca8f4f84b64fd in error.

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

2 years ago[LoopInterchange] Remove a limitation in LoopInterchange legality
Congzhe Cao [Thu, 6 Jan 2022 20:46:48 +0000 (15:46 -0500)]
[LoopInterchange] Remove a limitation in LoopInterchange legality

There was a limitation in legality that in the original inner loop latch,
no instruction was allowed between the induction variable increment
and the branch instruction. This is because we used to split the
inner latch at the induction variable increment instruction. Since
now we have split at the inner latch branch instruction and have
properly duplicated instructions over to the split block, we remove
this limitation.

Please refer to the test case updates to see how we now interchange
loops where instructions exist between the induction variable
increment and the branch instruction.

Reviewed By: bmahjour

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

2 years ago[lldb] [Process/FreeBSDKernel] Support finding all processes
Michał Górny [Wed, 22 Dec 2021 07:45:16 +0000 (08:45 +0100)]
[lldb] [Process/FreeBSDKernel] Support finding all processes

Include the complete list of threads of all running processes
in the FreeBSDKernel plugin.  This makes it possible to inspect
the states (including partial register dumps from PCB) of all kernel
and userspace threads at the time of crash, or at the time of reading
/dev/mem first.

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

2 years ago[libc++][NFC] Remove using declarations in common_reference.compile.pass.cpp
Nikolas Klauser [Thu, 6 Jan 2022 18:56:16 +0000 (19:56 +0100)]
[libc++][NFC] Remove using declarations in common_reference.compile.pass.cpp

Remove using declarations in common_reference.compile.pass.cpp

Reviewed By: Quuxplusone, Mordante, #libc, jloser

Spies: jloser, libcxx-commits

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

2 years agoRevert "[Hexagon] Some compound opportunities missed in presence of branches"
Nico Weber [Thu, 6 Jan 2022 20:32:14 +0000 (15:32 -0500)]
Revert "[Hexagon] Some compound opportunities missed in presence of branches"

This reverts commit afdc6a0b8eeec1a8ebe52b103ac1fdcfb93db3b3.
Breaks check-lld, see e.g.:
https://lab.llvm.org/buildbot/#/builders/123/builds/8100/steps/8/logs/stdio

2 years ago[lld-macho] Increase slops to prevent thunk out of range
Vincent Lee [Wed, 5 Jan 2022 23:05:09 +0000 (15:05 -0800)]
[lld-macho] Increase slops to prevent thunk out of range

One of our internal arm64 apps hit a thunk out of range error when building
with LLD. Per the comment, I'm arbitrarily increasing slop size to 256.

Reviewed By: #lld-macho, thakis

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

2 years ago[mlir][linalg][bufferize][NFC] Rename functions in BufferizationState
Matthias Springer [Thu, 6 Jan 2022 20:23:56 +0000 (05:23 +0900)]
[mlir][linalg][bufferize][NFC] Rename functions in BufferizationState

The old function names (e.g., `replaceOp`) could have been confusing to users because they sound similar to rewriter functions, but have slightly different semantics.

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

2 years agoDisable clang-tidy warnings from system macros
Carlos Galvez [Wed, 29 Dec 2021 14:42:30 +0000 (14:42 +0000)]
Disable clang-tidy warnings from system macros

Currently, it's inconsistent that warnings are disabled if they
come from system headers, unless they come from macros.
Typically a user cannot act upon these warnings coming from
system macros, so clang-tidy should ignore them unless the
user specifically requests warnings from system headers
via the corresponding configuration.

This change broke the ProTypeVarargCheck check, because it
was checking for the usage of va_arg indirectly, expanding it
(it's a system macro) to detect the usage of __builtin_va_arg.
The check has been fixed by checking directly what the rule
is about: "do not use va_arg", by adding a PP callback that
checks if any macro with name "va_arg" is expanded. The old
AST matcher is still kept for compatibility with Windows.

Add unit test that ensures warnings from macros are disabled
when not using the -system-headers flag. Document the change
in the Release Notes.

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

2 years ago[clang-format] Fix a crash (assertion) in qualifier alignment when matching template...
mydeveloperday [Thu, 6 Jan 2022 19:39:24 +0000 (19:39 +0000)]
[clang-format] Fix a crash (assertion) in qualifier alignment when matching template closer is null

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

```
template <class Id> using A = quantity /**/<kind<Id>, 1>;
```

the presence of the comment between identifier and template opener seems to be causing the qualifier alignment to fail

Reviewed By: curdeius

Fixes: #53008

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

2 years ago[libc++] [ranges] Simplify our idiom for testing niebloid-ness.
Arthur O'Dwyer [Wed, 29 Dec 2021 19:35:52 +0000 (14:35 -0500)]
[libc++] [ranges] Simplify our idiom for testing niebloid-ness.

In the test files, replace the old-style tests with a simple static_assert,
matching the current style as depicted in e.g.
`ranges_uninitialized_default_construct.pass.cpp`.

Preserve `is_function_like` (but renamed to `is_niebloid`) at
ldionne's request. The removal of this test helper will happen
in D116570 if at all.

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

2 years ago[SLP]Improve reordering for the nodes beeing used in alternate vectorization.
Alexey Bataev [Wed, 5 Jan 2022 22:07:28 +0000 (14:07 -0800)]
[SLP]Improve reordering for the nodes beeing used in alternate vectorization.

No need to include the order of the scalars beeing used as part of the
alternate vectorization into account when trying to reorder the whole
graph. Such elements better to reorder in the following phase because
the subtree still ends up in shuffle.

Part of D116688, fixes the regression in D116690.

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

2 years ago[SLP]Initialize the lane with the given value instead of default 0.
Alexey Bataev [Wed, 5 Jan 2022 21:03:07 +0000 (13:03 -0800)]
[SLP]Initialize the lane with the given value instead of default 0.

There is a bug in the reordering analysis stage. If the element with the
given hash is not added to the map but has the same number of APOs and
instructions with same parent, but different instruction opcode, it will
be initalized with default values and then the counter is increased by
1. But the lane is not updated and default to 0 instead of the actual
   `Lane` value. It leads to the fact that the analysis is useless in
   many cases and default to lane 0 instead of actual lane with the
   minimum amount of APO operands.

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

2 years ago[lldb] Remove summary for signed char *
Pavel Labath [Thu, 6 Jan 2022 18:50:44 +0000 (19:50 +0100)]
[lldb] Remove summary for signed char *

It conflicts with the summary for BOOL * (aka signed char *). This
partially reverts D112709.

2 years ago[mlir][Linalg] Disable fusion of reshape with elementwise ops for purely dynamic...
MaheshRavishankar [Thu, 6 Jan 2022 18:31:53 +0000 (10:31 -0800)]
[mlir][Linalg] Disable fusion of reshape with elementwise ops for purely dynamic cases.

`tensor.collapse_shape` op when fused with a consumer elementwise
`linalg.generic` operation results in creation of tensor.expand_shape
ops. In purely dynamic cases this can end up with a dynamic dimensions
being expanded to more than one dynamic dimension. This is disallowed
by the semantics of `tensor.expand_shape` operation. (While the
transformation is itself correct, its a gap in the specification of
`tensor.expand_shape` that is the issue). So disallow fusions which
result in such a pattern.

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

2 years ago[InstCombine] Factor out a common pattern match used 3 times. NFC.
Stanislav Mekhanoshin [Thu, 23 Dec 2021 00:08:14 +0000 (16:08 -0800)]
[InstCombine] Factor out a common pattern match used 3 times. NFC.

This is needed for the next patch which will add more patterns
to the same match.

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

2 years agoRevert "[AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions."
Daniel Kiss [Thu, 6 Jan 2022 18:17:45 +0000 (19:17 +0100)]
Revert "[AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions."

This reverts commit f903c8505515f15e956febbd8cdfa0037fbaf689.

2 years ago[libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)
Nikolas Klauser [Thu, 6 Jan 2022 11:36:07 +0000 (12:36 +0100)]
[libc++] Implement P1425R4 (Iterator pair constructors for std::stack and std::queue)

Implement P1425R4

Reviewed By: Quuxplusone, #libc, Mordante

Spies: Mordante, jloser, libcxx-commits, arichardson

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