platform/upstream/llvm.git
21 months ago[lldb][Test] Add C-array test-cases to CPlusPlusNameParser unit-tests
Michael Buch [Sat, 22 Oct 2022 11:14:28 +0000 (12:14 +0100)]
[lldb][Test] Add C-array test-cases to CPlusPlusNameParser unit-tests

Make sure we test the code path where we parse
function templates instantiated with C-arrays.

21 months ago[flang] Fix one Unexpectedly Passed test on X86
Peixin Qiao [Sat, 22 Oct 2022 10:57:05 +0000 (18:57 +0800)]
[flang] Fix one Unexpectedly Passed test on X86

The test case, kinds04_q10.f90, should run only for X86. Now it is
unexpected passed since 8686ff1d0d47ba8c980f5ea6bb53f77786478e23.
Add "-triple x86_64-unknown-linux-gnu" so that the test is for
testing the target X86 linux.

21 months ago[X86] Add v2i64/v8i16/v16i8 + AVX2 coverage to saturated shift tests
Simon Pilgrim [Sat, 22 Oct 2022 10:35:37 +0000 (11:35 +0100)]
[X86] Add v2i64/v8i16/v16i8 + AVX2 coverage to saturated shift tests

To help better test the effects of D136478

21 months ago[clang][Interp][NFC] Unify Call() implementations
Timm Bäder [Thu, 13 Oct 2022 15:17:44 +0000 (17:17 +0200)]
[clang][Interp][NFC] Unify Call() implementations

The type parameter we used to pass to call() was unused. Use the same
implementation for void and value-returning function calls.

21 months ago[clang][Interp] Check instance pointers before calling functions on them
Timm Bäder [Fri, 7 Oct 2022 13:49:37 +0000 (15:49 +0200)]
[clang][Interp] Check instance pointers before calling functions on them

Remove the double Call() implementation to reduce code duplication. Then
fix Function::getSource() so we can diagnose instance pointers being
null.

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

21 months ago[clang][Interp][NFC] Simplify creating parameter descriptors
Timm Bäder [Tue, 11 Oct 2022 07:06:04 +0000 (09:06 +0200)]
[clang][Interp][NFC] Simplify creating parameter descriptors

... using value_or instead of the if-else statement.

21 months ago[clang][Interp][NFC] Add another failing test case
Timm Bäder [Tue, 11 Oct 2022 05:02:05 +0000 (07:02 +0200)]
[clang][Interp][NFC] Add another failing test case

Function parameters need to be checked before the function is called.

21 months ago[clang][Interp][NFC] Trim InterpFrame includes
Timm Bäder [Mon, 10 Oct 2022 14:04:24 +0000 (16:04 +0200)]
[clang][Interp][NFC] Trim InterpFrame includes

21 months ago[clang][Interp] Add a missing static_assert message
Timm Bäder [Sat, 22 Oct 2022 08:31:11 +0000 (10:31 +0200)]
[clang][Interp] Add a missing static_assert message

This broke a builder:
https://lab.llvm.org/buildbot/#builders/139/builds/29923

21 months ago[clang][Interp][NFC] Add assertions to VM entry points
Timm Bäder [Mon, 10 Oct 2022 11:18:12 +0000 (13:18 +0200)]
[clang][Interp][NFC] Add assertions to VM entry points

Assert that the previous call left the stack empty, as well as that
successful interpretations leave an empty stack.

21 months ago[clang][Interp][NFC] Add two more array tests
Timm Bäder [Fri, 7 Oct 2022 12:00:00 +0000 (14:00 +0200)]
[clang][Interp][NFC] Add two more array tests

21 months ago[clang][Interp][NFC] Unify Div/Rem operation checks
Timm Bäder [Fri, 7 Oct 2022 08:38:33 +0000 (10:38 +0200)]
[clang][Interp][NFC] Unify Div/Rem operation checks

21 months ago[clangd] Make file limit for textDocument/rename configurable
Christian Kandeler [Sat, 22 Oct 2022 08:15:40 +0000 (10:15 +0200)]
[clangd] Make file limit for textDocument/rename configurable

Without this, clients are unable to rename often-used symbols in larger
projects.

Reviewed By: kadircet

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

21 months agoAvoid repeated checks and context lookup in llvm::Instruction::getAAMetadata
serge-sans-paille [Fri, 21 Oct 2022 18:49:52 +0000 (20:49 +0200)]
Avoid repeated checks and context lookup in llvm::Instruction::getAAMetadata

Repeated call to Instruction::hasMetadata() and lookup in
getContext().pImpl->ValueMetadata are not needed when we always work on
the same instruction, avoid them.

This simple change leads to interesting and consistent speedups in
compile time, around -0.5% according to http://llvm-compile-time-tracker.com, see

        http://llvm-compile-time-tracker.com/compare.php?from=9708d88017d0c9adaea65a4f5a5b589b67f292e2&to=88482b9addd5917e9c5226847efeb5451c5f78c0&stat=instructions

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

21 months ago[ORC] Add more information to duplicate section error message.
Lang Hames [Sat, 22 Oct 2022 04:31:32 +0000 (04:31 +0000)]
[ORC] Add more information to duplicate section error message.

Now includes the name of the graph and duplicate section.

