454170 Commits

Author SHA1 Message Date
Nikita Popov
8bcdc503eb [InstSimplify] Add test for PR61312 (NFC) 2023-03-10 10:29:43 +01:00
Alexander Shaposhnikov
421c098b32 [Clang][Sema] Start fixing handling of out-of-line definitions of constrained templates
This diff starts fixing our handling of out-of-line definitions of constrained templates.
Initially it was motivated by https://github.com/llvm/llvm-project/issues/49620 and
https://github.com/llvm/llvm-project/issues/60231.
In particular, this diff adjusts Sema::computeDeclContext to work properly in the case of
constrained template parameters.

Test plan:
1/ ninja check-all
2/ Bootstrapped Clang passes all the tests
3/ Internal testing

Differential revision: https://reviews.llvm.org/D145034
2023-03-10 09:21:09 +00:00
chenglin.bi
bf00eda69f [InstCombine] Add precommit tests for strong order compare patterns; NFC 2023-03-10 16:58:31 +08:00
Sameer Sahasrabuddhe
fd98416d37 [llvm][Uniformity] consistently handle always-uniform instructions
An instruction that is "always uniform" is so even if it occurs in an
irreducible cycle. The output produced by such an instruction may depend on the
implementation defined cycle hierarchy, but that does not affect the uniformity
of the output. In other words, an "always uniform" instruction is uniform even
if it is not m-converged.

Reviewed By: ruiling, ronlieb

Differential Revision: https://reviews.llvm.org/D145572
2023-03-10 14:23:40 +05:30
Valentin Clement
9470169fcb
[flang] Handle unlimited polymorphic with intrinsic dynamic type in extends_type_of
Unlimited polymorphic entities can have an intrinsic dynamic type. Update the
code of extends_type_of to compare the CFI_type in these case.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D145722
2023-03-10 09:49:58 +01:00
Max Kazantsev
6cb867389c [Test] Add missing noundef in positive test 2023-03-10 15:33:27 +07:00
Craig Topper
25b6d04ad5 [RISCV] Use binary search for RISCVLoadFPImm::getLoadFPImm.
The table is sorted so we can use a binary search instead of a
linear scan.
2023-03-10 00:02:35 -08:00
Markus Böck
cdd914a959 Revert "[mlir] Enable opaque pointers in LLVM conversion passes by default"
This reverts commit 552522bef66c56dc4336d5948662f295dd733c0d.

There are test failures in integration tests for GPU builds
2023-03-10 08:52:07 +01:00
Markus Böck
552522bef6 [mlir] Enable opaque pointers in LLVM conversion passes by default
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

When this patch lands any downstream users with custom LLVM conversion passes not yet using opaque pointers will start either experiencing assertions being triggered, null pointer dereferences or at the very least verifier errors. These can be either fixed by switching to opaque pointers or simply disabling opaque pointers in both pass options of any upstream conversion passes and any uses of `LLVMTypeConverter` via the `LowerToLLVMOptions`.

Users using just MLIRs conversion passes to the LLVM Dialect should not experience any change in functionality except when inspecting the output from the passes.

Differential Revision: https://reviews.llvm.org/D145585
2023-03-10 08:46:38 +01:00
Lang Hames
7163b1ab8d [JITLink][docs] Update docs for generic link algorithm and memory manager apis.
These sections were out of date.
2023-03-09 23:37:32 -08:00
Chuanqi Xu
8592b3e1d2 Revert "[NFC] Don't recompute Linkage for Decl in Release Modes"
This reverts commit 87ba95aa212a4fd363a4dd52677e9eea5224a4e7.
2023-03-10 15:25:26 +08:00
Chuanqi Xu
87ba95aa21 [NFC] Don't recompute Linkage for Decl in Release Modes
In the assertion enabled mode we will test if the computed linkage of
Declaration is consistent with the cached linkage. But we shouldn't
compuate it if we have cached linkage in the release modes.
2023-03-10 15:23:38 +08:00
Craig Topper
d704c7a6b3 [RISCV] Move some RISCVLoadFPImm out of line. NFC
This moves the LoadFPImmArr array to the cpp file. Being in the header
meant it was duplicated in every translation unit that includes the
header.

