Kazu Hirata [Wed, 22 Mar 2023 07:31:48 +0000 (00:31 -0700)]
[llvm] Use llvm::isNullConstant (NFC)
Max Kazantsev [Wed, 22 Mar 2023 07:25:34 +0000 (14:25 +0700)]
[Test] Add hanging test for D146276
The patch was reverted because of hang, adding the test so that this doesn't
happen again.
Kazu Hirata [Wed, 22 Mar 2023 07:25:13 +0000 (00:25 -0700)]
[X86] Use llvm::isOneConstant (NFC)
Ethan Luis McDonough [Thu, 2 Mar 2023 18:29:05 +0000 (12:29 -0600)]
[flang] Feature list plugin
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage.
Updated to fix build issues.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D143704
paperchalice [Wed, 22 Mar 2023 06:13:59 +0000 (23:13 -0700)]
[MCContext] Use `const Twine &` in symbol creation methods. NFC
All of these methods will invoke `getOrCreateSymbol(const Twine &Name)`, using `Twine` here makes these methods more flexible.
Differential Revision: https://reviews.llvm.org/D145923
Nicolas Vasilache [Mon, 20 Mar 2023 21:22:00 +0000 (14:22 -0700)]
[mlir][memref] Use folded composed affine apply ops in FoldMemRefAliasOps
Creating maximally folded and composd affine.apply operation during
FoldMemRefAliasOps composes better with other transformations without having
to interleave canonicalization passes.
Differential Revision: https://reviews.llvm.org/D146515
Ben Shi [Thu, 9 Mar 2023 04:04:54 +0000 (12:04 +0800)]
[clang][driver] Enable '-flto' on AVR
Reviewed By: MaskRay
Closes https://github.com/llvm/llvm-project/issues/55940
Differential Revision: https://reviews.llvm.org/D145646
Bruno Cardoso Lopes [Thu, 9 Mar 2023 00:00:02 +0000 (16:00 -0800)]
[Coroutines] Implement fix for cwg2563 issue and enable RVO under certain conditions
- The cwg2563 issue is fixed by delaying GRO initialization only when the types
mismatch between GRO and function return.
- When the types match directly initialize, which indirectly enables RVO to
kick in, partially restores behavior introduced in
https://reviews.llvm.org/D117087.
- Add entry to release notes.
Background:
https://github.com/llvm/llvm-project/issues/56532
https://cplusplus.github.io/CWG/issues/2563.html
https://github.com/cplusplus/papers/issues/1414
Differential Revision: https://reviews.llvm.org/D145641
Bruno Cardoso Lopes [Tue, 7 Mar 2023 20:51:34 +0000 (12:51 -0800)]
[Coroutines] Fix premature conversion of return object
Fix https://github.com/llvm/llvm-project/issues/56532
Effectively, this reverts behavior introduced in https://reviews.llvm.org/D117087,
which did two things:
1. Change delayed to early conversion of return object.
2. Introduced RVO possibilities because of early conversion.
This patches fixes (1) and removes (2). I already worked on a follow up for (2)
in a separated patch. I believe it's important to split these two because if the RVO
causes any problems we can explore reverting (2) while maintaining (1).
Notes on some testcase changes:
- `pr59221.cpp` changed to `-O1` so we can check that the front-end honors
the value checked for. Sounds like `-O3` without RVO is more likely
to work with LLVM optimizations...
- Comment out delete members `coroutine-no-move-ctor.cpp` since behavior
now requires copies again.
Differential Revision: https://reviews.llvm.org/D145639
Ting Wang [Wed, 22 Mar 2023 04:32:18 +0000 (00:32 -0400)]
[PowerPC][NFC] add const-nonsplat-array-init.ll
When doing store constant vector/scalar, some duplicated values can be reused.
Add test case and will show combiner can improve these.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D146500
yijia1212 [Wed, 22 Mar 2023 04:26:09 +0000 (21:26 -0700)]
update dependency for TransformOpsPyTdFiles
update dependency for TransformOpsPyTdFiles
Differential Revision: https://reviews.llvm.org/D146605
Craig Topper [Wed, 22 Mar 2023 02:48:20 +0000 (19:48 -0700)]
[RISCV] Clear mayRaiseFPException for fclass.d instruction.
We got it right for fclass.s and fclass.h.
Craig Topper [Wed, 22 Mar 2023 02:42:27 +0000 (19:42 -0700)]
[RISCV] Clear mayRaiseFPException for Zfa fmvh.x.d and fmvp.d.x instructions.
Craig Topper [Wed, 22 Mar 2023 02:15:30 +0000 (19:15 -0700)]
[RISCV] Move fli selection in RISCVISelDAGToDAG.cpp. NFC
We custom isel for ConstantFP that has higher priority than isel
patterns. We were previously detecting valid FP constants for fli
to early exit from the custom code. This detection called
getLoadFPImm. Then we would run the isel patterns which would call
getLoadFPImm a second time.
With a little bit more code we can directly select the fli instruction
in the custom handler and avoid a second call.
Remove the incorrect mayRaiseFPException flag from the FLI instructions.
Reviewed By: joshua-arch1
Differential Revision: https://reviews.llvm.org/D146093
Michael Francis [Tue, 21 Mar 2023 22:06:47 +0000 (22:06 +0000)]
[AIX][r] Do not call AddFilePathLibArgs with -r
We do not want to add file path lib args when -r is specified.
Differential Revision: https://reviews.llvm.org/D146578
Philip Reames [Wed, 22 Mar 2023 02:12:35 +0000 (19:12 -0700)]
[LFTR] Minor style cleanup [nfc]
Philip Reames [Wed, 22 Mar 2023 02:08:34 +0000 (19:08 -0700)]
[LFTR] Use evaluateAtIteration in genLoopLimit [nfc]
Note that the comments being removed appear to be very out of sync with the actual code in question.
Differential Revision: https://reviews.llvm.org/D146468
Philip Reames [Wed, 22 Mar 2023 02:04:14 +0000 (19:04 -0700)]
[LFTR] Simplify another case under assumption exit counts are integers [nfc]
This invariant was introduced in
8f3d16905d75b07a933d01dc29677fe5867c1b3e.
Johannes Doerfert [Tue, 21 Mar 2023 20:40:36 +0000 (13:40 -0700)]
[OpenMP] Remove shadow pointer map and introduce consistent locking
The shadow pointer map was problematic as we scanned an entire list if
an entry had shadow pointers. The new scheme stores the shadow pointers
inside the entries. This allows easy access without any search. It also
helps us, but also makes it necessary, to define a consistent locking
scheme. The implicit locking of entries via TargetPointerResultTy makes
this pretty effortless, however one has to:
- Lock HDTTMap before locking an entry.
- Do not lock HDTTMap while holding an entry lock.
- Hold the entry lock to read or modify an entry.
The changes to submitData and retrieveData have been made to ensure 2
when the LIBOMPTARGET_INFO flag is used. Most everything else happens by
itself as TargetPointerResultTy acts as a lock_guard for the entry. It
is a little complicated when we deal with multiple entries, especially
as they can be equal. However, one can still follow the rules with
reasonable effort.
LookupResult are now finally also locking the entry before it is
inspected. This is good even if we haven't run into a problem yet.
Differential Revision: https://reviews.llvm.org/D123446
Johannes Doerfert [Wed, 22 Mar 2023 00:43:26 +0000 (17:43 -0700)]
[OpenMP] Remove restriction on the thread count for parallel regions
Differential Revision: https://reviews.llvm.org/D112194
Johannes Doerfert [Tue, 21 Mar 2023 22:48:11 +0000 (15:48 -0700)]
[OpenMP] Avoid zero size copies to the device
This unblocks one of the XFAIL tests for AMD, though we need to work
around the missing printf still.
Differential Revision: https://reviews.llvm.org/D146592
Joseph Huber [Wed, 22 Mar 2023 02:00:46 +0000 (21:00 -0500)]
[libc] Don't install the GPU startup code for now
Summary:
This startup code is only intended to be used internally, we shouldn't
export it under a conflicting name. In the future we may package this in
an exportable format.
Craig Topper [Wed, 22 Mar 2023 01:52:05 +0000 (18:52 -0700)]
[RISCV] Use LBU for extloadi8.
The Zcb extension has c.lbu, but not c.lb. This patch makes us
prefer LBU over LB if we have a choice which will enable more
compression opportunities.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D146270
Jon Chesterfield [Wed, 22 Mar 2023 01:49:41 +0000 (01:49 +0000)]
[amdgpu][nfc] clang-format AMDGPULowerModuleLDS for easier merging
Philip Reames [Wed, 22 Mar 2023 01:34:40 +0000 (18:34 -0700)]
[SCEV] Add coverage for a missing flag inference case
Jon Chesterfield [Wed, 22 Mar 2023 01:23:19 +0000 (01:23 +0000)]
[amdgpu][nfc] Extract more functions in LowerModuleLDS, mark more methods static
Kazu Hirata [Wed, 22 Mar 2023 00:40:35 +0000 (17:40 -0700)]
[llvm] Use ConstantInt::{isZero,isOne} (NFC)
Peiming Liu [Tue, 21 Mar 2023 20:47:47 +0000 (20:47 +0000)]
[mlir][sparse] fix crash when using pure constant index in indexing mapping (fixes #61530)
To address https://github.com/llvm/llvm-project/issues/61530
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D146563
Jon Chesterfield [Tue, 21 Mar 2023 23:15:44 +0000 (23:15 +0000)]
[amdgpu][nfc] Comment and extract two functions in LowerModuleLDS
Alex Langford [Tue, 21 Mar 2023 18:20:31 +0000 (11:20 -0700)]
[lldb][CMake] Enforce not linking against plugin libs in core libs
Non-plugin lldb libraries should generally not be linking against lldb
plugin libraries. Enforce this in CMake.
Differential Revision: https://reviews.llvm.org/D146553
wren romano [Tue, 21 Mar 2023 20:13:42 +0000 (13:13 -0700)]
[mlir][sparse] Adding new `Merger::addLat` overload
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D146559
Craig Topper [Tue, 21 Mar 2023 23:20:30 +0000 (16:20 -0700)]
[RISCV] Improve validation of opcode for .insn.
The lower 2 bits of the opcode must be 0x3. If the lower 2 bits are
0-2, it's a compressed instruction.
Merge 3 slightly different error messages into 1 to reduce code. The
messages differed slightly depending on whether we parsed a string
or an expression. The message gets a little more generic, but is no
more generic than what binutils prints.
Congcong Cai [Tue, 21 Mar 2023 22:32:01 +0000 (06:32 +0800)]
[WebAssembly] Fix i64_i64_func_i64_i64_i32 type signature when multivalue feature is enabled
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D146533
Vitaly Buka [Tue, 21 Mar 2023 22:41:19 +0000 (15:41 -0700)]
[NFC][tsan] Add __tsan_default_{options,suppressions} into interface header
Artem Belevich [Mon, 20 Mar 2023 18:18:53 +0000 (11:18 -0700)]
[CUDA] Update cached kernel handle when the function instance changes.
Fixes clang crash caused by a stale function pointer.
The bug has been present for a pretty long time, but we were lucky not to
trigger it until D140663.
Differential Revision: https://reviews.llvm.org/D146448
Anlun Xu [Tue, 21 Mar 2023 22:23:13 +0000 (15:23 -0700)]
Add missing dependency for TransformDialect
Differential Revision: https://reviews.llvm.org/D146589
Dave Lee [Fri, 17 Mar 2023 02:19:05 +0000 (19:19 -0700)]
[lldb] Refactor deduction of the instance variable's name (NFC)
Move responsibility of providing the instance variable name (`this`, `self`) from
`TypeSystem` to `Language`.
`Language` the natural place for this, but also has downstream benefits. Some languages
have multiple `TypeSystem` implementations (ex Swift), and by placing this logic in the
`Language`, redundancy is avoided.
This change relies on the tests from D145348 and D146320.
Differential Revision: https://reviews.llvm.org/D146548
Craig Topper [Tue, 21 Mar 2023 21:58:53 +0000 (14:58 -0700)]
[RISCV] Remove 'rs1' field from RVInst16 class. NFC
yijia1212 [Tue, 21 Mar 2023 21:40:17 +0000 (14:40 -0700)]
Fix dep error for transform dialect in bazel
Fix dep error for transform dialect in bazel
Reviewed By: anlunx
Differential Revision: https://reviews.llvm.org/D146566
TatWai Chong [Tue, 21 Mar 2023 20:50:13 +0000 (20:50 +0000)]
[mlir][tosa] Add check if the operand of the operations is constant.
Some uses of TOSA rely on the constant operands of particular operations,
e.g. paddings and pad_const in pad op. Add a verification pattern in the
validation pass, and this is optionally enabled.
Change-Id: I1628c0840a27ab06ef91150eee56ad4f5ac9543d
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D145412
Aart Bik [Sat, 18 Mar 2023 01:24:01 +0000 (18:24 -0700)]
[mlir][sparse][gpu] end-to-end test for 2:4 sparsity on NVidia GPUs
Example of using 2:4 sparsity on NVidia GPU
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D145447
Snehasish Kumar [Sat, 11 Mar 2023 00:16:03 +0000 (00:16 +0000)]
[memprof] Support symbolization of PIE binaries.
Support symolization of PIE binaries in memprof. We assume that the
profiled binary has one executable text segment for simplicity. Update
the memprof-pic test to now expect the same output as the memprof-basic test.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D146181
Andrew Litteken [Tue, 21 Mar 2023 01:54:44 +0000 (20:54 -0500)]
[IRSim] Check largest sections first when analyzing similarity
When we check for similarity, right now there is no order to how it is checked, except for via the suffix tree ordering.
We can reduce how much structural analysis we perform by checking the the regions in decreasing size. In doing so, we know that if two large sections match, each of their contained regions also match. This allows us to skip the structural checking for each smaller section. IT does require that we use the large regions as a "bridge" to create the canonical mapping between the two regions.
This reduces compile time significantly for some benchmarks. It will not perform as well for programs with many small items.
Recommit fixes the IRSimilarity tests.
Recommit of:
805ec19d7d9915989be8a8a626176b5e29e19eee
Recommit fixes llvm-sim tests
Recommit of:
082ec267583100455fee356bb0d4ebd55aba2d46
Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338
Slava Zakharin [Fri, 17 Mar 2023 23:52:19 +0000 (16:52 -0700)]
[flang] Set proper source location for the main function.
Take the source position for the anonymous program from its scope.
If the first evaluation is a construct or directive, then it has
null source position.
Author: vdonaldson
Differential Revision: https://reviews.llvm.org/D146445
Blue Gaston [Tue, 21 Mar 2023 15:48:22 +0000 (08:48 -0700)]
[TSAN][Darwin] Forward declare spinlock functions on darwin for TSAN interceptors
Spinlock symbols are removed from headers in MacOS version 10.12 and greater.
Even though they are deprecated, the symbols remain available on the system.
The TSAN interceptors currently cause a build failure after this version because
of the change in availability of the symbol.
We want to continue intercepting the symbols available on the OS.
So we add forward declarations so that the TSAN interceptors can build.
This is tested with the existing osspinlock_norace test.
Differential Revision: https://reviews.llvm.org/D146537
Arthur Eubanks [Tue, 21 Mar 2023 19:05:18 +0000 (12:05 -0700)]
[NFC] Fix incorrect comment for simplifyRightShift
Shoaib Meenai [Tue, 21 Mar 2023 18:19:34 +0000 (11:19 -0700)]
[llvm-libtool-darwin] Fix test when libfile.a exists
This can be a valid system library, as reported in
https://reviews.llvm.org/D85540#inline-1415298
Kevin P. Neal [Tue, 21 Mar 2023 17:54:42 +0000 (13:54 -0400)]
Update checks in advance of an update to D68233.
In the past, the IR Verifier would bail out at the first broken function
it found. This required trickery with sed to put multiple broken functions
in a single test file.
Now, the Verifier allows for multiple broken functions. The sed trickery
is no longer needed. I've eliminated it.
I've also split the test into two since one of them passes verification
and we need to look at the output IR from 'opt'. The other fails and we
need to look at the diagnostics printed by the Verifier.
Craig Topper [Tue, 21 Mar 2023 18:07:38 +0000 (11:07 -0700)]
[SelectionDAG][RISCV] Remove code for handling too small shift type from SimplifyDemandedBits.
This code detected that the type returned from getShiftAmountTy was
too small to hold the constant shift amount. But it used the full
type size instead of scalar type size leading it to crash for
scalable vectors.
This code was necessary when getShiftAmountTy would always
return the target preferred shift amount type for scalars even when
the type was an illegal type larger than the target supported. For
vectors, getShiftAmountTy has always returned the vector type.
Fortunately, getShiftAmountTy was fixed a while ago to detect that
the target's preferred size for scalars is not large enough for the
type. So we can delete this code.
Switched to use getShiftAmountConstant to further simplify the code.
Fixs PR61561.
Hristo Hristov [Sat, 18 Mar 2023 10:54:17 +0000 (12:54 +0200)]
[libc++][spaceship] Implement `operator<=>` for `duration`
Implements parts of [[ https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html | P1614R2 ]]
Implemented `operator<=>` for `std::chrono::duration`
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D145881
Stefan Gränitz [Tue, 21 Mar 2023 18:01:54 +0000 (19:01 +0100)]
[lldb][expr] Propagate ClangDynamicCheckerFunctions::Install() errors to caller
I came accross this, because a lot of regression tests were saying:
```
(lldb) p argc
error: expression failed to parse:
error: couldn't install checkers, unknown error
```
With this change, error messages provide more detail:
```
(lldb) p argc
error: expression failed to parse:
error: couldn't install checkers:
error: Couldn't lookup symbols:
__objc_load
```
I didn't find a case where `Diagnostics()` is not empty. Also it looks like this isn't covered in any test (yet).
Reviewed By: bulbazord, Michael137
Differential Revision: https://reviews.llvm.org/D146541
Arthur Eubanks [Mon, 20 Mar 2023 18:18:35 +0000 (11:18 -0700)]
[AlwaysInliner] Make legacy pass like the new pass
The legacy pass is only used in AMDGPU codegen, which doesn't care about running it in call graph order (it actually has to work around that fact).
Make the legacy pass a module pass and share code with the new pass.
This allows us to remove the legacy inliner infrastructure.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D146446
Alex Langford [Mon, 20 Mar 2023 23:41:11 +0000 (16:41 -0700)]
[lldb][CMake] Enforce not letting lldbUtility link against any other lldb libs
lldbUtility is not supposed to depend on anything else in lldb. Let's
enforce that constraint in CMake rather than hoping something doesn't
slip in under the radar.
Differential Revision: https://reviews.llvm.org/D146473
Arthur Eubanks [Tue, 21 Mar 2023 17:25:04 +0000 (10:25 -0700)]
[test] Change DAG to NEXT in pipeline tests
These were made consistent in
951a980dc7aa6.
Dave Lee [Wed, 8 Mar 2023 21:22:00 +0000 (13:22 -0800)]
Recommit [lldb] Change dwim-print to default to disabled persistent results
Change `dwim-print` to now disable persistent results by default, unless requested by
the user with the `--persistent-result` flag.
Ex:
```
(lldb) dwim-print 1 + 1
(int) 2
(lldb) dwim-print --persistent-result on -- 1 + 1
(int) $0 = 2
```
Users who wish to enable persistent results can make and use an alias that includes
`--persistent-result on`.
Updates: To recommit this, both TestPersistentResult.py and TestPAlias.py needed to be
updated, as well as the changes in D146230.
Differential Revision: https://reviews.llvm.org/D145609
Paul Kirth [Tue, 21 Mar 2023 16:39:33 +0000 (16:39 +0000)]
[llvm][support] Fix ScopedPrinterTest on AIX
The test strings we used for infinity and NAN were not correct on AIX.
This patch creates those dynamically instead of hard-coded.
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D146542
Simon Pilgrim [Tue, 21 Mar 2023 17:23:21 +0000 (17:23 +0000)]
[DAG] visitABS - use FoldConstantArithmetic to perform constant folding.
Avoid needing to perform extra isConstantIntBuildVectorOrConstantInt checks
Dave Lee [Fri, 17 Mar 2023 02:15:38 +0000 (19:15 -0700)]
[lldb] Test direct ivar access in objc++ (NFC)
Add an Objective-C++ specific test for direct ivar access. This adds to the existing C++ and ObjC tests, and tests against regression for future refactoring.
Differential Revision: https://reviews.llvm.org/D146320
Arthur Eubanks [Tue, 21 Mar 2023 17:11:01 +0000 (10:11 -0700)]
[test] Remove redundant check prefix from new-pm-thinlto-prelink-pgo-defaults.ll
Jakub Kuderski [Tue, 21 Mar 2023 16:58:17 +0000 (12:58 -0400)]
[ADT] Add `llvm::range_size` function for generic ranges
This function follows `std::ranges::size` from C++20. It is intended
mainly for generic code that does not know the exact range type.
I did not modify the existing `llvm::size` function because it has a strict
guarantee of O(1) running time, and we cannot guarantee that when we delegate
size check to user-defined size functions.
Use `range_size` to optimize size checks in `zip`* and `enumerate`
functions. Before that, we would have to perform linear scans for ranges
without random access iterators.
This is the last change I have planned in the series that overhauls
`zip`* and `enumerate`.
Reviewed By: dblaikie, zero9178
Differential Revision: https://reviews.llvm.org/D146231
Aaron Ballman [Tue, 21 Mar 2023 16:48:13 +0000 (12:48 -0400)]
No longer issue static lambda pedantic warning for pre-c++2b compat
We were accidentally issuing "static lambdas are incompatible with C++
standards before C++2b" with -pedantic because it was an ExtWarn
diagnostic rather than a Warning. This corrects the diagnostic category
and adds some test coverage.
Fixes #61582
Craig Topper [Tue, 21 Mar 2023 16:47:07 +0000 (09:47 -0700)]
[IndVarSimplify] Remove duplicate call to getSCEV. NFC
We already did this same call on the line before.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D146444
Mark de Wever [Tue, 14 Mar 2023 20:27:03 +0000 (21:27 +0100)]
[libc++] Qualifies size_t.
This has been done using the following command
find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \;
And manually removed some false positives in std/depr/depr.c.headers.
The `std` module doesn't export `::size_t`, this is a preparation for that module.
Reviewed By: ldionne, #libc, EricWF, philnik
Differential Revision: https://reviews.llvm.org/D146088
Philip Reames [Tue, 21 Mar 2023 16:28:27 +0000 (09:28 -0700)]
[LSR] Don't crash on non-branch terminator in -lsr-term-fold
Reported in https://reviews.llvm.org/D146415. I rewrote the patch and aded the test case. Per that report, spec2006.483.xalancbmk crashes without this fix.
Philip Reames [Tue, 21 Mar 2023 15:30:38 +0000 (08:30 -0700)]
[LSR] Remove a couple stale comments in lsr-term-fold
Arthur Eubanks [Tue, 21 Mar 2023 01:01:50 +0000 (18:01 -0700)]
[test] Split up new-pm-thinlto-defaults.ll into prelink and postlink pipelines
They're becoming different enough that it's getting annoying to figure out how allocate check prefixes.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D146486
Congcong Cai [Tue, 21 Mar 2023 16:15:25 +0000 (00:15 +0800)]
[Webassembly][multivalue] update libcall signature for f128 when multivalue feature enabled
further update for [D146271](https://reviews.llvm.org/D146271)
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D146499
Andrew Litteken [Tue, 21 Mar 2023 16:11:27 +0000 (11:11 -0500)]
Revert "[IRSim] Check largest sections first when analyzing similarity"
llvm-sim test still misbehaving on other platforms.
This reverts commit
082ec267583100455fee356bb0d4ebd55aba2d46.
Anna Thomas [Wed, 8 Mar 2023 22:32:50 +0000 (17:32 -0500)]
[LV] Use speculatability within entire loop to avoid strided load predication
Use existing functionality for identifying total access size by strided
loads. If we can speculate the load across all vector iterations, we can
avoid predication for these strided loads (or masked gathers in
architectures which support it).
Differential Revision: https://reviews.llvm.org/D145616
Mirko Brkusanin [Tue, 21 Mar 2023 16:00:57 +0000 (17:00 +0100)]
[AMDGPU][NFC] Update GFX11 test checks
Andrew Litteken [Tue, 21 Mar 2023 01:54:44 +0000 (20:54 -0500)]
[IRSim] Check largest sections first when analyzing similarity
When we check for similarity, right now there is no order to how it is checked, except for via the suffix tree ordering.
We can reduce how much structural analysis we perform by checking the the regions in decreasing size. In doing so, we know that if two large sections match, each of their contained regions also match. This allows us to skip the structural checking for each smaller section. IT does require that we use the large regions as a "bridge" to create the canonical mapping between the two regions.
This reduces compile time significantly for some benchmarks. It will not perform as well for programs with many small items.
Recommit fixes the IRSimilarity tests.
Recommit of:
805ec19d7d9915989be8a8a626176b5e29e19eee
Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338
Luke Lau [Tue, 21 Mar 2023 14:46:15 +0000 (14:46 +0000)]
[RISCV][NFC] Add test case for SLP reduction vectorization failure
Horizontal reductions still occur on RISC-V, despite the maximum SLP VF
reported back by TTI being 1, to disable SLP.
This can cause the cost model to think it can vectorize a gather into
smaller, widened loads, when it will actually fail to do so.
This should ultimately be fixed whenever SLP is re-enabled for RISC-V at
some point.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D146529
Erich Keane [Tue, 21 Mar 2023 15:52:08 +0000 (08:52 -0700)]
Fix switch warning from
514e4359a
Adam Paszke [Tue, 21 Mar 2023 15:26:06 +0000 (08:26 -0700)]
Support retrieving the splat value from DenseElementsAttrs in Python
This is especially convenient when trying to resize the splat.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D146510
Carl Ritson [Tue, 21 Mar 2023 15:13:51 +0000 (16:13 +0100)]
[SystemZ] Fix modelling of composed subreg indices.
A rare case where coalescing resulted in a hh32 (high32 of high64 of vector
register) subreg usage caused getSubReg() to fail as the vector reg does not
have that subreg in its subregs list, but rather h32 which was expected to
also act as hh32. See link below for the discussion when solving this.
Patch By: critson
Reviewed By: uweigand
Fixes: https://github.com/llvm/llvm-project/issues/61390
Erich Keane [Tue, 21 Mar 2023 15:34:20 +0000 (08:34 -0700)]
Add warning test to make buildbots happy after
514e4359
David Spickett [Wed, 15 Mar 2023 10:26:38 +0000 (10:26 +0000)]
[lldb] Fix a 32 bit warning in ScriptedProcessInterface
../llvm-project/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h:61:12:
warning: implicit conversion from 'unsigned long long' to 'size_t' (aka 'unsigned int')
changes value from
18446744073709551615 to
4294967295 [-Wconstant-conversion]
../llvm-project/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:275:39:
warning: result of comparison of constant
18446744073709551615 with expression
of type 'size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
This happens because size_t on 32 bit is 32 bit, but LLDB_INVALID_OFFSET is
UINT64_MAX. Return lldb::offset_t instead, which is 64 bit everywhere.
DoWriteMemory still returns size_t but this is because every other
Process derived thing does that. As long as the failure check works I think
it should be fine.
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D146124
Max Kazantsev [Tue, 21 Mar 2023 15:18:40 +0000 (22:18 +0700)]
Revert "[GuardWidening] Improve analysis of potential widening into hotter block"
This reverts commit
8d2885c2ef98b81927c1f816691ec4e77cfc7f3f.
I accidentally introduced an infinite loop in this patch, will return when this is fixed.
Philip Reames [Tue, 21 Mar 2023 15:22:18 +0000 (08:22 -0700)]
[LSR] Fix "new use of poison" problem in lsr-term-fold
This models the approach used in LFTR. The short summary is that we need to prove the IV is not dead first, and then we have to either prove the poison flag is valid after the new user or delete it.
There are two key differences between this and LFTR.
First, I allow a non-concrete start to the IV. The goal of LFTR is to canonicalize and IVs with constant starts are canonical, so the very restrictive definition there is mostly okay. Here on the other hand, we're explicitly moving *away* from the canonical form, and thus need to handle non-constant starts.
Second, LFTR bails out instead of removing inbounds on a GEP. This is a pragmatic tradeoff since inbounds is hard to infer and assists aliasing. This pass runs very late, and I think the tradeoff runs the other way.
A different approach we could take for the post-inc check would be to perform a pre-inc check instead of a post-inc check. We would still have to check the pre-inc IV, but that would avoid the need to drop inbounds. Doing the pre-inc check would basically trade killing a whole IV for an extra register move in the loop. I'm open to suggestions on the right approach here.
Note that this analysis is quite expensive compile time wise. I have made no effort to optimize (yet).
Differential Revision: https://reviews.llvm.org/D146464
Nikita Popov [Tue, 21 Mar 2023 15:16:52 +0000 (16:16 +0100)]
[ModuleUtils] Handle globals_ctors/dtors with non-literal type (PR56809)
If the global already exists, use its existing type, so we don't
try to mix literal and non-literal structs among the elements.
Fixes https://github.com/llvm/llvm-project/issues/56809.
Erich Keane [Fri, 17 Mar 2023 16:54:39 +0000 (09:54 -0700)]
inline stmt attribute diagnosing in templates
D146089's author discovered that our diagnostics for always/no inline
would null-dereference when used in a template. He fixed that by
skipping in the dependent case.
This patch makes sure we diagnose these after a template instantiation.
It also adds infrastructure for other statement attributes to add
checking/transformation.
Differential Revision: https://reviews.llvm.org/D146323
Philip Reames [Tue, 21 Mar 2023 15:02:32 +0000 (08:02 -0700)]
[LSR] Use evaluateAtIteration in lsr-term-fold
This is a follow up to one of the side discussions on D146429. There are two semantic changes contained here.
The motivation for the change to the legality condition introduced in D146429 comes from the fact that we only check the post-inc form. As such, as long as the values of the post-inc variable don't self wrap, it's actually okay if we wrap past the starting value of the pre-inc IV.
Second, Nikic noticed during review that the test changes changed behavior for TC=0 (i.e. N=0 in the tests). On more careful inspection, it became apparent that the previous manual expansion code was incorrect in the case where the primary IV could wrap without poison, and started with the limit value (i.e. i8 post-inc starts at 255 for 0 exit test, implying pre-inc starts with 0). See @wrap_around test for an example of the (previous) miscompile.
Differential Revision: https://reviews.llvm.org/D146457
Philip Reames [Tue, 21 Mar 2023 14:45:30 +0000 (07:45 -0700)]
[LSR] Add a test case for (another) miscompile in lsr-term-fold
Derived from an observation by @nikic on D146457.
Valentin Clement [Tue, 21 Mar 2023 15:07:25 +0000 (16:07 +0100)]
[flang] Carry over dynamic type information when creating an unlimited polymorphic temp
The dyanmic type must be carried over in a PolymorphicValue when the address is
loaded from an unlimited polymorphic allocatable.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D146525
Maya Amrami [Thu, 9 Mar 2023 11:51:27 +0000 (13:51 +0200)]
[mlir] tosa.concat - Add InferTensorType interface
When this interface is used, a call to inferReturnTypeComponents()
is generated on creation and verification of the op.
A few changes were required in inferReturnTypeComponents():
- Emit error when it fails.
The verifier calls this method now, and it is preferable to
indicate what caused the failure.
- Fix the inferred return shapes so they have a type too.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D146132
Alex Zinenko [Mon, 20 Mar 2023 16:18:35 +0000 (16:18 +0000)]
[mlir] Transform dialect: add named sequences
Named sequences introduce an additional abstraction and reuse capability
to the transform dialect. They can be though of as macros parameterized
with handles that can be invoked in places where a transform dialect
operation is expected. Such reuse was previously not possible in the
dialect and required dynamic construction of the transform IR from the
client language. Named sequences are intentionally restricted to
disallow recursion, as it could make the dialect accidentally
Turing-complete, which isn't desired at this point.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D146433
Aaron Ballman [Tue, 21 Mar 2023 14:49:54 +0000 (10:49 -0400)]
No longer issue pedantic warning about pre-c++2b compat
We were accidentally issuing "overloaded 'operator[]' with more than
one parameter is a C++2b extension" with -pedantic because it was an
ExtWarn diagnostic rather than a Warning. This corrects the diagnostic
category and adds some test coverage.
Fixes #61582
Daniel Kiss [Tue, 21 Mar 2023 09:46:57 +0000 (10:46 +0100)]
Fix -fsplit-lto-unit with ifuncs
ifuncs can't take part of the whole-program devirtualization so no need them to be copied to the merged module.
The corresponding resolver function also kept out which caused the crash.
Fixes #60962 #57870
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D144982
Philip Reames [Tue, 21 Mar 2023 14:18:27 +0000 (07:18 -0700)]
[LFTR] Assert and simplify under assumption exit counts are integers [nfc]
This invariant was introduced in
8f3d16905d75b07a933d01dc29677fe5867c1b3e.
Differential Revision: https://reviews.llvm.org/D146470
David Spickett [Fri, 17 Mar 2023 11:04:38 +0000 (11:04 +0000)]
[lldb] For native compiles, check signal numbers are correct when adding codes
Reviewed By: arichardson, emaste
Differential Revision: https://reviews.llvm.org/D146285
Pavel Kosov [Tue, 21 Mar 2023 11:05:19 +0000 (14:05 +0300)]
Reland [clang][ASTImport] Add support for import of empty records
Patch represents the clang part of changes in D143347
Reviewed By: balazske
Differential Revision: https://reviews.llvm.org/D145057
~~
Huawei RRI, OS Lab
Adrian Kuegel [Tue, 21 Mar 2023 14:15:36 +0000 (15:15 +0100)]
[mlir] Add missing registrations to runners.
Adrian Kuegel [Tue, 21 Mar 2023 14:00:10 +0000 (15:00 +0100)]
Maryam Moghadas [Tue, 7 Mar 2023 15:27:02 +0000 (09:27 -0600)]
[PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC
This patch is to isolate the lax vector conversions warning only for PPC,
the reason is that SystemZ wants different logic in terms of
vector bool compatibility.
Reviewed By: lei
Differential Revision: https://reviews.llvm.org/D145506
Jan Sjodin [Mon, 20 Mar 2023 20:54:52 +0000 (16:54 -0400)]
[mlir] Add alloca address space handling to the data layout subsystem
This patch adds alloca address space information to the data layout interface
and implementation in the DLTI dialect. This is needed for targets that use
separate address spaces for local/stack data.
Reviewed By: ftynse, krzysz00
Differential Revision: https://reviews.llvm.org/D144657
Simon Pilgrim [Tue, 21 Mar 2023 13:24:47 +0000 (13:24 +0000)]
[X86] Add verify-machineinstrs checks to baseptr tests
Help catch regressions from D145650 that were only noticed on EXPENSIVE_CHECKS builds
Nicolas Vasilache [Tue, 21 Mar 2023 08:33:51 +0000 (01:33 -0700)]
[mlir][Transform] NFC - Add more advanced debug spew to help hunt down potential misuses
Differential Revision: https://reviews.llvm.org/D146509
Ilya Biryukov [Tue, 21 Mar 2023 13:06:45 +0000 (14:06 +0100)]
[Sema] Fix crash on __fp16 parameters in template instantiations
Fixes #61441.
Currently, Clang stores `nullptr` in the parameter lists inside
`FunctionProtoTypeLoc` if `__fp16` is used without pointer qualifiers.
Any code path that calls `Declarator::setInvalidType()` before
`GetFullTypeForDeclarator` will lead to the same problem downstream.
The relevant code is:
```cpp
if (D.isInvalidType())
return Context.getTrivialTypeSourceInfo(T);
return GetTypeSourceInfoForDeclarator(state, T, TInfo);
```
`GetTypeSourceInfoForDeclarator` sets the parameter `Decl`, but we can't
call it when `isInvalidType() == true` as this causes other assertion
failures that seem harder to fix.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D146426
Simon Pilgrim [Tue, 21 Mar 2023 12:59:10 +0000 (12:59 +0000)]
[DAG] foldBinOpIntoSelect - use FoldConstantArithmetic instead of getNode() + constant check.
This prevents unused nodes from being created if the constant check fails.
Noticed while triaging D127115 regressions
Sergio Afonso [Mon, 13 Mar 2023 12:51:18 +0000 (12:51 +0000)]
[mlir] Support lowering of dialect attributes attached to top-level modules
This patch supports the processing of dialect attributes attached to top-level
module-type operations during MLIR-to-LLVMIR lowering.
This approach modifies the `mlir::translateModuleToLLVMIR()` function to call
`ModuleTranslation::convertOperation()` on the top-level operation, after its
body has been lowered. This, in turn, will get the
`LLVMTranslationDialectInterface` object associated to that operation's dialect
before trying to use it for lowering prior to processing dialect attributes
attached to the operation.
Since there are no `LLVMTranslationDialectInterface`s for the builtin and GPU
dialects, which define their own module-type operations, this patch also adds
and registers them. The requirement for always calling
`mlir::registerBuiltinDialectTranslation()` before any translation of MLIR to
LLVM IR where builtin module operations are present is introduced. The purpose
of these new translation interfaces is to succeed when processing module-type
operations, allowing the lowering process to continue and to prevent the
introduction of failures related to not finding such interfaces.
Differential Revision: https://reviews.llvm.org/D145932