Nemanja Ivanovic [Wed, 24 May 2023 16:12:19 +0000 (11:12 -0500)]
[PowerPC] Do not attempt to combine fptoui without FPCVT
Commit
8064caf83fb166b709bfe0e7641c5181341cb064 added a call
to a function that performs this combine without checking whether
the target supports FPCVT. This caused asserts to trip on BE bots
as the default target does not have this feature.
Mark de Wever [Tue, 23 May 2023 15:22:12 +0000 (17:22 +0200)]
[libc++] Fixes clang-tidy plugin for clang-tidy 17.
When using with clang-tidy 17 Node.getAttrName() sometimes returns a
nullptr. This caused segfaults in the CI.
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D151224
Kazu Hirata [Wed, 24 May 2023 16:05:50 +0000 (09:05 -0700)]
[ARM] Remove unused functions isExpImmValue, isExpImm, and isInvertedExpImm
The last uses were removed by:
commit
772e4931932270a82f38c83d4344c800b2f54eff
Author: Simon Tatham <simon.tatham@arm.com>
Date: Thu Jan 23 11:53:27 2020 +0000
Differential Revision: https://reviews.llvm.org/D151299
Matt Arsenault [Wed, 24 May 2023 14:59:42 +0000 (15:59 +0100)]
AMDGPU: Add some new tests for class undef/poison handling
Nikolas Klauser [Wed, 24 May 2023 15:46:13 +0000 (08:46 -0700)]
Revert "[libc++] Apply _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION only in classes that we have instantiated externally"
This reverts commit
b3c9150062dc4264afb4a3d2790f071c1ebe0743.
There were unexpected breakages downstream. @EricWF is investigating.
Harsh Menon [Wed, 24 May 2023 01:03:59 +0000 (18:03 -0700)]
[mlir] Add support for multiple uses in transform.structured.fuse_into_containing_op
In the tile and fuse of the first extract use, we add support
for scenarios where the results of the tiled op have uses
that are dominated by the scf.for_all. Specifically, we replace
the scf.for_all with a new scf.for_all that has an additional
shared_out and add the appropriate parallel insert slice op.
Differential Revision: https://reviews.llvm.org/D151275
Vitaly Buka [Wed, 24 May 2023 07:31:15 +0000 (00:31 -0700)]
[sanitizer] Add allocator_interface test
Hooks are in malloc_hook.cpp.
Mark de Wever [Wed, 17 May 2023 17:17:52 +0000 (19:17 +0200)]
[libc++][format] Removes the experimental status.
The code has been quite ready for a while now and there are no more ABI
breaking papers. So this is a good time to mark the feature as stable.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D150802
Guillaume Chatelet [Wed, 24 May 2023 14:43:00 +0000 (14:43 +0000)]
[libc] simplify test for getrandom
`getrandom` is implemented as a syscall.
We don't want to test linux implementation of the syscall. We just want to verify that it reacts as expected to sensible values.
Runtime before
```
[ RUN ] LlvmLibcGetRandomTest.InvalidFlag
[ OK ] LlvmLibcGetRandomTest.InvalidFlag (took 0 ms)
[ RUN ] LlvmLibcGetRandomTest.InvalidBuffer
[ OK ] LlvmLibcGetRandomTest.InvalidBuffer (took 0 ms)
[ RUN ] LlvmLibcGetRandomTest.ReturnsSize
[ OK ] LlvmLibcGetRandomTest.ReturnsSize (took 83 ms)
[ RUN ] LlvmLibcGetRandomTest.PiEstimation
[ OK ] LlvmLibcGetRandomTest.PiEstimation (took 9882 ms)
```
Runtime after
```
[ RUN ] LlvmLibcGetRandomTest.InvalidFlag
[ OK ] LlvmLibcGetRandomTest.InvalidFlag (took 0 ms)
[ RUN ] LlvmLibcGetRandomTest.InvalidBuffer
[ OK ] LlvmLibcGetRandomTest.InvalidBuffer (took 0 ms)
[ RUN ] LlvmLibcGetRandomTest.ReturnsSize
[ OK ] LlvmLibcGetRandomTest.ReturnsSize (took 0 ms)
[ RUN ] LlvmLibcGetRandomTest.CheckValue
[ OK ] LlvmLibcGetRandomTest.CheckValue (took 0 ms)
```
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D151336
Peter Klausler [Tue, 23 May 2023 20:55:23 +0000 (13:55 -0700)]
[flang] Fix SPACING() of very small values
SPACING() must return TINY() for zero arguments (which we do)
and also for subnormal values smaller than TINY() in absolute value,
which we get wrong. Fix folding and the runtime.
Differential Revision: https://reviews.llvm.org/D151272
Christian Ulmann [Wed, 24 May 2023 14:52:54 +0000 (14:52 +0000)]
[mlir][LLVM] Fix aliasing in intrinsic base class
This commit fixes a bug in the intrinsic base class that caused the
declaration of alias analysis attributes under a wrong condition.
Valentin Clement [Wed, 24 May 2023 14:57:38 +0000 (07:57 -0700)]
[mlir][openacc] destroy region on firstprivate.recipe is optional
The destroy region is optional but the verifier was enforcing it.
Update the verifier and make it clear in the definition.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D151239
Luke Lau [Mon, 22 May 2023 16:51:32 +0000 (17:51 +0100)]
[RISCV] Scalarize constant stores of fixed vectors if small enough
For stores of small fixed-length vector constants, we can store them
with a sequence of lui/addi/sh/sw to avoid the cost of building the
vector and the vsetivli toggle, provided the constant materialization
cost isn't too high.
This subsumes the optimisation for stores of zeroes in
4dc9a2c5b93682c12d7a80bbe790b14ddb301877
(This is a reapply of
0ca13f9d2701e23af2d000a5d8f48b33fe0878b7)
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151221
Luke Lau [Wed, 24 May 2023 14:52:19 +0000 (15:52 +0100)]
Revert "[RISCV] Scalarize constant stores of fixed vectors up to 32 bits"
This reverts commit
0ca13f9d2701e23af2d000a5d8f48b33fe0878b7.
Philip Reames [Wed, 24 May 2023 14:43:52 +0000 (07:43 -0700)]
[RISCV] Add test coverage for buildvector of FP values
Matt Arsenault [Wed, 24 May 2023 07:52:22 +0000 (08:52 +0100)]
Inline: Convert test to generated checks
Matt Arsenault [Wed, 24 May 2023 13:24:49 +0000 (14:24 +0100)]
IR: Avoid include in FMF header
Matthias Springer [Wed, 24 May 2023 14:30:57 +0000 (16:30 +0200)]
[mlir][Transforms] Fix mlir-config flag check
Boolean compiler flags (such as `DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS`) show up in `mlir-config.h` as preprocessor defines that are either 0 or 1. Use `#if` instead of `#ifdef`.
This should have been part of D144552.
Luke Lau [Mon, 22 May 2023 16:51:32 +0000 (17:51 +0100)]
[RISCV] Scalarize constant stores of fixed vectors up to 32 bits
For stores of small fixed-length vector constants, we can store them
with a sequence of lui/addi/sh/sw to avoid the cost of building the
vector and the vsetivli toggle.
Note that this only handles vectors that are 32 bits or smaller, but
could be expanded to 64 bits if we know that the constant
materialization cost isn't too high.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151221
Luke Lau [Mon, 22 May 2023 16:49:45 +0000 (17:49 +0100)]
[RISCV] Add test cases for storing small constant vectors
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151220
Doru Bercea [Wed, 24 May 2023 14:14:43 +0000 (10:14 -0400)]
Enable up to 64 arguments for outlined regions in OpenMP device code.
Co-Author: Fabio Luporini <fabio@devitocodes.com>
Review: https://reviews.llvm.org/D150134
Jie Fu [Wed, 24 May 2023 14:21:56 +0000 (22:21 +0800)]
[MergeICmps] Fix -Wsign-compare and typos (NFC)
/data/llvm-project/llvm/lib/Transforms/Scalar/MergeICmps.cpp:623:21: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigne
d long') [-Werror,-Wsign-compare]
for (int i = 0; i < Comparisons.size(); i++) {
~ ^ ~~~~~~~~~~~~~~~~~~
1 error generated.
Matthias Springer [Wed, 24 May 2023 14:14:47 +0000 (16:14 +0200)]
[mlir][Transforms] GreedyPatternRewriteDriver debugging: Detect faulty patterns
Compute operation finger prints to detect incorrect API usage in RewritePatterns. Does not work for dialect conversion patterns.
Detect patterns that:
* Returned `failure` but changed the IR.
* Returned `success` but did not change the IR.
* Inserted/removed/modified ops, bypassing the rewriter. Not all cases are detected.
These new checks are quite expensive, so they are only enabled with `-DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON`. Failures manifest as fatal errors (`llvm::report_fatal_error`) or crashes (accessing deallocated memory). To get better debugging information, run `mlir-opt -debug` (to see which pattern is broken) with ASAN (to see where memory was deallocated).
Differential Revision: https://reviews.llvm.org/D144552
Jay Foad [Wed, 24 May 2023 11:00:01 +0000 (12:00 +0100)]
[RegisterCoalescer] Fix updating LiveIntervals in joinReservedPhysReg
Live intervals for physical registers are calculated lazily on demand.
In a case like this:
16B %0:gpr32 = IMPLICIT_DEF
32B $wzr = COPY %0
if the live interval for $wzr did not already exist then the update code
in joinReservedPhysReg would create it with a definition at 32B, which
would remain even after the COPY was deleted.
Differential Revision: https://reviews.llvm.org/D151314
Jay Foad [Fri, 5 May 2023 09:51:28 +0000 (10:51 +0100)]
[MachineVerifier] Verify liveins for live-through segments
Differential Revision: https://reviews.llvm.org/D149947
Zhongyunde [Wed, 24 May 2023 13:16:41 +0000 (21:16 +0800)]
Reland [MergeICmps] Adapt to non-eq comparisons, bugfix
1.Fix the last runtime issue as some sequent comparisons need be spilted.
For the origin equal comparisons chain, the new spilted Icmp chain will
still be end with equal, while for the new not-equal comparisons chain,
the new spilted Icmp chain will still be end with equal, so should address
this carefully, see detail wih case partial_sequent_ne
2. Fix the mismatch of last link comparison
Thanks for @aeubanks, @glandium and @ayzhao report the runtime issue
and carefully examine.
Fix https://github.com/llvm/llvm-project/issues/59740.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141188
Matthias Springer [Wed, 24 May 2023 13:59:29 +0000 (15:59 +0200)]
[mlir][Transforms][NFC] GreedyPatternRewriteDriver: Reformat debug logic
Do not duplicate code that is performing actual work, put debug code around it.
Differential Revision: https://reviews.llvm.org/D151207
Jay Foad [Wed, 24 May 2023 12:28:07 +0000 (13:28 +0100)]
[AMDGPU] Switch to backwards scavenging in non-spill cases
When the scavenger is not allowed to spill, the only difference between
forward and backward should be the heuristics used to pick an available
register. Forwards scavenging tries to pick a register that can be used
again later in the BB; backwards scavenging tries to pick one that can
be used earlier.
Backwards scavenging is preferred because it does not rely on accurate
kill flags.
Differential Revision: https://reviews.llvm.org/D151323
Sheng [Wed, 24 May 2023 14:02:41 +0000 (22:02 +0800)]
[clang][NFC] Add a blank line in ReleaseNotes.rst
A buildbot has failed on the absence of the blank line at the end of the bullet list.
Sheng [Wed, 24 May 2023 13:45:03 +0000 (21:45 +0800)]
[clang][Sema] Fix a crash when instantiating a non-type template argument in a dependent scope.
The type alias template is not diagnosed when instantiating an expected non-type template argument in a dependent scope, causing ICE.
Besides that, the diagnostic message has been updated to account for the fact that the function template is not the only non-type template.
Fixes #62533
Reviewed By: #clang-language-wg, erichkeane
Differential Revision: https://reviews.llvm.org/D151062
Hansang Bae [Thu, 4 May 2023 16:06:12 +0000 (11:06 -0500)]
[OpenMP][libomp] Implement KMP_DLSYM_NEXT on Windows
The interop API routines try to invoke external entries, but we did
not have support for KMP_DLSYM_NEXT on Windows. Also added proper
guards for STUB build.
Differential Revision: https://reviews.llvm.org/D149892
Clement Courbet [Wed, 24 May 2023 13:21:50 +0000 (15:21 +0200)]
[clang-tidy] Really fix rG9182c679dde7
Correct link is clang-tidy/checks/performance/no-automatic-move
Clement Courbet [Wed, 24 May 2023 13:18:11 +0000 (15:18 +0200)]
[clang-tidy]Fix rG9182c679dde7cb6480e66b9231a53d43ad03908b
Fix bad link to documentation.
Matthias Springer [Wed, 24 May 2023 13:02:56 +0000 (15:02 +0200)]
[mlir][transform] Expose transform op from TrackingListener
This allows subclasses (such as the ErrorCheckingTrackingListener in IREE) to produce better error messages.
Differential Revision: https://reviews.llvm.org/D151322
Krzysztof Parzyszek [Tue, 23 May 2023 20:08:34 +0000 (13:08 -0700)]
[Hexagon] Add more debugging options and dumps to HVC
Krzysztof Parzyszek [Tue, 23 May 2023 20:01:24 +0000 (13:01 -0700)]
[Hexagon] Remap all instructions generated for aligned address/value in HVC
Only the last instruction was remapped before.
Clement Courbet [Mon, 22 May 2023 13:05:06 +0000 (15:05 +0200)]
[clang-tidy]performance-no-automatic-move: fix false negative on `const T&&` ctors.
We were only handling `const T&`/`T&&` ctor pairs, and we were missing uref-based ctors.
Differential Revision: https://reviews.llvm.org/D151092
Matthias Springer [Wed, 24 May 2023 12:55:09 +0000 (14:55 +0200)]
[mlir][IR] Hash nesting structure in OperationFingerPrint
The following ops currently have the same finger print, even though they are different:
```
func.func @test() {
"test.foo"() ({
"test.bar"() : () -> ()
}) : () -> ()
}
```
And:
```
func.func @test() {
"test.bar"() : () -> ()
"test.foo"() ({ }) : () -> ()
}
```
The SHA1 hash used in OperationFingerPrint is order-sensitive, but the ops are hashed in the same order (post-order traversal), so the hash is the same. Switching to pre-order traversal does not solve the issue; a similar example, where IR differs just in its nesting structure, can be constructed.
The problem is solved by hashing the parent op pointer. (Alternatively, a traversal over the IR that hashes scope markers (`{}`) could be used.)
Differential Revision: https://reviews.llvm.org/D151306
Tue Ly [Tue, 23 May 2023 20:47:38 +0000 (16:47 -0400)]
[libc] Reduce the sizes of some math tests that take longest time.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D151256
Takuya Shimizu [Wed, 24 May 2023 12:11:56 +0000 (21:11 +0900)]
[clang][Sema] `-Wshadow` warns about shadowings by static local variables
This patch makes `-Wshadow` warn about the shadowings by static local variables.
Fixes https://github.com/llvm/llvm-project/issues/62850
Differential Revision: https://reviews.llvm.org/D151214
Takuya Shimizu [Wed, 24 May 2023 12:21:23 +0000 (21:21 +0900)]
Reland: [clang][AST] Print name instead of type when diagnosing uninitialized subobject in constexpr variables
This patch improves the diagnostic on uninitialized subobjects in constexpr variables by modifying the diagnostic message to display the subobject's name instead of its type.
Fixes https://github.com/llvm/llvm-project/issues/58601
Differential Revision: https://reviews.llvm.org/D146358
Alex Zinenko [Mon, 22 May 2023 14:36:58 +0000 (14:36 +0000)]
[mlir] move PDL-related transform ops into an extension
The initial bring-up of the Transform dialect relied on PDL to provide
the default handle type (`!pdl.operation`) and the matching capability.
Both are now provided natively by the Transform dialect removing the
reason to have a hard dependency on the PDL dialect and its interpreter.
Move PDL-related transform operations into a separate extension.
This requires us to introduce a dialect state extension mechanism into
the Transform dialect so it no longer needs to know about PDL constraint
functions that may be injected by extensions similarly to operations and
types. This mechanism will be reused to connect pattern application
drivers and the Transform dialect.
This completes the restructuring of the Transform dialect to remove
overrilance on PDL.
Note to downstreams: flow that are using `!pdl.operation` with Transform
dialect operations will now require `transform::PDLExtension` to be
applied to the transform dialect in order to provide the transform
handle type interface for `!pdl.operation`.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D151104
Joseph Huber [Mon, 22 May 2023 20:50:55 +0000 (15:50 -0500)]
[AMDGPU] Add attribute to AMDGPU ctor / dtor to indicate single threadedness
We only expect these ctor / dtor functions to be called with a single
thread. Add the appropriate attributes to indicate this to the backend.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D151153
Michael Buch [Tue, 23 May 2023 23:01:47 +0000 (00:01 +0100)]
[lldb][DataFormatter] Add dereference support to libstdcpp std::shared_ptr formatter
This mimicks the implementation of the libstdcpp std::unique_ptr
formatter.
This has been attempted several years ago in
`
0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94` but was reverted in
`
e7dd3972094c2f2fb42dc9d4d5344e54a431e2ce`.
The difference to the original patch is that we now maintain
a `$$dereference$$` member and we only store weak pointers
to the other children inside the synthetic frontend. This is
what the libc++ formatters do to prevent the recursion mentioned
in the revert commit.
Tue Ly [Tue, 23 May 2023 20:20:47 +0000 (16:20 -0400)]
[libc][bazel] Add log, log2, log10, log1p to bazel layout.
Add log, log2, log10, log1p and their unit tests to bazel layout.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D151252
LLVM GN Syncbot [Wed, 24 May 2023 10:54:20 +0000 (10:54 +0000)]
[gn build] Port
ced90d1ff64a
Alexandros Lamprineas [Thu, 11 May 2023 23:07:49 +0000 (00:07 +0100)]
[FuncSpec] Improve the accuracy of the cost model.
Instead of blindly traversing the use-def chain of constant arguments,
compute known constants along the way. Stop as soon as a user cannot
be replaced by a constant. Keep it light-weight by handling some basic
instruction types.
Differential Revision: https://reviews.llvm.org/D150464
Kiran Chandramohan [Wed, 24 May 2023 08:34:47 +0000 (09:34 +0100)]
Add OpenMPToLLVM conversion pattern for taskgroup
Fixes part of the issue in https://github.com/llvm/llvm-project/issues/62013
Reviewed By: psoni2628
Differential Revision: https://reviews.llvm.org/D151206
donald chen [Wed, 24 May 2023 10:05:34 +0000 (12:05 +0200)]
[mlir] [scf] Add RegionBranchOpInterface to scf.forall and scf.parallel op
Add RegionBranchOpIntefface to scf.forall and scf.parallel op to make analysis trace through subregions.
Differential Revision: https://reviews.llvm.org/D151287
Dominik Montada [Mon, 15 May 2023 09:51:30 +0000 (09:51 +0000)]
[TOSA] Fold consecutive concats on same axis
Consecutive concats that happen on the same axis can be folded into a
single, bigger concat. This patch implements this folding by
implementing the tosa::ConcatOp::fold method.
Differential Revision: https://reviews.llvm.org/D151210
Sergei Barannikov [Wed, 24 May 2023 09:57:07 +0000 (12:57 +0300)]
[CodeGen] Skip null physical register in AntiDepBreaker (NFCI)
D151036 adds an assertions that prohibits iterating over sub- and
super-registers of a null register. This is already the case when
iterating over register units of a null register, and worked by
accident for sub- and super-registers.
The only place where the assertion is currently triggering is in
CriticalAntiDepBreaker::ScanInstruction. Other places are changed
in case new assertions are added and should be harmless otherwise.
Differential Revision: https://reviews.llvm.org/D151288
Marco Elver [Wed, 24 May 2023 09:32:33 +0000 (11:32 +0200)]
[compiler-rt] Always use INTERCEPTOR()+ALIAS()+WRAP() to create interceptor alias
Do not open code creation of an interceptor alias to another
interceptor. Instead, use INTERCEPTOR() + ALIAS() + WRAP.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D151219
Marco Elver [Wed, 24 May 2023 09:32:28 +0000 (11:32 +0200)]
[TSan] Remove unused setjmp definitions
The __interceptor_*setjmp() definitions appear to have been defined for
the purpose of TSAN_INTERCEPT(), but on non-Mac systems, it seems
TSAN_INTERCEPT() isn't even being used anymore for setjmp.
Remove them. Nothing should call them anyway (due to CHECK-fail), so
having the linker fail is better than failing at runtime.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D151218
Marco Elver [Wed, 24 May 2023 09:32:21 +0000 (11:32 +0200)]
[HWASan] Use ASM_WRAPPER_NAME instead of __interceptor_*
Use ASM_WRAPPER_NAME to produce the name of the __interceptor_*
functions.
NFC.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D151217
Marco Elver [Wed, 24 May 2023 09:31:40 +0000 (11:31 +0200)]
[compiler-rt] Simplify ALIAS() attribute macro
Most uses of ALIAS() are in conjunction with WRAPPER_NAME().
Simplify the code and just make ALIAS() turn its argument into a string
(similar to Linux kernel's __alias macro). This in turn allows removing
WRAPPER_NAME().
NFC.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D151216
Christian Ulmann [Wed, 24 May 2023 09:05:21 +0000 (09:05 +0000)]
[mlir][transform] Fix merge_handle asm format
This commit ensures that the merge_handles operation prints its
`deduplicate` attribute as an optional keyword instead of "unit".
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D151310
bipmis [Wed, 24 May 2023 09:36:11 +0000 (10:36 +0100)]
[AggressiveInstCombine] Handle the nested GEP/BitCast scenario in Load Merge.
This seems to be an issue currently where there are nested/chained GEP/BitCast Pointers.
The patch generates a new GEP for the wider load to avoid dominance problems.
Differential Revision: https://reviews.llvm.org/D150864
Luke Lau [Mon, 22 May 2023 14:34:51 +0000 (15:34 +0100)]
[RISCV] Scalarize small fixed vector copies < XLEN
For small fixed-length vector copies like
vsetivli zero, 2, e16, m1, ta, ma
vle16.v v8, (a0)
vse16.v v8, (a1)
We can scalarize them if the total vector size < XLEN:
lw a0, 0(a0)
sw a0, 0(a1)
This patch adds a DAG combine to do so, reusing much of the existing
logic in https://reviews.llvm.org/D150717
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151103
Luke Lau [Mon, 22 May 2023 14:32:24 +0000 (15:32 +0100)]
[RISCV] Add test for small vector copies
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D151211
Nikita Popov [Wed, 24 May 2023 09:14:26 +0000 (11:14 +0200)]
[KnownBits] Reduce number of overflow checks for uadd/sub_sat (NFCI)
Only check for overflow on the min/max values, don't also check
for predicates in addition to that.
Benjamin Kramer [Wed, 24 May 2023 09:14:18 +0000 (11:14 +0200)]
Nikita Popov [Wed, 24 May 2023 09:02:16 +0000 (11:02 +0200)]
[KnownBits] Use early return for unknown LHS for shifts (NFC)
Make it clear that the leading/trailing zeros handling is only
relevant for the unknown LHS case, which is a fast path to avoid
the full shift amount loop in cases where it would not produce
better results.
Nikita Popov [Wed, 24 May 2023 08:52:18 +0000 (10:52 +0200)]
[ValueTracking] Check for known bits conflict for shl nsw (PR62908)
I removed the conflict check from computeKnownBitsFromShiftOperator()
in D150648 assuming that this is now handled on the KnownBits side.
However, the nsw handling is still inside ValueTracking, so we
still need to handle conflicts there. Restore the check closer to
where it is relevant.
Fixes https://github.com/llvm/llvm-project/issues/62908.
Nikita Popov [Wed, 24 May 2023 08:39:32 +0000 (10:39 +0200)]
[InstCombine] Directly iterate over users (NFC)
After
3a223f1eafe331508d171b519df8a4984791ab48, it's no longer
necessary to put the users into a vector. We can directly iterate
them instead.
Nikita Popov [Wed, 24 May 2023 08:32:20 +0000 (10:32 +0200)]
[KnownBits] Check for conflict-freedom in exhaustive tests
And make sure udiv() Exact does not produce conflicts.
Nico Weber [Wed, 24 May 2023 08:25:56 +0000 (04:25 -0400)]
[gn build] Port
1c9a8004ed88
Jens Massberg [Tue, 23 May 2023 11:12:01 +0000 (13:12 +0200)]
[Clang][C++20] Error out if parameter types of a defaulted comparion operator are not all the same.
This fixes #62880
Differential Revision: https://reviews.llvm.org/D151200
luxufan [Wed, 24 May 2023 07:46:44 +0000 (15:46 +0800)]
[LVI] Don't compute range on not guaranteed not to be undef condition in SelectInst
Fixes:https://github.com/llvm/llvm-project/issues/62901
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151295
Joshua Cao [Sun, 21 May 2023 20:30:26 +0000 (13:30 -0700)]
[LoopUnroll] Peel iterations based on select conditions
This also allows us to peel loops with a `select`:
```
for (int i = 0; i <= N; ++i);
f3(i == 0 ? a : b); // select instruction
```
into:
```
f3(a); // peel one iteration
for (int i = 1; i <= N; ++i)
f3(b);
```
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151052
Joshua Cao [Sat, 20 May 2023 20:07:19 +0000 (20:07 +0000)]
[LoopUnroll] Add tests for peeling iterations based on select, and, or
conditions
Kadir Cetinkaya [Wed, 24 May 2023 07:46:08 +0000 (09:46 +0200)]
[clangd] Fix add-using tweak on declrefs with template arguments
Differential Revision: https://reviews.llvm.org/D151303
Nikita Popov [Wed, 24 May 2023 07:52:43 +0000 (09:52 +0200)]
[InstCombine] Fix crash due to early extractvalue removal
Fixes the issue reported at https://github.com/llvm/llvm-project/commit/
4b8320868c9e32d1448c81ca76dba2a6b9f374cd#commitcomment-
114671248.
The extractvalue instructions may still be used by the calling code
in some cases. Rather than trying to figure out which extracts are
safe to remove and which aren't, add them to the worklist so they
will get DCEd by the main loop.
Matt Arsenault [Thu, 13 Apr 2023 14:25:18 +0000 (10:25 -0400)]
ValueTracking: Handle constrained_sqrt in computeKnownFPClass
With this, the body of CannotBeNegativeZero can be dropped.
Matt Arsenault [Tue, 23 May 2023 10:04:39 +0000 (11:04 +0100)]
AMDGPU: Drop FP_ROUND second value check
This doesn't mean what I thought it meant and is an optimization
hint flag.
Matt Arsenault [Tue, 23 May 2023 14:48:38 +0000 (15:48 +0100)]
Inline: Convert test to generated checks
Matt Arsenault [Tue, 23 May 2023 09:36:07 +0000 (10:36 +0100)]
Convert unit test to opaque pointers
Chuanqi Xu [Wed, 24 May 2023 02:13:31 +0000 (10:13 +0800)]
Recommit [C++20] [Modules] Serialize the evaluated constant values for VarDecl
Close https://github.com/llvm/llvm-project/issues/62796.
Previously, we didn't serialize the evaluated result for VarDecl. This
caused the compilation of template metaprogramming become slower than
expect. This patch fixes the issue.
This is a recommit tested with asan built clang.
Théo Degioanni [Wed, 24 May 2023 07:25:02 +0000 (07:25 +0000)]
[mlir] [sroa] Add support for MemRef.
This patch implements SROA interfaces for MemRef, up to a given fixed
size.
Reviewed By: gysit, Dinistro
Differential Revision: https://reviews.llvm.org/D151102
Sergei Barannikov [Wed, 24 May 2023 05:10:35 +0000 (08:10 +0300)]
[AMDGPU] Check if register is non-null before calling isSubRegisterEq (NFCI)
D151036 adds an assertions that prohibits iterating over sub- and
super-registers of a null register. This is already the case when
iterating over register units of a null register, and worked by
accident for sub- and super-registers.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D151289
Kazu Hirata [Wed, 24 May 2023 06:37:38 +0000 (23:37 -0700)]
[IR] Use LLVMContext::MD_nontemporal (NFC)
Aiden Grossman [Wed, 24 May 2023 02:46:38 +0000 (02:46 +0000)]
[clang][X86] Add __cpuidex function to cpuid.h
MSVC has a `__cpuidex` function implemented to call the underlying cpuid
instruction which accepts a leaf, subleaf, and data array that the output
data is written into. This patch adds this functionality into clang
under the cpuid.h header. This also makes clang match GCC's behavior.
GCC has had `__cpuidex` in its cpuid.h since 2020.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150646
LLVM GN Syncbot [Wed, 24 May 2023 05:58:04 +0000 (05:58 +0000)]
[gn build] Port
bea2ff655068
Chuanqi Xu [Wed, 24 May 2023 05:55:45 +0000 (13:55 +0800)]
Revert "[C++20] [Modules] Serialize the evaluated constant values for VarDecl"
This reverts commit
c0d6f85e3ae8bcfdb7217d165314f01c1a4af9ae. The asan
bot detected a memory leak after this patch. Revert it for now.
Mark de Wever [Thu, 20 Apr 2023 19:03:40 +0000 (21:03 +0200)]
[libc++] Untangles invoke.
The type traits parts are moved to a type_traits detail header.
This was discovered while working on modules.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D150538
Mark de Wever [Sat, 20 May 2023 10:38:57 +0000 (12:38 +0200)]
[libc++] Adds C++26 support.
Clang has been updated to support C++26, this adds the same support for
libc++. At the moment C++23 and C++26 are identical. During the next
plenary in June the first C++26 papers will be voted on.
Note like Clang this patch uses C++26 is the internal part and C++2c in
the user visible part.
Depends on D150795
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D151026
Owen Pan [Wed, 24 May 2023 05:11:45 +0000 (22:11 -0700)]
Revert "[clang-format] Fix indentation for selective formatting"
This reverts commit
72ab89e3197cc1bee3b9774edb504690e3e43ed0.
Reverted due to bots failures e.g.
https://lab.llvm.org/buildbot/#/builders/139/builds/41339.
Kazu Hirata [Wed, 24 May 2023 05:10:59 +0000 (22:10 -0700)]
[lldb] Fix typos in documentation
Louis Dionne [Tue, 23 May 2023 18:39:37 +0000 (11:39 -0700)]
[libc++][NFC] Refactor helper method into the Lit test format
Differential Revision: https://reviews.llvm.org/D151238
Louis Dionne [Thu, 11 May 2023 14:05:25 +0000 (10:05 -0400)]
[libc++] Complete refactor of tests for operator new
I stumbled upon the `operator new` and `operator new[]` tests while
investigating an issue with `operator new` when exceptions are disabled,
and I realized that our test coverage was incomplete. This patch refactors
all the `operator new` and `operator new[]` tests to add consistency and
better coverage for scenarios in which it should be possible to override
an operator indirectly by defining another one (for example new(size_t, nothrow)
should use new(size_t) if it has been provided).
This is intended to be a NFC setting up the terrain for some refactoring
work and bug fix in operator new.
Differential Revision: https://reviews.llvm.org/D150408
wangpc [Wed, 24 May 2023 03:32:25 +0000 (11:32 +0800)]
[TableGen] Unify the priority of variables
In D148197, we have made `defvar` statement able to refer to class
template arguments. However, the priority of class/multiclass
template argument is higher than variables defined by `defvar`, which
is a little counterintuitive.
In this patch, we unify the priority of variables. Each pair of
braces introduces a new scope, which may contain some additional
variables like template arguments, loop iterators, etc. We can
define local variables inside this scope via `defvar` and these
variables are of higher priority than additional variables. This
means that `defvar` will shadow additional variables with the same
name. The scope can be nested, and we use the innermost variable.
This make variables defined by `defvar` prior to class/multiclass
template arguments, loop iterators, etc. The shadow rules now are:
* `V` in a record body shadows a global `V`.
* `V` in a record body shadows template argument `V`.
* `V` in template arguments shadows a global `V`.
* `V` in a `foreach` statement list shadows any `V` in surrounding record or global scopes.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D149016
Joshua Cao [Fri, 28 Apr 2023 06:43:01 +0000 (23:43 -0700)]
[BBUtils][NFC] Delete SplitBlockAndInsertIfThen with DT.
The method is marked for deprecation. Delete the method and move all of
its consumers to use the DomTreeUpdater version.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D149428
Chuanqi Xu [Wed, 24 May 2023 03:41:26 +0000 (11:41 +0800)]
[NFC] Fix the warning for dangling pointer for
c0d6f85e3ae8bc
The bot notes a warning-converted-error for the dangling pointer. And
the patch fixes that.
Sedenion [Wed, 24 May 2023 02:10:14 +0000 (19:10 -0700)]
[clang-format] Fix indentation for selective formatting
The problem was that the LevelIndentTracker remembered
the indentation level of previous deeper levels when
leaving a scope. Afterwards, when it entered again a
deeper level, it blindly reused the the previous
indentation level. In case of the --lines option
configured such that the previous deeper level was not
formatted, that previous level was whatever happened
to be there in the source code. The formatter simply
believed it.
This is fixed by letting the LevelIndentTracker forget
the previous deeper levels when stepping out of them
(=> change in LevelIndentTracker::nextLine()).
Note that this used to be the case until LLVM 14.0.6,
but was changed in
https://github.com/llvm/llvm-project/issues/56352 to
fix a crash. Our commit here essentially reverts that
crash fix. It seemed to have been incorrect. The proper
fix is to set the AnnotedLine::Level of joined lines
correctly (=> change in LineJoiner::join()).
See
https://github.com/llvm/llvm-project/issues/59178#issuecomment-
1542637781
for some more details.
Fixes #58464.
Fixes #59178.
Differential Revision: https://reviews.llvm.org/D151047
Chuanqi Xu [Wed, 24 May 2023 02:13:31 +0000 (10:13 +0800)]
[C++20] [Modules] Serialize the evaluated constant values for VarDecl
Close https://github.com/llvm/llvm-project/issues/62796.
Previously, we didn't serialize the evaluated result for VarDecl. This
caused the compilation of template metaprogramming become slower than
expect. This patch fixes the issue.
Bing1 Yu [Wed, 24 May 2023 02:15:23 +0000 (10:15 +0800)]
[LegalizeType][X86] Support WidenVecRes_AssertZext and SplitVecRes_AssertZext for ISD::AssertZext during LegalizeType procedure
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150941
Rahman Lavaee [Wed, 24 May 2023 01:44:10 +0000 (01:44 +0000)]
[Propeller] Add HasIndirectBranch to BBEntry::Metadata.
This information helps to avoid considering cloning for blocks with indirect branches.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D150611
Galen Elias [Tue, 23 May 2023 03:11:17 +0000 (20:11 -0700)]
[clang-format] Adjust braced list detection (reland 6dcde65)
This is a retry of https://reviews.llvm.org/D114583, which was backed
out for regressions.
Clang Format is detecting a nested scope followed by another open brace
as a braced initializer list due to incorrectly thinking it's matching a
braced initializer at the end of a constructor initializer list which is
followed by the body open brace.
Unfortunately, UnwrappedLineParser isn't doing a very detailed parse, so
it's not super straightforward to distinguish these cases given the
current structure of calculateBraceTypes. My current hypothesis is that
these can be disambiguated by looking at the token preceding the
l_brace, as initializer list parameters will be preceded by an
identifier, but a scope block generally will not (barring the MACRO
wildcard).
To this end, I am adding tracking of the previous token to the LBraceStack
to help scope this particular case.
TokenAnnotatorTests cherry picked from https://reviews.llvm.org/D150452.
Fixes #33891.
Fixes #52911.
Differential Revision: https://reviews.llvm.org/D150403
Owen Pan [Wed, 24 May 2023 01:33:37 +0000 (18:33 -0700)]
[clang-format] Revert 6dcde65 due to missing commit message title
This reverts commit
6dcde658b2380d7ca1451ea5d1099af3e294ea16.
Aart Bik [Tue, 23 May 2023 20:47:10 +0000 (13:47 -0700)]
[mlir][sparse][gpu] fix F32 bug for SpMV and SpMM
The alpha/beta variables, residing on the host, should have the
32-bit or 64-bit width of the result type. It was formerly always
passed as double.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D151255
Leonard Chan [Tue, 23 May 2023 23:38:29 +0000 (23:38 +0000)]
[compiler-rt] Allow 64-bit sanitizer allocator to be used if using RISCV64 and Fuchsia
This way, Fuchsia can use the 64-bit allocator settings in D151157 without changing the default behavior for others.
Differential Revision: https://reviews.llvm.org/D151159