Move the 2 functions that use the array out of line.
2023-03-09 23:22:33 -08:00
Rong Xu
ebe09e2a95 [FSAFDO] Improve FS discriminator encoding
This change improves FS discriminators in the following ways:
(1) use call-stack debug information in the the to generate
discriminators: the same (src/line) DILs can now have same
discriminator value if they come from different call-stacks.
This effectively increases the usable discriminator values
for each round of FS discriminator pass.
(2) don't generate the FS discriminator for meta instructions
(i.e. instructions not emitted). This reduces the number
discriminators conflicts (for the case we run out of discriminator
bits for that pass).
(3) use less expensive hashing of xxHash64.

These improvements should bring better performance for FSAFDO
and they should be used by default. But this change creates
incompatible FS discriminators. For the iterative profile users,
they might see a performance drop in the first release with
this change (due to the fact that the profiles have the old
discriminators and the compiler uses the new discriminator).
We have measured that this is not more than 1.5% on several
benchmarks. Note the degradation should be gone in the second
release and one should expect a performance gain over the binary
without this change.

One possible solution to the iterative profile issue would be
separating discriminators for profile-use and the ones emitted to
the binary. This would require a mechanism to allow two sets of
discriminators to be maintained and then phasing out the first
approach. This is too much churn in the compiler and the
performance implications do not seem to be worth the effort.

Instead, we put the changes under an option so iterative profile
users can do a gradual rollout of this change. We will make the
option default value to true in a later patch and eventually
purge this option from the code base.

Differential Revision: https://reviews.llvm.org/D145171
2023-03-09 23:18:48 -08:00
Chuanqi Xu
af86957cbb [C++20] [Modules] Don't load declaration eagerly for named modules
Close https://github.com/llvm/llvm-project/issues/61064.

The root cause of the issue is that we will deserilize some declarations
eagerly when reading the BMI. However, many declarations in the BMI are
not necessary for the importer. So it wastes a lot of time.
2023-03-10 14:57:21 +08:00
Jie Fu
0b327814d8 [libfuzzer] Fix build error due to out-of-line definition of 'Fuzzer' does not match any declaration in 'fuzzer::Fuzzer' (NFC)
/data/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:138:9: error: out-of-line definition of 'Fuzzer' does not match any declaration in 'fuzzer::Fuzzer'
Fuzzer::Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD,
        ^~~~~~
/data/llvm-project/compiler-rt/lib/fuzzer/FuzzerInternal.h:35:10: note: type of 4th parameter of member declaration does not match definition ('fuzzer::FuzzingOptions &' vs 'const fuzzer::FuzzingOptions &')
         FuzzingOptions &Options);
         ^
1 error generated.
2023-03-10 14:52:28 +08:00
Max Kazantsev
1746460630 [Test] Add some corner cases negative tests for D143726
- No common loop-variant;
- One comparison against loop-variant;
2023-03-10 13:14:16 +07:00
Max Kazantsev
7f32c3defb [Test] Add negative and positive tests with extra uses for D143726 2023-03-10 13:14:16 +07:00
Max Kazantsev
5e7949c79d [Test] Add negative eq/ne tests for D143726 2023-03-10 13:14:15 +07:00
Max Kazantsev
8309fb7b12 [Test] Add negative and positive mismatched predicates tests for D143726 2023-03-10 13:14:15 +07:00
Max Kazantsev
64cb8930c4 [Test] Add negative and positive logical or/and tests for D143726 2023-03-10 13:14:15 +07:00
Max Kazantsev
c7d995d9de [Test] Add swapped tests for D143726 2023-03-10 13:14:15 +07:00
Wu, Yingcong
513d9b9f3d [libfuzzer] avoid unneccessary copy
Avoid some unneccessary copy

Reviewed By: fmayer