21 months ago[libc] Add implementation of fgetc.
Siva Chandra Reddy [Fri, 21 Oct 2022 06:46:31 +0000 (06:46 +0000)]
[libc] Add implementation of fgetc.

Reviewed By: michaelrj

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

21 months ago[libc] Add stdin definition.
Siva Chandra Reddy [Thu, 20 Oct 2022 23:44:13 +0000 (23:44 +0000)]
[libc] Add stdin definition.

Reviewed By: michaelrj

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

21 months ago[libc] Add select.h and the implementation of the select function for Linux.
Siva Chandra Reddy [Wed, 19 Oct 2022 23:55:15 +0000 (23:55 +0000)]
[libc] Add select.h and the implementation of the select function for Linux.

Reviewed By: michaelrj

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

21 months agobazel fix for TranslateLib
Aart Bik [Sat, 22 Oct 2022 02:50:22 +0000 (19:50 -0700)]
bazel fix for TranslateLib

Reviewed By: cota

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

21 months ago[lld-macho] Map file should map symbols to their original bitcode file
Jez Ng [Sat, 22 Oct 2022 02:48:25 +0000 (22:48 -0400)]
[lld-macho] Map file should map symbols to their original bitcode file

... instead of mapping them to the intermediate object file.
This matches ld64.

Reviewed By: #lld-macho, Roger

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

21 months ago[lld-macho][nfc] Update map file sample output in comment
Jez Ng [Sat, 22 Oct 2022 02:39:57 +0000 (22:39 -0400)]
[lld-macho][nfc] Update map file sample output in comment

Include symbol sizes (present after {D135883}) as well as an example of
a dead-stripped symbol.

21 months ago[NFC][LoongArch] Polish the test for fixup diagnostics
Weining Lu [Sat, 22 Oct 2022 01:50:25 +0000 (09:50 +0800)]
[NFC][LoongArch] Polish the test for fixup diagnostics

21 months ago[mlgo] Make regalloc extra features logging test more robust
Mircea Trofin [Sat, 22 Oct 2022 01:49:29 +0000 (18:49 -0700)]
[mlgo] Make regalloc extra features logging test more robust

One of the first few instructions being probed has an opcode that's more
likely to change with work on X86 target, so just regexp-ing it.

21 months ago[flang] Fix the interface for numerical/logical scalar with VALUE attribute
Peixin Qiao [Sat, 22 Oct 2022 01:15:02 +0000 (09:15 +0800)]
[flang] Fix the interface for numerical/logical scalar with VALUE attribute

Programmers may use procedure without BIND(C) attribute to interoperate
with C code. For numerical/logical scalar with VALUE attribute, pass the
argument by value so that the behavior is consistent with gfortran or
nvfortran. The argument with the OPTIONAL attribute cannot be passed by
value since the actual argument may be absent.

For the derived type, pass-by-value is not supported yet, so pass the
argument by reference for now.

Reviewed By: jeanPerier

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

21 months ago[clang-tidy] Avoid adding unnecessary semicolon in modernize-use-equals-default
Alexander Shaposhnikov [Sat, 22 Oct 2022 00:42:50 +0000 (00:42 +0000)]
[clang-tidy] Avoid adding unnecessary semicolon in modernize-use-equals-default

Adjust the automatic fixit to avoid adding superfluous semicolon.

Test plan: ninja check-all

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

21 months ago[gn build] Port 661881d43633
LLVM GN Syncbot [Sat, 22 Oct 2022 00:22:59 +0000 (00:22 +0000)]
[gn build] Port 661881d43633

21 months ago[gn build] port 27d8eedd5a3c (ClangSupportTests)
Nico Weber [Sat, 22 Oct 2022 00:22:38 +0000 (20:22 -0400)]
[gn build] port 27d8eedd5a3c (ClangSupportTests)

21 months ago[flang] Disable test due to unexpected warnings
Peter Klausler [Fri, 21 Oct 2022 23:55:00 +0000 (16:55 -0700)]
[flang] Disable test due to unexpected warnings

Now that Fortran warnings are tested, one test is failing unexpectedly on
aarch64 even though it should run only for x86.  Disabling it for now
with "XFAIL: *" to get build bot back up until the test's configuration
can be properly corrected.

21 months ago[X86] Add AMX-FP16 instructions.
Xiang1 Zhang [Fri, 21 Oct 2022 22:24:47 +0000 (06:24 +0800)]
[X86] Add AMX-FP16 instructions.

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

21 months agoAdd missing dependency to fix build.bazel.
bixia1 [Fri, 21 Oct 2022 23:58:30 +0000 (16:58 -0700)]
Add missing dependency to fix build.bazel.

Reviewed By: Peiming, aartbik

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

21 months ago[mlir] Delete dup code and use unified methods.
Hanhan Wang [Fri, 21 Oct 2022 23:51:11 +0000 (16:51 -0700)]
[mlir] Delete dup code and use unified methods.

The foldMemRefCast method is defined in memref namespace; the
foldTensorCast method is defined in tensor namespace. This revision
deletes the dup code and use the unified methods.

Reviewed By: dcaballe

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

21 months ago[clang] Add time profile for constant evaluation
Evgeny Shulgin [Sat, 15 Oct 2022 17:11:40 +0000 (17:11 +0000)]
[clang] Add time profile for constant evaluation

