platform/upstream/llvm.git
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

2 years ago[libc++] Re-enable `GCC11 / C++11`, `Clang 12` and `ASAN` CI-runs
Nikolas Klauser [Thu, 6 Jan 2022 17:51:25 +0000 (18:51 +0100)]
[libc++] Re-enable `GCC11 / C++11`, `Clang 12` and `ASAN` CI-runs

2 years ago[DFSan] Refactor dfsan_mem_shadow_transfer.
Andrew Browne [Wed, 5 Jan 2022 22:54:28 +0000 (14:54 -0800)]
[DFSan] Refactor dfsan_mem_shadow_transfer.

Reviewed By: morehouse

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

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

2 years ago[AArch64] Add basic umulo and smulo costs
David Green [Thu, 6 Jan 2022 17:22:47 +0000 (17:22 +0000)]
[AArch64] Add basic umulo and smulo costs

This adds some AArch64 specific smul_with_overflow and umul_with_overflow
costs, overriding the default costs. The code generation for these mul
with overflow intrinsics is usually better than the default expansion on
AArch64. The costs come from https://godbolt.org/z/zEzYhMWqo with various
types, or llvm/test/CodeGen/AArch64/arm64-xaluo.ll.

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

2 years ago[libc++] [test] XFAIL "span.cons/initializer_list.pass.cpp" for apple-clang-12.
Arthur O'Dwyer [Thu, 6 Jan 2022 17:15:28 +0000 (12:15 -0500)]
[libc++] [test] XFAIL "span.cons/initializer_list.pass.cpp" for apple-clang-12.

This should have been done in 6a6a80e88e, but buildkite was down so I
hadn't noticed. This brings this test file into line with several others
in this directory.

2 years ago[LowerMatrixIntrinsics] writeFnName - don't dereference a dyn_cast<>. NFC.
Simon Pilgrim [Thu, 6 Jan 2022 17:09:09 +0000 (17:09 +0000)]
[LowerMatrixIntrinsics] writeFnName - don't dereference a dyn_cast<>. NFC.

dyn_cast<> can return null - use cast<> instead to assert the cast is valid before dereferencing the casted pointer.

Fixes static-analyzer null dereference warning.

2 years ago[Hexagon] Consider HVX reg aliases for .cur warning
Brian Cain [Fri, 28 Sep 2018 15:14:11 +0000 (10:14 -0500)]
[Hexagon] Consider HVX reg aliases for .cur warning

2 years ago[unroll] Strengthen verification of analysis updates under expensive asserts
Philip Reames [Thu, 6 Jan 2022 16:50:09 +0000 (08:50 -0800)]
[unroll] Strengthen verification of analysis updates under expensive asserts

I am suspecting a bug around updates of loop info for unreachable exits, but don't have a test case.  Running this locally on make check didn't reveal anything, we'll see if the expensive checks bots find it.

2 years ago[flang] Separate temporary and user-specified object files
Andrzej Warzynski [Tue, 4 Jan 2022 11:02:11 +0000 (11:02 +0000)]
[flang] Separate temporary and user-specified object files

This patch updates the `flang` bash scripts to differentiate between
object files provided by the user and intermediate object files
generated by the script. The latter are an "implementation detail" that
should not be visible to the end user (i.e. deleted before the scripts
exits). The former should be preserved.

Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1348

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

2 years ago[gn build] Port 56ca11e31e6a
LLVM GN Syncbot [Thu, 6 Jan 2022 16:28:57 +0000 (16:28 +0000)]
[gn build] Port 56ca11e31e6a

2 years ago[RISCV] Use simm5_plus1_nonzero in isel patterns for vmsgeu.vi/vmsltu.vi intrinsics.
Craig Topper [Thu, 6 Jan 2022 16:24:32 +0000 (08:24 -0800)]
[RISCV] Use simm5_plus1_nonzero in isel patterns for vmsgeu.vi/vmsltu.vi intrinsics.