Differential Revision: https://reviews.llvm.org/D145758
2023-03-09 22:11:48 -08:00
sgokhale
7b338a691e [CodeGen][AArch64] Generate Pseudo instructions for integer MLA/MAD/MLS/MSB
Differential Revision: https://reviews.llvm.org/D145488
2023-03-10 10:58:18 +05:30
Max Kazantsev
279f0c02ad [Test] Regenerate tests using update_llc_test_checks.py 2023-03-10 11:34:16 +07:00
Lang Hames
1b5a605112 [JITLink] Use unique_function rather than std::function for JITLink passes.
Passes aren't expected to be copied, and switching to unique_function allows
them to capture values with move-only types.
2023-03-09 20:03:31 -08:00
Eugene Zhulenev
faf697e49b [mlir] Add support for f8 data types to LLVM dialect types
This change allows using fp8 pointers when exporting to LLVM, because we anyway export them as opaque pointers, however full support of fp8 types is not yet implemented on the LLVM side.

Differential Revision: https://reviews.llvm.org/D143008
2023-03-09 18:52:36 -08:00
Yaxun (Sam) Liu
1f8a3ce325 [HIP] Fix temporary files
Currently HIP toolchain uses Driver::GetTemporaryDirectory to
create a temporary directory for some temporary files during
compilation. The temporary directories are not automatically
deleted after compilation. This slows down compilation
on Windows.

Switch to use GetTemporaryPath which only creates temporay
files which will be deleted automatically.