Add time profiler for various constexpr evaluation events
so that slow event could be visible on the visualized flame chart.

Reviewed By: aaron.ballman

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

21 months ago[mlir][sparse] use straightline and loop to insert into tensor
Aart Bik [Wed, 19 Oct 2022 19:44:53 +0000 (12:44 -0700)]
[mlir][sparse] use straightline and loop to insert into tensor

This exposed a missing type conversion for codegen

Reviewed By: Peiming

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

21 months agoFix build.bazel files for adding Index dialect and LLVMTypes.
bixia1 [Fri, 21 Oct 2022 19:23:46 +0000 (12:23 -0700)]
Fix build.bazel files for adding Index dialect and LLVMTypes.

Reviewed By: aartbik

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

21 months ago[flang] Mark test UNSUPPORTED on Windows
Peter Klausler [Fri, 21 Oct 2022 22:42:28 +0000 (15:42 -0700)]
[flang] Mark test UNSUPPORTED on Windows

A recent upgrade to test_errors.py enabled verification of
warning messages.  One test had warning messages that depend
on *not* being run in Windows, and it now fails.  Add an
!UNSUPPORTED: system-windows line to it.

21 months ago[mlir:LLVM][NFC] Cleanup attribute/enum definitions
River Riddle [Fri, 21 Oct 2022 00:26:55 +0000 (17:26 -0700)]
[mlir:LLVM][NFC] Cleanup attribute/enum definitions

Enum definitions are currently spread throughout the op definitions
file, making it difficult to reason about both where they are, and
where to add new ones when necessary. The attribute definitions are
in a similarish case, where while they have a dedicated .td file, there
definitions/declarations are generated in the main LLVMDialect source
files. This makes it difficult to reason about how to cleanly add new
attributes/enums.

This commit adds a dedicated LLVMEnums.td file for enum definitions,
cleans up the AttrDefs.td file, and adds a new LLVMAttrs.cpp/.h file to
home enum/attr definitions moving forward. This makes it much cleaner to
add new attributes/enums to the LLVM dialect.

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

21 months ago[mlir] Implement the SubElement interfaces for the builtin locations
River Riddle [Thu, 20 Oct 2022 23:39:25 +0000 (16:39 -0700)]
[mlir] Implement the SubElement interfaces for the builtin locations

This enables find/replace of nested components for location attributes.

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

21 months ago[mlir] Generate parser/printers for enums
River Riddle [Thu, 20 Oct 2022 23:31:01 +0000 (16:31 -0700)]
[mlir] Generate parser/printers for enums

This greatly simplifies composing enums in attribute/type printers,
which currently reimplement these functions as needed.

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

21 months agoRevert "Revert "[scudo] Support partial page releasing""
Chia-hung Duan [Fri, 21 Oct 2022 22:03:40 +0000 (22:03 +0000)]
Revert "Revert "[scudo] Support partial page releasing""

This reverts commit 1cf1b36112b3d475d443909881b02799b548e6b8.

Reviewed By: cferris

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

21 months ago[mlir][sparse] Refining the IR/CMakeLists.txt (followup to D136477)
wren romano [Fri, 21 Oct 2022 21:43:27 +0000 (14:43 -0700)]
[mlir][sparse] Refining the IR/CMakeLists.txt (followup to D136477)

Reviewed By: aartbik

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

21 months ago[mlir][llvm] Allow literal structs to replaceImmediateSubElements
Jeff Niu [Fri, 21 Oct 2022 22:00:20 +0000 (15:00 -0700)]
[mlir][llvm] Allow literal structs to replaceImmediateSubElements

SubElementInterfaces forbids all mutable types and attributes from
implementing `replaceImmediateSubElements`. However, this prohibits
literal structs, which are immutable, from implementing that function.
This patch defers the decision on whether to support
`replaceImmediateSubElements` to the individual types/attributes.

Depends on D136505

Reviewed By: rriddle

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

21 months ago[mlir][llvm] More LLVMFixed/ScalableVectorType to TypeDef
Jeff Niu [Fri, 21 Oct 2022 21:54:57 +0000 (14:54 -0700)]
[mlir][llvm] More LLVMFixed/ScalableVectorType to TypeDef

This keeps the current parser, however, since the mnemonic `vec` is
overloaded for both of these types.

Depends on D136499

Reviewed By: rriddle

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

21 months ago[mlir][llvm] Fix replaceImmediateSubElements on LLVMPointerType
Jeff Niu [Fri, 21 Oct 2022 21:08:10 +0000 (14:08 -0700)]
[mlir][llvm] Fix replaceImmediateSubElements on LLVMPointerType

This method was assearting on opaque pointers because the element is
null.

Depends on D136498

Reviewed By: rriddle

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

21 months ago[mlir][llvm] Move LLVMPointerType to TypeDef
Jeff Niu [Fri, 21 Oct 2022 20:16:25 +0000 (13:16 -0700)]
[mlir][llvm] Move LLVMPointerType to TypeDef

Depends on D136485

Reviewed By: rriddle

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

21 months ago[mlir][llvm] Move LLVMFunctionType to a TypeDef
Jeff Niu [Fri, 21 Oct 2022 18:08:41 +0000 (11:08 -0700)]
[mlir][llvm] Move LLVMFunctionType to a TypeDef

