Commit graph

420151 commits

Author SHA1 Message Date
Teresa Johnson ced9a795fd [WPD] Add statistics
Add statistics to count overall devirtualized targets as well as the
various types of devirtualizations applied at callsites.

Differential Revision: https://reviews.llvm.org/D123152
2022-04-05 18:48:23 -07:00
Matt Arsenault ced1250b0f MIRParser: Fix asserting with invalid flags on machine operands
Constructing an operand with kills on defs and deads on uses asserts
in the constructor, so diagnose these.
2022-04-05 21:46:26 -04:00
Gulfem Savrun Yeniceri bcf8f2188b Revert "[InstrProfiling] No runtime hook for unused funcs"
This reverts commit c7f91e227a.
This patch caused an issue in Fuchsia source code coverage builders.
2022-04-06 01:41:44 +00:00
Jun Zhang 8a4d388c7f
[Clang][Sema] Prohibit statement expression in the default argument
As statement expression makes no sense in the default argument,
this patch tries to disable it in the all cases.

Please note that the statement expression is a GNU extension, which
means that Clang should be consistent with GCC. However, there's no
response from GCC devs since we have raised the issue for several weeks.
In this case, I think we can disallow statement expressions as a default
parameter in general for now, and relax the restriction if GCC folks
decide to retain the feature for functions but not lambdas in the
future.

Related discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104765

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

Differential Revision: https://reviews.llvm.org/D119609
2022-04-06 09:28:20 +08:00
Yuanfang Chen c32f8f3461 [unittests] fix intermittent SupportTests failures
by invoking `SupportTests --gtest_shuffle=1`.

`HideUnrelatedOptions`/`HideUnrelatedOptionsMulti` failed due to other
tests calling `cl::ResetCommandLineParser()` which causes default
options to be removed.

`ExitOnError` would hang due to the threading environment. Renaming it
as `*Deathtest` is the recommended practice by GTest docs.
2022-04-05 18:19:20 -07:00
Aart Bik 175b9af484 [mlir][sparse] avoid reserving dense storage for ptr/idx
This avoids a rather big bug where we were reserving
dense space for the ptx/idx in the first sparse dimension.
For example, using CSR for a 140874 x 140874 matrix with
3977139 nonzero would reserve the full 19845483876 space.
This revision fixes this for now, but we need to revisit
the reservation heuristic to make this better.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D123166
2022-04-05 17:40:01 -07:00
Lang Hames 9a62d9db2e [JITLink][MachO] Fix alignment bug in the c-string literal section graphifier.
This function had been assuming a 1-byte alignment, which isn't always correct.
This commit updates it to take the alignment from the __cstring section.

The key change is to the createContentBlock call, but the surrounding code is
updated with clearer debugging output to support the testcase (and any future
debugging work).
2022-04-05 17:38:54 -07:00
John Demme 94d96c2a62 [MLIR] [Python] Pybind adaptors: coerce None to default MlirLocation
Add default source location coercion to enable location elision in
Python code.
2022-04-05 17:10:20 -07:00
Tom Honermann 5531abaf71 [clang] Corrections for target_clones multiversion functions.
This change merges code for emit of target and target_clones multiversion
resolver functions and, in doing so, corrects handling of target_clones
functions that are declared but not defined. Previously, a use of such
a target_clones function would result in an attempted emit of an ifunc
that referenced an undefined resolver function. Ifunc references to
undefined resolver functions are not allowed and, when the LLVM verifier
is not disabled (via '-disable-llvm-verifier'), resulted in the verifier
issuing a "IFunc resolver must be a definition" error and aborting the
compilation. With this change, ifuncs and resolver function definitions
are always emitted for used target_clones functions regardless of whether
the target_clones function is defined (if the function is defined, then
the ifunc and resolver are emitted regardless of whether the function is
used).