Keep the original input file name convention for Darwin host
toolchain since it is needed for deterministic binary
(https://reviews.llvm.org/D111269)

Fixes: SWDEV-386058

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D145509
2023-03-09 21:41:58 -05:00
Sam Clegg
d32f71a91a [lld][WebAssembly] Use C++17 nested namespace syntax in most places. NFC
Like D131405, but for wasm-ld.

Differential Revision: https://reviews.llvm.org/D145399
2023-03-09 18:37:32 -08:00
wanglian
7c2a3573b6 [Codegen][NFC] Replace 'RegisterRegAlloc::FunctionPassCtor'
with 'RegisterRegAllocBase<T>::FunctionPassCtor'.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D145032
2023-03-10 10:31:26 +08:00
Jim Lin
7e9293572d [RISCV] Set how many bytes load from or store to stack slot
Refer from: https://reviews.llvm.org/D44782

After https://reviews.llvm.org/D130302, LW+SEXT.B can be folded into LB
as partially reload stack slot. This gains incorrect optimization result
from `StackSlotColoring` without given the number of bytes exactly load
from stack. LB+SW are mis-interpreted as fully reload/restore from stack
slot without the sign-extension. SW would be considered as a redundant store.

The testcase is copied from llvm/test/CodeGen/X86/pr30821.mir.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D145471
2023-03-10 10:14:59 +08:00
Jim Lin
865fb2e440 [RISCV] Pre-commit test case for D140460
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D145549
2023-03-10 10:14:59 +08:00
Vitaly Buka
bb01b9919f [ConstraintElimination] Fix UB after D145677 2023-03-09 18:18:29 -08:00
Igor Zhukov
882fba9ff2 [libc++][ranges] Implement LWG-3865 Sorting a range of pairs
Reviewed By: Mordante, philnik, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D144262
2023-03-10 09:01:52 +07:00
Luke Lau
c417266db5 [RISCV] Model interleave and deinterleave shuffles in cost model
Interleave and deinterleave shuffles are lowered by a more efficient
sequence if the element size is smaller than ELEN.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145678
2023-03-10 01:10:00 +00:00
Kirill Stoimenov
25ba9dcf18 [HWASAN][LSAN] Fix buildbot failure. 2023-03-10 01:07:43 +00:00
Paul Walker
990b11c507 [SVE] Precommit multiuse predicated compare tests. 2023-03-10 00:55:11 +00:00
Kirill Stoimenov
011b4d4706 [HWASAN][LSAN] Disable tests which don't pass in HWASAN+LSAN mode
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D145727
2023-03-10 00:51:55 +00:00
Michael Buch
adc5168d71 [lldb][InstrumentationRuntime] Make 'data' struct anonymous in order to avoid collisions with types in the debuggee
The `UBSAN`/`ASAN` plugins would previously call the internal helper
structure injected into the source expression `struct data { ... };`

This occasionally collided with user-defined types of the same (quite
common) name. In the presence of varibale with the same name LLDB would
simply fail to run the injected `InstrumentationRuntime` expressions
with:
```
warning: cannot evaluate AddressSanitizer expression:
expression failed to parse:
error: <user expression 2>:2:5: must use 'struct' tag to refer to type 'data' in this scope
    data t;
```

In the presence of another type called 'data', LLDB would most likely
crash with something like:
```
0x00000001198de614 clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) + 1088
0x00000001198de614 clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) + 1088
0x0000000119907930 clang::ASTImporter::ImportDefinition(clang::Decl*) + 596
0x00000001163db928 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(clang::Decl*, clang::Decl*) + 100
0x00000001163da070 (anonymous namespace)::CompleteTagDeclsScope::~CompleteTagDeclsScope() + 572
...
```
...because it got the types confused.

This patch makes these structures anonymous so there's no
chance of clashing with other types in the program. This is
already the approach taken in `UBSan/InstrumentationRuntimeABSan.cpp`.

**Testing**

- API tests still pass
- Tested manually that the `memory history` command now works in the presence of a local called `data`

Differential Revision: https://reviews.llvm.org/D145569
2023-03-10 00:40:22 +00:00
Jun Zhang
3ecf731376
[InstCombine] Reduce absolute diff from min+max+sub
This patch implements fold: max(a,b) nsw/nuw - min(a,b) --> abs(a nsw - b)

Alive2: https://alive2.llvm.org/ce/z/4yLp7D
Fixes: https://github.com/llvm/llvm-project/issues/61228

Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D145540
2023-03-10 08:00:40 +08:00
Arthur Eubanks
9e0c2626f3 [llvm-c] Remove pointee support from LLVMGetElementType
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D145717
2023-03-09 15:42:38 -08:00
Ben Shi
013235a200 [RISCV][NFC] Add tests for SLP vectorization of math functions
RISCV has "vfabs.v" and "vfsqrt.v" so math functions abs and sqrt
can be SLP vectorized. But others exp/log/sin/asin/sinh/asinh/...
can not.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145562
2023-03-10 07:34:21 +08:00
Renaud-K
b07ef9e7cd Break circular dependency between FIR dialect and utilities 2023-03-09 15:24:51 -08:00
Emilio Cota
350d7e33ff [mlir][vector] remove unnecessary VectorTransformOps include
While at it, add a dep that we missed in https://reviews.llvm.org/D145638.

Reviewed By: kuhar, dcaballe

Differential Revision: https://reviews.llvm.org/D145731
2023-03-09 18:23:36 -05:00
Jason Molenda
7f25c3e25f Slight refinement to a change yesterday in metadata-added binaries
When ObjectFileMachO::LoadCoreFileImages load a binary into the
target with a valid load address, we don't need to re-load its
segments into the Target's SectionLoadList again.  But we should
still call ModulesDidLoad on these modules so breakpoints can be
inserted etc.
2023-03-09 14:56:22 -08:00
Bruno Cardoso Lopes
54225c457a [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-09 14:18:26 -08:00
Christopher Ferris
32be3405f5 [scudo] Add a fast get time version.
On Android, the _COARSE version of clock_gettime is about twice as fast.
Therefore, add a getMonotonicTimeFast function that is used in the
releaseToOSMaybe functions.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D145636
2023-03-09 14:12:53 -08:00
bzcheeseman
82e177bbde [ORC] Fix name shadowing issue, NFC.
Testing the COFFPlatform on MSVC, a name shadowing issue surfaced where `LoadDynLibrary` inside the constructor was actually using the moved-from function argument. This patch simply renames the argument to avoid that shadowing.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D145710
2023-03-09 14:07:43 -08:00
Aart Bik
e1b3c5c403 [sparse][mlir] test transposition on sorted COO
DO NOT SUBMIT YET, test exposes bug

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D145708
2023-03-09 14:01:51 -08:00
Peiming Liu
ab99b5d1f6 [mlir][sparse] deduplicate non-unique coordinates unconditionally
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D145621
2023-03-09 21:59:57 +00:00