Reviewed By: rriddle

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

21 months agoFixed CMakeLists.txt to export mlir/include/mlir/Dialenct/SparseTensor/IR/Enums.h...
Murali Vijayaraghavan [Fri, 21 Oct 2022 21:09:13 +0000 (21:09 +0000)]
Fixed CMakeLists.txt to export mlir/include/mlir/Dialenct/SparseTensor/IR/Enums.h correctly for installing MLIRSparseTensorEnums as a library in other projects using MLIR

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

21 months ago[mlir][scf] support 1:N type conversion for scf.for.
Peiming Liu [Thu, 20 Oct 2022 03:48:55 +0000 (03:48 +0000)]
[mlir][scf] support 1:N type conversion for scf.for.

scf.for used to only support 1:1 type conversion, this patch add support for 1:N type conversion.

Reviewed By: aartbik

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

21 months ago[ObjCARC] Remove legacy PM versions of optimization passes
Arthur Eubanks [Sun, 2 Oct 2022 20:20:21 +0000 (13:20 -0700)]
[ObjCARC] Remove legacy PM versions of optimization passes

This doesn't touch objc-arc-contract because that's in the codegen pipeline.
However, this does move its corresponding initialize function into initializeCodegen().

Reviewed By: asbirlea

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

21 months ago[mlir][sparse] Fix build warning (NFC)
Jeff Niu [Fri, 21 Oct 2022 20:13:07 +0000 (13:13 -0700)]
[mlir][sparse] Fix build warning (NFC)

21 months agoReland "[scudo] Manage free blocks in BatchGroup."
Chia-hung Duan [Mon, 17 Oct 2022 20:38:37 +0000 (20:38 +0000)]
Reland "[scudo] Manage free blocks in BatchGroup."

This is not a pure revert of c929bcb7d85700494217f3a2148549f8757e0eed.
It also includes a bug fix.

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

21 months ago[mlir][llvm] Move LLVMArrayType to a TypeDef
Jeff Niu [Fri, 21 Oct 2022 17:56:43 +0000 (10:56 -0700)]
[mlir][llvm] Move LLVMArrayType to a TypeDef

This moves the `LLVMArrayType` to a `TypeDef`. The main side-effect of
this change is that the syntax `array<4xi32>` is no longer allowed. It
was previously parsed and then printed as `array<4 x i32>`. Now the
syntax must be the latter.

Reviewed By: rriddle

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

21 months ago[mlir-translate] Support parsing operations other than 'builtin.module' as top-level
rkayaith [Wed, 28 Sep 2022 01:31:16 +0000 (21:31 -0400)]
[mlir-translate] Support parsing operations other than 'builtin.module' as top-level

This adds a '--no-implicit-module' option, which disables the insertion
of a top-level 'builtin.module' during parsing.

The translation APIs are also updated to take/return 'Operation*'
instead of 'ModuleOp', to allow other operation types to be used. To
simplify translations which are restricted to specific operation types,
'TranslateFromMLIRRegistration' has an overload which performs the
necessary cast and error checking.

Reviewed By: rriddle

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

21 months ago[mlir] Add conversion function from OwningOpRef<T> to OwningOpRef<Operation *>
rkayaith [Fri, 21 Oct 2022 18:37:42 +0000 (14:37 -0400)]
[mlir] Add conversion function from OwningOpRef<T> to OwningOpRef<Operation *>

Reviewed By: rriddle

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

21 months agoRevert "[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain"
Petr Hosek [Fri, 21 Oct 2022 19:49:19 +0000 (19:49 +0000)]
Revert "[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain"

This reverts commit 8d89dbceeb576171efd12a5657c038a2ec2e54a5 since
this broke the compiler-rt build.

21 months ago[flang] Extend test_errors.py to test warnings and explanatory messages
Peter Klausler [Fri, 21 Oct 2022 18:22:49 +0000 (11:22 -0700)]
[flang] Extend test_errors.py to test warnings and explanatory messages

flang/test/Semantics/test_errors,py only compares actual error messages
with expected error messages.  Many tests have expected warning messages
in them, but they are not checked.

A forthcoming change adds several new warning and explanatory messages
to the compiler, and these messages must be testable.

So (re-?) enable non-error message checking in test_errors.py and adjust some
existing tests to get them to pass.

Warning messages related to host-specific folding conditions will not
be emitted on all platforms, so they will continue to be ignored.

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

21 months ago[bazel][obvious] Add few missing deps in the libc overlay.
Siva Chandra Reddy [Fri, 21 Oct 2022 19:42:24 +0000 (19:42 +0000)]
[bazel][obvious] Add few missing deps in the libc overlay.

21 months ago[mlir][sparse] Add rewrite rule for the sparse_tensor.out operator.
bixia1 [Fri, 21 Oct 2022 16:10:35 +0000 (09:10 -0700)]
[mlir][sparse] Add rewrite rule for the sparse_tensor.out operator.

Also fix the rewrite rule for sparse_tensor.new to reflect the recent change of
the runtime C interface and to use utilities for memref.alloca.

Reviewed By: aartbik

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

21 months ago[mlir][index] Add missing dependencies
Jeff Niu [Fri, 21 Oct 2022 19:00:22 +0000 (12:00 -0700)]
[mlir][index] Add missing dependencies