The 0 immediate can't be selected to vmsgtu.vi/vmsleu.vi by decrementing
the immediate. To prevent his we had special patterns that provided
alternate lowering for the 0 cases. This relied on tablegen prioritizing
the 0 pattern over the sim5_plus1 range.

This patch introduces simm5_plus1_nonzero that excludes 0. It also
excludes the special case for vmsltu.vi since we can just use
vmsltu.vx and let the 0 be selected to X0.

This is an alternative to some of the changes in D116584.

Reviewed By: Chenbing.Zheng, asb

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

2 years ago[CMake] Include ZLIB_ROOT in LLVMConfig.cmake
Jake Egan [Thu, 6 Jan 2022 16:22:09 +0000 (11:22 -0500)]
[CMake] Include ZLIB_ROOT in LLVMConfig.cmake

Include the value of `ZLIB_ROOT` in `LLVMConfig.cmake` so `FindZLIB` can pick it up. This fixes an issue where ZLIB is not found on AIX runtimes despite specifying `-DZLIB_ROOT`.

Reviewed By: daltenty

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

2 years ago[RISCV] Add an MIR pass to replace redundant sext.w instructions with copies.
Craig Topper [Thu, 6 Jan 2022 16:17:07 +0000 (08:17 -0800)]
[RISCV] Add an MIR pass to replace redundant sext.w instructions with copies.

Function calls and compare instructions tend to cause sext.w
instructions to be inserted. If we make good use of W instructions,
these operations can often end up being redundant. We don't always
detect these during SelectionDAG due to things like phis. There also
some cases caused by failure to turn extload into sextload in
SelectionDAG. extload selects to LW allowing later sext.ws to become
redundant.

This patch adds a pass that examines the input of sext.w instructions trying
to determine if it is already sign extended. Either by finding a
W instruction, other instructions that produce a sign extended result,
or looking through instructions that propagate sign bits. It uses
a worklist and visited set to search as far back as necessary.

Reviewed By: asb, kito-cheng

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

2 years agoFix build failure with GCC 11 in C++20 mode
Evgeny Mandrikov [Thu, 6 Jan 2022 16:01:05 +0000 (17:01 +0100)]
Fix build failure with GCC 11 in C++20 mode

See https://wg21.link/cwg2237

Reviewed By: shafik, dexonsmith

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

2 years ago[RISCV] Don't advertise i32->i64 zextload as free for RV64.
Craig Topper [Thu, 6 Jan 2022 16:13:41 +0000 (08:13 -0800)]
[RISCV] Don't advertise i32->i64 zextload as free for RV64.

The zextload hook is only used to determine whether to insert a
zero_extend or any_extend for narrow types leaving a basic block.
Returning true from this hook tends to cause any load whose output
leaves the basic block to become an LWU instead of an LW.

Since we tend to prefer sexts for i32 compares on RV64, this can
cause extra sext.w instructions to be created in other basic blocks.

If we use LW instead of LWU this gives the MIR pass from D116397
a better chance of removing them.

Another option might be to teach getPreferredExtendForValue in
FunctionLoweringInfo.cpp about our preference for sign_extend of
i32 compares. That would cause SIGN_EXTEND to be chosen for any
value used by a compare instead of using the isZExtFree heuristic.
That will require code to convert from the llvm::Type* to EVT/MVT
as well as querying the type legalization actions to get the
promoted type in order to call TargetLowering::isSExtCheaperThanZExt.
That seemed like many extra steps when no other target wants it.
Though it would avoid us needing to lean on the MIR pass in some cases.

Reviewed By: asb

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

2 years ago[RISCV] Change RISCVISD::FCVT*RTZ opcodes to take rounding mode as an operand.
Craig Topper [Thu, 6 Jan 2022 07:14:19 +0000 (23:14 -0800)]
[RISCV] Change RISCVISD::FCVT*RTZ opcodes to take rounding mode as an operand.

Pre-work for a future change that will use these opcodes with other
rounding modes.

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

