platform/upstream/llvm.git
23 months ago[RISCV] Incorporate LMUL into costs for arithmetic and shuffles
Philip Reames [Thu, 1 Dec 2022 18:37:44 +0000 (10:37 -0800)]
[RISCV] Incorporate LMUL into costs for arithmetic and shuffles

This reuses the routine implemented in 0e6f0b7 to implement several existing TODOs. Many of the operations scale linearly with LMUL; this change represents that in the cost model.

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

23 months ago[CodeGen] Fix restore blocks' BasicBlock information in branch relaxation
ZHU Zijia [Thu, 1 Dec 2022 18:41:04 +0000 (02:41 +0800)]
[CodeGen] Fix restore blocks' BasicBlock information in branch relaxation

In branch relaxation pass, restore blocks are created and placed before
the jump destination if indirect branches are required. For example:

        foo
        sd      s11, 0(sp)
        jump    .restore, s11
        bar
        bar
        bar
        j       .dest
.restore:
        ld      s11, 0(sp)
.dest:
        baz

The BasicBlock information of the restore MachineBasicBlock should be
identical to the dest MachineBasicBlock.

Reviewed By: arsenm

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

23 months ago[CodeGen][test] Pre-commit test for D131863
ZHU Zijia [Thu, 1 Dec 2022 18:39:14 +0000 (02:39 +0800)]
[CodeGen][test] Pre-commit test for D131863

Reviewed By: arsenm

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

23 months ago[Hexagon] Punt on GEPs with different base types in vector alignment
Krzysztof Parzyszek [Thu, 1 Dec 2022 16:00:11 +0000 (08:00 -0800)]
[Hexagon] Punt on GEPs with different base types in vector alignment

23 months agoRevert "[flang] Use proper attributes for runtime calls with 'i1' arguments/returns."
Slava Zakharin [Thu, 1 Dec 2022 17:35:59 +0000 (09:35 -0800)]
Revert "[flang] Use proper attributes for runtime calls with 'i1' arguments/returns."

This reverts commit d5b0de35bdd9a3f4d4a093e7938b06add34678eb.

23 months agoRevert "[CodeGen] Add new pass for late cleanup of redundant definitions."
Jonas Paulsson [Thu, 1 Dec 2022 18:29:24 +0000 (13:29 -0500)]
Revert "[CodeGen] Add new pass for late cleanup of redundant definitions."

Temporarily revert and fix buildbot failure.

This reverts commit 6d12599fd4134c1da63198c74a25490d28c733f6.

23 months ago[CodeGen] Add new pass for late cleanup of redundant definitions.
Jonas Paulsson [Wed, 6 Apr 2022 15:47:00 +0000 (17:47 +0200)]
[CodeGen] Add new pass for late cleanup of redundant definitions.

A new pass MachineLateInstrsCleanup is added to be run after PEI.

This is a simple pass that removes redundant and identical instructions
whenever found by scanning the MF once while keeping track of register
definitions in a map. These instructions are typically immediate loads
resulting from rematerialization, and address loads emitted by target in
eliminateFrameInde().

This is enabled by default, but a target could easily disable it by means of
'disablePass(&MachineLateInstrsCleanupID);'.

This late cleanup is naturally not "optimal" in removing instructions as it
is done by looking at phys-regs, but still quite effective. It would be
desirable to improve other parts of CodeGen and avoid these redundant
instructions in the first place, but there are no ideas for this yet.

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

Reviewed By: RKSimon, foad, craig.topper, arsenm, asb

23 months ago[NFC] Port an assortment of tests that invoke SROA to new pass manager
Roman Lebedev [Thu, 1 Dec 2022 18:12:31 +0000 (21:12 +0300)]
[NFC] Port an assortment of tests that invoke SROA to new pass manager

23 months ago[clang] Add test for CWG36
Vlad Serebrennikov [Thu, 1 Dec 2022 18:10:28 +0000 (21:10 +0300)]
[clang] Add test for CWG36

Reviewed By: #clang-language-wg, aaron.ballman, erichkeane

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

23 months ago[lldb] Remove timer from Module::GetNumCompileUnits
Dave Lee [Tue, 29 Nov 2022 00:15:41 +0000 (16:15 -0800)]
[lldb] Remove timer from Module::GetNumCompileUnits

`GetNumCompileUnits` has fast execution, and is high firing. Fast and frequent functions are not good candidates for timers. In a recent profile, `GetNumCompileUnits` was called >>10k times with an average duration of 1 microsecond.

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

23 months ago[Clang] Adjust assert from Sema::BuildCXXTypeConstructExpr
Shafik Yaghmour [Thu, 1 Dec 2022 17:38:13 +0000 (09:38 -0800)]
[Clang] Adjust assert from Sema::BuildCXXTypeConstructExpr

Currently Sema::BuildCXXTypeConstructExpr asserts that list initialization must
mean we have an InitListExpr as well. We have several cases of valid code the
result in CXXTemporaryObjectExpr in the AST instead for list initialization.
Commit 1ae689c seems to indicate that this is not unexpected, although may be a
design issue

This fixes:

  https://github.com/llvm/llvm-project/issues/58302
  https://github.com/llvm/llvm-project/issues/58753
  https://github.com/llvm/llvm-project/issues/59100

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

23 months ago[NVPTX] Convert tests to check 'target=nvptx.*'
Paul Robinson [Thu, 1 Dec 2022 17:00:04 +0000 (09:00 -0800)]
[NVPTX] Convert tests to check 'target=nvptx.*'

Part of the project to eliminate special handling for triples in lit
expressions.