Fixes shared lib build

21 months ago[test] Use -passes syntax in Analysis tests
Bjorn Pettersson [Fri, 21 Oct 2022 17:38:51 +0000 (19:38 +0200)]
[test] Use -passes syntax in Analysis tests

Another step towards getting rid of dependencies to the legacy
pass manager.

Primary change here is to just do -passes=foo instead of -foo in
simple situations (when running a single pass). But also
updated a few test running multiple passes.

21 months ago[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain
Petr Hosek [Fri, 7 Oct 2022 18:20:34 +0000 (18:20 +0000)]
[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain

All our users have migrated to ld64.lld so we no longer need libLTO.

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

21 months ago[mlir][Pass] Fix parsePassPipeline error stream
rkayaith [Fri, 21 Oct 2022 02:46:04 +0000 (22:46 -0400)]
[mlir][Pass] Fix parsePassPipeline error stream

The error stream isn't being propagated properly, causing some output to
be sent to stderr even when a different stream is given.

Reviewed By: rriddle

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

21 months ago[llvm-debuginfo-analyzer] (05/09) - Select elements
Carlos Alberto Enciso [Fri, 21 Oct 2022 12:12:19 +0000 (13:12 +0100)]
[llvm-debuginfo-analyzer] (05/09) - Select elements

The test case 'checkFlexiblePatterns' caused a failure in:

  https://lab.llvm.org/buildbot/#/builders/85/builds/11590
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
    runtime error: applying zero offset to null pointer
    llvm/lib/Support/regengine.inc:151:18

The logical view is traversed and for each logical element a
series of match criterias are applied. One of those criterias
is to match its name or type name to a given pattern.

If the logical element does not have a type (for instance a
'namespace') do not try to use its type name, which is a
empty string as the 'matcher' function receives a null pointer.

Reviewed By: probinson

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

21 months ago[trace][intel pt][simple] Fix TestTraceSave
Walter Erquinigo [Fri, 21 Oct 2022 18:00:13 +0000 (11:00 -0700)]
[trace][intel pt][simple] Fix TestTraceSave

That test was failing due to a wrong else statement. Now it passes.

21 months ago[ConstraintElim] Add additional GEP subtraction tests.
Florian Hahn [Fri, 21 Oct 2022 17:58:14 +0000 (18:58 +0100)]
[ConstraintElim] Add additional GEP subtraction tests.

21 months ago[mlir][sparse] lower number of entries op to actual code
Aart Bik [Thu, 20 Oct 2022 23:01:37 +0000 (16:01 -0700)]
[mlir][sparse] lower number of entries op to actual code

works both along runtime path and pure codegen path

Reviewed By: Peiming

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

21 months ago[HLSL] Remove unused frontend-generated ID
Chris Bieneman [Fri, 21 Oct 2022 17:08:35 +0000 (12:08 -0500)]
[HLSL] Remove unused frontend-generated ID

As @python3kgae pointed out we're going to want to assign these IDs
after optimization so that we can remove unused resrouces. This patch
just removes the unused ID value from the frontend metadata, clang code
generation, and updates associated test cases.

Reviewed By: python3kgae

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

21 months ago[LLDB][NativePDB] Improve ParseDeclsForContext time.
Zequan Wu [Sat, 15 Oct 2022 00:15:02 +0000 (17:15 -0700)]
[LLDB][NativePDB] Improve ParseDeclsForContext time.

1. When we evaluating an expression multiple times and the searching scope is translation unit, ParseDeclsForContext iterates the type info and symbol info multiple times, though only the debug info is parsed once. Using llvm::call_once to make it only iterating and parsing once.

2. When evaluating an expression with identifier whose parent scope is a namespace, ParseDeclsForContext needs to search the entire type info to complete those records whose name is prefixed with the namespace's name and the entire symbol info to to parse functions and non-local variables. Caching parsed namespaces to avoid unnecessary searching.

Reviewed By: labath

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

21 months ago[InstCombine] allow more commutative matches for logical-and to select fold
Sanjay Patel [Fri, 21 Oct 2022 16:22:40 +0000 (12:22 -0400)]
[InstCombine] allow more commutative matches for logical-and to select fold

When the common value is part of either select condition,
this is safe to reduce. Otherwise, it is not poison-safe
(with the select form of the pattern):
https://alive2.llvm.org/ce/z/FxQTzB

This is another patch motivated by issue #58313.

21 months agoLet MLIR ODS also support generating build() functions without result type parameters...
Zhixun Tan [Fri, 21 Oct 2022 17:09:52 +0000 (10:09 -0700)]
Let MLIR ODS also support generating build() functions without result type parameters when the op contains regions.

Regions were intentionally left unsupported: https://github.com/llvm/llvm-project/commit/398f04aa49109fd5d1eff2c1946a2956dc6b29c6

Reviewed By: jpienaar

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

21 months ago[mlir][index] Fix NoSideEffect->Pure
Jeff Niu [Fri, 21 Oct 2022 17:04:07 +0000 (10:04 -0700)]
[mlir][index] Fix NoSideEffect->Pure

21 months ago[mlir][index] Add `convert-index-to-llvm` pass
Jeff Niu [Tue, 11 Oct 2022 17:10:57 +0000 (10:10 -0700)]
[mlir][index] Add `convert-index-to-llvm` pass

This patch adds a lowering pass to convert `index` dialect ops to LLVM.

Depends on D135694

Reviewed By: rriddle

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

21 months ago[mlir][index] Add folders for `index` ops
Jeff Niu [Tue, 11 Oct 2022 16:47:00 +0000 (09:47 -0700)]
[mlir][index] Add folders for `index` ops

This patch adds folders for `index` dialect ops. Ths folders are
careful to ensure that fold results are valid on both 32-bit and 64-bit
targets.

Depends on D135689

Reviewed By: rriddle

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

21 months ago[mlir][index] Add `index` dialect ops and attributes
Jeff Niu [Tue, 11 Oct 2022 16:29:35 +0000 (09:29 -0700)]
[mlir][index] Add `index` dialect ops and attributes

This patch adds the definitions for the operations and attributes (just
one enum attribute) for the `index` dialect.

Depends on D135688

Reviewed By: rriddle, jpienaar

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

21 months ago[mlir][index] Add boilerplate for the `index` dialect
Jeff Niu [Tue, 11 Oct 2022 00:02:44 +0000 (17:02 -0700)]
[mlir][index] Add boilerplate for the `index` dialect

This patch introduces the `index` dialect and associated boilerplate for
adding ops and enums (comparison predicates).

Reviewed By: rriddle, jpienaar, nicolasvasilache

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

21 months ago[ELF] Suppress "duplicate symbol" when resolving STB_WEAK and STB_GNU_UNIQUE in diffe...
Fangrui Song [Fri, 21 Oct 2022 16:43:25 +0000 (09:43 -0700)]
[ELF] Suppress "duplicate symbol" when resolving STB_WEAK and STB_GNU_UNIQUE in different COMDATs

```
template <typename T> struct A {
  A() {}
  int value = 0;
};

template <typename Value> struct B {
  static A<int> a;
};

template <typename Value> A<int> B<Value>::a;

inline int foo() {
  return B<int>::a.value;
}
```

```
clang++ -c -fno-pic a.cc -o weak.o
g++ -c -fno-pic a.cc -o unique.o  # --enable-gnu-unique-object

# Duplicate symbol error. In postParse, we do not check `sym.binding`
ld.lld -e 0 weak.o unique.o
```

Mixing GCC and Clang object files in this case is not ideal. .bss._ZGVN1BIiE1aE
has different COMDAT groups. It appears to work in practice because the guard
variable prevents harm due to double initialization.

For the linker, we just stick with the rule that a weak binding does not cause
"duplicate symbol" errors.

Close https://github.com/llvm/llvm-project/issues/58232

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

21 months ago[PGO][AIX] Improve dummy var retention and allow -bcdtors:csect linking.
Wael Yehia [Thu, 20 Oct 2022 16:07:35 +0000 (16:07 +0000)]
[PGO][AIX] Improve dummy var retention and allow -bcdtors:csect linking.

1) Use a static array of pointer to retain the dummy vars.
2) Associate liveness of the array with that of the runtime hook variable
   __llvm_profile_runtime.