2 years ago[EarlyCSE] Support opaque pointers
Nikita Popov [Tue, 28 Dec 2021 15:00:33 +0000 (16:00 +0100)]
[EarlyCSE] Support opaque pointers

Explicitly check the load/store value type, because this is no
longer implicitly checked through the pointer type.

2 years ago[AST] ASTContext::mergeTypes - pull out repeated getAs<> calls. NFC.
Simon Pilgrim [Thu, 6 Jan 2022 16:04:26 +0000 (16:04 +0000)]
[AST] ASTContext::mergeTypes - pull out repeated getAs<> calls. NFC.

Avoids static-analyzer null dereference warnings.

2 years agoAMDGPU: Clear NoPHIs property in SIOptimizeVGPRLiveRanges
Matt Arsenault [Thu, 6 Jan 2022 00:30:21 +0000 (19:30 -0500)]
AMDGPU: Clear NoPHIs property in SIOptimizeVGPRLiveRanges

Fixes verifier error when writing MIR tests that didn't have phis to
begin with.

2 years ago[mlir][linalg][bufferize][NFC] Use RewritePatterns instead of custom traversal
Matthias Springer [Thu, 6 Jan 2022 15:50:21 +0000 (00:50 +0900)]
[mlir][linalg][bufferize][NFC] Use RewritePatterns instead of custom traversal

This change simplifies BufferizableOpInterface and other functions. Overall, the API will get smaller: Functions related to custom IR traversal are deleted entirely. This will makes it easier to write BufferizableOpInterface implementations.

This is also in preparation of unifying Comprehensive Bufferize and core bufferization. While Comprehensive Bufferize could theoretically maintain its own IR traversal, there is no reason to do so, because all bufferize implementations in BufferizableOpInterface have to support partial bufferization anyway. And we can share a larger part of the code base between the two bufferizations.

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

2 years agoReland "[clang][ObjC] Add fix it for missing methods in impl"
David Goldman [Thu, 6 Jan 2022 15:24:14 +0000 (10:24 -0500)]
Reland "[clang][ObjC] Add fix it for missing methods in impl"

This reverts commit 37be74885946f18dbeb70343ad659924c61d2549/
relands https://reviews.llvm.org/D116417 now that the internal
issue has been fixed.

2 years ago[clang][lex] NFC: Move some HeaderSearch functions to .cpp file
Jan Svoboda [Thu, 6 Jan 2022 15:22:36 +0000 (16:22 +0100)]
[clang][lex] NFC: Move some HeaderSearch functions to .cpp file

2 years ago[mlir][linalg][bufferize][NFC] Pass BufferizationState as const reference
Matthias Springer [Thu, 6 Jan 2022 15:16:16 +0000 (00:16 +0900)]
[mlir][linalg][bufferize][NFC] Pass BufferizationState as const reference

This is mostly for documentation purposes: Passing the object as a const reference signifies that analysis decisions cannot be changed after the analysis.

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

2 years ago[libc++][NFC] Reformat <__filesystem/operations.h>
Nikolas Klauser [Thu, 23 Dec 2021 22:26:49 +0000 (23:26 +0100)]
[libc++][NFC] Reformat <__filesystem/operations.h>

Reformat `<__filesystem/operations.h>`

Reviewed By: Quuxplusone, #libc, ldionne

Spies: ldionne, libcxx-commits

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

2 years ago[MemCpyOptimizer] hasUndefContents - only look for underlying object if we've found...
Simon Pilgrim [Thu, 6 Jan 2022 15:14:53 +0000 (15:14 +0000)]
[MemCpyOptimizer] hasUndefContents - only look for underlying object if we've found an alloca

Provides an early-out if we fail to find an AllocaInst, and avoids a static analyzer warning about null dereferencing.

2 years ago[MemCpyOptimizer] Use auto* for cast<> results (style). NFC.
Simon Pilgrim [Thu, 6 Jan 2022 15:07:30 +0000 (15:07 +0000)]
[MemCpyOptimizer] Use auto* for cast<> results (style). NFC.

