Commit Graph

455415 Commits

Author SHA1 Message Date
Matthias Springer
9c16eef1ec [mlir][IR] Add ReverseDominanceIterator for IR walkers
Blocks are enumerated depth-first, but post-order. I.e., a block is enumerated when its successors have been enumerated. This iteration style is suitable when deleting blocks in a regions: in the absence of cycles, uses are deleted before their definitions.

Differential Revision: https://reviews.llvm.org/D146125
2023-03-22 09:01:58 +01:00
Balazs Benics
558b46fde2 [analyzer] Fix crashing getSValFromInitListExpr for nested initlists
In the following example, we will end up hitting the `llvm_unreachable()`:
https://godbolt.org/z/5sccc95Ec
```lang=C++
enum class E {};
const E glob[] = {{}};
void initlistWithinInitlist() {
  clang_analyzer_dump(glob[0]); // crashes at loading from `glob[0]`
}
```

We should just return `std::nullopt` instead for these cases.
It's better than crashing.

Reviewed By: xazax.hun

Differential Revision: https://reviews.llvm.org/D146538
2023-03-22 08:43:09 +01:00
Kazu Hirata
9bb96fd874 [llvm] Use llvm::isNullConstant (NFC) 2023-03-22 00:31:48 -07:00
Max Kazantsev
e603285316 [Test] Add hanging test for D146276
The patch was reverted because of hang, adding the test so that this doesn't
happen again.
2023-03-22 14:26:44 +07:00
Kazu Hirata
1fe6a8a584 [X86] Use llvm::isOneConstant (NFC) 2023-03-22 00:25:13 -07:00
Ethan Luis McDonough
823ddba1b3
[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
2023-03-22 01:27:55 -05:00
paperchalice
792bb70d29 [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
2023-03-21 23:13:59 -07:00
Nicolas Vasilache
829446cb45 [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
2023-03-21 22:17:36 -07:00
Ben Shi
0d37efdbc5 [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
2023-03-22 12:57:58 +08:00
Bruno Cardoso Lopes
fa0d4e1f12 [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
2023-03-21 21:42:31 -07:00
Bruno Cardoso Lopes
43f5085fa8 [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
2023-03-21 21:42:25 -07:00
Ting Wang
f64dc9bc6e [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
2023-03-22 00:32:18 -04:00
yijia1212
55dd04f6bc update dependency for TransformOpsPyTdFiles
update dependency for TransformOpsPyTdFiles

Differential Revision: https://reviews.llvm.org/D146605
2023-03-21 21:26:31 -07:00
Craig Topper
c176edc013 [RISCV] Clear mayRaiseFPException for fclass.d instruction.
We got it right for fclass.s and fclass.h.
2023-03-21 19:48:23 -07:00
Craig Topper
2023cc2b1b [RISCV] Clear mayRaiseFPException for Zfa fmvh.x.d and fmvp.d.x instructions. 2023-03-21 19:42:27 -07:00
Craig Topper
b50c6857a4 [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
2023-03-21 19:33:27 -07:00
Michael Francis
4dc04557d7 [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
2023-03-22 02:25:46 +00:00
Philip Reames
06006f438e [LFTR] Minor style cleanup [nfc] 2023-03-21 19:17:31 -07:00
Philip Reames
206dc54534 [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
2023-03-21 19:17:31 -07:00
Philip Reames
a124b4c7f9 [LFTR] Simplify another case under assumption exit counts are integers [nfc]
This invariant was introduced in 8f3d16905d.
2023-03-21 19:17:31 -07:00
Johannes Doerfert
f2c385934b [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
2023-03-21 19:16:27 -07:00
Johannes Doerfert
0153ab6dbc [OpenMP] Remove restriction on the thread count for parallel regions
Differential Revision: https://reviews.llvm.org/D112194
2023-03-21 19:16:13 -07:00
Johannes Doerfert
de9edf4afe [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
2023-03-21 19:16:13 -07:00
Joseph Huber
ebcc6dba5f [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.
2023-03-21 21:01:27 -05:00
Craig Topper
8e43c22d30 [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
2023-03-21 18:52:05 -07:00
Jon Chesterfield
78e6818049 [amdgpu][nfc] clang-format AMDGPULowerModuleLDS for easier merging 2023-03-22 01:49:53 +00:00
Philip Reames
c49e56a295 [SCEV] Add coverage for a missing flag inference case 2023-03-21 18:41:18 -07:00
Jon Chesterfield
d70e7ea0d1 [amdgpu][nfc] Extract more functions in LowerModuleLDS, mark more methods static 2023-03-22 01:25:28 +00:00
Kazu Hirata
b9c4b95b11 [llvm] Use ConstantInt::{isZero,isOne} (NFC) 2023-03-21 17:40:35 -07:00
Peiming Liu
2b21327fee [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
2023-03-21 23:45:20 +00:00
Jon Chesterfield
e8ad2a051c [amdgpu][nfc] Comment and extract two functions in LowerModuleLDS 2023-03-21 23:39:20 +00:00
Alex Langford
5499b026d2 [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
2023-03-21 16:24:36 -07:00
wren romano
13e9afd16d [mlir][sparse] Adding new Merger::addLat overload
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D146559
2023-03-21 16:22:04 -07:00
Craig Topper
087b5f3277 [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.
2023-03-21 16:20:30 -07:00
Congcong Cai
696fdece49 [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
2023-03-22 06:53:54 +08:00
Vitaly Buka
a09283a551 [NFC][tsan] Add __tsan_default_{options,suppressions} into interface header 2023-03-21 15:46:34 -07:00
Artem Belevich
2aa90da012 [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
2023-03-21 15:36:12 -07:00
Anlun Xu
c5f6339c12 Add missing dependency for TransformDialect
Differential Revision: https://reviews.llvm.org/D146589
2023-03-21 15:23:23 -07:00
Dave Lee
c327f99254 [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
2023-03-21 15:22:07 -07:00
Craig Topper
abe0362dd8 [RISCV] Remove 'rs1' field from RVInst16 class. NFC 2023-03-21 14:58:53 -07:00
yijia1212
51c8c1e1e5 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
2023-03-21 14:40:43 -07:00
TatWai Chong
08b0977a19 [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
2023-03-21 20:54:47 +00:00
Aart Bik
a2c63d7f0b [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
2023-03-21 13:32:43 -07:00
Snehasish Kumar
cef71d0105 [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
2023-03-21 20:13:18 +00:00
Andrew Litteken
e240e6b8b7 [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: 805ec19d7d

Recommit fixes llvm-sim tests

Recommit of: 082ec26758

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338
2023-03-21 14:49:41 -05:00
Slava Zakharin
ee7b6fd4c1 [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
2023-03-21 12:32:42 -07:00
Blue Gaston
ae484c21c0 [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
2023-03-21 12:16:19 -07:00
Arthur Eubanks
852cfc2ed3 [NFC] Fix incorrect comment for simplifyRightShift 2023-03-21 12:05:37 -07:00
Shoaib Meenai
22b5fe7478 [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
2023-03-21 11:20:24 -07:00
Kevin P. Neal
2bd4130362 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.
2023-03-21 14:15:15 -04:00