This change has the side effect of causing target_clones variants and
resolver functions to be emitted in a different order than they were
previously. This is harmless and is reflected in the updated tests.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D122958
2022-04-05 19:50:22 -04:00
Tom Honermann 40af8df6fe [clang] NFC: Preparation for merging code to emit target and target_clones resolvers.
This change modifies CodeGenModule::emitMultiVersionFunctions() in preparation
for a change that will merge support for emitting target_clones resolvers into
this function. This change mostly serves to isolate indentation changes from
later behavior modifying changes.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D122957
2022-04-05 19:50:22 -04:00
Tom Honermann 0ace0100ae [clang] NFC: Simplify the interface to CodeGenModule::GetOrCreateMultiVersionResolver().
Previously, GetOrCreateMultiVersionResolver() required the caller to provide
a GlobalDecl along with an llvm::type and FunctionDecl. The latter two can be
cheaply obtained from the first, and the llvm::type parameter is not always
used, so requiring the caller to provide them was unnecessary and created the
possibility that callers would pass an inconsistent set. This change simplifies
the interface to only require the GlobalDecl value.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D122956
2022-04-05 19:50:22 -04:00
Tom Honermann bed5ee3f4b [clang] NFC: Enhance comments in CodeGen for multiversion function support.
Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D122955
2022-04-05 19:50:22 -04:00
Louis Dionne 6720bc202a [libc++] Remove error about _LIBCPP_ALTERNATE_STRING_LAYOUT not being supported anymore
It's been over two years since I added the temporary error, so I think
it's reasonable to remove it now.
2022-04-05 19:45:21 -04:00
Louis Dionne fd92ca00b4 [libc++][NFC] Remove stray whitespace in comment 2022-04-05 19:45:20 -04:00
Johannes Doerfert 3e8c4366e2 [Attributor] Visit droppable uses in AAIsDead
If we ignore droppable users everything only used in llvm.assume (among
other things) is going to be deleted as dead. This is not helpful.
Instead we want to only delete things we actually don't need anymore. A
follow up will deal with loads in a smarter way.
2022-04-05 18:20:45 -05:00
Johannes Doerfert dd92b29e75 [Attributor][NFC] Pre-commit new test case 2022-04-05 18:20:45 -05:00
Jorge Gorbe Moya 54cc7de4bc Fix bazel build.
- https://reviews.llvm.org/D122619 bumped zlib version but didn't change
  the hash

- Added new header from https://reviews.llvm.org/D108438
2022-04-05 15:45:53 -07:00
Jessica Paquette 6c9bc2dd1c [GlobalISel] NFC: Add test coverage for s144 and s142
144 = 16 * 9

For types where s16 is legal.

It may be interesting to break these down into 16-bit chunks rather than 32
or 64 bits.

Add tests for some opcodes, just so we get some test coverage drawing attention
to this.
2022-04-05 15:26:46 -07:00
Jonas Devlieghere 70984dd40a
[lldb] Update ReadAllRegisterValues in RegisterContextWindows 2022-04-05 15:15:48 -07:00
Greg Clayton b6087ba769 Disable LLDB index cache for .o files with no UUID.
After enabling the LLDB index cache in production we discovered that some distributed build systems play with the modification times of any .o files that were downloaded from the build cache. This was causing the LLDB index cache to read the wrong cache file for files that didn't have a UUID as all of the modfication times were set to the same value by the build system. When new .o files were downloaded, the only unique identifier was the mod time which were all the same, and we would load an older cache for the updated .o file. So disabling caching of files that have no UUIDs for now until we can create a more solid solution.

Differential Revision: https://reviews.llvm.org/D120948
2022-04-05 15:14:36 -07:00
Jessica Paquette 30922d62f4 [GlobalISel] NFC: Add some test coverage for s158
158 = 32 * 5 - 2

This is a wide type which may benefit from a different widening scheme than
types which are multiples of 64. For example, if 32-bit and 64-bit scalars
are both allowed, and a type is a multiple of 32, or is closer to a multiple
of 32, it *may* be better to

- Widen to the wide multiple of 32
- Break up the type into 32-bit chunks

Anyway, we don't have any test coverage for this at all, so for the sake of
making sure we test it, let's add some test coverage.
2022-04-05 15:11:22 -07:00
William Woodruff d81b014469 [NFC][Bitstream] Improve the dumpability of bitstream/bitcode headers
The `LLVMBitCodes.h` header contains various enums that are updated whenever LLVM's bitcode fundamentally changes. It would be nice to track these changes in a semi-automated way, so that external tools that attempt to parse LLVM's bitstream and bitcode can remain in sync.

Before this change, `LLVMBitCodes.h` had a single dependency -- it needed the `FIRST_APPLICATION_BLOCKID` enum value from `BitCodes.h`. `BitCodes.h`, in turn, had a whole tree of include dependencies that boiled down to `llvm-config.h`, meaning that it was impossible to dump the AST of either file without having a partial or full LLVM build tree already present.

To eliminate that requirement, this patch introduces a new leaf-only header, `BitCodeEnums.h`, which includes the "core" enums originally in `BitCodes.h`. `LLVMBitCodes.h` and `BitCodes.h` both include this new header in turn, preserving the current header relationships while allowing `LLVMBitCodes.h` to be dumped fully independently with a command like this (run from the repository root):