23 months ago[lld-macho] Private label aliases to weak symbols should not retain section data
Jez Ng [Thu, 1 Dec 2022 17:01:07 +0000 (12:01 -0500)]
[lld-macho] Private label aliases to weak symbols should not retain section data

If we have two files with the same weak symbol like so:

```
ltmp0:
_weak:
  <contents>
```
and

```
ltmp1:
_weak:
  <contents>
```

Linking them together should leave only one copy of `<contents>`, not
two. Previously, we would keep around both copies because of the
private-label `ltmp<N>` symbols (i.e. symbols that start with `l`) -- we
would not coalesce those, so we would treat them as retaining the
contents.

This matters for more than just size -- we are depending upon this
behavior internally for emitting a certain file format. This file
format's header is repeated in each object file, but we want it to
appear just once in our output.

Why can't we not emit those aliases to `_weak`, or reference the
`ltmp<N>` symbols instead of `_weak`? Well, MC actually adds `ltmp<N>`
symbols as part of the assembly-to-binary translation step. So any
codegen at the clang level can't access them.

All that said... this solution is actually kind of hacky. Here, we avoid
creating the private-label symbols at parse time. This is acceptable
since we never emit those symbols in our output. However, in ld64, any
aliasing temporary symbols (ignored or otherwise) won't retain coalesced
data. But implementing this is harder -- we would have to create those
symbols first (so we can emit their names later), but we would have to
ensure the linker correctly shuffles them around when their aliasees get
coalesced.

Additionally, ld64 treats these temporary symbols as functionally
equivalent to the weak symbols themselves -- that is, it will emit weak
binds when those non-weak temporary aliases are referenced. We have
imitated this behavior for private-label symbols, but implementing it for
local aliases in general seems substantially more difficult. I'm not
sure if any programs actually depend on this behavior though, so maybe
it's a moot point.

Finally, ld64 does all this regardless of whether
`.subsections_via_symbols` is specified. We don't. But again, given how
rare the lack of that directive is (I've only seen it from hand-written
assembly inputs), I don't think we need to worry about it.

Reviewed By: #lld-macho, oontvoo

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

23 months ago[ConstraintElim] Use collectOffset result for chained gep support.
Florian Hahn [Thu, 1 Dec 2022 17:01:07 +0000 (17:01 +0000)]
[ConstraintElim] Use collectOffset result for chained gep support.

This slightly simplifies the code and addresses a correctness issue
where the index scaling for the precondition was not considered
properly.

Thanks to @nikic for pointing that out in D137840.

23 months ago[flang] hlfir.associate and hlfir.end_associate codegen
Jean Perier [Thu, 1 Dec 2022 16:58:20 +0000 (17:58 +0100)]
[flang] hlfir.associate and hlfir.end_associate codegen

Add hlfir.associate and hlfir.end_associate codegen.
To properly allow reusing the bufferized expression storage for the
newly created variable, bufferization of hlfir.expr has to be updated
so that hlfir.expr are translated to a variable and a boolean to
indicate if the variable storage needs to be freed after the expression
was used. That way the responsibility to free the bufferized expression
can be passed to the variable user, and applied in the
hlfir.end_associate.

Right now, not of the bufferized expression are heap allocated, so
generating the conditional freemem in hlfir.end_associate is left as
a TODO for when it can be tested.

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

23 months ago[DirectX] Fix shared libraries build
Alex Richardson [Mon, 21 Nov 2022 14:43:21 +0000 (14:43 +0000)]
[DirectX] Fix shared libraries build

I just tried to build all experimental targets and noticed that DirectX did
not build with -DBUILD_SHARED_LIBS=ON.

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

23 months ago[ConstraintElim] Add chained GEP tests with multiple indices/diff types.
Florian Hahn [Thu, 1 Dec 2022 16:51:40 +0000 (16:51 +0000)]
[ConstraintElim] Add chained GEP tests with multiple indices/diff types.

Extend test coverage for chained GEPs.

23 months ago[flang] Lower power to HLFIR
Jean Perier [Thu, 1 Dec 2022 16:49:29 +0000 (17:49 +0100)]
[flang] Lower power to HLFIR

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

23 months ago[flang] Lower add, mul, div, and sub to HLFIR
Jean Perier [Thu, 1 Dec 2022 16:39:36 +0000 (17:39 +0100)]
[flang] Lower add, mul, div, and sub to HLFIR

Only lower operations when the operands are scalar for now.

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

23 months agoAdd update_any_test_checks.py convenience utility
Nicolai Hähnle [Thu, 1 Dec 2022 12:40:13 +0000 (13:40 +0100)]
Add update_any_test_checks.py convenience utility

Given a list of test files, this utility will run (optionally in
parallel) the corresponding update_*_test_checks tool for all given
tests that have automatically generated assertions.

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

23 months ago[lld][NFC] rename ELF alignment into addralign
Guillaume Chatelet [Thu, 1 Dec 2022 16:19:56 +0000 (16:19 +0000)]
[lld][NFC] rename ELF alignment into addralign

23 months ago[mlir][spirv] Fix integer dot prod capabilities
Jakub Kuderski [Thu, 1 Dec 2022 14:14:52 +0000 (09:14 -0500)]
[mlir][spirv] Fix integer dot prod capabilities

Allow the integer dot product cabailities to be used in SPIR-V <1.6 when
the SPV_KHR_integer_dot_product extension is available.

Reviewed By: antiagainst

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

23 months ago[AArch64] Add missing #include
Tomas Matheson [Thu, 1 Dec 2022 15:53:25 +0000 (15:53 +0000)]
[AArch64] Add missing #include

23 months ago[AArch64] Improve TargetParser API
Tomas Matheson [Fri, 18 Nov 2022 11:20:05 +0000 (11:20 +0000)]
[AArch64] Improve TargetParser API

