platform/upstream/llvm.git
17 months ago[BranchRelaxation] Move faulting_op check into callee [nfc]
Philip Reames [Fri, 27 Jan 2023 19:23:53 +0000 (11:23 -0800)]
[BranchRelaxation] Move faulting_op check into callee [nfc]

Mostly to remove a special case from an upcoming patch.

17 months ago[SystemZ] Fix handling of vectors and their exposure of the vector ABI.
Jonas Paulsson [Tue, 10 Jan 2023 00:51:11 +0000 (18:51 -0600)]
[SystemZ] Fix handling of vectors and their exposure of the vector ABI.

- Global vector variables expose the vector ABI through their alignments only
  if they are >=16 bytes in size.

- Vectors passed between functions expose the vector ABI only if they are
  <=16 bytes in size.

LLVM test suite builds with gcc/clang now give the same gnu attributes emitted.

Reviewed By: Ulrich Weigand

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

17 months agoworkflows: Fix libclc tests
Tom Stellard [Fri, 27 Jan 2023 19:23:19 +0000 (11:23 -0800)]
workflows: Fix libclc tests

libclc requires using cmake files to detect the LLVM installation instead
of llvm-config so we need to update our cmake invocation.

Reviewed By: thieta

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

17 months agolibclc: Fix building against an llvm build directory
Tom Stellard [Fri, 27 Jan 2023 19:15:54 +0000 (11:15 -0800)]
libclc: Fix building against an llvm build directory

Reviewed By: thieta

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

17 months agoFix recursive error for constraints depending on itself incorrectly
Erich Keane [Fri, 27 Jan 2023 19:06:07 +0000 (11:06 -0800)]
Fix recursive error for constraints depending on itself incorrectly

Fixes: #60323

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

The problem is that we are profiling the 'Expr' components directly,
however when they contain an unresolved lookup, those canonicalize
identically.  The result was the two versions of calls to 'go' were
canonicalized identically.

This patch fixes this by ensuring we consider the declaration the
constraint is attached to, when possible.  When not, we skip the
diagnostic.