```
clang -fsyntax-only -x c++ -Illvm/include -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang llvm::bitc::BlockIDs llvm/include/llvm/Bitcode/LLVMBitCodes.h
```

I recognize that this is a pretty unusual change and perhaps not a guarantee that the LLVM authors would like to make in the general case (i.e., that individual files within LLVM can have their AST dumped with minimal dependencies). However, I believe the criticality/limited scope of the file(s) in this patch warrants an exception. Please let me know if there's any other information I can provide, or anything else I can do to improve this patch!

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D108438
2022-04-05 15:10:49 -07:00
Hanhan Wang 96e9b6c9dc Revert "[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse)."
This reverts commit 64f659bee6.

An invalid tensor.expand_shape op is generated with the commit. To repro:

$ mlir-opt -canonicalize a.mlir

```
func @foo(%0: tensor<1x1xf32>, %1: tensor<1x1xf32>, %2: tensor<1x1xf32>) -> tensor<1x1xf32> {
  %cst = arith.constant 0.000000e+00 : f32
  %3 = linalg.init_tensor [8, 1] : tensor<8x1xf32>
  %4 = linalg.fill ins(%cst : f32) outs(%3 : tensor<8x1xf32>) -> tensor<8x1xf32>
  %5 = tensor.collapse_shape %0 [] : tensor<1x1xf32> into tensor<f32>
  %6 = tensor.insert_slice %5 into %4[0, 0] [1, 1] [1, 1] : tensor<f32> into tensor<8x1xf32>
  %7 = linalg.init_tensor [8, 1] : tensor<8x1xf32>
  %8 = linalg.fill ins(%cst : f32) outs(%7 : tensor<8x1xf32>) -> tensor<8x1xf32>
  %9 = tensor.collapse_shape %2 [] : tensor<1x1xf32> into tensor<f32>
  %10 = tensor.insert_slice %9 into %8[0, 0] [1, 1] [1, 1] : tensor<f32> into tensor<8x1xf32>
  %11 = tensor.collapse_shape %6 [[0, 1]] : tensor<8x1xf32> into tensor<8xf32>
  %12 = linalg.init_tensor [8] : tensor<8xf32>
  %13 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%11 : tensor<8xf32>) outs(%12 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %14 = tensor.expand_shape %13 [[0, 1, 2, 3]] : tensor<8xf32> into tensor<1x1x8x1xf32>
  %15 = tensor.collapse_shape %1 [] : tensor<1x1xf32> into tensor<f32>
  %16 = linalg.init_tensor [] : tensor<f32>
  %17 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%15 : tensor<f32>) outs(%16 : tensor<f32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<f32>
  %18 = tensor.expand_shape %17 [] : tensor<f32> into tensor<1x1x1x1xf32>
  %19 = tensor.collapse_shape %10 [[0, 1]] : tensor<8x1xf32> into tensor<8xf32>
  %20 = linalg.init_tensor [8] : tensor<8xf32>
  %21 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%19 : tensor<8xf32>) outs(%20 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %22 = tensor.expand_shape %21 [[0, 1, 2, 3]] : tensor<8xf32> into tensor<1x1x8x1xf32>
  %23 = linalg.mmt4d {comment = "f32*f32->f32, aarch64, matrix*vector"} ins(%14, %18 : tensor<1x1x8x1xf32>, tensor<1x1x1x1xf32>) outs(%22 : tensor<1x1x8x1xf32>) -> tensor<1x1x8x1xf32>
  %24 = tensor.collapse_shape %23 [[0, 1, 2, 3]] : tensor<1x1x8x1xf32> into tensor<8xf32>
  %25 = linalg.init_tensor [8] : tensor<8xf32>
  %26 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%24 : tensor<8xf32>) outs(%25 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %27 = tensor.expand_shape %26 [[0, 1]] : tensor<8xf32> into tensor<8x1xf32>
  %28 = tensor.extract_slice %27[0, 0] [1, 1] [1, 1] : tensor<8x1xf32> to tensor<f32>
  %29 = tensor.expand_shape %28 [] : tensor<f32> into tensor<1x1xf32>
  return %29 : tensor<1x1xf32>
}
```

Differential Revision: https://reviews.llvm.org/D123161
2022-04-05 15:05:41 -07:00
Jonas Devlieghere 470eb5c29b
[lldb] Add more missing consts in NativeRegisterContexts 2022-04-05 14:43:39 -07:00
Benjamin Kramer b7bf5a7a7e [lldb] Add missing const to NativeRegisterContextLinux_arm 2022-04-05 23:39:08 +02:00
Groverkss 0a06ac749b [MLIR][Affine][Analysis] Merge FAC and FACV
With the introduction of IntegerPolyhedron and IntegerRelation in Presburger
directory, the purpose of FlatAffineConstraints becomes redundant. For users
requiring Presburger arithmetic without IR information, Presburger library can
directly be used. For users requiring IR information,
FlatAffineValueConstraints can be used.