Re-land with constexpr StringRef::substr():

The TargetParser depends heavily on a collection of macros and enums to tie
together information about architectures, CPUs and extensions. Over time this
has led to some pretty awkward API choices. For example, recently a custom
operator-- has been added to the enum, which effectively turns iteration into
a graph traversal and makes the ordering of the macro calls in the header
significant. More generally there is a lot of string <-> enum conversion
going on. I think this shows the extent to which the current data structures
are constraining us, and the need for a rethink.

Key changes:

 - Get rid of Arch enum, which is used to bind fields together. Instead of
   passing around ArchKind, use the named ArchInfo objects directly or via
   references.

 - The list of all known ArchInfo becomes an array of pointers.

 - ArchKind::operator-- is replaced with ArchInfo::implies(), which defines
   which architectures are predecessors to each other. This allows features
   from predecessor architectures to be added in a more intuitive way.

 - Free functions of the form f(ArchKind) are converted to ArchInfo::f(). Some
   functions become unnecessary and are deleted.

 - Version number and profile are added to the ArchInfo. This makes comparison
   of architectures easier and moves a couple of functions out of clang and
   into AArch64TargetParser.

 - clang::AArch64TargetInfo ArchInfo is initialised to Armv8a not INVALID.

 - AArch64::ArchProfile which is distinct from ARM::ArchProfile

 - Give things sensible names and add some comments.

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

23 months ago[X86][FP16] Do not combine fminnum/fmaxnum for FP16 emulation
Phoebe Wang [Thu, 1 Dec 2022 14:31:51 +0000 (22:31 +0800)]
[X86][FP16] Do not combine fminnum/fmaxnum for FP16 emulation

Under the emulation situation, we lack native fmin/fmax instruction support.

Fixes #59258

Reviewed By: skan, spatel

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

23 months ago[mlir] use correct markdown headers in TensorOps.td
Oleksandr "Alex" Zinenko [Thu, 1 Dec 2022 15:22:24 +0000 (16:22 +0100)]
[mlir] use correct markdown headers in TensorOps.td

The `====` underline is for h1, we actually need h4. This makes TOC look bad.

23 months ago[PS4/PS5] Canonicalize tests to use 'target=.*-(ps4|ps5)'
Paul Robinson [Thu, 1 Dec 2022 15:20:35 +0000 (07:20 -0800)]
[PS4/PS5] Canonicalize tests to use 'target=.*-(ps4|ps5)'

This allows grepping for ps4 or ps5 to continue to work.

23 months agoReland "[AArch64][SME]: Generate streaming-compatible code for ld2-alloca."
Sander de Smalen [Thu, 1 Dec 2022 11:00:41 +0000 (11:00 +0000)]
Reland "[AArch64][SME]: Generate streaming-compatible code for ld2-alloca."

Phabricator review for this patch was D138791

23 months agoReland "[AArch64][SME]: Add precursory tests for D138791"
Sander de Smalen [Thu, 1 Dec 2022 14:38:01 +0000 (14:38 +0000)]
Reland "[AArch64][SME]: Add precursory tests for D138791"

This reverts commit 06846596eb1768eea06778a5b6da31145e84e461.

23 months agoRevert "[MLIR] Introduce constraint attributes for DenseArrayAttr"
Lorenzo Chelini [Thu, 1 Dec 2022 14:44:03 +0000 (15:44 +0100)]
Revert "[MLIR] Introduce constraint attributes for DenseArrayAttr"

This reverts commit dd0de4dca92cd6affafb47f788b64e99187168f1.

Build on mlir-windows fails:

Step 6 (build-check-mlir-build-only) failure: build (failure)
C:\buildbot\mlir-x64-windows-ninja\build\tools\mlir\test\lib\Dialect\Test\TestOps.cpp.inc(928): error C2220: the following warning is treated as an error
C:\buildbot\mlir-x64-windows-ninja\build\tools\mlir\test\lib\Dialect\Test\TestOps.cpp.inc(928): warning C4804: '>': unsafe use of type 'bool' in operation
C:\buildbot\mlir-x64-windows-ninja\build\tools\mlir\test\lib\Dialect\Test\TestOps.cpp.inc(7419): warning C4804: '>': unsafe use of type 'bool' in operation

23 months ago[MLIR][Transform] Fix top-level comment (NFC)
Lorenzo Chelini [Thu, 1 Dec 2022 14:31:16 +0000 (15:31 +0100)]
[MLIR][Transform] Fix top-level comment (NFC)

23 months ago[flang][NFC] Remove debugging line in convert op
Valentin Clement [Thu, 1 Dec 2022 14:25:05 +0000 (15:25 +0100)]
[flang][NFC] Remove debugging line in convert op

This line should not have made it to the final patch.

23 months ago[clang] Add test for CWG360
Vlad Serebrennikov [Thu, 1 Dec 2022 14:09:28 +0000 (17:09 +0300)]
[clang] Add test for CWG360