2 years ago[mlir][linalg][bufferize][NFC] Do not cache bufferized function types
Matthias Springer [Thu, 6 Jan 2022 14:58:20 +0000 (23:58 +0900)]
[mlir][linalg][bufferize][NFC] Do not cache bufferized function types

This does not work if BufferizationState is passed around as a const reference in most places.

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

2 years ago[lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table...
Vy Nguyen [Thu, 6 Jan 2022 02:58:12 +0000 (21:58 -0500)]
[lld][macho][nfc] Make tests less britle by not expecting ordering in symbol table dump.

(parial)fixes PR/53026

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

2 years ago[SLP][NFC]Fix comment, NFC.
Alexey Bataev [Thu, 6 Jan 2022 14:38:29 +0000 (06:38 -0800)]
[SLP][NFC]Fix comment, NFC.

2 years ago[SLP][NFC]Add a test for the extra shuffle after alternate node, NFC.
Alexey Bataev [Thu, 6 Jan 2022 14:34:58 +0000 (06:34 -0800)]
[SLP][NFC]Add a test for the extra shuffle after alternate node, NFC.

2 years ago[Verifier] Enforce elementtype attr for inline asm indirect constraints
Nikita Popov [Thu, 6 Jan 2022 14:17:35 +0000 (15:17 +0100)]
[Verifier] Enforce elementtype attr for inline asm indirect constraints

This enforces the LangRef change from D116531 in the Verifier, now
that clang and tests have been updated.

2 years ago[LoopFlatten] checkOverflow - use cast<> instead of dyn_cast<> to avoid dereference...
Simon Pilgrim [Tue, 4 Jan 2022 22:24:18 +0000 (22:24 +0000)]
[LoopFlatten] checkOverflow - use cast<> instead of dyn_cast<> to avoid dereference of nullptr.

Fix static analysis warning by using cast<> instead of dyn_cast<> as both isa<> and isGuaranteedToExecuteForEveryIteration expect a non-null Instruction pointer.

2 years ago[BitCode] Autoupgrade inline asm elementtype attribute
Nikita Popov [Thu, 6 Jan 2022 14:02:45 +0000 (15:02 +0100)]
[BitCode] Autoupgrade inline asm elementtype attribute

This is the autoupgrade part of D116531. If old bitcode is missing
the elementtype attribute for indirect inline asm constraints,
automatically add it. As usual, this only works when upgrading
in typed mode, we haven't figured out upgrade in opaque mode yet.

2 years ago[mlir][Linalg] NFC - Modernize padding pattern
Nicolas Vasilache [Thu, 6 Jan 2022 13:30:49 +0000 (08:30 -0500)]
[mlir][Linalg] NFC - Modernize padding pattern

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

2 years ago[SystemZ][z/OS][libcxx]:Fix fopen64 undeclared error in 32 bit mode
Fanbo Meng [Thu, 6 Jan 2022 13:56:13 +0000 (08:56 -0500)]
[SystemZ][z/OS][libcxx]:Fix fopen64 undeclared error in 32 bit mode

z/OS doesn't support fopen64() functions. Modify the preprocessor directive for z/OS to use fopen() instead.

Reviewed By: #libc, abhina.sreeskantharajan, muiez, ldionne

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

2 years ago[MLIR] Simplex::findPivotRow: silence spurious coverity warning
Arjun P [Thu, 6 Jan 2022 13:46:57 +0000 (19:16 +0530)]
[MLIR] Simplex::findPivotRow: silence spurious coverity warning

Initialize some variables to zero to avoid a warning about them possibly being
used uninitialized. In actuality, they will never be used before initialization.

2 years ago[LICM] Update comments related to escape check (NFC)
Nikita Popov [Thu, 6 Jan 2022 13:44:39 +0000 (14:44 +0100)]
[LICM] Update comments related to escape check (NFC)

The comments here were outdated and a bit confusing without the
knowledge that we're only guarding against reads on unwind.