Peixin-Qiao [Tue, 12 Apr 2022 02:15:15 +0000 (10:15 +0800)]
[MLIR][OpenMP] Add support for threadprivate directive
This supports the threadprivate directive in OpenMP dialect following
the OpenMP 5.1 [2.21.2] standard. Also lowering to LLVM IR using OpenMP
IRBduiler.
Reviewed By: kiranchandramohan, shraiysh, arnamoy10
Differential Revision: https://reviews.llvm.org/D123350
jacquesguan [Mon, 11 Apr 2022 07:56:46 +0000 (07:56 +0000)]
[mlir][NFC] Remove some redundant code.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123487
Vitaly Buka [Tue, 12 Apr 2022 01:58:26 +0000 (18:58 -0700)]
[sanitizer] Update undefined symbols of symbolizer
Eugene Zhulenev [Tue, 12 Apr 2022 00:28:51 +0000 (17:28 -0700)]
[mlir] Add msan memory unpoisoning macros to mlir ExecutionEngine
Adding annotations on as-needed bases, currently only for memrefCopy, but in general all C API functions that take pointers to memory allocated/initialized inside the jit-compiled code must be annotated, to be able to run with msan.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D123557
Liqin Weng [Tue, 12 Apr 2022 01:19:39 +0000 (09:19 +0800)]
[InstCombine] fold more constant remainder to select-of-constants remainder
Reviewed By: xbolva00, spatel, Chenbing.Zheng
Differential Revision: https://reviews.llvm.org/D123486
Alexander Shaposhnikov [Tue, 12 Apr 2022 01:25:29 +0000 (01:25 +0000)]
[InstCombine] Fold icmp(X) ? f(X) : C
This diff extends foldSelectInstWithICmp to handle the case icmp(X) ? f(X) : C
when f(X) is guaranteed to be equal to C for all X in the exact range of the inverse predicate.
This addresses the issue https://github.com/llvm/llvm-project/issues/54089.
Differential revision: https://reviews.llvm.org/D123159
Test plan: make check-all
rdzhabarov [Tue, 12 Apr 2022 00:29:23 +0000 (00:29 +0000)]
Fixing BUILD dependency on the DialectBase.
Differential Revision: https://reviews.llvm.org/D123558
Alexander Shaposhnikov [Tue, 12 Apr 2022 01:07:30 +0000 (01:07 +0000)]
[InstCombine][NFC] Add baseline tests for folds icmp(X) ? f(X) : C
Differential revision: https://reviews.llvm.org/D123430
Test plan: make check-all
Craig Topper [Tue, 12 Apr 2022 01:03:43 +0000 (18:03 -0700)]
[SelectionDAG] Remove unecessary null check after call to getNode. NFC
As far as I know getNode will never return a null SDValue.
I'm guessing this was modeled after the FoldConstantArithmetic
call earlier.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D123550
Vitaly Buka [Tue, 12 Apr 2022 00:26:21 +0000 (17:26 -0700)]
[sanitizer] Make test pass with InternalSymbolizer
Vitaly Buka [Tue, 12 Apr 2022 00:25:08 +0000 (17:25 -0700)]
[sanitizer] Fix arg types of internal functions
They didn't match sanitizer_common for 32bit.
Matt Arsenault [Sun, 10 Apr 2022 14:47:12 +0000 (10:47 -0400)]
GlobalISel: Verify atomic load/store ordering restriction
Reject acquire stores and release loads. This matches the restriction
imposed by the LLParser and IR verifier.
Matt Arsenault [Sat, 9 Apr 2022 18:16:18 +0000 (14:16 -0400)]
AArch64/GlobalISel: Regenerate mir test checks
Minimizes the test diffs in future changes from introduction of -NEXT.
Arthur Eubanks [Fri, 8 Apr 2022 22:18:16 +0000 (15:18 -0700)]
Reland [mlir] Remove uses of LLVM's legacy pass manager
Use the new pass manager.
This also removes the ability to run arbitrary sets of passes. Not sure if this functionality is used, but it doesn't seem to be tested.
No need to initialize passes outside of constructing the PassBuilder with the new pass manager.
Reland: Fixed custom calls to `-lower-matrix-intrinsics` in integration tests by replacing them with `-O0 -enable-matrix`.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D123425
LLVM GN Syncbot [Mon, 11 Apr 2022 23:49:30 +0000 (23:49 +0000)]
[gn build] Port
203a1e36ed75
Arthur Eubanks [Mon, 11 Apr 2022 23:45:19 +0000 (16:45 -0700)]
Revert "[mlir] Remove uses of LLVM's legacy pass manager"
This reverts commit
b0f7f6f78d050cc89b31c87fb48744989145af60.
Causes test failures: https://lab.llvm.org/buildbot#builders/61/builds/24879
Matt Arsenault [Sun, 10 Apr 2022 23:50:47 +0000 (19:50 -0400)]
GlobalISel: Add memSizeNotByteSizePow2 legality helper
This is really a replacement for memSizeInBytesNotPow2 that actually
does what most every target wants. In particular, since s1 rounds to 1
byte, it wasn't lowered by this predicate. This results in targets
needing to think harder and add more matchers to catch all the
degenerate cases.
Also small bug fix that prevented the correct insertion of
G_ASSERT_ZEXT in the AArch64 use case.
Matt Arsenault [Mon, 11 Apr 2022 17:24:57 +0000 (13:24 -0400)]
GlobalISel: Implement computeKnownBits for overflow bool results
Matt Arsenault [Sun, 10 Apr 2022 22:20:10 +0000 (18:20 -0400)]
AMDGPU/GlobalISel: Add some additional IR tests for zextload
Matt Arsenault [Sun, 10 Apr 2022 17:27:56 +0000 (13:27 -0400)]
AMDGPU/GlobalISel: Add more tests for inreg extend + load combine
Matt Arsenault [Sun, 10 Apr 2022 15:23:06 +0000 (11:23 -0400)]
Mips/GlobalISel: Remove test IR sections and regenerate checks
Matt Arsenault [Sun, 10 Apr 2022 12:37:44 +0000 (08:37 -0400)]
AArch64/GlobalISel: Remove IR section from a test
Matt Arsenault [Sat, 9 Apr 2022 12:37:44 +0000 (08:37 -0400)]
AMDGPU/GlobalISel: Remove unused parameter
Matt Arsenault [Fri, 17 Dec 2021 15:23:03 +0000 (10:23 -0500)]
Reapply "AMDGPU: Remove AMDGPUFixFunctionBitcasts pass"
This reverts commit
8a85be807bd453eb9c88d0126c75fd5ea393f60d.
The unrelated failure this exposed was fixed.
Mahesh Ravishankar [Mon, 11 Apr 2022 23:34:43 +0000 (23:34 +0000)]
[mlir][Linalg] Split `populateElementwiseOpsFusionPatterns`.
The method to add elementwise ops fusion patterns pulls in many other
patterns by default. The patterns to pull in along with the
elementwise op fusion should be upto the caller. Split the method to
pull in just the elementwise ops fusion pattern. Other cleanup changes
include
- Move the pattern for constant folding of generic ops (currently only
constant folds transpose) into a separate file, cause it is not
related to fusion
- Drop the uber LinalgElementwiseFusionOptions. With the
populateElementwiseOpsFusionPatterns being split, this has no
utility now.
- Drop defaults for the control function.
- Fusion of splat constants with generic ops doesnt need a control
function. It is always good to do.
Differential Revision: https://reviews.llvm.org/D123236
Arthur Eubanks [Fri, 8 Apr 2022 22:18:16 +0000 (15:18 -0700)]
[mlir] Remove uses of LLVM's legacy pass manager
Use the new pass manager.
This also removes the ability to run arbitrary sets of passes. Not sure if this functionality is used, but it doesn't seem to be tested.
No need to initialize passes outside of constructing the PassBuilder with the new pass manager.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D123425
Mehdi Amini [Sun, 3 Apr 2022 22:36:30 +0000 (22:36 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in AffineOps.cpp (NFC)
Mehdi Amini [Sun, 3 Apr 2022 22:28:45 +0000 (22:28 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in ConvertShapeConstraints.cpp (NFC)
Changpeng Fang [Mon, 11 Apr 2022 23:12:39 +0000 (16:12 -0700)]
AMDGPU: Align the implicit kernel argument segment to 8 bytes for v5
Summary:
In emitting metadata for implicit kernel arguments, we need to be in sync with the actual loads
to align the implicit kernel argument segment to 8 byte boundary. In this work, we simply force
this alignment through the first implicit argument.
In addition, we don't emit metadata for any implicit kernel argument if none of them is actually used.
Reviewers: arsenm, b-sumner
Differential Revision: https://reviews.llvm.org/D123346
River Riddle [Wed, 6 Apr 2022 18:42:19 +0000 (11:42 -0700)]
[mlir-vscode] Don't emit errors if the user didn't set the server path
This avoids emitting errors in situations where the user doesn't have a server
setup, and doesn't mean to (e.g. when they merely want syntax highlighting).
Differential Revision: https://reviews.llvm.org/D123240
River Riddle [Wed, 6 Apr 2022 06:14:06 +0000 (23:14 -0700)]
[mlir-vscode] Refactor server creation to be lazy
We currently proactively create language clients for every workspace folder,
and every language. This makes startup time more costly, and also emits errors
for missing language servers in contexts that the user currently isn't in. For example,
if a user opens a .mlir file we don't want to emit errors about .pdll files. We also don't
want to emit errors for missing servers in workspace folders that don't even utilize
MLIR.
This commit refactors client creation to lazy-load when a document that requires the
server is opened.
Differential Revision: https://reviews.llvm.org/D123184
River Riddle [Wed, 6 Apr 2022 05:09:46 +0000 (22:09 -0700)]
[mlir-vscode] Fix processing of files not within the workspace
In a previous commit we added proper support for separate configurations
per workspace folder, but that effectively broke support for processing out-of-workspace
files. Given how useful this is (e.g. when iterating on a test case in /tmp), this
commit refactors server creation to support this again. We support this case using
a "fallback" server that specifically handles files not within the workspace. This uses
the configuration settings for the current workspace itself (not the specific folder).
Differential Revision: https://reviews.llvm.org/D123183
Luboš Luňák [Tue, 5 Apr 2022 12:25:02 +0000 (14:25 +0200)]
don't extra notify ModulesDidLoad() from LoadModuleAtAddress()
Places calling LoadModuleAtAddress() already call ModulesDidLoad()
after a loop calling LoadModuleAtAddress(), so it's not necessary
to call it from there, and the batched ModulesDidLoad() may be
more efficient than this place calling it one after one.
This also makes the ModuleLoadedNotifys test pass on Linux now that
the duplicates no longer bring down the average of modules notified
per call.
Differential Revision: https://reviews.llvm.org/D123128
River Riddle [Wed, 6 Apr 2022 21:44:15 +0000 (14:44 -0700)]
[mlir:docs] Add proper documentation for defining dialects
We don't actually have any documentation today for how to
declaratively define a dialect. This commit rectifies that and properly
documents how to define a Dialect in tablegen, and details all of
the possible fields.
Differential Revision: https://reviews.llvm.org/D123258
River Riddle [Wed, 6 Apr 2022 21:43:21 +0000 (14:43 -0700)]
[mlir] Split dialect definition constructs out of OpBase into DialectBase
OpBase is currently extremely overbloated with constructs. This
commit continues the current process of cleaning this up, by splitting
out dialect definition constructs. This maps the ODS side more closely
to the C++ side.
Differential Revision: https://reviews.llvm.org/D123257
Rahman Lavaee [Mon, 11 Apr 2022 21:39:41 +0000 (14:39 -0700)]
Allow building heatmaps from basic sampled events with `-nl`.
I find that this is useful for finding event hotspots.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D123067
Ben Barham [Mon, 11 Apr 2022 21:50:28 +0000 (14:50 -0700)]
[VFS] RedirectingFileSystem only replace path if not already mapped
If the `ExternalFS` has already remapped to an external path then
`RedirectingFileSystem` should not change it to the originally provided
path. This fixes the original path always being used if multiple VFS
overlays were provided and the path wasn't found in the highest (ie.
first in the chain).
For now this is accomplished through the use of a new
`ExposesExternalVFSPath` field on `vfs::Status`. This flag is true when
the `Status` has an external path that's different from its virtual
path, ie. the contained path is the external path. See the plan in
`FileManager::getFileRef` for where this is going - eventually we won't
need `IsVFSMapped` any more and all returned paths should be virtual.
Resolves rdar://
90578880 and llvm-project#53306.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D123398
Louis Dionne [Wed, 1 Dec 2021 19:28:14 +0000 (14:28 -0500)]
[runtimes][CI] Add a 20 minutes individual test time out
If a single test has been running for more than 20 minutes on a CI node,
something is wrong and it should time-out instead of running until the
node potentially times out itself.
Differential Revision: https://reviews.llvm.org/D114896
Fangrui Song [Mon, 11 Apr 2022 21:44:44 +0000 (14:44 -0700)]
[CMake][gn][Bazel] Remove HAVE_PTHREAD_GETSPECIFIC
The only user was removed by
d351f54a076edf24c2a2bfda7cc7e3313ee3eecf.
Craig Topper [Mon, 11 Apr 2022 21:29:01 +0000 (14:29 -0700)]
[RISCV][SelectionDAG] Add a hook to sign extend i32 ConstantInt operands of phis on RV64.
Materializing constants on RISCV is simpler if the constant is sign
extended from i32. By default i32 constant operands of phis are
zero extended.
This patch adds a hook to allow RISCV to override this for i32. We
have an existing isSExtCheaperThanZExt, but it operates on EVT which
we don't have at these places in the code.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D122951
Tue Ly [Mon, 11 Apr 2022 19:58:45 +0000 (15:58 -0400)]
[libc] Fix nested namespace issues with multiply_add.h.
The FMA header was included inside namespaces in multiply_add.h.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D123539
Joseph Huber [Mon, 11 Apr 2022 21:26:33 +0000 (17:26 -0400)]
[OpenMP] Do not use the default pipeline without optimizations
Summary:
A previous patch added the option to use the default pipeline when
perfomring LTO rather than the regular LTO pipeline. This greatly
improved performance regressions we were observing with the LTO
pipeline. However, this should not be used if the user explicitly
disables optimizations as the default pipeline expects some
optimizatoins to be perfomed.
Fangrui Song [Mon, 11 Apr 2022 21:20:33 +0000 (14:20 -0700)]
[Support] Remove unused/uncompilable !HAVE_PTHREAD_GETSPECIFIC code path
lib/Support/ThreadLocal.cpp has been uncompilable since rL158346 (2012-06) when
`data` became a char array. The error looks like
```
...llvm/lib/Support/Unix/ThreadLocal.inc:66:57: error: array type 'char[8]' is not assignable
void ThreadLocalImpl::setInstance(const void* d) { data = const_cast<void*>(d);}
```
Florian Mayer [Sat, 9 Apr 2022 03:01:53 +0000 (20:01 -0700)]
[HWASan] allow symbolizer script to index binaries by build id.
Tested on an example callstack with misplaced binaries from Android.
Tested Regex against callstack without Build ID to confirm it still works.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D123437
Arthur Eubanks [Mon, 11 Apr 2022 21:06:40 +0000 (14:06 -0700)]
[test][clang] Use -clear-ast-before-backend instead of -flegacy-pass-manager in CommandLineTest
Arthur Eubanks [Mon, 11 Apr 2022 20:54:52 +0000 (13:54 -0700)]
[test] Remove various legacy pass manager tests
The new PM been the default for a while and we're in the process of removing the legacy PM optimization pipeline.
Fangrui Song [Mon, 11 Apr 2022 20:49:06 +0000 (13:49 -0700)]
[docs] Remove outdated -fexperimental-new-pass-manager for profile data remapping support
Arthur Eubanks [Mon, 11 Apr 2022 20:39:17 +0000 (13:39 -0700)]
[test] Remove references to -fno-legacy-pass-manager in tests
This has been the default for a while and we're in the process of removing the legacy PM optimization pipeline.
Fangrui Song [Mon, 11 Apr 2022 20:35:25 +0000 (13:35 -0700)]
Value::isTransitiveUsedByMetadataOnly: Don't repeatedly add an element to the worklist. NFC
Arthur Eubanks [Mon, 11 Apr 2022 20:14:22 +0000 (13:14 -0700)]
[test] Remove references to -fexperimental-new-pass-manager in tests
This has been the default for a while and we're in the process of removing the legacy PM optimization pipeline.
Richard [Mon, 11 Apr 2022 01:15:22 +0000 (19:15 -0600)]
[clang-tidy] Support parenthesized literals in modernize-macro-to-enum
When scanning a macro expansion to examine it as a candidate enum,
first strip off arbitrary matching parentheses from the outside in,
then examine what remains to see if it is Lit, +Lit, -Lit or ~Lit.
If not, reject it as a possible enum candidate.
Differential Revision: https://reviews.llvm.org/D123479
Fixes #54843
Jonas Devlieghere [Mon, 11 Apr 2022 17:42:59 +0000 (10:42 -0700)]
[lldb] Don't report progress in the REPL
Don't report progress events in the REPL. Most of the progress events
are debugger specific which are useful when you're debugging, but not so
much when you're waiting for the next line to be executed in the REPL.
This patch disables reporting of progress events when in REPL mode.
rdar://
91502950
Differential revision: https://reviews.llvm.org/D123426
Biplob Mishra [Mon, 11 Apr 2022 19:53:52 +0000 (20:53 +0100)]
AArch64 adding more tests to show the simple scenarios for or/and combine
Sanjay Patel [Mon, 11 Apr 2022 19:44:57 +0000 (15:44 -0400)]
[InstCombine] guard against splat-mul corner case
The test is already simplified, and I'm not sure how
to write a test to exercise the new clause. But it
protects the 2-bit pattern from miscompiling as noted
in D123453.
https://alive2.llvm.org/ce/z/QPyVfv
(If we managed to fall into the mul transform, it
would wrongly create a zero on this pattern.)
Arjun P [Sun, 10 Apr 2022 20:09:13 +0000 (21:09 +0100)]
[MLIR][Presburger][Simplex] symbolic lexmin: add some normalization heuristics
Normalize some of the division and inequality expressions used,
which can improve performance. Also deduplicate some of the
normalization functionality throughout the Presburger library.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D123314
Jez Ng [Mon, 11 Apr 2022 19:45:25 +0000 (15:45 -0400)]
[lld-macho][nfc] Use includeInSymtab for all symtab-skipping logic
{D123302} got me looking deeper at `includeInSymtab`. I thought it was a
little odd that there were excluded (live) symbols for which
`includeInSymtab` was false; we shouldn't have so many different ways to
exclude a symbol. As such, this diff makes the `L`-prefixed-symbol
exclusion code use `includeInSymtab` too. (Note that as part of our
support for `__eh_frame`, we will also be excluding all `__eh_frame`
symbols from the symtab in a future diff.)
Another thing I noticed is that the `emitStabs` code never has to deal
with excluded symbols because `SymtabSection::finalize()` already
filters them out. As such, I've updated the comments and asserts from
{D123302} to reflect this.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D123433
Arjun P [Sun, 10 Apr 2022 11:25:14 +0000 (12:25 +0100)]
[MLIR][Presburger] subtract: fix bug in the non-recursive implementation
When making the subtract implementation non-recursive, tail calls were
implemented by incrementing the level but not pushing a frame, and returning
was implemented as returning to the level corresponding to the number of frames in the stack.
This is incorrect, as there could be a case where we tail-recurse at `level`,
and then recurse at `level + 1`, pushing a frame. However, because the previous
frame was missing, this new frame would be interpreted as corresponding to
`level` and not `level + 1`. Fix this by removing the special handling of tail
calls and just doing them as normal recursion, as this is the simplest correct
implementation and handling them specifically would be a premature optimization.
The impact of this bug is only on performance as this can only lead to
unnecessary subtractions of the same disjuncts multiples times. As subtraction
is idempotent, and rationally empty disjuncts are always discarded, this
does not affect the output, so this patch does not include a regression test.
(This also does not affect termination.)
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D123327
Fangrui Song [Mon, 11 Apr 2022 19:29:25 +0000 (12:29 -0700)]
[Driver] Simplify hasFlag pattern with addOptInFlag/addOptOutFlag helpers
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D123468
Nicolai Hähnle [Fri, 8 Apr 2022 15:52:13 +0000 (10:52 -0500)]
AMDGPU/SDAG: Custom SETCC (i.e. ballot) is always uniform
The AMDGPUISD::SETCC node is like ISD::SETCC, but returns a lane mask
instead of a per-lane boolean. The lane mask is uniform.
This improves instruction selection for code patterns like
ctpop(ballot(x)), which can now use an S_BCNT1_* instruction instead
of V_BCNT_*.
GlobalISel already selects scalar instructions (an earlier commit
added a test case)..
Differential Revision: https://reviews.llvm.org/D123432
Mogball [Fri, 8 Apr 2022 16:41:31 +0000 (16:41 +0000)]
[mlir][ods] ODS-level Attribute Optimizations
This patch contains several ODS-level optimizations to attribute getters and getting.
1. OpAdaptors, when provided a DictionaryAttr, will instantiate an OperationName so that adaptor attribute getters can used cached identifiers.
2. Verifiers will take advantage of attributes stored in sorted order to get all required (non-optional, non-default valued, and non-derived) attributes in one pass over the attribute dictionary and verify that they are present.
3. ODS-generated attribute getters will use "subrange" lookup. Because the attributes are stored in sorted order and ODS knows which attributes are required, the number of required attributes less than and greater than each attribute can be computed. When searching for an attribute, the ends of the search range can be dropped.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D122430
Whitney Tsang [Mon, 11 Apr 2022 17:52:34 +0000 (13:52 -0400)]
[LoopUnroll] Always respect user unroll pragma
IMO when user provide unroll pragma, compiler should always respect it.
It is not clear to me why loop unroll pass currently ensure that the
unrolled loop size is limited by PragmaUnrollThreshold.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D119148
Daniel Grumberg [Thu, 7 Apr 2022 12:50:28 +0000 (13:50 +0100)]
[clang][extract-api] Emit "functionSignature" in SGF for ObjC methods.
- Split GlobalRecord into two distinct types to be able to introduce
has_function_signature type trait.
- Add has_function_signature type trait.
- Serialize function signatures as part of serializeAPIRecord for
records that are known to have a function signature.
Differential Revision: https://reviews.llvm.org/D123304
zijunzhao [Mon, 11 Apr 2022 17:09:34 +0000 (17:09 +0000)]
[libcxx] locale_bionic.h: skip ndk-version.h on Android platform
The Android platform does not have ndk-version.h, but it will always
have up-to-date libc headers, so it does not need any compatibility
code intended for past versions of NDK_MAJOR. If ndk-version.h is missing,
assume NDK_MAJOR is (conceptually) infinite
Bug: https://buganizer.corp.google.com/issues/
222341313
Test: None
Fraser Cormack [Mon, 11 Apr 2022 17:32:38 +0000 (18:32 +0100)]
[TableGen][NFC] Reflow Record accessor comments
Fraser Cormack [Mon, 11 Apr 2022 17:29:29 +0000 (18:29 +0100)]
[TableGen][NFC] Fix copy/paste error in comment
Nico Weber [Mon, 11 Apr 2022 15:01:34 +0000 (11:01 -0400)]
[llvm-lib] Add /WX, warn by default on empty inputs, add opt-out
lib.exe by default exits successfully without writing an output
file when no inputs are passed. llvm-lib has the same behavior,
for compatibility.
This behavior interacts poorly with build systems: If a static
library target had no inputs, llvm-lib would not produce an output
file, causing ninja (or make, or a similar system) to successfully
run that step, but then re-run it on the next build.
After this patch, llvm-lib emits a warning in this case, that with
/WX can be turned into an error. That way, ninja (or make, or...)
will mark the initial build as failed.
People who don't like the warning can use /ignore:emptyoutput to
suppress it.
The warning also points out the existing flag /llvmlibempty which
forces creation of an empty .lib file (this is an extension to lib.exe).
Differential Revision: https://reviews.llvm.org/D123517
Craig Topper [Mon, 11 Apr 2022 17:02:05 +0000 (10:02 -0700)]
[RISCV] Remove riscv-v-fixed-length-vector-elen-max command line option.
This was added before Zve extensions were defined. I think users
should use Zve32x or Zve32f now. Though we will lose support for limiting
ELEN to 16 or 8, but I hope no one was using that.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D123418
Craig Topper [Mon, 11 Apr 2022 17:01:16 +0000 (10:01 -0700)]
[RISCV] Remove ExtZvl enum from RISCVSubtarget. NFC
Having an enum with names that contain the string representation
of their value doesn't add any value. We can just use the numbers.
Reviewed By: kito-cheng, frasercrmck
Differential Revision: https://reviews.llvm.org/D123417
Martin Storsjö [Wed, 6 Apr 2022 11:13:54 +0000 (14:13 +0300)]
[lldb] Silence warnings about unused static variables in RegisterInfos_arm64.h
Move them to the only source file that included RegisterInfos_arm64.h
that actually used these variables.
This silences warnings like these:
In file included from lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp:42:
lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h:790:35: warning: ‘g_register_infos_mte’ defined but not used [-Wunused-variable]
790 | static lldb_private::RegisterInfo g_register_infos_mte[] = {
| ^~~~~~~~~~~~~~~~~~~~
lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h:787:35: warning: ‘g_register_infos_pauth’ defined but not used [-Wunused-variable]
787 | static lldb_private::RegisterInfo g_register_infos_pauth[] = {
| ^~~~~~~~~~~~~~~~~~~~~~
Differential Revision: https://reviews.llvm.org/D123206
Craig Topper [Mon, 11 Apr 2022 16:37:41 +0000 (09:37 -0700)]
[TargetLowering][RISCV] Allow truncation when checking if the arguments of a setcc are splats.
We're just trying to canonicalize here and won't be using the constant
value returned.
The attached test changes are because we were previously commuting
a seteq X, (splat_vector 0) because we also have (sub 0, X). The
0 is larger than the element type so we don't detect it as a splat
without the AllowTruncation flag. By preventing the commute we are
able to match it to the vmseq.vx instruction during isel. We only
look for constants on the RHS in isel.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D123256
Martin Storsjö [Mon, 28 Mar 2022 20:49:31 +0000 (23:49 +0300)]
[libcxx] [test] Fix back-to-back use of get_temp_file_name() on Windows
On non-Windows platforms, get_temp_file_name() uses `mkstemp()`,
which picks a unique name and creates a file atomically. The
Windows implementation uses `_mktemp_s()`, which doesn't create the
file. The documentation of `_mktemp_s()` also says that by design,
the function uses the same pattern within a process, as long as that
file doesn't exist.
Thus previously, two consecutive calls to `get_temp_file_name()`
on Windows returned the same file name.
Try to create the suggested temp file with `_O_EXCL` (marking the
file name as already used for future calls to `_mktemp_s`) and retry
if we weren't able to exclusively create the file.
This fixes the test failures on Windows observed in D122257.
Differential Revision: https://reviews.llvm.org/D122612
Louis Dionne [Mon, 11 Apr 2022 16:30:38 +0000 (12:30 -0400)]
[libc++][NFC] Use noexcept instead of _NOEXCEPT for code compiled into the library
We build the library with C++20 anyways, so we can use noexcept directly.
Siva Chandra Reddy [Fri, 8 Apr 2022 08:07:22 +0000 (08:07 +0000)]
[libc] Add a definition of pthread_attr_t and its getters and setters.
Not all attributes have been added to phtread_attr_t in this patch. They
will be added gradually in future patches.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D123423
Stephen Tozer [Tue, 1 Mar 2022 13:20:51 +0000 (13:20 +0000)]
[Dexter] Collate penalties of the same type into a single line for each
Currently in Dexter, every step at which a DexExpectWatchValue/Type does
not have the correct value is printed on a separate line. This patch
reduces the size of the text output by instead printing each incorrect
result (i.e. each incorrect value seen, 'Variable optimized out', and so
on) on its own line, alongside a list of the steps at which that result
was seen. This makes for much less spam in the output when watches are
missing or wrong for many steps.
Differential Revision: https://reviews.llvm.org/D120716
Vy Nguyen [Mon, 11 Apr 2022 15:58:31 +0000 (11:58 -0400)]
[lld][macho]Fix test to sort symbol table before dumping
Details: The test previously expected a specific order of those symbols, which is not guaranteed (could change simply due to hashing changes, etc).
So we change it to explicitly sort the symbols before checking contents.
PR/53026
Differential Revision: https://reviews.llvm.org/D116813
Sanjay Patel [Mon, 11 Apr 2022 15:16:11 +0000 (11:16 -0400)]
[InstCombine] try to fold low-mask of ashr to lshr
With one-use, we handle this via demanded-bits.
But We need to handle extra uses to improve issue #54750.
https://alive2.llvm.org/ce/z/aDYkPv
Sanjay Patel [Mon, 11 Apr 2022 14:48:47 +0000 (10:48 -0400)]
[InstCombine] add tests for low-mask of ashr; NFC
Florian Hahn [Mon, 11 Apr 2022 15:37:23 +0000 (17:37 +0200)]
Revert "[LICM] Only create load in pre-header when promoting load."
This reverts commit
42229b96bf94ec896d5c62fa643d83ba96e86eea.
This appears to cause crashes on multiple bots.
Kadir Cetinkaya [Fri, 8 Apr 2022 07:56:43 +0000 (09:56 +0200)]
[clangd] Performance improvements and cleanup
- Inline SymbolID hashing to header
- Don't collect references for symbols without a SymbolID
- Store referenced symbols, rather than separately storing decls and
macros.
- Don't defer ref collection to end of translation unit
- Perform const_cast when updating reference counts (~0.5% saving)
- Introduce caching for getSymbolID in SymbolCollector. (~30% saving)
- Don't modify symbolslab if there's no definition location
- Don't lex the whole file to deduce spelled tokens, just lex the
relevant piece (~8%)
Overall this achieves ~38% reduction in time spent inside
SymbolCollector compared to baseline (on my machine :)).
I'd expect the last optimization to affect dynamic index a lot more, I
was testing with clangd-indexer on clangd subfolder of LLVM. As
clangd-indexer runs indexing of whole TU at once, we indeed see almost
every token from every source included in the TU (hence lexing full
files vs just lexing referenced tokens are almost the same), whereas
during dynamic indexing we mostly index main file symbols, but we would
touch the files defining/declaring those symbols, and lex complete files
for nothing, rather than just the token location.
The last optimization is also a functional change (added test),
previously we used raw tokens from syntax::tokenize, which didn't
canonicalize trigraphs/newlines in identifiers, wheres
Lexer::getSpelling canonicalizes them.
Differential Revision: https://reviews.llvm.org/D122894
LLVM GN Syncbot [Mon, 11 Apr 2022 14:58:55 +0000 (14:58 +0000)]
[gn build] Port
c292b6066cca
Simon Pilgrim [Mon, 11 Apr 2022 14:34:53 +0000 (15:34 +0100)]
[AMDGPU] Regenerate insert_vector_dynelt.ll
Nikita Popov [Mon, 11 Apr 2022 14:46:26 +0000 (16:46 +0200)]
[SimplifyLibCalls] Remove unnecessary inbounds check
Even if the GEP is not inbounds, the GEP will have provenance of
the global, and accessing past the extent of the global would be
undefined behavior.
Nikita Popov [Mon, 11 Apr 2022 14:45:27 +0000 (16:45 +0200)]
[InstCombine] Add strlen of gep test without inbounds (NFC)
Louis Dionne [Thu, 3 Feb 2022 19:45:22 +0000 (14:45 -0500)]
[libc++] Implement P1007R3: std::assume_aligned
This supersedes and incoroporates content from both D108906 and D54966,
and also some original content.
Co-Authored-by: Marshall Clow <mclow.lists@gmail.com>
Co-Authored-by: Gonzalo Brito Gadeschi
Differential Revision: https://reviews.llvm.org/D118938
Florian Hahn [Mon, 11 Apr 2022 14:45:18 +0000 (16:45 +0200)]
[LICM] Only create load in pre-header when promoting load.
When only a store is sunk, there is no need to create a load in the
pre-header, as the result of the load will never get used.
The dead load can can introduce UB, if the function is marked as
writeonly.
Fixes #51248.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123473
Louis Dionne [Mon, 11 Apr 2022 14:38:26 +0000 (10:38 -0400)]
[libc++] Make .version.pass.cpp tests be compile-only tests
We don't really need to run them.
Groverkss [Mon, 11 Apr 2022 14:31:27 +0000 (20:01 +0530)]
[MLIR][Presburger] Make PWMAFunction inheritence from space private
This patch makes inheritence from PresburgerSpace for PWMAFunction private.
The reasoning for this patch is to prevent implicit conversion to
PresburgerSpace from PWMAFunction and to not expose all functions exposed by
PresburgerSpace in PWMAFunction.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D123076
gysit [Mon, 11 Apr 2022 14:23:53 +0000 (14:23 +0000)]
[mlir][tensor] Add pattern to fold ExtractSliceOp, PadOp chains.
The pattern folds chains of tensor::ExtractSliceOp, tensor::PadOp pairs if they pad different dimensions. Repeated tiling and padding of the tiled dimensions may introduce such chains. This canonicalization pattern folds these chains to a single tensor::ExtractSliceOp, tensor::PadOp pair that pads all dimensions at once, which simplifies vectorization and bufferization.
Example:
```mlir
%0 = tensor.extract_slice %input[16, 0] [%sz0, 64] [1, 1]
: tensor<64x64xf32> to tensor<?x64xf32>
%1 = tensor.pad %0 low[0, 0] high[%pw0, 0] { ...
} : tensor<?x64xf32> to tensor<8x64xf32>
%2 = tensor.extract_slice %1[0, 4] [8, %sz1] [1, 1]
: tensor<8x64xf32> to tensor<8x?xf32>
%res = tensor.pad %2 nofold low[0, 0] high[0, %pw1] { ...
} : tensor<8x?xf32> to tensor<8x4xf32>
```
folds into:
```mlir
%0 = tensor.extract_slice %input[16, 4] [%sz0, %sz1] [1, 1]
: tensor<64x64xf32> to tensor<?x?xf32>
%res = tensor.pad %0 nofold low[0, 0] high[%pw0, %pw1] { ...
} : tensor<?x?xf32> to tensor<8x4xf32>
```
Reviewed By: nicolasvasilache, hanchung
Differential Revision: https://reviews.llvm.org/D122722
Hans Wennborg [Fri, 8 Apr 2022 13:54:09 +0000 (15:54 +0200)]
[dllexport] odr-use constexpr default args for constructor closures
InstantiateDefaultCtorDefaultArgs() is supposed to mark default
constructor args as odr-used, since those args will be used when
emitting the constructor closure.
However, constexpr vars were not getting odr-used since
DoMarkVarDeclReferenced() defers them in MaybeODRUseExprs, and the code
was calling CleanupVarDeclMarking() which discarded those uses instead
of processing them.
(This came up in Chromium, crbug.com/1312086)
Differential revision: https://reviews.llvm.org/D123405
Ulrich Weigand [Mon, 11 Apr 2022 14:18:09 +0000 (16:18 +0200)]
[compiler-rt][SystemZ] Skip fuzzer/coverage.test
This test is currently marked as XFAIL on s390x, but it is randomly
passing, causing build bot issues. Setting as UNSUPPORTED for now.
Nikita Popov [Mon, 11 Apr 2022 12:36:37 +0000 (14:36 +0200)]
[Clang] Avoid legacy PM in some tests (NFC)
Either remove legacy PM run lines or change them to use new PM.
Nikolas Klauser [Sat, 9 Apr 2022 14:19:45 +0000 (16:19 +0200)]
[libc++] Remove the usage of __init in operator+
`operator+` currently calls `__init`. This patch removes the usage of implementation details.
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D123058
David Spickett [Wed, 6 Apr 2022 14:29:51 +0000 (14:29 +0000)]
[llvm][AArch64] Generate getExtensionFeatures from the list of extensions
This takes the AARCH64_ARCH_EXT_NAME in AArch64TargetParser.def and uses
it to generate all the "if bit is set add this feature name" code.
Which gives us a bunch that we were missing. I've updated testing
to include those and reordered them to match the order in the .def.
The final part of the test will catch any missing extensions if
we somehow manage to not generate an if block for them.
This has changed the order of cc1's "-target-feature" output so I've
updated some tests in clang to reflect that.
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D123296
LLVM GN Syncbot [Mon, 11 Apr 2022 12:47:08 +0000 (12:47 +0000)]
[gn build] Port
b4ad28da196d
Guoxiong Li [Mon, 11 Apr 2022 12:31:16 +0000 (08:31 -0400)]
[Clang] Override method ModuleImportRead in MultiplexASTDeserializationListener
Fixes https://llvm.org/PR54521
Differential Revision: https://reviews.llvm.org/D123452
Momchil Velikov [Mon, 11 Apr 2022 11:08:26 +0000 (12:08 +0100)]
[CodeGen] Async unwind - add a pass to fix CFI information
This pass inserts the necessary CFI instructions to compensate for the
inconsistency of the call-frame information caused by linear (non-CGA
aware) nature of the unwind tables.
Unlike the `CFIInstrInserer` pass, this one almost always emits only
`.cfi_remember_state`/`.cfi_restore_state`, which results in smaller
unwind tables and also transparently handles custom unwind info
extensions like CFA offset adjustement and save locations of SVE
registers.
This pass takes advantage of the constraints taht LLVM imposes on the
placement of save/restore points (cf. `ShrinkWrap.cpp`):
* there is a single basic block, containing the function prologue
* possibly multiple epilogue blocks, where each epilogue block is
complete and self-contained, i.e. CSR restore instructions (and the
corresponding CFI instructions are not split across two or more
blocks.
* prologue and epilogue blocks are outside of any loops
Thus, during execution, at the beginning and at the end of each basic
block the function can be in one of two states:
- "has a call frame", if the function has executed the prologue, or
has not executed any epilogue
- "does not have a call frame", if the function has not executed the
prologue, or has executed an epilogue
These properties can be computed for each basic block by a single RPO
traversal.
From the point of view of the unwind tables, the "has/does not have
call frame" state at beginning of each block is determined by the
state at the end of the previous block, in layout order.
Where these states differ, we insert compensating CFI instructions,
which come in two flavours:
- CFI instructions, which reset the unwind table state to the
initial one. This is done by a target specific hook and is
expected to be trivial to implement, for example it could be:
```
.cfi_def_cfa <sp>, 0
.cfi_same_value <rN>
.cfi_same_value <rN-1>
...
```
where `<rN>` are the callee-saved registers.
- CFI instructions, which reset the unwind table state to the one
created by the function prologue. These are the sequence:
```
.cfi_restore_state
.cfi_remember_state
```
In this case we also insert a `.cfi_remember_state` after the
last CFI instruction in the function prologue.
Reviewed By: MaskRay, danielkiss, chill
Differential Revision: https://reviews.llvm.org/D114545
Christian Sigg [Mon, 11 Apr 2022 09:29:32 +0000 (11:29 +0200)]
Remove deprecated `parseSourceFile/String()` overloads.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123490
Marius Brehler [Mon, 11 Apr 2022 11:45:44 +0000 (11:45 +0000)]
[mlir][emitc][nfc] Replace !emitc.opaque pointers
Replaces `!emitc.opaque` types used to express pointers with
`!emitc.ptr` types.
Sanjay Patel [Mon, 11 Apr 2022 11:09:47 +0000 (07:09 -0400)]
[SDAG] try to reduce compare of funnel shift equal 0
fshl (or X, Y), X, C ==/!= 0 --> or (shl Y, C), X ==/!= 0
fshl X, (or X, Y), C ==/!= 0 --> or (srl Y, BW-C), X ==/!= 0
This is similar to an existing setcc-of-rotate fold, but the
matching requires more checks for the more general funnel op:
https://alive2.llvm.org/ce/z/Ab2jDd
We are effectively decomposing the funnel shift into logical
shifts, reassociating, and removing a shift.
This should get us the final improvements for x86-64 that were
originally shown in D111530
( https://github.com/llvm/llvm-project/issues/49541 );
x86-32 still shows some SHLD/SHRD, so the pattern is not
matching there yet.
Differential Revision: https://reviews.llvm.org/D122919
Florian Hahn [Mon, 11 Apr 2022 11:27:38 +0000 (13:27 +0200)]
[LICM] Add additional test for load hoisting, simplify existing one.