This patch merges FAC and FACV to remove redundancy of FAC.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D122476
2022-04-06 03:02:32 +05:30
Amir Ayupov f99398fe0e [BOLT][NFC] Move isADD64rr and isADDri out of MCPlusBuilder class
Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D123077
2022-04-05 14:32:07 -07:00
David Blaikie 6302a91468 DebugInfo: ThinLTO: Import template parameters on type declarations
Necessary when importing class template specializations that have
simplified template names (may otherwise be necessary - eg: Sony
requires template parameter DIEs even with unsimplified names, but short
of always importing names this is the best I can do for now) - long term
this probably needs a flag for the DICompositeType to specify whether it
needs template parameters on declarations & that flag could power this
behavior, rather than inspecting the name.
2022-04-05 21:29:58 +00:00
Jonas Devlieghere ed9a14f912
[lldb] Add missing const to NativeRegisterContextLinux_x86_64
Fixes error: invalid conversion from ‘const uint8_t*’ {aka ‘const
unsigned char*’} to ‘uint8_t*’ {aka ‘unsigned char*’}
2022-04-05 14:26:50 -07:00
Ben Barham f65b0b5dcf Revert "[VFS] RedirectingFileSystem only replace path if not already mapped"
This reverts commit 3fda0edc51, which
breaks crash reproducers in very specific circumstances. Specifically,
since crash reproducers have `UseExternalNames` set to false, the
`File->getFileEntry().getDir()->getName()` call in `DoFrameworkLookup`
would use the *cached* directory name instead of the directory of the
looked-up file.

The plan is to re-commit this patch but to *add*
`ExposesExternalVFSPath` rather than replace `IsVFSMapped`.

Differential Revision: https://reviews.llvm.org/D123103
2022-04-05 14:24:40 -07:00
Jonas Devlieghere c2f6460145
[lldb] Update the NativeRegisterContext to take a WritableMemoryBuffer 2022-04-05 14:19:01 -07:00
Paul Robinson 1e085448b3 [PS4] Fix header search list
A missing "break" in the initial implementation had us adding a
spurious "/usr/include" to the header search list. Later someone
introduced LLVM_FALLTHROUGH to prevent a warning.  Replace this with
the correct "break" and make sure the extra directory isn't added to
the PS4 header search list.
2022-04-05 14:14:13 -07:00
Shangwu Yao 15a1769631 Emit OpenCL metadata when targeting SPIR-V
This is required for converting function calls such as get_global_id()
into SPIR-V builtins.

Differential Revision: https://reviews.llvm.org/D123049
2022-04-05 20:58:32 +00:00
Bill Wendling 1acba8a4b5 [mlir] Reinstate the variable
Mid-air collition of patches.
2022-04-05 13:57:14 -07:00
Jonas Devlieghere a722dea4af
[lldb] Update reinterpret_cast in linux/Host.cpp
Fixes error: reinterpret_cast from type ‘const uint8_t*’ {aka ‘const
unsigned char*’} to type ‘char*’ casts away qualifiers
2022-04-05 13:52:07 -07:00
Nathan James b4ad3c3891 Reland "[ASTMatchers] Output currently matching node on crash"
Extend D120185 to also log the node being matched on in case of a crash.
This can help if a matcher is causing a crash or there are not enough interesting nodes bound.

Reviewed By: aaron.ballman

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

This reverts commit 61d67c8eec.

This relands commit 6e33e45b94.

Fixing the build issue on 32bit machines due to not enough free bits in the PointerUnion.
2022-04-05 21:47:16 +01:00
Jonas Devlieghere f2ea125ea0
[lldb] Change CreateMemoryInstance to take a WritableDataBuffer
Change the CreateMemoryInstance interface to take a WritableDataBuffer.

Differential revision: https://reviews.llvm.org/D123073
2022-04-05 13:46:41 -07:00
Jonas Devlieghere fc54427e76
[lldb] Refactor DataBuffer so we can map files as read-only
Currently, all data buffers are assumed to be writable. This is a
problem on macOS where it's not allowed to load unsigned binaries in
memory as writable. To be more precise, MAP_RESILIENT_CODESIGN and
MAP_RESILIENT_MEDIA need to be set for mapped (unsigned) binaries on our
platform.