The result is that we are relaxing our diagnostic in some cases (Of
which I couldn't come up with a reproducer), such that we might see
overflows when evaluating constraints that depend on themselves in a way
that they are not attached to a declaration directly, such as if
they are nested requirements, though the hope is this won't be a
problem, since the 'parent' named constraint would catch this.  I'm
hopeful that the 'worst case' is that we catch recursion 'later' in the
process, instead of immediately.

17 months agoworkflows: Bump python version on Windows to try to fix lldb failure
Tom Stellard [Fri, 27 Jan 2023 19:06:18 +0000 (11:06 -0800)]
workflows: Bump python version on Windows to try to fix lldb failure

Reviewed By: thieta

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

17 months ago[clang-tidy] Fix warning in portability-simd-intrinsics
Piotr Zegar [Wed, 25 Jan 2023 18:00:33 +0000 (18:00 +0000)]
[clang-tidy] Fix warning in portability-simd-intrinsics

When portability-simd-intrinsics.Suggest were set to false,
produced warning were missing source location,
and due to that such warning coudn't be NOLINTed.

Added missing tests.

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

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

17 months agolibclc: Set CMAKE_CXX_STANDARD to 17 to match llvm
Tom Stellard [Fri, 27 Jan 2023 18:50:01 +0000 (10:50 -0800)]
libclc: Set CMAKE_CXX_STANDARD to 17 to match llvm

Reviewed By: thieta

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

17 months ago[CMake] Include clang-bolt bootstrap target in BOLT-PGO.cmake
Amir Ayupov [Fri, 27 Jan 2023 17:48:13 +0000 (09:48 -0800)]
[CMake] Include clang-bolt bootstrap target in BOLT-PGO.cmake

Preemptively include clang-bolt target in BOLT-PGO CMake cache file,
in preparation of https://reviews.llvm.org/D139454 to avoid breaking
bolt-x86_64-ubuntu-clang-bolt-lto-pgo buildbot.

17 months ago[lldb] Make SBSection::GetSectionData call Section::GetSectionData.
Jorge Gorbe Moya [Thu, 26 Jan 2023 22:23:41 +0000 (14:23 -0800)]
[lldb] Make SBSection::GetSectionData call Section::GetSectionData.

`SBSection::GetSectionData` and `Section::GetSectionData` are
implemented differently, and the `SBSection` method doesn't handle
compressed sections correctly.

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

17 months ago[gn build] Enable check-bolt on Linux
Arthur Eubanks [Tue, 17 Jan 2023 01:47:12 +0000 (17:47 -0800)]
[gn build] Enable check-bolt on Linux

It builds but not all tests pass, mostly due to missing libbolt_rt_instr.a.

Reviewed By: thakis

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

17 months agoFix tsan problem where the per-thread shared_ptr() can be locked right before the...
Qiao Zhang [Fri, 27 Jan 2023 17:49:29 +0000 (18:49 +0100)]
Fix tsan problem where the per-thread shared_ptr() can be locked right before the cache is destroyed causing a race where it tries to remove an entry from a destroyed cache.

Reviewed By: rriddle

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

17 months agodisable-language-runtime-unwindplans desc rewrite to be searchable
Jason Molenda [Fri, 27 Jan 2023 17:39:31 +0000 (09:39 -0800)]
disable-language-runtime-unwindplans desc rewrite to be searchable

The description for disable-language-runtime-unwindplans did not
include likely search terms ("backtrace", "stack"), rewrite it
to include those so it is more easily discoverable with apropos.
The text is still not the clearest description of what a language
runtime is / what it might do, but this is better.

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

17 months agoDon't flag memory-only mach-o corefiles as invalid
Jason Molenda [Fri, 27 Jan 2023 17:37:34 +0000 (09:37 -0800)]
Don't flag memory-only mach-o corefiles as invalid

It is possible to have a memory-only mach-o corefile, with the
threads provided by an os-plugin thread provider, or a scripted
process, in Python.

Differential Revision: https://reviews.llvm.org/D142662
rdar://102579544

17 months ago[LinkerWrapper] Add support for --[no-]whole-archive into the linker wrapper
Joseph Huber [Fri, 27 Jan 2023 17:29:47 +0000 (11:29 -0600)]
[LinkerWrapper] Add support for --[no-]whole-archive into the linker wrapper

Summary:
This patch adds support for `--[no-]whole-archive` to the linker
wrapper. This allows us to bypass the symbol resolution logic that is
normally used for static archives. For multi-architecture binaries this
also allows us to build for every single member.

17 months ago[Verifier][WinEH] Check funclet tokens on intrinsic calls that may lower to function...
Stefan Gränitz [Fri, 27 Jan 2023 15:48:05 +0000 (16:48 +0100)]
[Verifier][WinEH] Check funclet tokens on intrinsic calls that may lower to function calls

WinEHPrepare requires funclet operand bundles ("tokens") on function calls from EH funclets to prevent them from getting removed as "implausible" calls. This includes calls to intrinsic functions that lower to function calls in the course of IR transformations (e.g. ObjC ARC runtime calls).

We can not detect such cases in WinEHPrepare itself, because at this point they mixed up with valid implausible calls. These must be removed to guarantee that the EH backend can assign unique colors and EH state numbers to all blocks.

This patch allows the IR Verifier to detect missing and dangling funclet tokens. Non-conforming IR becomes illegal and miscompilations are detected early. In order to find funclet pad instructions for funclets that extend over multiple blocks, we have to calculate EH funclet colors. As coloring can be expensive, it runs on-demand and results are cached per function.

Reviewed By: efriedma

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

17 months agoLift EHPersonalities from Analysis to IR (NFC)
Stefan Gränitz [Tue, 24 Jan 2023 11:29:53 +0000 (12:29 +0100)]
Lift EHPersonalities from Analysis to IR (NFC)

Computing EH-related information was only relevant for analysis passes so far. Lifting it to IR will allow the IR Verifier to calculate EH funclet coloring and validate funclet operand bundles in a follow-up step.

Reviewed By: rnk, compnerd

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

17 months ago[mlir][sparse] Implement BufferizableOpInterface for additional ops
Matthias Springer [Fri, 27 Jan 2023 16:49:26 +0000 (17:49 +0100)]
[mlir][sparse] Implement BufferizableOpInterface for additional ops

The handling of unknown ops will be tightened in a subsequent change. All sparse_tensor ops should implement BufferizableOpInterface, otherwise, they are treated as "unknown" and additional buffer allocs/copies may be inserted around them.

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

17 months ago[mlir][sparse][NFC] Disallow writing into sparse_tensor.to_... results
Matthias Springer [Fri, 27 Jan 2023 16:49:14 +0000 (17:49 +0100)]
[mlir][sparse][NFC] Disallow writing into sparse_tensor.to_... results

Writing into the memrefs returned by `sparse_tensor.to_values` etc. can cause additional copies during bufferization.

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

17 months ago[LinkerWrapper][NFC] Remove unused options
Joseph Huber [Fri, 27 Jan 2023 16:44:16 +0000 (10:44 -0600)]
[LinkerWrapper][NFC] Remove unused options

Summary:
These options are no longer used, we don't need to keep them.

17 months ago[lldb][CXXModuleHandler] Set TemplateArgument::IsDefaulted
Michael Buch [Fri, 27 Jan 2023 14:17:02 +0000 (14:17 +0000)]
[lldb][CXXModuleHandler] Set TemplateArgument::IsDefaulted

Since https://reviews.llvm.org/D141827 this field gets used
to print type names. Thus propagate it after importing TemplateArguments
from modules.

**Testing**

* Confirmed that this fixes the ongoing `import-std-module` test
  failures.

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

17 months ago[clang][ASTImporter] Propagate TemplateArgument::IsDefaulted during import
Michael Buch [Fri, 27 Jan 2023 14:09:48 +0000 (14:09 +0000)]
[clang][ASTImporter] Propagate TemplateArgument::IsDefaulted during import

With https://reviews.llvm.org/D141826 `TemplateArgument`s have an
additional field that indicates their defaulted-ness. This gets
used during debug-info generation and in the `clang::TypePrinter`.

This patch copies the field during the import process so consumers
of the ASTImporter can benefit from the other Clang components that
read the field.

**Testing**

* Added unit-test
* Checked that this fixes (in addition to a follow-up LLDB patch)
  fix current test failures in LLDB

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

17 months ago[mlir][NFC] GreedyPatternRewriteDriver: Merge region-based and multi-op-based drivers
Matthias Springer [Fri, 27 Jan 2023 16:25:55 +0000 (17:25 +0100)]
[mlir][NFC] GreedyPatternRewriteDriver: Merge region-based and multi-op-based drivers

Deduplicate large parts of the worklist processing (`GreedyPatternRewriteDriver::processWorklist`).

The new class hierarchy is as follows:
```
          GreedyPatternRewriteDriver (abstract)
                       ^
                       |
      -----------------------------------
      |                                 |
RegionPatternRewriteDriver         MultiOpPatternRewriteDriver
```

Also update the Markdown documentation.

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

17 months ago[flang] Add Count to simplified intrinsics
Sacha Ballantyne [Fri, 27 Jan 2023 15:31:42 +0000 (15:31 +0000)]
[flang] Add Count to simplified intrinsics

This patch adds a simplfiied version of count for the simplify intrinsics pass, allowing the function to be inlined.

This was done specifically to help improve performance for exchange2, and provides a ~12% performance increase.

Reviewed By: vzakhari, Leporacanthicus

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

17 months ago[gn] merge 650bbc56203c9
Nico Weber [Fri, 27 Jan 2023 16:26:55 +0000 (11:26 -0500)]
[gn] merge 650bbc56203c9

Needed to link e.g. LexTests after ca446037af0.

17 months agoCorrect the link to the latest C DR status page for C11 and C17
Aaron Ballman [Fri, 27 Jan 2023 16:17:42 +0000 (11:17 -0500)]
Correct the link to the latest C DR status page for C11 and C17

We were linking against:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm

However, the latest DR page for the 400s is:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm

17 months ago[libc][math] Implement asinhf function correctly rounded for all rounding modes.
Tue Ly [Fri, 27 Jan 2023 15:15:46 +0000 (10:15 -0500)]
[libc][math] Implement asinhf function correctly rounded for all rounding modes.

Implement asinhf function correctly rounded for all rounding modes.

Reviewed By: zimmermann6

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

17 months ago[libc++] Disables a test in clang-17.
Mark de Wever [Fri, 27 Jan 2023 16:01:55 +0000 (17:01 +0100)]
[libc++] Disables a test in clang-17.

This test already had issues and bumping main to 17 causes them to fail
again.

17 months ago[SCCP] Add test cases with switch on range containing undef.
Florian Hahn [Fri, 27 Jan 2023 16:02:29 +0000 (16:02 +0000)]
[SCCP] Add test cases with switch on range containing undef.

17 months agoStop diagnosing member and array access in offsetof as an extension
Aaron Ballman [Fri, 27 Jan 2023 16:01:12 +0000 (11:01 -0500)]
Stop diagnosing member and array access in offsetof as an extension

This was a mistake from e7300e75b51a7e7d4e81975b4be7a6c65f9a8286
(https://reviews.llvm.org/D133574) caused by us accidentally tracking
an older copy of the C DR list for DR496. The text in
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_496 makes
it clear that subobjects are allowed, which means member and array
access expressions are allowed.

This backs out the changes from the previous commit that relate to this
diagnostic.

17 months ago[gn] port a3b0dde4edb9 (llvm-cov -> Debuginfod dep)
Nico Weber [Fri, 27 Jan 2023 15:59:54 +0000 (10:59 -0500)]
[gn] port a3b0dde4edb9 (llvm-cov -> Debuginfod dep)

17 months agoRevert "[DAGCombine] fp_to_sint isSaturatingMinMax"
Samuel Parker [Fri, 27 Jan 2023 15:31:54 +0000 (15:31 +0000)]
Revert "[DAGCombine] fp_to_sint isSaturatingMinMax"

This reverts commit 85395af27241ab9c8d5763b8afcaa07f1bab26d5.

This is causing trouble with scalable vectors.

17 months ago[NFC][AArch64] Get extension strings directly from ArchInfo in target parser
Lucas Prates [Wed, 25 Jan 2023 12:15:00 +0000 (12:15 +0000)]
[NFC][AArch64] Get extension strings directly from ArchInfo in target parser

Reviewed By: tmatheson

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

17 months ago[libc][cmake] Fix LIBC_TARGET_OS query from compiler triple for `darwin`.
Tue Ly [Mon, 9 Jan 2023 15:05:41 +0000 (10:05 -0500)]
[libc][cmake] Fix LIBC_TARGET_OS query from compiler triple for `darwin`.

Currently LIBC_TARGET_OS query from compiler triple returns `apple` for
macOS.  This change will fix it back to `darwin` as before.

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

17 months agoWorkflows: Fix version-check.py script for when there is no RC tag yet
Tom Stellard [Fri, 27 Jan 2023 14:57:35 +0000 (06:57 -0800)]
Workflows: Fix version-check.py script for when there is no RC tag yet

Reviewed By: thieta

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

17 months ago[mlir] GreedyPatternRewriteDriver: Move strict mode to GreedyPatternRewriteDriver
Matthias Springer [Fri, 27 Jan 2023 14:44:12 +0000 (15:44 +0100)]
[mlir] GreedyPatternRewriteDriver: Move strict mode to GreedyPatternRewriteDriver

`strictMode` is moved to GreedyRewriteConfig to simplify the API and state of rewriter classes. The region-based GreedyPatternRewriteDriver now also supports strict mode.

MultiOpPatternRewriteDriver becomes simpler: fewer method must be overridden.

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

17 months ago[SCCP] Use range info to prove AddInst has NSW flag.
Florian Hahn [Fri, 27 Jan 2023 14:09:25 +0000 (14:09 +0000)]
[SCCP] Use range info to prove AddInst has NSW flag.

This patch updates SCCP to use the value ranges of AddInst operands to
try to prove the AddInst does not overflow in the signed sense and
adds the NSW flag. The reasoning is done with
makeGuaranteedNoWrapRegion (thanks @nikic for point it out!).

Follow-ups will include extending this to more
OverflowingBinaryOperators.

Depends on D142387.

Reviewed By: nikic

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

17 months ago[mlir] GreedyPatternRewriteDriver: All entry points take a config
Matthias Springer [Fri, 27 Jan 2023 13:14:41 +0000 (14:14 +0100)]
[mlir] GreedyPatternRewriteDriver: All entry points take a config

The multi-op entry point now also takes a GreedyPatternRewriteConfig and respects config.maxNumRewrites. The scope is also a part of the config now.

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

17 months ago[lldb][Target] GetScratchTypeSystems: sort TypeSystems with strict weak ordering
Michael Buch [Fri, 27 Jan 2023 13:03:57 +0000 (13:03 +0000)]
[lldb][Target] GetScratchTypeSystems: sort TypeSystems with strict weak ordering

`std::sort` requires a comparison operator that obides by strict weak
ordering. `operator<=` on pointer does not and leads to undefined
behaviour. Specifically, when we grow the `scratch_type_systems` vector
slightly larger (and thus take `std::sort` down a slightly different
codepath), we segfault. This happened while working on a patch that
would in fact grow this vector. In such a case ASAN reports:

```
$ ./bin/lldb ./lldb-test-build.noindex/lang/cpp/complete-type-check/TestCppIsTypeComplete.test_builtin_types/a.out -o "script -- lldb.target.FindFirstType(\"void\")"
(lldb) script -- lldb.target.FindFirstType("void")
=================================================================
==59975==ERROR: AddressSanitizer: container-overflow on address 0x000108f6b510 at pc 0x000280177b4c bp 0x00016b7d7430 sp 0x00016b7d7428
READ of size 8 at 0x000108f6b510 thread T0
    #0 0x280177b48 in std::__1::shared_ptr<lldb_private::TypeSystem>::shared_ptr[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0xb4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x177b48)
(BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #1 0x280dcc008 in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::shared_ptr<lldb_private::TypeSystem>*>(std::__1::shared_ptr<lldb_private::TypeSystem>*, std::__1::shared_
ptr<lldb_private::TypeSystem>*, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::iterator_traits<std::__1::shared_ptr<lldb_private::TypeSystem>*>::difference_type)+0x1050 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblld
b.17.0.0git.dylib:arm64+0xdcc008) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #2 0x280d88788 in lldb_private::Target::GetScratchTypeSystems(bool)+0x5a4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88788) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #3 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #4 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #5 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)

<--- snipped --->

0x000108f6b510 is located 400 bytes inside of 512-byte region [0x000108f6b380,0x000108f6b580)
allocated by thread T0 here:
    #0 0x105209414 in wrap__Znwm+0x74 (/Applications/Xcode2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x51414) (BuildId: 0a44828ceb64337bbfff60b22cd838f0320000
00200000000100000000000b00)
    #1 0x280dca3b4 in std::__1::__split_buffer<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::shared_pt
r<lldb_private::TypeSystem>>&)+0x11c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdca3b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #2 0x280dc978c in void std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::__push_back_slow_path<std::__1::shared_ptr<lldb_private::TypeSystem> const&>(std::__1::s
hared_ptr<lldb_private::TypeSystem> const&)+0x13c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdc978c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #3 0x280d88dec in std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::push_back[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0x80 (/Users/mic
haelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88dec) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #4 0x280d8857c in lldb_private::Target::GetScratchTypeSystems(bool)+0x398 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd8857c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #5 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #6 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
    #7 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
    #8 0x10627fff0 in _PyObject_MakeTpCall+0x7c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x7bff0) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
    #9 0x106378a98 in _PyEval_EvalFrameDefault+0xbcf8 (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x174a98) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
```

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

17 months ago[NFC][AArch64] Get default features directly from ArchInfo and CpuInfo objects
Lucas Prates [Tue, 24 Jan 2023 17:44:15 +0000 (17:44 +0000)]
[NFC][AArch64] Get default features directly from ArchInfo and CpuInfo objects

This updates the AArch64's Target Parser and its uses to capture
information about default features directly from ArchInfo and CpuInfo
objects, instead of relying on an API function to access them
indirectly.

Reviewed By: tmatheson

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

17 months ago[NFC][AArch64] Use optional returns in target parser instead of 'invalid' objects
Lucas Prates [Mon, 23 Jan 2023 11:12:38 +0000 (11:12 +0000)]
[NFC][AArch64] Use optional returns in target parser instead of 'invalid' objects

This updates the parsing methods in AArch64's Target Parser to make use
of optional returns instead of "invalid" enum values, making the API's
behaviour clearer.

Reviewed By: lenary, tmatheson

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

17 months agoAdd clang_CXXMethod_isExplicit to libclang
Luca Di Sera [Mon, 23 Jan 2023 12:14:17 +0000 (13:14 +0100)]
Add clang_CXXMethod_isExplicit to libclang

The new method is a wrapper of `CXXConstructorDecl::isExplicit` and
`CXXConversionDecl::isExplicit`, allowing the user to recognize whether
the declaration pointed to by a cursor was marked with the explicit
specifier.

An export for the function, together with its documentation, was added
to "clang/include/clang-c/Index.h" with an implementation provided in
"clang/tools/libclang/CIndex.cpp".

The implementation is based on similar `clang_CXXMethod`
implementations, returning a falsy unsigned value when the cursor is not
a declaration, is not a declaration for a constructor or conversion
function or is not a relevant declaration that was marked with the
`explicit` specifier.

The new symbol was added to "clang/tools/libclang/libclang.map" to be
exported, under the LLVM16 tag.

"clang/tools/c-index-test/c-index-test.c" was modified to print a
specific tag, "(explicit)", for cursors that are recognized by
`clang_CXXMethod_isExplicit`.

Two new regression files, "explicit-constructor.cpp" and
"explicit-conversion-function.cpp", were added to "clang/test/Index", to
ensure that the behavior of the new function is correct for constructors
and conversion functions, respectively.

The "get-cursor.cpp", "index-file.cpp" and
"recursive-cxx-member-calls.cpp" regression files in "clang/test/Index"
were updated as they were affected by the new "(explicit)" tag.

A binding for the new function was added to libclang's python's
bindings, in "clang/bindings/python/clang/cindex.py", as the
"is_explicit_method" method under `Cursor`.

An accompanying test was added to
"clang/bindings/python/tests/cindex/test_cursor.py", mimicking the
regression tests for the C side.

The current release note for Clang, "clang/docs/ReleaseNotes.rst" was
modified to report the new addition under the "libclang" section.

Reviewed By: aaron.ballman

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

17 months ago[Docs] Fix a statement wrt instruction alignment of 0
Shivam Gupta [Fri, 27 Jan 2023 11:59:00 +0000 (17:29 +0530)]
[Docs] Fix a statement wrt instruction alignment of 0

This fix https://github.com/llvm/llvm-project/issues/53371
Zero is not a legal alignment.

Reviewed By: nikic

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

17 months ago[flang][hlfir] Handle box and non constant must_free in end_associate.
Jean Perier [Fri, 27 Jan 2023 11:52:01 +0000 (12:52 +0100)]
[flang][hlfir] Handle box and non constant must_free in end_associate.

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

17 months ago[flang][hlfir] Handle scalar to array in hlfir.assign codegen.
Jean Perier [Fri, 27 Jan 2023 11:49:55 +0000 (12:49 +0100)]
[flang][hlfir] Handle scalar to array in hlfir.assign codegen.

The scalar must be placed in memory before creating descriptors and
calling the runtime assignment API.

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

17 months agoRevert "[lldb] Add support for DW_AT_default_value in template params"
David Spickett [Fri, 27 Jan 2023 11:13:31 +0000 (11:13 +0000)]
Revert "[lldb] Add support for DW_AT_default_value in template params"

This reverts commit 1cf52e540242f968e0cf789587bcf76c01332aeb.

Due to test failures on Arm and AArch64 bots:
https://lab.llvm.org/buildbot/#/builders/96/builds/34718

(which were obscured by an earlier build failure)

17 months ago[mlir][transforms] CSE ops with multiple regions
Matthias Springer [Fri, 27 Jan 2023 11:14:10 +0000 (12:14 +0100)]
[mlir][transforms] CSE ops with multiple regions

There were issues with the CSE equivalence analysis that have been fixed with D142558. This makes it possible to CSE ops with multiple regions.

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

17 months ago[PowerPC] ppc64-P9-vabsd.ll - add some basic ISD::ABDS test coverage
Simon Pilgrim [Fri, 27 Jan 2023 11:12:10 +0000 (11:12 +0000)]
[PowerPC] ppc64-P9-vabsd.ll - add some basic ISD::ABDS test coverage

Test coverage to ensure D142313 lowers ISD::ABDU -> VABSD but not ISD::ABDS (although I think v4i32 would be compatible with the XVNEGSP trick)

17 months ago[mlir][transforms] Simplify OperationEquivalence and CSE
Matthias Springer [Fri, 27 Jan 2023 10:49:25 +0000 (11:49 +0100)]
[mlir][transforms] Simplify OperationEquivalence and CSE

Replace `mapOperands` and `mapResults` with two new callbacks. It was not clear what "mapping" meant and why the equivalence relationship was a property of the Operand/OpResult as opposed to just SSA values.

This revision changes the contract of the two callbacks: `checkEquivalent` compares two values for equivalence. `markEquivalent` informs the caller that the analysis determined that two values are equivalent. This simplifies the API because callers do not have to reason about operands/results, but just SSA values.

`OperationEquivalence::isEquivalentTo` can be used directly in CSE and there is no need for a custom op equivalence analysis.

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

17 months ago[mlir] GreedyPatternRewriteDriver: Entry point takes single region
Matthias Springer [Fri, 27 Jan 2023 10:09:13 +0000 (11:09 +0100)]
[mlir] GreedyPatternRewriteDriver: Entry point takes single region

The rewrite driver is typically applied to a single region or all regions of the same op. There is no longer an overload to apply the rewrite driver to a list of regions.

This simplifies the rewrite driver implementation because the scope is now a single region as opposed to a list of regions.

Note: This change is not NFC because `config.maxIterations` and `config.maxNumRewrites` is now counted for each region separately. Furthermore, worklist filtering (`scope`) is now applied to each region separately.

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

17 months ago[memref][Transform][NFC] Improve the doc for masked_vectorize
Quentin Colombet [Thu, 26 Jan 2023 14:36:44 +0000 (15:36 +0100)]
[memref][Transform][NFC] Improve the doc for masked_vectorize

The `transform.structured.masked_vectorize` operator assumes that the
iteration space of the given linalg op is smaller than the given vector
sizes.
Explicitly states this requirement in the description of the operation.

Also fix the related comment and assert message in the vectorization code.
The wording was flipped.

NFC

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

17 months ago[MLIR] Fix tensor shapes in Toy chapter 1
Thomas Preud'homme [Mon, 23 Jan 2023 14:01:08 +0000 (14:01 +0000)]
[MLIR] Fix tensor shapes in Toy chapter 1

In Toy tutorial chapter 1, multiply_transpose() is called with b<2, 3>
and c<3, 2> when both parameters should have the same shape. This commit
fixes this by instead using c and d as parameters and fix a comment typo
where c and d are mentioned to have shape <2, 2> when they actually have
shape <3, 2>.

Reviewed By: mehdi_amini

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

17 months ago[mlir] GreedyPatternRewriteDriver: Make classes single-use
Matthias Springer [Fri, 27 Jan 2023 09:49:16 +0000 (10:49 +0100)]
[mlir] GreedyPatternRewriteDriver: Make classes single-use

Less mutable state, more `const`. This is to address a concern about complexity of state in D140304.

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

17 months ago[mlir][NFC] GreedyPatternRewriteDriver: Remove OpPatternRewriteDriver
Matthias Springer [Fri, 27 Jan 2023 09:41:45 +0000 (10:41 +0100)]
[mlir][NFC] GreedyPatternRewriteDriver: Remove OpPatternRewriteDriver

The `MultiOpPatternRewriteDriver` can be reused. This gives us better debug messages and more code reuse. Debug messages such as `** Replace: (op name)` were previously not printed when using the `applyOpPatternsAndFold(Operation *, ...)` overload.

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

17 months ago[mlir] GreedyPatternRewriteDriver: Enqueue ancestors in MultiOpPatternRewriteDriver
Matthias Springer [Fri, 27 Jan 2023 09:19:50 +0000 (10:19 +0100)]
[mlir] GreedyPatternRewriteDriver: Enqueue ancestors in MultiOpPatternRewriteDriver

The `GreedyPatternRewriteDriver` was extended to enqueue ancestors in D140304. With this change, `MultiOpPatternRewriteDriver` behaves the same way.

Note: `MultiOpPatternRewriteDriver` now also has a scope that limits how far we go when checking ancestors. By default, this is the first common region of all given ops.

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

17 months ago[mlir][Conversion] Rename the MemRefToLLVM pass
Quentin Colombet [Tue, 24 Jan 2023 13:05:47 +0000 (13:05 +0000)]
[mlir][Conversion] Rename the MemRefToLLVM pass

Since the recent MemRef refactoring that centralizes the lowering of
complex MemRef operations outside of the conversion framework, the
MemRefToLLVM pass doesn't directly convert these complex operations.

Instead, to fully convert the whole MemRef dialect space, MemRefToLLVM
needs to run after `expand-strided-metadata`.

Make this more obvious by changing the name of the pass and the option
associated with it from `convert-memref-to-llvm` to
`finalize-memref-to-llvm`.
The word "finalize" conveys that this pass needs to run after something
else and that something else is documented in its tablegen description.

This is a follow-up patch related to the conversation at:
https://discourse.llvm.org/t/psa-you-need-to-run-expand-strided-metadata-before-memref-to-llvm-now/66956/14

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

17 months ago[mlir] fail gracefull in CallOpSignatureConversion
Alex Zinenko [Thu, 26 Jan 2023 14:02:34 +0000 (14:02 +0000)]
[mlir] fail gracefull in CallOpSignatureConversion

Previously, the CallOpSignatureConversion pattern would assert if
function signature change affected the number of results. Fail the
pattern instead and let the caller propagate failure.

Fixes #60186.

Reviewed By: mehdi_amini

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

17 months agoRevert "[JT][CT] Preserve exisiting BPI/BFI during JumpThreading"
Evgeniy Brevnov [Fri, 27 Jan 2023 08:35:32 +0000 (15:35 +0700)]
Revert "[JT][CT] Preserve exisiting BPI/BFI during JumpThreading"

This reverts commit 26e7cb24cb5dfa560683064d37f560558f00aa67.

17 months ago[mlir][linalg] Make Linalg vectorizer lower affine.apply
Andrzej Warzynski [Mon, 23 Jan 2023 19:01:04 +0000 (19:01 +0000)]
[mlir][linalg] Make Linalg vectorizer lower affine.apply

It is possible that the input to the Linalg vectorizer contains
`affine.apply` ops (see the example in [1]). Such operations are not
vectarizable at the moment, but this can be fixed by simply converting
them to arithmetic operations. This is basically what this patch
introduces.

The IR change enabled in this patch could be part of a larger set of
"linalgOp pre-processing" transformations that happens right before
vectorization starts but after we know we can vectorize the op. I am
leaving this as a TODO.

[1] https://github.com/iree-org/iree/issues/10876.

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

17 months ago[clang][Interp][NFC] Print parent class name of methods
Timm Bäder [Thu, 26 Jan 2023 11:47:08 +0000 (12:47 +0100)]
[clang][Interp][NFC] Print parent class name of methods

in Function::dump().

17 months ago[clang][Interp][NFC] Remove an unnecessary isArray() check
Timm Bäder [Tue, 24 Jan 2023 18:58:09 +0000 (19:58 +0100)]
[clang][Interp][NFC] Remove an unnecessary isArray() check

We already do an isPrimitiveArray() check, so no need for the isArray()
check.

17 months ago[JT][CT] Preserve exisiting BPI/BFI during JumpThreading
Evgeniy Brevnov [Fri, 25 Nov 2022 10:29:27 +0000 (17:29 +0700)]
[JT][CT] Preserve exisiting BPI/BFI during JumpThreading

Currently, JT creates and updates local instances of BPI\BFI. As a result global ones have to be invalidated if JT made any changes.
In fact, JT doesn't use any information from BPI/BFI for the sake of the transformation itself. It only creates BPI/BFI to keep them up to date. But since it updates local copies (besides cases when it updates profile metadata) it just waste of time.

Current patch is a rework of D124439. D124439 makes one step and replaces local copies with global ones retrieved through AnalysisPassManager. Here we do one more step and don't create BPI/BFI if the only reason of creation is to keep BPI/BFI up to date. Overall logic is the following. If there is cached BPI/BFI then update it along the transformations. If there is no existing BPI/BFI, then create it only if it is required to update profile metadata.

Please note if BPI/BFI exists on exit from JT (either cached or created) it is always up to date and no reason to invalidate it.

Reviewed By: mkazantsev

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

17 months ago[clang][Interp][NFC] Add GetPtrBasePop opcode
Timm Bäder [Thu, 5 Jan 2023 11:55:29 +0000 (12:55 +0100)]
[clang][Interp][NFC] Add GetPtrBasePop opcode

Change GetPtrBase to *not* pop the base pointer and add a *Pop variant.
This will be used in later patches.

17 months ago[clang][Interp] Implement __builtin_assume
Timm Bäder [Sat, 7 Jan 2023 11:05:05 +0000 (12:05 +0100)]
[clang][Interp] Implement __builtin_assume

Just ignore it.

As part of this, move the Ret and RetVoid implementation to Interp.h, so
they can be shared with InterpBuiltin.cpp.

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

17 months ago[OpenMP] Fix stack overflow for test bug54082.c
Shilei Tian [Fri, 27 Jan 2023 04:45:02 +0000 (23:45 -0500)]
[OpenMP] Fix stack overflow for test bug54082.c

When `N` is 1024, `int result[N][N]` is obviously large stack that Windows cannot support...

Fix #60326.

Reviewed By: jdoerfert

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

17 months ago[lldb][Test][NFC] TestCreateClassTemplateDecl: make variable names more readable
Michael Buch [Fri, 27 Jan 2023 03:25:16 +0000 (03:25 +0000)]
[lldb][Test][NFC] TestCreateClassTemplateDecl: make variable names more readable

Suggested in https://reviews.llvm.org/D140030

17 months ago[lldb][NFC] Build fix: use TemplateParameterInfos public APIs instead of accessing...
Michael Buch [Fri, 27 Jan 2023 03:08:39 +0000 (03:08 +0000)]
[lldb][NFC] Build fix: use TemplateParameterInfos public APIs instead of accessing private members

Fixes build failures caused by a faulty rebase
in `a29e06bbeaad7012ac85b221f1aaba3fe1d5fd35`

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

17 months ago[ReleaseNotes] Add release notes for LLDB/Clang changes to handling of defaulted...
Michael Buch [Thu, 26 Jan 2023 17:52:09 +0000 (17:52 +0000)]
[ReleaseNotes] Add release notes for LLDB/Clang changes to handling of defaulted template arguments

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

17 months ago[lldb] Add support for DW_AT_default_value in template params
Michael Buch [Sun, 15 Jan 2023 03:26:41 +0000 (03:26 +0000)]
[lldb] Add support for DW_AT_default_value in template params

**Summary**

This patch makes LLDB understand the `DW_AT_default_value` on
template argument DIEs. As a result, type summaries will no
longer contain the defaulted template arguments, reducing
noise substantially. E.g.,

Before:
```
(lldb) v nested
(std::vector<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator <char> > > > > >) nested = size=0 {}
```

After:
```
(lldb) v nested
(std::vector<std::vector<std::basic_string<char> > >) nested = size=0 {}
```

See discussion in https://reviews.llvm.org/D140423

**Testing**

* Adjust API tests
* Added unit-test

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

17 months ago[lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private
Michael Buch [Sat, 17 Dec 2022 17:32:51 +0000 (17:32 +0000)]
[lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

This patch makes the members of `TemplateParameterInfos` only accessible
via public APIs. The motivation for this is that
`TemplateParameterInfos` attempts to maintain two vectors in tandem
(`args` for the template arguments and `names` for the corresponding
name). Working with this structure as it's currently designed makes
it easy to run into out-of-bounds accesses later down the line.

This patch proposes to introduce a new
`TemplateParameterInfos::InsertArg` which is the only way to
set the `TemplateArgument` and name of an entry and since we
require both to be specified we maintain the vectors in sync
out-of-the-box.

To avoid adding non-const getters just for unit-tests a new
`TemplateParameterInfosManipulatorForTests` is introduced
that can be used to control internal state from tests.

17 months ago[clang][DebugInfo] Check TemplateArgument::IsDefaulted
Michael Buch [Sat, 21 Jan 2023 01:49:14 +0000 (01:49 +0000)]
[clang][DebugInfo] Check TemplateArgument::IsDefaulted

Since `ClassTemplateSpecializationDecl`s now set the
`TemplateArgument::IsDefaulted` bit, there's no need
to derive it here.

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

17 months ago[clang][TypePrinter] Test TemplateArgument::IsDefaulted when omitting default arguments
Michael Buch [Sun, 15 Jan 2023 03:37:09 +0000 (03:37 +0000)]
[clang][TypePrinter] Test TemplateArgument::IsDefaulted when omitting default arguments

**Summary**

This patch allows clients who can't properly construct
a `ClassTemplateDecl` to still benefit from the `clang::TypePrinter`s
ability to skip printing defaulted template arguments. The
clients simply have to call `TemplateArgument::setIsDefaulted`
in advance.

See discussion in https://reviews.llvm.org/D140423

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

17 months ago[clang][TemplateBase] Add IsDefaulted bit to TemplateArgument
Michael Buch [Sun, 15 Jan 2023 03:36:50 +0000 (03:36 +0000)]
[clang][TemplateBase] Add IsDefaulted bit to TemplateArgument

**Summary**

This patch adds a `IsDefaulted` field to `clang::TemplateArgument`.

To prevent memory footprint increase we still 1 bit from `ArgKind`.

**Changes**

1. `getIsDefaulted`/`setIsDefaulted` to allow clients to communicate
   an argument's defaulted-ness to the TypePrinter
2. The `TemplateArgument` properties description had to be changed
   to make sure we correctly mark the defaulted-ness of arguments
   that came from a deserialized AST (caught by the HLSL test-suite)
3. The `TemplateArgument` constructors now accept a `IsDefaulted`
   parameter to simplify construction from the tablegen description.
   Though if people don't want to clutter the constructors we can
   instead call `setIsDefaulted` from tablegen
4. When `clang::Sema` checks the template arguments against template
   parameters we now call `setIsDefaulted`. This makes sure that
   whenever a specialization decl gets constructed, the defaulted-ness
   of the associated `TemplateArgument`s has already been deduced.
   This preserves the immutability of `TemplateArgumentList`s

**Background**

In LLDB we construct ASTs from debug-info and hand it to clang
to perform actions such as printing/formatting a typenames.
Some debug formats, specifically DWARF, may only encode information
about class template instantiations, losing the structure of the generic
class definition. However, the `clang::TypePrinter` needs a properly
constructed `ClassTemplateDecl` with generic default argument decls
to be able to deduce whether a `ClassTemplateSpecializationDecl` was
instantiatiated with `TemplateArgument`s that correspond to the
defaults. LLDB does know whether a particular template argument was
defaulted, but can't currently tell clang about it.

This patch allows LLDB to set the defaulted-ness of a `TemplateArgument`
and thus benefit more from `clang::TypePrinter`.

See discussion in https://reviews.llvm.org/D140423

**Testing**

* Added unit-test
* LLDB/clang/llvm test-suite passes

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

17 months ago[clang][TypePrinter] Support expression template arguments when checking defaultedness
Michael Buch [Wed, 25 Jan 2023 17:09:06 +0000 (17:09 +0000)]
[clang][TypePrinter] Support expression template arguments when checking defaultedness

This patch adds support for `TemplateArgument`s of kind
`TemplateArgument::Expression` to `clang::isSubstitutedDefaultArgument`.
We do so by evaluating both the `Pattern` and `Arg` expression to an
`APInt`, if we can, and comparing the results.

This will be useful in an upcoming change where
`clang::isSubstitutedDefaultArgument` gets called from `clang::Sema`
where the `TemplateArgument`s are instantiated as expressions (without
being evaluted to `APInt` beforehand).

**Testing**

- Added unit-tests

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

17 months ago[test] Remove unused `unittest2` import from concurrent_base.py
Jordan Rupprecht [Fri, 27 Jan 2023 02:23:23 +0000 (18:23 -0800)]
[test] Remove unused `unittest2` import from concurrent_base.py

17 months ago[X86][ConstraintFP] Model `MXCSR` for function call
Phoebe Wang [Fri, 27 Jan 2023 01:24:57 +0000 (09:24 +0800)]
[X86][ConstraintFP] Model `MXCSR` for function call

This patch is inspired by D111433. It would affect the performance under
strict FP mode. But it preserves the correct rounding behavior accross
function calls.

Fixes #59305

Reviewed By: sepavloff

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

17 months ago[test] Remove unused `unittest2` import
Jordan Rupprecht [Fri, 27 Jan 2023 02:02:16 +0000 (18:02 -0800)]
[test] Remove unused `unittest2` import

17 months ago[clang-format] Disallow templates to be followed by literal
Emilia Dreamer [Fri, 27 Jan 2023 01:56:11 +0000 (03:56 +0200)]
[clang-format] Disallow templates to be followed by literal

There should not be any cases where the angle brackets of template
parameters are directly followed by a literal. It is more likely that a
comparison is taking place instead.

This patch makes the TokenAnnotator prefer to annotate < and > as
operators when directly followed by a literal. A similar check already
exists for literals directly *before* potential template args.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

17 months ago[mlir][tensor] Add a tiling interface registration for pack/unpack only.
Hanhan Wang [Wed, 18 Jan 2023 00:44:32 +0000 (16:44 -0800)]
[mlir][tensor] Add a tiling interface registration for pack/unpack only.

Reviewed By: mravishankar

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

17 months ago[NFC] Optimize vector usage in lld
Jez Ng [Fri, 27 Jan 2023 01:28:58 +0000 (20:28 -0500)]
[NFC] Optimize vector usage in lld

By using emplace_back, as well as converting some loops to for-each, we can do more efficient vectorization.

Make copy constructor for TemporaryFile noexcept.

Reviewed By: #lld-macho, int3

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

17 months agotest-release.sh: Use parallel xz for packaging the binaries
Tom Stellard [Thu, 26 Jan 2023 23:18:58 +0000 (15:18 -0800)]
test-release.sh: Use parallel xz for packaging the binaries

Reviewed By: amyk, dim, hans

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

17 months ago[test][lldb-vscode] Fix unclean shutdown in test_terminate_commands
Jordan Rupprecht [Thu, 26 Jan 2023 22:29:48 +0000 (14:29 -0800)]
[test][lldb-vscode] Fix unclean shutdown in test_terminate_commands

This test manually sends `terminateCommands` to shutdown, but then the test attempts another `terminateCommands` request in test tear down, which fails since it's already torn down. This error is ignored in LLDB's old fork of unittest2, but will be reported as a test failure in `unittest` from the Python standard library. Use `disconnectAutomatically` to avoid terminating twice.

17 months ago[bazel] Add missing dependency after 55cf0de35e
Benjamin Kramer [Thu, 26 Jan 2023 22:25:15 +0000 (23:25 +0100)]
[bazel] Add missing dependency after 55cf0de35e

17 months ago[flang] Fixed restrictions checking for OpenACC loop-associated constructs.
Slava Zakharin [Thu, 26 Jan 2023 22:20:47 +0000 (14:20 -0800)]
[flang] Fixed restrictions checking for OpenACC loop-associated constructs.

CheckDoConcurrentClauseRestriction and CheckTileClauseRestriction expect
that the construct has associated DoConstruct, while it is not set
when the do-loop has no loop control. The change is to skip the clauses
checks, when the do-loop does not have the loop control.

An alternative fix would be to associate the DoConstruct even when
the do-loop has no loop control and let Check*ClauseRestriction run their
checks, but I am not sure if associating invalid DoConstruct is a good idea.

This fixes failure in Semantics/OpenACC/acc-canonicalization-validity.f90
reported in D142279.

Reviewed By: clementval

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

17 months ago[flang] Fixed uninitialized std::unique_ptr dereference.
Slava Zakharin [Thu, 26 Jan 2023 22:17:13 +0000 (14:17 -0800)]
[flang] Fixed uninitialized std::unique_ptr dereference.

This fixes unittest failures reported in D142279:
  flang-Unit :: Frontend/./FlangFrontendTests/5/7
  flang-Unit :: Frontend/./FlangFrontendTests/6/7

17 months ago[mlir][Linalg] Adding a greedy packing transform dialect op.
Nicolas Vasilache [Thu, 26 Jan 2023 20:30:54 +0000 (12:30 -0800)]
[mlir][Linalg] Adding a greedy packing transform dialect op.

This PR adds a `pack_greedily` transform operation that infers the packing for gemm
subcomputations embedded within in any LinalgOp and packs accordingly.
A normalization step guarantees that we get the innermost op dimensions in one of `8`
possible `(m, n, k)` orders, specified as a parameter, from which we can emit all
packed forms.

The current implementation takes an arbitrary LinalgOp and tries to pack it along
the specified dimensions with specified sizes and inner dim permutation.

This achieves a new level of normalization and generalization for any `n-D`
LinalgOp that contains a gemm embedded within it:
we will always see a predictable packed form for any of these ops.

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

17 months ago[SYCL] Fix test to conform to SYCL2020
Elizabeth Andrews [Thu, 26 Jan 2023 21:51:56 +0000 (13:51 -0800)]
[SYCL] Fix test to conform to SYCL2020

17 months ago[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend
Dominik Adamski [Tue, 17 Jan 2023 09:51:48 +0000 (03:51 -0600)]
[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

Currently default simd alignment is defined by Clang specific TargetInfo class.
This class cannot be reused for LLVM Flang. That's why default simd alignment
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.

Previous attempt: https://reviews.llvm.org/D138496 was wrong because
the default alignment depended on the number of built LLVM targets.

If we wanted to calculate the default alignment for PPC and we hadn't specified
PPC LLVM target to build, then we would get 0 as the alignment because
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as
the default value.

If PPC LLVM target had been built earlier, then OMPIRBuilder could have created
PPCTargetMachine object and it would have returned 128.

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

Reviewed By: jdoerfert

17 months ago[LinkerWrapper] Fix `-Bsymbolic` being sent to the compiler and not the linker
Joseph Huber [Thu, 26 Jan 2023 21:00:24 +0000 (15:00 -0600)]
[LinkerWrapper] Fix `-Bsymbolic` being sent to the compiler and not the linker

Summary:
Clang doesn't warn on `-B` options passed to it. This one is not
forwarded to the linker which results in some tests failing when
offloading to x86_64 with the `bfd` linker.

17 months agoReland: [llvm-cov] Look up object files using debuginfod
Daniel Thornburgh [Mon, 24 Oct 2022 22:35:00 +0000 (15:35 -0700)]
Reland: [llvm-cov] Look up object files using debuginfod

Reviewed By: gulfem

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

17 months ago[RISCV] Add MC support of RISCV Zcb Extension
WuXinlong [Thu, 26 Jan 2023 20:54:00 +0000 (12:54 -0800)]
[RISCV] Add MC support of RISCV Zcb Extension

This patch add the instructions of Zcb extension.

Instructions in zcb extensions shorten part of bit manipulation instructions.

Co-authored-by: Craig Topper <craig.topper@sifive.com>
Reviewed By: craig.topper

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

17 months ago[Support] Remove findFirstSet and findLastSet
Kazu Hirata [Thu, 26 Jan 2023 20:29:48 +0000 (12:29 -0800)]
[Support] Remove findFirstSet and findLastSet

This patch removes findFirstSet and findLastSet as there are no uses
left in LLVM.

I am not aware of any uses of findFirstSet and findLastSet in the
open-source world outside LLVM, so I am skipping the deprecation step.

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

17 months ago[extract_symbols.py] Filter out more symbols for MSVC
Mike Hommey [Thu, 26 Jan 2023 20:28:09 +0000 (21:28 +0100)]
[extract_symbols.py] Filter out more symbols for MSVC

This strips out about 5k symbols.

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

Reviewed By: john.brawn

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

17 months ago[libc++] Add documentation for reproducing CI issues locally
Louis Dionne [Wed, 25 Jan 2023 18:09:39 +0000 (13:09 -0500)]
[libc++] Add documentation for reproducing CI issues locally

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

17 months ago[gn build] Port 36080434a885
LLVM GN Syncbot [Thu, 26 Jan 2023 19:41:53 +0000 (19:41 +0000)]
[gn build] Port 36080434a885

17 months ago[libc++] Move the definition of aligned allocation helpers outside of <new>
Louis Dionne [Fri, 2 Dec 2022 21:45:49 +0000 (13:45 -0800)]
[libc++] Move the definition of aligned allocation helpers outside of <new>

They are not needed in <new> -- in fact they are only needed in .cpp files.
Getting those out of the way makes the headers smaller and also makes it
easier to use the library on platforms where aligned allocation is not
available.

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

17 months ago[CMake] Support undefined LLVM_NATIVE_ARCH in llvm_map_components_to_libnames().
Ivan Kosarev [Thu, 26 Jan 2023 17:44:43 +0000 (17:44 +0000)]
[CMake] Support undefined LLVM_NATIVE_ARCH in llvm_map_components_to_libnames().

https://reviews.llvm.org/D142405 made this function relying on the
LLVM_NATIVE_ARCH be defined, which is not necessarily the case for
third-party projects that include LLVM as their part.

Reviewed By: beanz

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

17 months ago[llvm][docs] Update old metadata syntax in examples
Paul Kirth [Thu, 26 Jan 2023 17:53:19 +0000 (17:53 +0000)]
[llvm][docs] Update old metadata syntax in examples

This patch updates examples in the documentation to match the existing
convention. Calls to intrinsics that have metadata arguments were not
included.

Reviewed By: dexonsmith

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

17 months ago[NVPTX] Do not addrspacecast AS-specific kernel arguments.
Artem Belevich [Wed, 25 Jan 2023 20:12:32 +0000 (12:12 -0800)]
[NVPTX] Do not addrspacecast AS-specific kernel arguments.

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

The assumption that generic pointers passed to a CUDA kernel is CUDA-specific
and should not be applied to non-CUDA compilations.  Addrspacecasts to global AS
and back should never be applied to AS-specific pointers.

In order to make tests actually do the testing for non-CUDA compilation, we need
to get TargetMachine from the TargetPassConfig, instead of passing it explicitly
as a pass constructor argument.

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

17 months ago[OpenMP] Run an extra 'OpenMPOpt' pass in LTO-mode
Joseph Huber [Thu, 26 Jan 2023 17:23:21 +0000 (11:23 -0600)]
[OpenMP] Run an extra 'OpenMPOpt' pass in LTO-mode

The `OpenMPOpt` pass is pivotal to the performance of many OpenMP
offloading programs. When we perform non-LTO builds with OpenMP we used
to link the OpenMP deviceRTL individually for each TU. This lead to us
getting an additional attributor run on the combined runtime and user
code. When we used LTO we lost a run and suffered a large performance
degradation. This patch simply adds in the extra `OpenMPOpt` pass that
we miss into the LTO pipeline. This patch fixes the performance
regression shown in applications that used OpenMP offloading in LTO
mode.

Previously, this wasn't legal to do as we could emit new runtime calls
into the module. That was fixed by D142646.

Depends on D142646

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

Reviewed By: jdoerfert

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