3) Perform the runtime initialization through the runtime hook variable.
4) Preserve the runtime hook variable using the -u linker flag.

Reviewed By: hubert.reinterpretcast

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

21 months ago[AArch64][SVE2] Add the SVE2.1 fdot instructions
David Sherwood [Wed, 19 Oct 2022 11:43:14 +0000 (11:43 +0000)]
[AArch64][SVE2] Add the SVE2.1 fdot instructions

This patch adds the assembly/disassembly for the following instructions:

FDOT : Half-precision floating-point dot product
FDOT : Half-precision floating-point indexed dot product

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

21 months ago[libc++][NFC] Add documentation for _Or and _And
Louis Dionne [Fri, 21 Oct 2022 16:25:29 +0000 (12:25 -0400)]
[libc++][NFC] Add documentation for _Or and _And

21 months ago[mlir][scf] Add an IndexSwitchOp
Jeff Niu [Sun, 16 Oct 2022 18:30:08 +0000 (11:30 -0700)]
[mlir][scf] Add an IndexSwitchOp

The `scf.index_switch` is a control-flow operation that branches to one of the
given regions based on the values of the argument and the cases. The
argument is always of type `index`.

Example:

```mlir
%0 = scf.index_switch %arg0 -> i32
case 2 {
  %1 = arith.constant 10 : i32
  scf.yield %1 : i32
}
case 5 {
  %2 = arith.constant 20 : i32
  scf.yield %2 : i32
}
default {
  %3 = arith.constant 30 : i32
  scf.yield %3 : i32
}
```

Reviewed By: jpienaar

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

21 months ago[llvm-reduce] Attempt to strip debug info
Arthur Eubanks [Tue, 18 Oct 2022 22:42:14 +0000 (15:42 -0700)]
[llvm-reduce] Attempt to strip debug info

I often run llvm-reduce on IR that contains debug info, this prevents an
extra step of `opt -passes=strip` I do every time and will result in a
lot less invalid reductions around debug metadata.

Reviewed By: dblaikie

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