Binaries are mapped through FileSystem::CreateDataBuffer which returns a
DataBufferLLVM. The latter is backed by a llvm::WritableMemoryBuffer
because every DataBuffer in LLDB is considered to be writable. In order
to use a read-only llvm::MemoryBuffer I had to split our abstraction
around it.

This patch distinguishes between a DataBuffer (read-only) and
WritableDataBuffer (read-write) and updates LLDB to use the appropriate
one.

rdar://74890607

Differential revision: https://reviews.llvm.org/D122856
2022-04-05 13:46:37 -07:00
Bill Wendling 4169650537 [mlir] Remove an unused variable and correct types.
No functionality change.
2022-04-05 13:44:12 -07:00
River Riddle 43c0a45a79 [mlir-vscode] Add better support for multiple workspace folders
We currently only launch one set of language clients when starting the extension,
but this has the unfortunate effect of applying the same settings to all workspace
folders. This commit adds support for multiple workspace folders by launching
a server for each folder in the workspace. This allows for having different servers
for different workspace folders, e.g. when there are multiple MLIR projects in
the same workspace.

Differential Revision: https://reviews.llvm.org/D122793
2022-04-05 13:41:40 -07:00
River Riddle ade148d936 [mlir-vscode] Add better resolution for server file paths
We currently require that server paths are full paths, which is
fairly inconvenient for a myriad of reasons. This commit
attempts to resolve a given server path with the current workspace.

This has a nice additional affect that we can now actually have
default server paths. This means that mlir-lsp-server and
mlir-pdll-lsp-server can be transparently picked up from
build directories (i.e. generally no need for upstream users to
configure the extension).

Fixes #54627

Differential Revision: https://reviews.llvm.org/D122792
2022-04-05 13:41:40 -07:00
Vladislav Khmelevsky 2e51a32219 [BOLT] Check for !isTailCall in isUnconditionalBranch
Add !isTailCall in isUnconditionalBranch check in order to sync the x86
and aarch64 and fix the fixDoubleJumps pass on aarch64.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Differential Revision: https://reviews.llvm.org/D122929
2022-04-05 23:39:34 +03:00
Aaron Siddhartha Mondal 04b42c99f6 Fix typo in new -config-file option
The new -config-file option introduced by 9e1f4f1 was accidentally
referenced as args.config_path on the python side. This patch renames
args.config_path to args.config_file.

To avoid confusion with python file objects, the input argument for
get_tidy_invocation has been renamed from config_path to
config_file_path.

See GitHub issue #54728 for a discussion.
2022-04-05 16:28:49 -04:00
Nirvedh 01055ed1d7 [mlir][linalg] Move linalg.fill folding into linalg.generic pattern from canonicalization to elementwise fusion
Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D122847
2022-04-05 20:13:03 +00:00
Artur Pilipenko 857d699667 Move BasicBlock::getTerminator definition to the header
This way it can be inlined to its caller. This method
shows up in the profile and it is essentially a fancy
getter. It would benefit from inlining into its callers.

NFC.
2022-04-05 13:11:38 -07:00
Lang Hames 01bc5b7034 [JITLink] Fix sorting bug for PC-begin candidate symbols during EH-frame fixup.
The sort should have been lexicographic, but wasn't. This resulted in us
choosing a common symbol at address zero over the intended target function,
leading to a crash.

This patch also moves sorting up to the start of the pass, which means that we
only need to hold on to the canonical symbol at each address rather than a list
of candidates.
2022-04-05 13:02:28 -07:00
Paul Robinson 077f90315b [PS5] Add PS5 as a legal triple component 2022-04-05 12:55:12 -07:00
Jason Molenda ee394177e6 Refine memory buffer for importing shared cache objc class list
In https://reviews.llvm.org/D118972 I increased this buffer to be
big enough to import 261,144 classes but this is a lot more than
we currently have, an allocating a too-large buffer can add memory
pressure even if it's only for a short time.  Reduce the size of
this memory buffer to big enough to import 163,840 classes.  I'll
probably move to a scheme where we read the objc classes in chunks,
with a smaller buffer and multiple inferior function calls.

rdar://91275493
2022-04-05 12:49:40 -07:00
Tom Honermann 7c53fc4fe1 [clang] Emit target_clones resolver functions as COMDAT.
Previously, resolver functions synthesized for target_clones multiversion
functions were not emitted as COMDAT. Now fixed.
2022-04-05 15:34:35 -04:00
Tom Honermann 3531a4fa3b [clang] NFC: Extend comdat validation in target multiversion function tests. 2022-04-05 15:34:35 -04:00