P1787: "CWG360 is resolved by applying access control to using-declarations."
[[ http://eel.is/c++draft/class.access#general-4.sentence-3 | class.access.general#4 ]]: "When a using-declarator is named, access control is applied to it, not to the declarations that replace it."

Reviewed By: #clang-language-wg, aaron.ballman

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

23 months ago[MLIR][Tensor] Add canonicalization for UnpackOp
Lorenzo Chelini [Tue, 29 Nov 2022 13:51:34 +0000 (14:51 +0100)]
[MLIR][Tensor] Add canonicalization for UnpackOp

pack(unpack(x)) -> x

Reviewed By: hanchung

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

23 months ago[MLIR] Introduce constraint attributes for DenseArrayAttr
Lorenzo Chelini [Tue, 29 Nov 2022 18:45:37 +0000 (19:45 +0100)]
[MLIR] Introduce constraint attributes for DenseArrayAttr

- `DenseArrayStrictlyPositive` all elements are required to be > 0.
  Returns true if the range is empty.

- `DenseArrayNonNegative` all elements are required to be >= 0. Returns
  true if the range is empty.

Both constraints will simplify verifier logic as we move from using `I64ArrayAttr` to `DenseI64ArrayAttr`.

Reviewed By: rriddle

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

23 months ago[X86] Remove unnecessary RDRAND overrides from znver1/znver2 model
Simon Pilgrim [Thu, 1 Dec 2022 13:41:36 +0000 (13:41 +0000)]
[X86] Remove unnecessary RDRAND overrides from znver1/znver2 model

Reported by D138359 - the overrides matched the base class schedule definition (its been flagged as WriteMicrocoded instead of WriteSystem but the models define both the same)

23 months ago[MachineCombiner][RISCV] Make hasReassociableSibling virtual and override it for...
Anton Sidorenko [Thu, 20 Oct 2022 15:07:43 +0000 (18:07 +0300)]
[MachineCombiner][RISCV] Make hasReassociableSibling virtual and override it for RISCV

To check reassociation correctness for RISCV, we must ensure that the root and
it's sibling have equal rounding modes (for floating point instructions).
`hasReassociableSibling` is a good place to make additional target-dependend
checks.

This patch allows us to enable default machine combiner mechanism to gather
reassociation candidates on RISCV.

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

23 months ago[flang] Avoid verifier error when emboxing trivial type to unlimited polymorphic...
Valentin Clement [Thu, 1 Dec 2022 13:25:04 +0000 (14:25 +0100)]
[flang] Avoid verifier error when emboxing trivial type to unlimited polymorphic entity

Reviewed By: jeanPerier

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

23 months agoRevert "[AArch64] Improve TargetParser API"
Tomas Matheson [Thu, 1 Dec 2022 13:06:54 +0000 (13:06 +0000)]
Revert "[AArch64] Improve TargetParser API"

Buildbots unhappy about constexpr function.

This reverts commit 450de8008bb0ccb5dfc9dd69b6f5b434158772bd.

23 months ago[AArch64] Improve TargetParser API
Tomas Matheson [Fri, 18 Nov 2022 11:20:05 +0000 (11:20 +0000)]
[AArch64] Improve TargetParser API

The TargetParser depends heavily on a collection of macros and enums to tie
together information about architectures, CPUs and extensions. Over time this
has led to some pretty awkward API choices. For example, recently a custom
operator-- has been added to the enum, which effectively turns iteration into
a graph traversal and makes the ordering of the macro calls in the header
significant. More generally there is a lot of string <-> enum conversion
going on. I think this shows the extent to which the current data structures
are constraining us, and the need for a rethink.

Key changes:

 - Get rid of Arch enum, which is used to bind fields together. Instead of
   passing around ArchKind, use the named ArchInfo objects directly or via
   references.

 - The list of all known ArchInfo becomes an array of pointers.

 - ArchKind::operator-- is replaced with ArchInfo::implies(), which defines
   which architectures are predecessors to each other. This allows features
   from predecessor architectures to be added in a more intuitive way.

 - Free functions of the form f(ArchKind) are converted to ArchInfo::f(). Some
   functions become unnecessary and are deleted.

 - Version number and profile are added to the ArchInfo. This makes comparison
   of architectures easier and moves a couple of functions out of clang and
   into AArch64TargetParser.

 - clang::AArch64TargetInfo ArchInfo is initialised to Armv8a not INVALID.

 - AArch64::ArchProfile which is distinct from ARM::ArchProfile

 - Give things sensible names and add some comments.

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

23 months ago[AArch64TargetParser] getArchFeatures -> getArchFeature
Tomas Matheson [Fri, 18 Nov 2022 13:05:11 +0000 (13:05 +0000)]
[AArch64TargetParser] getArchFeatures -> getArchFeature

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

23 months ago[AArch64] Remove unused fields from CPUs in TargetParser
Tomas Matheson [Sat, 26 Nov 2022 13:44:36 +0000 (13:44 +0000)]
[AArch64] Remove unused fields from CPUs in TargetParser

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

23 months ago[X86] Remove unnecessary INTO overrides from znver1/znver2 model
Simon Pilgrim [Wed, 30 Nov 2022 17:58:48 +0000 (17:58 +0000)]
[X86] Remove unnecessary INTO overrides from znver1/znver2 model

Reported by D138359 - the overrides matched the base class schedule definition (its been flagged as WriteMicrocoded instead of WriteSystem but the models define both the same)

23 months ago[X86] Remove unnecessary VPERMPS/VPERMDrr overrides from znver3 model
Simon Pilgrim [Wed, 30 Nov 2022 17:47:55 +0000 (17:47 +0000)]
[X86] Remove unnecessary VPERMPS/VPERMDrr overrides from znver3 model

Reported by D138359 - the overrides matched the base class schedule definition (in the case of VPERMDYrr it was entirely replacing uses of WriteVarShuffle256 so could that could be adjusted directly)

23 months ago[X86] Remove unnecessary XADD*rr overrides from bdver2 model
Simon Pilgrim [Wed, 30 Nov 2022 15:42:25 +0000 (15:42 +0000)]
[X86] Remove unnecessary XADD*rr overrides from bdver2 model

Reported by D138359 - the overrides matched the base class schedule definition

23 months ago[clangd] Log diagnostics if we failed to create a preamble.
Sam McCall [Thu, 1 Dec 2022 10:34:02 +0000 (11:34 +0100)]
[clangd] Log diagnostics if we failed to create a preamble.

Really we want these to be shown to the client, but the path to do so involves
storing them in

Bandaid for https://github.com/clangd/clangd/issues/1408
See https://github.com/clangd/clangd/issues/1399 for motivation

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

23 months ago[DSE] Add tests for __memset_chk libcalls.
Florian Hahn [Thu, 1 Dec 2022 12:07:51 +0000 (12:07 +0000)]
[DSE] Add tests for __memset_chk libcalls.

23 months ago[mlir][Transform][NFC] Use a single rewriter instead of duplicating it everywhere
Nicolas Vasilache [Thu, 1 Dec 2022 11:48:23 +0000 (03:48 -0800)]
[mlir][Transform][NFC] Use a single rewriter instead of duplicating it everywhere

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

23 months ago[DSE] Split off _chk libcall tests into separate file.
Florian Hahn [Thu, 1 Dec 2022 11:37:06 +0000 (11:37 +0000)]
[DSE] Split off _chk libcall tests into separate file.

This keeps a clearer separation between tests and avoids growing the
libcalls.ll test too large.

23 months ago[include-cleaner] Use RAV instead of ASTMatchers in LocateSymbolTest
Kadir Cetinkaya [Thu, 1 Dec 2022 10:57:33 +0000 (11:57 +0100)]
[include-cleaner] Use RAV instead of ASTMatchers in LocateSymbolTest

ASTMatchers are pulling in lots of dependencies that we don't really
need for just finding a decl based on name. So use a simple RAV instead.

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

23 months ago[gn build] Port 89f36dd8f32f
LLVM GN Syncbot [Thu, 1 Dec 2022 11:19:48 +0000 (11:19 +0000)]
[gn build] Port 89f36dd8f32f

23 months ago[gn build] Port 65d6d67fc9a9
LLVM GN Syncbot [Thu, 1 Dec 2022 11:19:48 +0000 (11:19 +0000)]
[gn build] Port 65d6d67fc9a9

23 months ago[Object] Add some more LoongArch support
WANG Xuerui [Thu, 1 Dec 2022 09:58:11 +0000 (17:58 +0800)]
[Object] Add some more LoongArch support

Add ELFObjectFileBase::getLoongArchFeatures, and return the proper ELF
relative reloc type for LoongArch.

Reviewed By: MaskRay, SixWeining

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

23 months agoRevert "[AArch64][SME]: Add precursory tests for D138791"
David Sherwood [Thu, 1 Dec 2022 11:13:19 +0000 (11:13 +0000)]
Revert "[AArch64][SME]: Add precursory tests for D138791"

This reverts commit 45adca0f52af346a131163d1cc3e4a08baf7f0f1.

23 months agoRevert "[WIP] Add support for MMA conversion for 1-D vector.transfer followed by...
Nicolas Vasilache [Thu, 1 Dec 2022 10:56:33 +0000 (02:56 -0800)]
Revert "[WIP] Add support for MMA conversion for 1-D vector.transfer followed by a broadcast to 2-D"

This reverts commit 7db25f78db807da171f23bcbaff258c5677901d1.

This was mistakently stacked below (and committed) along with an NFC change.

23 months ago[include-cleaner] Attempt two at fixing buildbots
Kadir Cetinkaya [Thu, 1 Dec 2022 10:48:55 +0000 (11:48 +0100)]
[include-cleaner] Attempt two at fixing buildbots

23 months ago[mlir][Linalg][NFC] Improve debugging during vectorization
Nicolas Vasilache [Thu, 1 Dec 2022 10:07:50 +0000 (02:07 -0800)]
[mlir][Linalg][NFC] Improve debugging during vectorization

Make more systematic use of `notifyMatchFailure`.

23 months ago[WIP] Add support for MMA conversion for 1-D vector.transfer followed by a broadcast...
Nicolas Vasilache [Wed, 30 Nov 2022 21:36:13 +0000 (13:36 -0800)]
[WIP] Add support for MMA conversion for 1-D vector.transfer followed by a broadcast to 2-D

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

23 months ago[AArch64] Fix test streaming-compatible-expand-masked-gather-scatter.ll
David Sherwood [Thu, 1 Dec 2022 10:46:44 +0000 (10:46 +0000)]
[AArch64] Fix test streaming-compatible-expand-masked-gather-scatter.ll

Fixes an issue introduced by D138588.

We should only run the test on a aarch64 registered target since it
makes use of a target-only flag.

23 months ago[flang] lower F77 calls in HLFIR
Jean Perier [Thu, 1 Dec 2022 10:09:35 +0000 (11:09 +0100)]
[flang] lower F77 calls in HLFIR

Use recently added hlfir.associate/hlfir.end_associate to deal
with the cases where the actual argument is an expression.

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

23 months agoRevert "[AArch64][SME]: Generate streaming-compatible code for ld2-alloca."
David Sherwood [Thu, 1 Dec 2022 09:53:13 +0000 (09:53 +0000)]
Revert "[AArch64][SME]: Generate streaming-compatible code for ld2-alloca."

This reverts commit 279c0a83aa22cd35d4b7c7c52b85d2a86f2528a7.

23 months ago[libc][benchmark] more precise estimate of throughput
Guillaume Chatelet [Thu, 1 Dec 2022 10:19:16 +0000 (10:19 +0000)]
[libc][benchmark] more precise estimate of throughput

This patch increases precision by performing the integer divivion after the
multiplication.

23 months ago[flang] Make sure PointerNullifyDerived is called on pointer array
Valentin Clement [Thu, 1 Dec 2022 10:18:12 +0000 (11:18 +0100)]
[flang] Make sure PointerNullifyDerived is called on pointer array

Record type was not correctly retrived so the runtime call was not
produced correctly.
Fix how the record type is retrived so the correct call is
produced.

Reviewed By: jeanPerier

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

23 months ago[flang] Use genExprBox for the rhs when calling PointerAssociate for unlimited polymo...
Valentin Clement [Thu, 1 Dec 2022 10:12:01 +0000 (11:12 +0100)]
[flang] Use genExprBox for the rhs when calling PointerAssociate for unlimited polymorphic pointer

In D139019 the assumption was made that the rhs was also the MutableBox
but this is not a constraint. Use genExprBox instead. Also the allowed
conversion in D139019 was not correct. Remoed it since it is not needed anymore.

Reviewed By: jeanPerier

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

23 months ago[reland][libc] Add bcopy
Guillaume Chatelet [Thu, 1 Dec 2022 10:06:36 +0000 (10:06 +0000)]
[reland][libc] Add bcopy

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

23 months ago[include-cleaner] Fix build
Kadir Cetinkaya [Thu, 1 Dec 2022 10:02:04 +0000 (11:02 +0100)]
[include-cleaner] Fix build

23 months agoRevert D138994 "[libc] Add bcopy"
Guillaume Chatelet [Thu, 1 Dec 2022 09:55:36 +0000 (09:55 +0000)]
Revert D138994 "[libc] Add bcopy"

Broke build bot

This reverts commit 186a15f7a9311a75f3c5e90243ea5d6d20878de1.

23 months ago[libc] Add bcopy
Guillaume Chatelet [Wed, 30 Nov 2022 10:49:23 +0000 (10:49 +0000)]
[libc] Add bcopy

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

23 months ago[include-cleaner] Introduce symbol to location mapping
Kadir Cetinkaya [Mon, 5 Sep 2022 15:54:18 +0000 (17:54 +0200)]
[include-cleaner] Introduce symbol to location mapping

Creates a one to many mapping, by returning all the possible locations
providing a symbol. Also includes an "is definition" signal for the
location, that can be used for ranking afterwards.

This also takes care of stdlib symbols by having a variant of locations.

Depends on D135859.

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

23 months agoCache memory buffer's name length
serge-sans-paille [Wed, 23 Nov 2022 06:45:59 +0000 (07:45 +0100)]
Cache memory buffer's name length

This avoids repeated calls to strlen while we already know its value.

When preprocessing sqlite3.c, this gives a surprising 2% speedup.

Full benchmark available here:

https://llvm-compile-time-tracker.com/compare.php?from=d14c2d408dccd8c6defa7d151e9a96be3cac8cc3&to=04f0641c1cbdcd0bdbd11cd910ca6091420bf52e&stat=instructions:u

Recommit 1824432174b3166b40bce59477beb5821170748e, with restored '\0' at the end of buffer name.

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

23 months ago[mlir] Fix build breakage introduced by D139026
Matthias Springer [Thu, 1 Dec 2022 08:16:17 +0000 (09:16 +0100)]
[mlir] Fix build breakage introduced by D139026

23 months ago[mlir][linalg][transform] Add structured.replace op
Matthias Springer [Wed, 30 Nov 2022 17:27:30 +0000 (18:27 +0100)]
[mlir][linalg][transform] Add structured.replace op

This op is useful for debugging/experiments and allows users to replace ops (without arguments + IsolatedFromAbove) with the given op in the region of transform op.

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

23 months ago[MLIR][Transform] Disambiguate ternary operator for MSVC
Benjamin Kramer [Thu, 1 Dec 2022 07:58:37 +0000 (08:58 +0100)]
[MLIR][Transform] Disambiguate ternary operator for MSVC

mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp(42): error C2446: ':': no conversion from 'OpTy' to 'OpTy'
        with
        [
            OpTy=mlir::scf::ForOp
        ]
        and
        [
            OpTy=mlir::AffineForOp
        ]
mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp(42): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

23 months ago[clang-tidy] Add misc-use-anonymous-namespace check
Carlos Galvez [Thu, 3 Nov 2022 11:04:10 +0000 (11:04 +0000)]
[clang-tidy] Add misc-use-anonymous-namespace check

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

23 months ago[Driver] Add test for -stdlib++-isystem with -nostdinc
Shoaib Meenai [Thu, 1 Dec 2022 07:09:28 +0000 (23:09 -0800)]
[Driver] Add test for -stdlib++-isystem with -nostdinc

This further clarifies the intent of the flag.

23 months ago[RISCV] Use Register instead of unsigned. NFC
Craig Topper [Thu, 1 Dec 2022 06:51:57 +0000 (22:51 -0800)]
[RISCV] Use Register instead of unsigned. NFC

23 months ago[mlir] Change scf::LoopNest to store 'results'.
Christian Sigg [Tue, 15 Nov 2022 13:19:35 +0000 (14:19 +0100)]
[mlir] Change scf::LoopNest to store 'results'.

This fixes the case where scf::LoopNest::loops is empty.

Change LoopVector and ValueVector to SmallVector.

Reviewed By: ftynse

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

23 months ago[X86] Add ExpandLargeFpConvert Pass and enable for X86
Freddy Ye [Thu, 1 Dec 2022 05:47:25 +0000 (13:47 +0800)]
[X86] Add ExpandLargeFpConvert Pass and enable for X86

As stated in
https://discourse.llvm.org/t/rfc-llc-add-expandlargeintfpconvert-pass-for-fp-int-conversion-of-large-bitint/65528,
this implementation is very similar to ExpandLargeDivRem, which expands
‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp .. to’, ‘sitofp .. to’ instructions
with a bitwidth above a threshold into auto-generated functions. This is
useful for targets like x86_64 that cannot lower fp convertions with more
than 128 bits. The expanded nodes are referring from the IR generated by
`compiler-rt/lib/builtins/floattidf.c`, `compiler-rt/lib/builtins/fixdfti.c`,
and etc.

Corner cases:
1. For fp16: as there is no related builtins added in compliler-rt. So I
mainly utilized the fp32 <-> fp16 lib calls to implement.
2. For fp80: as this pass is soft fp emulation and no fp80 instructions can
help in this problem. I recommend users to deprecate this usage. For now, the
implementation uses fp128 as the temporary conversion type and inserts
fptrunc/ext at top/end of the function.
3. For bf16: as clang FE currently doesn't support bf16 algorithm operations
(convert to int, float, +, -, *, ...), this patch doesn't consider bf16 for
now.
4. For unsigned FPToI: since both default hardware behaviors and libgcc are
ignoring "returns 0 for negative input" spec. This pass follows this old way
to ignore unsigned FPToI. See this example:
https://gcc.godbolt.org/z/bnv3jqW1M

The end-to-end tests are uploaded at https://reviews.llvm.org/D138261

Reviewed By: LuoYuanke, mgehre-amd

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

23 months agoEnhance stack protector for calling no return function
Xiang1 Zhang [Mon, 28 Nov 2022 07:02:04 +0000 (15:02 +0800)]
Enhance stack protector for calling no return function

Reviewed By: LuoYuanke, WangPengfei, lebedev.ri

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

23 months agoReport which modules have forcefully completed types in statistics.
Greg Clayton [Thu, 24 Nov 2022 04:28:03 +0000 (20:28 -0800)]
Report which modules have forcefully completed types in statistics.

A previous patch added the ability for us to tell if types were forcefully completed. This patch adds the ability to see which modules have forcefully completed types and aggregates the number of modules with forcefully completed types at the root level.

We add a module specific setting named "debugInfoHadIncompleteTypes" that is a boolean value. We also aggregate the number of modules at the root level that had incomplete debug info with a key named "totalModuleCountWithIncompleteTypes" that is a count of number of modules that had incomplete types.

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

23 months ago[mlir][spirv] Fix missing parameter usage
Lei Zhang [Thu, 1 Dec 2022 05:05:16 +0000 (05:05 +0000)]
[mlir][spirv] Fix missing parameter usage

This was accidentially removed during refactoring.

Reviewed By: kuhar

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

23 months ago[RISCV] Add ANDI to getRegAllocationHints.
Craig Topper [Thu, 1 Dec 2022 04:54:27 +0000 (20:54 -0800)]
[RISCV] Add ANDI to getRegAllocationHints.

23 months ago[RISCV] Replace hardcoded constant with OPIVI.Value in tablegen. NFC
Craig Topper [Thu, 1 Dec 2022 04:10:13 +0000 (20:10 -0800)]
[RISCV] Replace hardcoded constant with OPIVI.Value in tablegen. NFC

23 months ago[AArch64][SME][NFC]: Enable lowering truncate for enhancement.
Hassnaa Hamdi [Thu, 1 Dec 2022 03:44:42 +0000 (03:44 +0000)]
[AArch64][SME][NFC]: Enable lowering truncate for enhancement.

Enable lowering truncate to enhance the generated code.

23 months ago[AArch64][SME]: Scalarize masked gather/scatter in streaming mode.
Hassnaa Hamdi [Tue, 29 Nov 2022 16:40:37 +0000 (16:40 +0000)]
[AArch64][SME]: Scalarize masked gather/scatter in streaming mode.

Add testing files:
 - streaming-compatible-expand-masked-gather-scatter.ll

Reviewed By: david-arm, sdesmalen

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

23 months ago[AArch64][SME]: Generate streaming-compatible code for ld2-alloca.
Hassnaa Hamdi [Wed, 30 Nov 2022 09:45:47 +0000 (09:45 +0000)]
[AArch64][SME]: Generate streaming-compatible code for ld2-alloca.

To generate code compatible to streaming mode:
 - disable lowering interleaved load to avoid generating invalid NEON intrinsics.

Reviewed By: sdesmalen

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

23 months ago[AArch64][SME]: Add precursory tests for D138791
Hassnaa Hamdi [Mon, 28 Nov 2022 12:40:46 +0000 (12:40 +0000)]
[AArch64][SME]: Add precursory tests for D138791

Testing files:
 - ld2-alloca.ll

23 months ago[AMX] Support AMX-FP16 new intrinsic interface
Xiang1 Zhang [Thu, 1 Dec 2022 01:23:44 +0000 (09:23 +0800)]
[AMX] Support AMX-FP16 new intrinsic interface

We support AMX-FP16 isa in https://reviews.llvm.org/D135941 now.
The old  intrinsic interface need to manually write tile registers.
So we support its new intrinsic interface to let it be able to do register allocation.

Reviewed By: LuoYuanke

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

23 months ago[LoongArch] Add remaining intrinsics for CRC check instructions
gonglingqin [Thu, 1 Dec 2022 01:18:00 +0000 (09:18 +0800)]
[LoongArch] Add remaining intrinsics for CRC check instructions

After D137316 implements the intrinsics of the first crc check instruction
and related diagnosis, this patch implements the intrinsics of all remaining
crc check instructions.

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

23 months ago[AArch64][SME]: Add streaming-compatible testing files.
Hassnaa Hamdi [Tue, 29 Nov 2022 12:57:56 +0000 (12:57 +0000)]
[AArch64][SME]: Add streaming-compatible testing files.

Testing files:
 - int-compares.ll
 - int-immediates.ll
 - log-reduce.ll

Reviewed By: david-arm, sdesmalen

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

23 months ago[OpenMP][LegacyPM] Remove OpenMPOptCGSCCLegacyPass
LiaoChunyu [Wed, 30 Nov 2022 12:23:55 +0000 (20:23 +0800)]
[OpenMP][LegacyPM] Remove OpenMPOptCGSCCLegacyPass

Using the legacy pass manager for the optimization pipeline is deprecated.
I see the new PM is available.

Reviewed By: aeubanks, jdoerfert

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

23 months ago[AArch64][SME]: Add streaming-compatible testing files.
Hassnaa Hamdi [Tue, 29 Nov 2022 12:58:47 +0000 (12:58 +0000)]
[AArch64][SME]: Add streaming-compatible testing files.

Testing files:
 - limit-duplane.ll
 - optimize-ptrue.ll
 - ptest.ll

Reviewed By: david-arm, sdesmalen

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

23 months ago[mlir] Update HeapAsmResourceBlob::allocate API to make alignment explicit
River Riddle [Tue, 29 Nov 2022 02:48:12 +0000 (18:48 -0800)]
[mlir] Update HeapAsmResourceBlob::allocate API to make alignment explicit

This effectively matches the same API changes that were made to
UnmanagedAsmResourceBlob.

23 months ago[mlir] Cleanup lingering problems surrounding attribute/type aliases
River Riddle [Tue, 29 Nov 2022 02:35:00 +0000 (18:35 -0800)]
[mlir] Cleanup lingering problems surrounding attribute/type aliases

This commit refactors attribute/type alias generation to be similar to how
we do it for operations, i.e. we generate aliases determined on what is
actually necessary when printing the IR (using a dummy printer for alias
collection). This allows for generating aliases only when necessary, and
also allows for proper propagation of when a nested alias can be deferred.
This also necessitated a fix for location parsing to actually parse aliases
instead of ignoring them.

Fixes #59041

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

23 months ago[Driver] Only check -nostdinc++ for -stdlib++-isystem
Shoaib Meenai [Thu, 1 Dec 2022 00:45:08 +0000 (16:45 -0800)]
[Driver] Only check -nostdinc++ for -stdlib++-isystem

A drive-by change in 53c98d85a8a609552448043d5512e70313b1eb1b made
-stdlib++-isystem be suppressed by -nostdinc and -nostdlibinc in
addition to -nostdinc++. However, that's contrary to the intent of the
flag. It's common to provide your own C++ headers (e.g. when building
libc++ by itself or as a compiler-rt dependency) but rely on the system
C headers, and having -stdlib++-isystem only look at -nostdinc++ allows
us to customize both the C header path (via -nostdinc or -nostdlibinc)
and the C++ header path (via -stdlib++-isystem) at the toolchain level
but still let users of the toolchain provide their own C++ headers. Add
a comment explaining the rationale to make it clearer.

23 months ago[runtimes] Fix runtimes-test-depends
Shoaib Meenai [Thu, 1 Dec 2022 00:41:31 +0000 (16:41 -0800)]
[runtimes] Fix runtimes-test-depends

The dependency list is stored in a global property, so we need to fetch
it to a variable before using that variable. We also need to add the
list contents as dependencies correctly.

23 months ago[AArch64][SME]: Add streaming-compatible testing files.
Hassnaa Hamdi [Tue, 29 Nov 2022 12:57:01 +0000 (12:57 +0000)]
[AArch64][SME]: Add streaming-compatible testing files.

Testing files:
 - subvector.ll
 - permute-rev.ll
 - permute-zip-uzp-trn.ll
 - vector-shuffle.ll

Reviewed By: david-arm, sdesmalen

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

23 months ago[libc] add unsafe mode to strlen
Michael Jones [Thu, 14 Jul 2022 22:17:18 +0000 (15:17 -0700)]
[libc] add unsafe mode to strlen

The only safe way to implement strlen involves reading the string one
char at a time. It is faster to read in larger blocks, but this leads to
reading beyond the string boundary, which is undefined behavior. This
patch adds an implementation and flag to use this fast but unsafe
version of strlen.

Reviewed By: sivachandra

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

23 months ago[clang-tidy] Suppress google-objc-avoid-throwing-exception in system macros 🫢
Stephane Moore [Wed, 9 Nov 2022 19:07:53 +0000 (11:07 -0800)]
[clang-tidy] Suppress google-objc-avoid-throwing-exception in system macros 🫢

The google-objc-avoid-throwing-exception check enforces the Google
Objective-C Style Guide's prohibition on throwing exceptions in user
code but the check incorrectly triggers findings for code emitted from
system headers. This commit suppresses any findings that do not have
valid locations or are emitted from macros in system headers.

Avoid Throwing Exceptions, Google Objective-C Style Guide:
https://github.com/google/styleguide/blob/gh-pages/objcguide.md#avoid-throwing-exceptions

Test Notes:
Ran clang-tidy lit tests.

Reviewed By: gribozavr2

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

23 months ago[HWASAN] Modified __hwasan::Thread::unique_id_ to be u32 instead of u64.
Kirill Stoimenov [Thu, 1 Dec 2022 00:18:49 +0000 (00:18 +0000)]
[HWASAN] Modified __hwasan::Thread::unique_id_ to be u32 instead of u64.

This is needed for LSAN integration work. LSAN uses context to store thread_id << 32 + stack_id. In order to fit both we would need thread_id to be 32 bit.

Reviewed By: vitalybuka

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