21 months ago[RISCV] Add missing vscale x 1 cost model entries and tests.
Craig Topper [Fri, 21 Oct 2022 15:56:00 +0000 (08:56 -0700)]
[RISCV] Add missing vscale x 1 cost model entries and tests.

Reviewed By: reames

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

21 months ago[AMDGPU] Use VGPR classes in divergent build_vector patterns
Jay Foad [Fri, 21 Oct 2022 15:42:43 +0000 (16:42 +0100)]
[AMDGPU] Use VGPR classes in divergent build_vector patterns

This does not appear to affect codegen, but using SGPR classes for
operands of VALU instructions looked weird.

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

21 months ago[mlir][sparse] Refactor the convert operator conversion to support codegen for the...
bixia1 [Fri, 21 Oct 2022 15:25:45 +0000 (08:25 -0700)]
[mlir][sparse] Refactor the convert operator conversion to support codegen for the operator.

Outline the code that generates the loop structure to iterate over a dense
tensor or a sparse constant to genDenseTensorOrSparseConstantIterLoop.

Move a few routines to CodegenUtils for sharing.

Reviewed By: wrengr

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

21 months ago[MachineVerifier] Try harder to verify LiveVariables
Jay Foad [Wed, 6 Jul 2022 13:00:32 +0000 (14:00 +0100)]
[MachineVerifier] Try harder to verify LiveVariables

Verify the LiveVariables analysis after a pass that claims to preserve
it, even if there are no further passes (apart from the verifier itself)
that would use the analysis.

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

21 months ago[InstCombine] allow some commutative matches for logical-and to select fold
Sanjay Patel [Fri, 21 Oct 2022 15:15:11 +0000 (11:15 -0400)]
[InstCombine] allow some commutative matches for logical-and to select fold

This is obviously correct for real logic instructions,
and it also works for the poison-safe variants that use
selects:
https://alive2.llvm.org/ce/z/wyHiwX

This is motivated by the lack of 'xor' folding seen in issue #58313.
This more general fold should help reduce some of those patterns,
but I'm not sure if this specific case does anything for that
particular example.

21 months ago[InstCombine] refactor matching code for logical ands; NFCI
Sanjay Patel [Fri, 21 Oct 2022 14:43:54 +0000 (10:43 -0400)]
[InstCombine] refactor matching code for logical ands; NFCI

Separating the matches makes it easier
to enhance for commutative patterns.

21 months ago[flang] Fix FIRSupport build race condition with HLFIRDialect
Jean Perier [Fri, 21 Oct 2022 15:21:58 +0000 (08:21 -0700)]
[flang] Fix FIRSupport build race condition with HLFIRDialect

FIRSupports includes headers from HLFIRDialect that are generated at
compile time. Therefore it must wait until these headers have been
generated.

Fix flang bot failures:
https://lab.llvm.org/buildbot/#/builders/173/builds/10304

21 months ago[test] Use -passes in more Transforms tests
Bjorn Pettersson [Thu, 20 Oct 2022 22:04:16 +0000 (00:04 +0200)]
[test] Use -passes in more Transforms tests

Another step towards getting rid of dependencies to the legacy
pass manager.

Primary change here is to just do -passes=foo instead of -foo in
simple situations (when running a single transform pass). But also
updated a few test running multiple passes.

Also removed some "duplicated" RUN lines in a few tests that where
using both -foo and -passes=foo syntax. No need to do the same kind
of testing twice.

21 months ago[instcombine] Add basic test coverage for demanded bits of scalable vectors
Philip Reames [Fri, 21 Oct 2022 14:50:01 +0000 (07:50 -0700)]
[instcombine] Add basic test coverage for demanded bits of scalable vectors

21 months ago[AArch64]SME2 Multi-vector-Multiple Vectors SQDMULH instructions
Caroline Concatto [Thu, 20 Oct 2022 16:32:39 +0000 (17:32 +0100)]
[AArch64]SME2 Multi-vector-Multiple Vectors SQDMULH instructions

 This patch adds the assembly/disassembly for the following instruction:
  SQDMULH (multiple vectors): Multi-vector signed saturating doubling multiply high.
For 2 and 4 ZA registers

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09/SME-Instructions/SQDMULH--multiple-vectors---Multi-vector-signed-saturating-doubling-multiply-high-?lang=en

Depends on: D135563

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

21 months ago[AArch64][SVE2] Add the SVE2.1 fclamp instructions
David Sherwood [Wed, 19 Oct 2022 10:47:24 +0000 (10:47 +0000)]
[AArch64][SVE2] Add the SVE2.1 fclamp instructions

This patch adds the assembly/disassembly for the following instructions:

FCLAMP : Floating-point clamp to minimum/maximum number

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

21 months ago[NFC] Make sure we check an optional when checking function constraints
Erich Keane [Fri, 21 Oct 2022 14:31:26 +0000 (07:31 -0700)]
[NFC] Make sure we check an optional when checking function constraints

For some reason the initial deferred concepts patch didn't add this
check, which someone noticed could cause a problem with other patches
applied.  This makes sure we check these, so that an error condition
cannot cause us to crash.

21 months ago[LLVMIR] Use helper methods to set/check readnone attribute (NFC)
Nikita Popov [Fri, 21 Oct 2022 14:22:26 +0000 (16:22 +0200)]
[LLVMIR] Use helper methods to set/check readnone attribute (NFC)

This makes the code forward-compatible to the memory attribute.

21 months ago[AAArch64][Windows] Fix the crash when running ninja check-asan
chenglin.bi [Fri, 21 Oct 2022 14:11:22 +0000 (22:11 +0800)]
[AAArch64][Windows] Fix the crash when running ninja check-asan

The crash comes from mismatch between load count in epilogue and seh instruction count.
Still because of the pass AArch64LoadStoreOpt. It remove some load in the epilogue but haven't remove the corresponding seh instruction.
This patch don't optimize the load in the epilogue to fix the issue.

Fix: #58516

Reviewed By: mstorsjo

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

21 months ago[AArch64] Add SVE2.1 target feature for Armv9-A 2022 Architecture Extension
David Sherwood [Tue, 18 Oct 2022 16:43:44 +0000 (16:43 +0000)]
[AArch64] Add SVE2.1 target feature for Armv9-A 2022 Architecture Extension

First patch in a series adding MC layer support for SVE2.1.

This patch adds the following feature:

sve2p1

Some of the existing SVE instructions added for SME are now
also available under the sve2p1 feature, which are now guarded
by the HasSVE2p1orSME predicate.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

21 months ago[TwoAddressInstruction] Fix stale LiveVariables info in processStatepoint
Jay Foad [Fri, 21 Oct 2022 13:08:58 +0000 (14:08 +0100)]
[TwoAddressInstruction] Fix stale LiveVariables info in processStatepoint

D129213 improves verification of LiveVariables, and caused
CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll to fail with:
*** Bad machine code: LiveVariables: Block should not be in AliveBlocks ***
after Two-Address instruction pass.

Fix it by clearing AliveBlocks for a register which is no longer used.

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

21 months ago[AArch64] SME2 Multiple vectors int/float binary accumulator and two/four ZA singl...
Caroline Concatto [Fri, 21 Oct 2022 13:38:46 +0000 (14:38 +0100)]
[AArch64] SME2 Multiple vectors  int/float  binary accumulator and  two/four ZA single-vector

This patch adds the assembly/disassembly for the following instructions:
INT :
  ADD (array accumulators): Add multi-vector to ZA array vector accumulators.
  SUB  (array accumulators): Subtract multi-vector from ZA array vector accumulators.
FP:
  FADD : Floating-point add multi-vector to ZA array vector accumulators.
  FSUB : Floating-point subtract multi-vector from ZA array vector accumulators.
For  Two and Four ZA single-vectors

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Depends on: D135563

Reviewed By: sdesmalen

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

21 months ago[mlir][linalg] Add one-shot-bufferize tests for Linalg ops: reduce, map and transpose.
Oleg Shyshkov [Fri, 21 Oct 2022 13:19:52 +0000 (15:19 +0200)]
[mlir][linalg] Add one-shot-bufferize tests for Linalg ops: reduce, map and transpose.

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

21 months ago[AArch64]SME2 multi-vec FP/INT down convert 2/4 registers
Caroline Concatto [Thu, 20 Oct 2022 18:11:04 +0000 (19:11 +0100)]
[AArch64]SME2 multi-vec FP/INT  down convert 2/4 registers

This patch implements
Int:
  SQCVT: Multi-vector signed saturating extract narrow for 2 and 4 registers.
  UQCVT: Multi-vector unsigned saturating extract narrow for 2 and 4 registers.
  SQCVTU: Multi-vector signed saturating unsigned extract narrow for 2 and 4 registers
  SQCVTN:  Multi-vector signed saturating extract narrow and interleave.
  SQCVTUN: Multi-vector signed saturating unsigned extract narrow and interleave.
  UQCVTN: Multi-vector unsigned saturating extract narrow and interleave.

FP:
  FCVT(narrowing): Multi-vector floating-point convert from single-precision to
                  packed half-precision.
  FCVTN: Multi-vector floating-point convert from single-precision to
           interleaved half-precision.
  BFCVT: Multi-vector floating-point convert from single-precision to packed
         BFloat16 format.
  BFCVTN: : Multi-vector floating-point convert from single-precision to
            interleaved BFloat16 format.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Depends on: D135563

Reviewed By: sdesmalen

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

21 months ago[AArch64]SME2 Multi-vector - Index/Single/Multi Array Vectors FMA sources
Caroline Concatto [Thu, 20 Oct 2022 17:57:33 +0000 (18:57 +0100)]
[AArch64]SME2 Multi-vector - Index/Single/Multi Array Vectors FMA sources

This patch adds the assembly/disassembly for the following instructions:
  INT:
     SMLAL
     SMLSL
     UMLAL
     UMLSL
  FP:
    BFMLAL
    BFMLSL
    FMLAL
    FMLSL
For multiple and indexed vector, Multiple and Single vector and
Multi vectors, for 1, 2 and 4 ZA registers.

The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

It also adds a new immediate:
  uimm3s2range for off3
  uimm2s2range for off2
to represent the vector select offset.
The new operands have the range between the first and the last vector position.

Depends on: D135563

Reviewed By: aemerson, sdesmalen

Re-landing the patch as the problem with https://reviews.llvm.org/D135563
is fixed in this commit: 1e4f82c2578cf5045ffe

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