Matt Arsenault [Thu, 13 Oct 2022 17:02:34 +0000 (10:02 -0700)]
AsmPrinter: Remove pointless code in inline asm emission
This was scanning through def operands looking for the
symbol operand. This is pointless because the symbol is always
the first operand as enforced by the verifier, and all operands
are implicit.
Xiang1 Zhang [Fri, 14 Oct 2022 03:23:20 +0000 (11:23 +0800)]
[AArch64][BuildErrorFix] Add compatible classifyGlobalFunctionReference
chenglin.bi [Fri, 14 Oct 2022 04:07:43 +0000 (12:07 +0800)]
[AArch64] add tests for ccmp with negative constant op1; NFC
Katherine Rasmussen [Thu, 13 Oct 2022 01:10:53 +0000 (18:10 -0700)]
[flang] Add a semantics test for atomic_ref
Reviewed By: rouson
Differential Revision: https://reviews.llvm.org/D135840
Ting Wang [Fri, 14 Oct 2022 02:57:40 +0000 (22:57 -0400)]
[clang][PowerPC][NFC] Add base test case for PPC64 VAArg aggregate smaller than a slot
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D133488
Xiang1 Zhang [Tue, 13 Sep 2022 06:48:12 +0000 (14:48 +0800)]
[InlineAsm][bugfix] Correct function addressing in inline asm
In Linux PIC model, there are 4 cases about value/label addressing:
Case 1: Function call or Label jmp inside the module.
Case 2: Data access (such as global variable, static variable) inside the module.
Case 3: Function call or Label jmp outside the module.
Case 4: Data access (such as global variable) outside the module.
Due to current llvm inline asm architecture designed to not "recognize" the asm
code, there are quite troubles for us to treat mem addressing differently for
same value/adress used in different instuctions.
For example, in pic model, call a func may in plt way or direclty pc-related,
but lea/mov a function adress may use got.
This patch fix/refine the case 1 and case 2 in inline asm.
Due to currently inline asm didn't support jmp the outsider lable, this patch
mainly focus on fix the function call addressing bugs in inline asm.
Reviewed By: Pengfei, RKSimon
Differential Revision: https://reviews.llvm.org/D133914
Matthias Springer [Fri, 14 Oct 2022 01:39:50 +0000 (10:39 +0900)]
[mlir][bufferize] Treat certain aliasing-only uses like memory reads
This fixes an issue in One-Shot Bufferize that could lead to missing buffer copies in the future. This bug can currently not be triggered because of the order in which ops are analyzed (always bottom-to-top). However, if we consider different traversal orders for the analysis in the future, this bug can cause subtle issues that are difficult to debug.
Example:
```
%0 = ...
%1 = tensor.insert ... into %0
%2 = tensor.extract_slice %0
tensor.extract %2[...]
```
In case of a top-to-bottom analysis of the above IR, the `tensor.insert` is analyzed before the `tensor.extract_slice`. In that case, the `tensor.insert` will bufferize in-place because %2 is not yet known to become an alias of %0 (and therefore causing a conflict).
With this change, the `tensor.insert` will bufferize out-of-place, regardless of the traversal order.
Differential Revision: https://reviews.llvm.org/D135049
Nick Kreeger [Fri, 14 Oct 2022 01:33:24 +0000 (20:33 -0500)]
[mlir] Update CallInterfaceCallable to use the new casting infra.
This enables casting LLVM style for mlir::CallInterfaceCallable usage.
Differential Revision: https://reviews.llvm.org/D135823
Nemanja Ivanovic [Fri, 14 Oct 2022 01:09:23 +0000 (20:09 -0500)]
[PowerPC] Change CRNOT to a code gen single operand instruction
Inputs to crnor can come from operands with chains so
if it is being used simply to negate such an operand,
the repeated input cannot be CSE'd. This patch just
adds a code-gen only instruction for this that takes
a single input and duplicates it in the encoding of
the underlying crnor.
Differential revision: https://reviews.llvm.org/D133577
Greg Clayton [Wed, 28 Sep 2022 23:50:38 +0000 (16:50 -0700)]
Improve dynamic loader support in DynamicLoaderPOSIXDYLD when using core files.
Prior to this fix, no shared libraries would be loaded for a core file, even if they exist on the current machine. The issue was the DYLDRendezvous would read a DYLDRendezvous::Rendezvous from memory of the process in DYLDRendezvous::Resolve() which would read some ld.so structures as they existed in the middle of a process' lifetime. In core files we see, the DYLDRendezvous::Rendezvous::state would be set to eAdd for running processes. When ProcessELFCore.cpp would load the core file, it would call DynamicLoaderPOSIXDYLD::DidAttach(), which would call the above Rendezvous functions. The issue came when during the DidAttach function it call DYLDRendezvous::GetAction() which would return eNoAction if the DYLDRendezvous::m_current.state was read from memory as eAdd. This caused no shared libraries to be loaded for any ELF core files. We now detect if we have a core file and after reading the DYLDRendezvous::m_current.state from memory we set it to eConsistent, which causes DYLDRendezvous::GetAction() to return the correct action of eTakeSnapshot and shared libraries get loaded.
We also improve the DynamicLoaderPOSIXDYLD class to not try and set any breakpoints to catch shared library loads/unloads when we have a core file, which saves a bit of time.
Differential Revision: https://reviews.llvm.org/D134842
Nico Weber [Thu, 13 Oct 2022 23:56:37 +0000 (19:56 -0400)]
[gn build] port
1fda6f6859aa (lld driver_executable)
Michal Paszkowski [Mon, 10 Oct 2022 22:17:11 +0000 (00:17 +0200)]
[SPIRV] Fix formatting of function tests
Differential Revision: https://reviews.llvm.org/D135624
Chia-hung Duan [Thu, 13 Oct 2022 22:52:04 +0000 (22:52 +0000)]
[scudo] Support partial page releasing
Block grouping enables us doing partial page releasing so that we can
release the pages in a finer granularity. Which means we don't need to
visit all blocks to determine which pages are unused. Besides, this
means we can do incremental page releasing depends on the number fo free
blocks.
Reviewed By: cryptoad, cferris
Differential Revision: https://reviews.llvm.org/D134226
Chia-hung Duan [Thu, 13 Oct 2022 22:51:17 +0000 (22:51 +0000)]
[scudo] Manage free blocks in BatchGroup.
Scudo is supposed to allocate any blocks across the entired mapped
pages and each page is equally likely to be selected. Which means Scudo
is leaning to touch as many pages as possible. This brings better
security but it also sacrifices the chance of releasing dirty pages.
To alleviate the unmanagable footprint growing, this CL introduces the
BatchGroup concept. Each blocks will be classified into a BatchGroup
according to its address. While allocation, we are leaning to allocate
blocks in the same group first. Note that the blocks selected from a
group is still random over several pages. At the same time, we have
better prediction of dirty page growing speed. Besides, we are able to
do partial page releasing by examing part of BatchGroups.
Reviewed By: cryptoad, cferris
Differential Revision: https://reviews.llvm.org/D133897
Chia-hung Duan [Thu, 13 Oct 2022 22:33:35 +0000 (22:33 +0000)]
[scudo] Add PageReleaseContext to convey page usage status.
PageReleaseContext contains all the information needed for determing if
a page can be released. Splitting out the context increases the flexibility
of heterogenous free lists in the future. Also rename PackedCounterArray to
PageMap.
Reviewed By: cryptoad, cferris
Differential Revision: https://reviews.llvm.org/D133895
Chia-hung Duan [Thu, 13 Oct 2022 22:03:06 +0000 (22:03 +0000)]
Use u16 to store Count/MaxCount
The Count/MaxCount used in TransferBatch and PerClass can be fit in u16 in
current configurations and it's also reasonable to have a u16 limit. The
spare 16 bits will be used for additional status like pages mapping
status in a TransferBatch.
Reviewed By: cryptoad, cferris, vitalybuka
Differential Revision: https://reviews.llvm.org/D133145
Jason Molenda [Thu, 13 Oct 2022 23:28:18 +0000 (16:28 -0700)]
PlatformDarwinKernel calls the ctor directly, not setting no-jit
Fix a small thinko in https://reviews.llvm.org/D133534 . Normally
DynamicLoaderDarwinKernels are created via the CreateInstance plugin
method, and that plugin method sets the Process CanJIT to false.
In the above patch, I added a new code path that can call the
DynamicLoaderDarwinKernel ctor directly, without going through
CreateInstance, and CanJIT was not being correctly set for the
process.
rdar://
101148552
Peter Collingbourne [Fri, 7 Oct 2022 04:13:05 +0000 (21:13 -0700)]
Driver: Change default Android linker to lld.
The clang distributed with the Android NDK has defaulted to lld since r22,
so let's update the driver to match.
Differential Revision: https://reviews.llvm.org/D135421
Alexandros Lamprineas [Fri, 7 Oct 2022 16:40:41 +0000 (17:40 +0100)]
[NFC][FuncSpec] Add a test to show redundant function cloning.
Happens when we find identical specializations.
Differential Revision: https://reviews.llvm.org/D135459
Wolfgang Pieb [Fri, 16 Sep 2022 16:40:14 +0000 (09:40 -0700)]
[PGO] Do not create block count annotations when all weights are 0,
avoiding an assertion.
A BB with a nonzero count, whose successor blocks all have 0 counts, could
cause an assertion. Don't create any branch weights in this case.
Reviewed By: xur
Differential Revision: https://reviews.llvm.org/D134203
Sam Clegg [Thu, 13 Oct 2022 16:53:12 +0000 (09:53 -0700)]
[lld][WebAssembly] Add symbols marking start/end of stack region
Currently emscripten is make assumptions about that memory layout,
assuming the stack is between `__data_end` and `__heap_base`:
https://github.com/emscripten-core/emscripten/blob/
af961ad5c4c278ec510f0b7f7d522a95ee5a90f8/system/lib/compiler-rt/stack_limits.S#L42-L61
With this change we can be more precise:
https://github.com/emscripten-core/emscripten/pull/18057
Differential Revision: https://reviews.llvm.org/D135910
Mehdi Amini [Thu, 6 Oct 2022 19:36:31 +0000 (19:36 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in VectorOps.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:32:24 +0000 (19:32 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaCanonicalizations.cpp (NFC)
David Blaikie [Thu, 13 Oct 2022 21:11:41 +0000 (21:11 +0000)]
Move GCC-compatible pod-packing change to v16/old behavior available at v15 and below
Change matches D126334/
e59f648d698e since this change got punted from
v15 too.
Slava Zakharin [Thu, 13 Oct 2022 20:43:41 +0000 (13:43 -0700)]
Revert "[Libomp] Do not error on undefined version script symbols"
This reverts commit
096f93e73dc3f88636cdcb57515e3732385b452d.
Revert "[Libomptarget] Make the plugins ingore undefined exported symbols"
This reverts commit
3f62314c235bd2475c8e2b5b874b2932a444e823.
Revert "[LLD] Enable --no-undefined-version by default."
This reverts commit
7ec8b0d162e354c703f5390784287054601f9c69.
Three commits are reverted because of the current omp build fail
with GNU ld. See discussion here: https://reviews.llvm.org/rG096f93e73dc3
Jez Ng [Thu, 13 Oct 2022 20:44:33 +0000 (16:44 -0400)]
[lld-macho] Preserve the size of common symbols
We never noticed this before because the only time the size gets emitted is via
the linker map...
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D135884
Jez Ng [Thu, 13 Oct 2022 20:44:29 +0000 (16:44 -0400)]
[lld-macho] Include symbol sizes in mapfile
This matches ld64's behavior.
Additionally, I edited the "Dead Stripped Symbols" header to omit "Address" --
this also matches ld64.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D135883
Arthur Eubanks [Thu, 13 Oct 2022 20:31:22 +0000 (13:31 -0700)]
[test] Reset timer flag after test is done
Fixes some test failures after D135219 on internal bots.
Sanjay Patel [Thu, 13 Oct 2022 19:37:28 +0000 (15:37 -0400)]
[InstCombine] fold logical and/or to xor
(A | B) & ~(A & B) --> A ^ B
https://alive2.llvm.org/ce/z/qpFMns
We already have the equivalent fold for real
logic instructions, but this pattern may occur
with selects too.
This is part of solving issue #58313.
Sanjay Patel [Thu, 13 Oct 2022 18:32:33 +0000 (14:32 -0400)]
[InstCombine] add tests for logical select xor folds; NFC
issue #58313
Florian Hahn [Thu, 13 Oct 2022 20:08:33 +0000 (21:08 +0100)]
[ConstraintElim] Add support for GEPs with multiple indices.
Lift restriction on GEPs with a single index by iterating over all
indices and joining the {Coefficient, Variable} entries for all indices
together.
Aaron Ballman [Thu, 13 Oct 2022 20:04:25 +0000 (16:04 -0400)]
Fix the clang Sphinx build
This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/34157
Florian Hahn [Thu, 13 Oct 2022 19:58:10 +0000 (20:58 +0100)]
[ConstraintElim] Add nested GEP test with scalable vectors.
Fangrui Song [Thu, 13 Oct 2022 19:50:15 +0000 (12:50 -0700)]
[llvm-objdump] Add HelpText for --no-addresses after D135040
Alex Brachet [Thu, 13 Oct 2022 19:47:15 +0000 (19:47 +0000)]
[PGO] Make emitted symbols hidden
This was reverted because it was breaking when targeting Darwin which
tried to export these symbols which are now hidden. It should be safe
to just stop attempting to export these symbols in the clang driver,
though Apple folks will need to change their TAPI allow list described
in the commit where these symbols were originally exported
https://github.com/llvm/llvm-project/commit/
f5380185623be243ba0f1b18d4bd594ac5cc7163
Bug: https://github.com/llvm/llvm-project/issues/58265
Differential Revision: https://reviews.llvm.org/D135340
Zequan Wu [Thu, 29 Sep 2022 02:40:35 +0000 (19:40 -0700)]
[LLDB][NativePDB] Fix struct layout when it has anonymous unions.
Previously, lldb mistook fields in anonymous union in a struct as the direct
field of the struct, which causes lldb crashes due to multiple fields sharing
the same offset in a struct. This patch fixes it.
MSVC generated pdb doesn't have the debug info entity representing a anonymous
union in a struct. It looks like the following:
```
struct S {
union {
char c;
int i;
};
};
0x1004 | LF_FIELDLIST [size = 40]
- LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
- LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1005 | LF_STRUCTURE [size = 32] `S`
unique name: `.?AUS@@`
vtable: <no type>, base list: <no type>, field list: 0x1004
```
Clang generated pdb is similar, though due to the [[ https://github.com/llvm/llvm-project/issues/57999 | bug ]],
it's not more useful than the debug info above. But that's not very relavent,
lldb should still be able to understand MSVC geneerated pdb.
```
0x1003 | LF_UNION [size = 60] `S::<unnamed-tag>`
unique name: `.?AT<unnamed-type-$S1>@S@@`
field list: <no type>
options: forward ref (= 0x1003) | has unique name | is nested, sizeof 0
0x1004 | LF_FIELDLIST [size = 40]
- LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
- LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
- LF_NESTTYPE [name = ``, parent = 0x1003]
0x1005 | LF_STRUCTURE [size = 32] `S`
unique name: `.?AUS@@`
vtable: <no type>, base list: <no type>, field list: 0x1004
options: contains nested class | has unique name, sizeof 4
0x1006 | LF_FIELDLIST [size = 28]
- LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
- LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1007 | LF_UNION [size = 60] `S::<unnamed-tag>`
unique name: `.?AT<unnamed-type-$S1>@S@@`
field list: 0x1006
options: has unique name | is nested | sealed, sizeof
```
This patch delays the FieldDecl creation when travesing LF_FIELDLIST so we know
if there are multiple fields are in the same offsets and are able to group them
into different anonymous unions based on offsets. Nested anonymous union will
be flatten into one anonymous union, because we simply don't have that info, but
they are equivalent in terms of union layout.
Differential Revision: https://reviews.llvm.org/D134849
Xiang Li [Tue, 11 Oct 2022 18:43:42 +0000 (11:43 -0700)]
[DirectX backend] [NFC] Change Resources::write to const.
Change Resources::write to const.
Also fix parameter name.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D135705
Alex Brachet [Thu, 13 Oct 2022 19:26:06 +0000 (19:26 +0000)]
Only enable driver test if in driver build
Alex Brachet [Thu, 13 Oct 2022 19:23:25 +0000 (19:23 +0000)]
[llvm-driver] Add lld
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.
Differential Revision: https://reviews.llvm.org/D127472
Yabin Cui [Thu, 13 Oct 2022 19:16:58 +0000 (15:16 -0400)]
Fix clang version check in SARIF diagnostics test
This is to allow future clang versions and use of LLVM_VERSION_PATCH.
Differential Revision: https://reviews.llvm.org/D135896
Bill Wendling [Wed, 12 Oct 2022 21:43:38 +0000 (14:43 -0700)]
[clang] Update ASM goto documentation to reflect how Clang differs from GCC
That said, we are planning to add this support in the near future.
Link: https://github.com/llvm/llvm-project/issues/53562
Differential Revision: https://reviews.llvm.org/D135818
Siva Chandra Reddy [Tue, 11 Oct 2022 00:38:29 +0000 (00:38 +0000)]
[libc] Add a simple implementation of the posix_spawn function.
The implementation currently ignores all spawn attributes. Support for
them will be added in future changes.
A simple allocator for integration tests has been added so that the
integration test for posix_spawn can use the
posix_spawn_file_actions_add* functions.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D135752
Sanjoy Das [Thu, 13 Oct 2022 18:09:09 +0000 (11:09 -0700)]
Unbreak Windows build
Without the llvm_unreachable, Windows complains about not returning a
value from mlir::isSpeculatable on all paths.
Differential Revision: https://reviews.llvm.org/D135899
Jonathon Penix [Fri, 7 Oct 2022 02:37:10 +0000 (19:37 -0700)]
[flang] Lower assumed length character allocatable and pointer arguments
It seems the needed functionality was already implemented for host associations,
so turn that code into a function and move it into a (hopefully appropriate)
common location and reuse it.
Differential Revision: https://reviews.llvm.org/D135481
Florian Hahn [Thu, 13 Oct 2022 17:58:37 +0000 (18:58 +0100)]
[ConstraintElim] Move check-and-replace logic to helper function (NFC).
Move logic to check and replace conditions to a helper function. This
isolates the code, allows using early returns, reduces the
indentation and simplifies eliminateConstraints.
Jakub Chlanda [Thu, 13 Oct 2022 17:40:00 +0000 (10:40 -0700)]
[NVPTX] Support neg{.ftz} for f16 and f16x2
Differential Revision: https://reviews.llvm.org/D135428
Wiktor Garbacz [Thu, 13 Oct 2022 17:40:27 +0000 (10:40 -0700)]
Fix LSan build
This change fixes a build bug introduced in
39db491957dcf095936d81bed89c2b4edae2a1e7
Differential Revision: https://reviews.llvm.org/D135860
Aaron Puchert [Wed, 13 Jul 2022 23:47:52 +0000 (01:47 +0200)]
Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls
When support for copy elision was initially added in
e97654b2f2807, it
was taking attributes from a constructor call, although that constructor
call is actually not involved. It seems more natural to use attributes
on the function returning the scoped capability, which is where it's
actually coming from. This would also support a number of interesting
use cases, like producing different scope kinds without the need for tag
types, or producing scopes from a private mutex.
Changing the behavior was surprisingly difficult: we were not handling
CXXConstructorExpr calls like regular calls but instead handled them
through the DeclStmt they're contained in. This was based on the
assumption that constructors are basically only called in variable
declarations (not true because of temporaries), and that variable
declarations necessitate constructors (not true with C++17 anymore).
Untangling this required separating construction from assigning a
variable name. When a call produces an object, we use a placeholder
til::LiteralPtr for `this`, and we collect the call expression and
placeholder in a map. Later when going through a DeclStmt, we look up
the call expression and set the placeholder to the new VarDecl.
The change has a couple of nice side effects:
* We don't miss constructor calls not contained in DeclStmts anymore,
allowing patterns like
MutexLock{&mu}, requiresMutex();
The scoped lock temporary will be destructed at the end of the full
statement, so it protects the following call without the need for a
scope, but with the ability to unlock in case of an exception.
* We support lifetime extension of temporaries. While unusual, one can
now write
const MutexLock &scope = MutexLock(&mu);
and have it behave as expected.
* Destructors used to be handled in a weird way: since there is no
expression in the AST for implicit destructor calls, we instead
provided a made-up DeclRefExpr to the variable being destructed, and
passed that instead of a CallExpr. Then later in translateAttrExpr
there was special code that knew that destructor expressions worked a
bit different.
* We were producing dummy DeclRefExprs in a number of places, this has
been eliminated. We now use til::SExprs instead.
Technically this could break existing code, but the current handling
seems unexpected enough to justify this change.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D129755
Tom Praschan [Fri, 7 Oct 2022 10:46:11 +0000 (12:46 +0200)]
[clangd] Add missing readonly modifier for const generic parameters
Fixes https://github.com/clangd/clangd/issues/1222. As discussed there, we saw no reason to keep this check.
Differential Revision: https://reviews.llvm.org/D135892
Alan Hu [Thu, 13 Oct 2022 17:07:06 +0000 (10:07 -0700)]
[llvm-ocaml] Fix arity mismatch in pointer bindings
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D135842
Eric Li [Wed, 12 Oct 2022 20:28:59 +0000 (16:28 -0400)]
[clang] Support `constexpr` for some `ASTNodeKind` member functions
Add `constexpr` support for:
* The `getFromNodeKind` factory function
* `isSame`
* `isNone`
* `hasPointerIdentity`
This enables these functions to be used in SFINAE context for AST node
types.
Differential Revision: https://reviews.llvm.org/D135816
Nico Weber [Thu, 13 Oct 2022 15:44:09 +0000 (11:44 -0400)]
[lld/mac] Add test for bug fixed in reland
82ca390062d115
Differential Revision: https://reviews.llvm.org/D135889
Sam Clegg [Wed, 12 Oct 2022 23:39:47 +0000 (16:39 -0700)]
[lld][WebAssembly] Add `--extra-features` flag to add addional features
This flag acts just like the existing `--features` flag but instead
of replacing the set of inferred features it adds to it.
This is useful for example if you want to `--export` a mutable global
but none of the input of object were built with mutable global support.
In that case you can do `--extra-features=mutable-globals` to avoid the
linker error that would otherwise be generated in this case:
wasm-ld: error: mutable global exported but 'mutable-globals' feature not present in inputs: `__stack_pointer`. Use --no-check-features to suppress.
Differential Revision: https://reviews.llvm.org/D135831
Arthur Eubanks [Tue, 4 Oct 2022 22:13:16 +0000 (15:13 -0700)]
[PassTimingInfo] Stop double (or worse) counting passes/analyses
If we nest timers, we end up double counting anything nested.
The most egregious is ModuleInlinerWrapperPass/DevirtSCCRepeatedPass showing up as >20% of the total time when they're just wrappers.
Analyses also end up getting counted multiple times because they're nested inside wrappers and passes.
Ignore ModuleInlinerWrapperPass/DevirtSCCRepeatedPass and put analyses into their own TimerGroup.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D135219
Craig Topper [Thu, 13 Oct 2022 15:52:58 +0000 (08:52 -0700)]
[RISCV] Match (select C, -1, X)->(or -C, X) during lowerSelect
Same with (select C, X, -1), (select C, 0, X), and (select C, X, 0).
There's a DAGCombine after we turn the select into select_cc, but
that may introduce a setcc that didn't previously exist. We could
add more DAGCombines to remove the extra setcc, but this seemed lower
effort.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D135833
Nico Weber [Thu, 13 Oct 2022 15:18:59 +0000 (11:18 -0400)]
[lld/mac] Convert undef-spell-corrector.s test to split-file
Differential Revision: https://reviews.llvm.org/D135888
Nico Weber [Thu, 13 Oct 2022 14:36:08 +0000 (10:36 -0400)]
[lld/mac] Make two local variables const
While reading this code, I was wondering if we change these variables in the
loop. We don't, so make them const to make this easier to see next time.
No behavior change.
Differential Revision: https://reviews.llvm.org/D135877
Ramiro Leal-Cavazos [Thu, 13 Oct 2022 16:02:01 +0000 (09:02 -0700)]
Fix handling of rank-1 tensors in tosa.reduce_sum
The conversion of `tosa.reduce_sum` to linalg creates a
`linalg.generic` op that produces a tensor of rank `input_rank -
1`. This tensor is then expanded back into a tensor of rank
`input_rank`. In the case where the tensor being expanded is rank-0,
the reassociation map used must be empty. However, the current
implementation indexes and modifies the reassociation map independent
of the rank of the tensor being expanded, resulting in out-of-bounds
indexing when the tensor being expanded is rank-0. This commit adds a
guard to the reassociation map indexing.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D135828
Mehdi Amini [Thu, 6 Oct 2022 19:31:50 +0000 (19:31 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in TosaCanonicalizations.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:31:17 +0000 (19:31 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in TosaCanonicalizations.cpp (NFC)
David Green [Thu, 13 Oct 2022 15:41:44 +0000 (16:41 +0100)]
[CodeGenPrep] Handle constants in ConvertPhiType
This is a simple addition to the convertPhiTypes in CodeGenPrepare to
consider and convert constants as it converts the phi type. Someone
fixed the bug in the motivating example, so the undef is now a constant
0. This does mean converting between integer and floating point
constants, which may have different materialization.
Differential Revision: https://reviews.llvm.org/D135561
Nicolas Vasilache [Thu, 13 Oct 2022 15:13:25 +0000 (08:13 -0700)]
[mlir][Transform] Fix dropReverseMapping early exit condition
Previously, the erasure would not trigger and result in surprising behavior.
Differential Revision: https://reviews.llvm.org/D135881
Nikita Popov [Thu, 13 Oct 2022 15:29:37 +0000 (17:29 +0200)]
[MemCpyOpt] Add additional tests with lifetime intrinsics (NFC)
David Green [Thu, 13 Oct 2022 15:23:34 +0000 (16:23 +0100)]
[AArch64] Add ConvertPhiType constant tests. NFC
Nikita Popov [Thu, 13 Oct 2022 15:02:16 +0000 (17:02 +0200)]
[MemCpyOpt] Add additional debug output (NFC)
Nikita Popov [Thu, 13 Oct 2022 14:47:04 +0000 (16:47 +0200)]
[MemCpyOpt] Don't run full pipeline in test (NFC)
Just memcpyopt is enough for this test.
Aaron Ballman [Thu, 13 Oct 2022 14:58:52 +0000 (10:58 -0400)]
Update developer policy on potentially breaking changes
We've recently had issues appropriately notifying users and
stakeholders of changes to projects that may be potentially disruptive
when upgrading. This led to discussion on Discourse about how to
improve the situation, which can be found at:
https://discourse.llvm.org/t/rfc-add-new-discourse-channel-for-potentially-breaking-disruptive-changes-for-clang/65251
Ultimately, it sounds like we want to encourage three things:
* Alert vendors during the code review so they can provide early
feedback on potentially breaking changes that would be unacceptable
for them.
* Alert vendors and users after committing the changes so they can
perform pre-release testing on a completed change to determine if it
causes unreasonable problems for them.
* Alert users more clearly through the release notes so that it's
easier to determine how disruptive an upgrade might be.
This updates the developer policy accordingly.
Differential Revision: https://reviews.llvm.org/D134878
Florian Hahn [Thu, 13 Oct 2022 14:56:26 +0000 (15:56 +0100)]
[LV] Add epilogue test with variable induction start value.
Add additional test mentioned by @venkataramanan.kumar.llvm in
D92132.
Guillaume Chatelet [Thu, 13 Oct 2022 14:49:58 +0000 (14:49 +0000)]
Revert "[libc] New version of the mem* framework"
This reverts commit
d55f2d8ab076298cfd745c05c1b4dfd5583f8b9e.
Guillaume Chatelet [Thu, 13 Oct 2022 14:43:44 +0000 (14:43 +0000)]
[libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.
Codegen can be checked here https://godbolt.org/z/x19zvE59v
Differential Revision: https://reviews.llvm.org/D135134
Nico Weber [Wed, 12 Oct 2022 00:40:26 +0000 (20:40 -0400)]
Reland "[lld/mac] Port typo correction for undefined symbols from ELF port"
The only difference in the reland is that the loop at the top of
getAlternativeSpelling() now calls dyn_cast_or_null() instead
of dyn_cast() -- a file's symbols list can contain null entries.
The test for this might be slightly involved, so I'll land it in
a follow-up, to make the reland similar to the original commit.
Originally reviewed at:
Differential Revision: https://reviews.llvm.org/D135038
This reverts commit
317b5582b813c51d1fb6723fd44b227b7f274bc7.
Alexey Bataev [Tue, 4 Oct 2022 18:14:38 +0000 (11:14 -0700)]
[SLP]Improve costs of vectorized loads/stores by analyzing GEPs.
When generating masked gathers nodes, SLP vectorizer accounts the cost
of the GEPs for loads as part of the scalar-vector transformation cost
estimation. But it does not do it for vectorized loads/stores, while it
may completely remove some of the GEPs completely. Because of this in
some cases masked gather operation can be much more profitable rather
than regular vectorization (masked-gather cost + vector GEP - scalar
loads + GEPs comparing to vectorized loads - scalar loads).
Added the analysis of the removed scalarGEPs for vectorized load/store nodes for better cost estimation.
Differential Revision: https://reviews.llvm.org/D135282
Philip Reames [Thu, 13 Oct 2022 14:08:35 +0000 (07:08 -0700)]
Revert "Remove PlaceSafepoints pass"
This reverts commit
cb66e123c6bc82a793300b6fb3ecbed79c58f557. It was reported via https://reviews.llvm.org/rGcb66e123c6bc82a793300b6fb3ecbed79c58f557#1132969 that the Microsoft.NET compiler is still using this pass.
Matt Devereau [Thu, 13 Oct 2022 14:06:24 +0000 (14:06 +0000)]
[VectorCombine] Add insertelement-shufflevector VectorCombine tests
This is a precommit which adds some tests to show the functionality of an
upcoming VectorCombine optimization
Nemanja Ivanovic [Thu, 13 Oct 2022 14:06:26 +0000 (09:06 -0500)]
[PowerPC] Stash GPR to VSR if emergency spill slot is not reachable
When removing frame indices on PowerPC, we need to scavenge
a GPR to materialize a large constant if the stack offset
for the spill/reload cannot be reached by a D-Form
instruction. However, in a perfect storm of conditions,
we may not have GPR's available to scavenge, thereby
requiring an emergency spill. If such an emergency
spill also needs to be spilled to a location with a
large offset, it would itself require register scavenging
thereby creating an infinite loop.
This patch detects when the scavenger cannot scavenge
a register and the spill/reload is to a location with
a large offset. It then stashes a GPR into a VSR so
that it can use the GPR to materialize the constant
(rather than scavenging a GPR).
Fixes: https://github.com/llvm/llvm-project/issues/52894
Differential revision: https://reviews.llvm.org/D124841
Anton Sidorenko [Thu, 13 Oct 2022 13:56:14 +0000 (14:56 +0100)]
[NFC] Use forward decl of MachineCombinerPattern enum to reduce dependencies
Differential Revision: https://reviews.llvm.org/D135776
Joseph Huber [Thu, 13 Oct 2022 13:44:07 +0000 (08:44 -0500)]
[Libomp] Do not error on undefined version script symbols
Summary:
A recent patch made all of the places we used version scripts in OpenMP
start throwing errors when linking with LLD. This is hopefully the last
one required to get the build bots to pass. This patch simply adds the
`--undefined-version` flag to the places where the version scripts are
used.
Simon Pilgrim [Thu, 13 Oct 2022 13:34:01 +0000 (14:34 +0100)]
[X86] Attempt to combine binary shuffles where both operands come from the same larger vector
Allows us to use combineX86ShuffleChainWithExtract to combine targetshuffle(low_subvector(x),high_subvector(x)) -> low_subvector(targetshuffle(x)) style patterns
This is currently very limited (it must have a v2i64/v2f64 result), but while triaging I noticed we might be able to extend this to allow more types for targets with suitable variable cross lane shuffle support.
Fixes #58339
Pavel Labath [Thu, 13 Oct 2022 13:22:22 +0000 (15:22 +0200)]
[lldb] Place PlatformQemu Properties into anonymous namespace
It's fine right now, but will break as soon as someone else declares a
PluginProperties class in the same way.
Also tighten up the scope of the anonymous namespaces surrounding the
other PluginProperties classes.
Joseph Huber [Thu, 13 Oct 2022 13:08:46 +0000 (08:08 -0500)]
[Libomptarget] Make the plugins ingore undefined exported symbols
Summary:
Recent changes made the default behaviour to error when given an
undefined symbol in a version script. A previous patch fixed this for
`libomptarget` by removing the single undefined symbol. However, the
plguins are expected to only define a subset of the availible functions
so we shouldn't treat it as an error. This patch updates the build flags
to work appropriately.
Florian Hahn [Thu, 13 Oct 2022 12:57:43 +0000 (13:57 +0100)]
[ConstraintElim] Use MulOverflow to avoid UB on signed overflow.
This fixes an UBSan failure after
359bc5c541ae. For inbounds GEP with
index sizes <= 64, having the coefficients overflowing is fine.
Valentin Clement [Thu, 13 Oct 2022 12:48:20 +0000 (14:48 +0200)]
[flang] Lower tbp dispatch calls for polymorphic array element
When calling a type-bound procedure from a polymoprhic array element,
the dynamic type needs to be extracted from the array descriptor
and passed to the embox operation for the pass-object.
Depends on D135809
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135856
Joseph Huber [Thu, 13 Oct 2022 12:39:04 +0000 (07:39 -0500)]
[Libomptarget] Remove undefined 'omp_get_interop_rc_desc' symbol from exports list
Summary:
A recent patch made undefined symbols in version scripts cause errors by
default. The `omp_get_interop_rc_desc` function is declared but not
defined, so it is undefined in the final link unit. This patch removes
it from the exports list, it should be added back in when actually
defined and used.
Tobias Gysi [Thu, 13 Oct 2022 11:45:13 +0000 (14:45 +0300)]
[mlir][llvm] Use TableGen to import compare ops from LLVM IR.
The revision imports compare operations using TableGen generated
builders, instead of using the special handlers defined by the Importer.
It therefore adds a new llvmArgIndexes field that allows to specify
a mapping between MLIR argument and LLVM IR operand indexes if they do
not match. Additionally, the FCmp op is extended with an additional
builder and all compare operations are extended with verification
traits to ensure the operands types match. These extensions simplify
the logic of the newly introduced builders and are in line with the
compare operations define by the arithmetic dialect.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D135855
Jean Perier [Thu, 13 Oct 2022 12:24:56 +0000 (14:24 +0200)]
[flang][RFC] Adding higher level FIR ops to ease expression lowering
This document describes a new HLFIR dialect with a new value type
(hlfir.expr) and some new higher level FIR operations to make lowering
to FIR more straightforward and make pattern matching of high level
Fortran concepts (array and character assignments, character operations,
and transformational intrinsics) easier in FIR.
This should allow implementing the remaining gaps in Fortran 95 features
without increasing the lowering code complexity too much, and get a
clean start for the remaining F2003 and F2018 features.
Differential Revision: https://reviews.llvm.org/D134285
Weining Lu [Thu, 13 Oct 2022 06:37:53 +0000 (14:37 +0800)]
[Clang][LoongArch] Pass "f" and "d" features to cc1 to enable hard float
On LoongArch, currently neither of "f" and "d" feature is passed from
clang driver to cc1 by default. This means the backend generates code
for soft float.
In order to run programs in current LoongArch machines (hard float
environment) this patch temporarily enables "f" and "d" features.
In future, we should conditionally turn on these features depend on
various clang options, e.g. -mdouble-float, -msingle-float,
-msoft-float and -mfpu.
WANG Xuerui [Thu, 13 Oct 2022 11:29:17 +0000 (19:29 +0800)]
[test][LoongArch] Mark old JIT ExecutionEngine tests as unsupported
The old MCJIT won't be accepting new architectures so it can only be
appropriate to add ourselves to the exclude list.
Differential Revision: https://reviews.llvm.org/D134367
WANG Xuerui [Thu, 13 Oct 2022 11:19:49 +0000 (19:19 +0800)]
[LoongArch] Add support for llvm.trap and llvm.debugtrap
Similar to D69390 for RISCV, use a guaranteed non-existing insn for
llvm.trap and the break insn for llvm.debugtrap.
Differential Revision: https://reviews.llvm.org/D134365
Rupert Nash [Thu, 13 Oct 2022 11:22:50 +0000 (07:22 -0400)]
[libc++] <sstream>: update references to standard paragraphs
The paragraph numbers used previously did not match the C++20 nor
C++17 standards. I have updated them to the textual dotted names to
avoid this problem in future.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D135861
WANG Xuerui [Thu, 13 Oct 2022 06:56:52 +0000 (14:56 +0800)]
[LoongArch] Updates for the LoongArch ELF psABI v2.01 revision
The e_flags of existing object files are all 0x3 which happens to be
compatible. From this commit on, all LoongArch objects produced with
upstream LLVM will be of object file ABI v1, which is already supported
by binutils' master branch (to be released as 2.40), and is allowed by
the same binutils version to interlink with v0 objects so the existing
distributions have time to migrate.
Differential Revision: https://reviews.llvm.org/D134601
Sheng [Thu, 13 Oct 2022 10:57:00 +0000 (18:57 +0800)]
[AArch64] Improve codegen for "trunc <4 x i64> to <4 x i8>" for all cases
To achieve this, we need this observation:
`uzp1` is just a `xtn` that operates on two registers
For example, given the following register with type v2i64:
LSB_______MSB
x0 x1 x2 x3
Applying xtn on it we get:
x0 x2
This is equivalent to bitcast it to v4i32, and then applying uzp1 on it:
x0 x1 x2 x3
|
uzp1
v
x0 x2 <value from other register>
We can transform xtn to uzp1 by this observation, and vice versa.
This observation only works on little endian target. Big endian target has
a problem: the uzp1 cannot be replaced by xtn since there is a discrepancy
in the behavior of uzp1 between the little endian and big endian.
To illustrate, take the following for example:
LSB____________________MSB
x0 x1 x2 x3
On little endian, uzp1 grabs x0 and x2, which is right; on big endian, it
grabs x3 and x1, which doesn't match what I saw on the document. But, since
I'm new to AArch64, take my word with a pinch of salt. This bevavior is
observed on gdb, maybe there's issue in the order of the value printed by it ?
Whatever the reason is, the execution result given by qemu just doesn't match.
So I disable this on big endian target temporarily until we find the crux.
Fixes #57502
Reviewed By: dmgreen, mingmingl
Co-authored-by: Mingming Liu <mingmingl@google.com>
Differential Revision: https://reviews.llvm.org/D133850
Sam McCall [Tue, 11 Oct 2022 17:10:53 +0000 (19:10 +0200)]
[pseudo] Document disambiguation design progress
Need to take a break from this, so write down where we got to.
Differential Revision: https://reviews.llvm.org/D135696
Daniel Grumberg [Wed, 12 Oct 2022 17:18:15 +0000 (18:18 +0100)]
[clang][ExtractAPI] Ignore fully anonymous RecordDecls
ExtractAPI was emitting a separate symbol for anonymous record declaration
that define the type of a member of another record declaration. Now
ExtractAPI ignores these declarations and just records the existence of
the actual member.
Differential Revision: https://reviews.llvm.org/D135804
Simon Pilgrim [Thu, 13 Oct 2022 10:36:14 +0000 (11:36 +0100)]
[X86][AVX2] Add shuffle test case where we fail to merge vpunpcklqdq(vextracti128(x,0),vextracti128(x,1)) -> vpermq
These are likely to appear during truncation
Caroline Concatto [Thu, 6 Oct 2022 11:38:42 +0000 (12:38 +0100)]
[AArch64] Add SME 2 target feature for Armv8-A and Armv9-A 2022 Architecture Extension
First patch in a series adding MC layer support for Scalable Matrix
Extension 2 (SME2).
This patch adds the following feature:
sme2
The 2022 Architecture Extension release adds other feature flags(eg.:sme2.1),
that will be in follow-up patches.
The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09
Differential Revision: https://reviews.llvm.org/D135448
Nikita Popov [Thu, 13 Oct 2022 10:08:08 +0000 (12:08 +0200)]
Revert "[FunctionAttrs] Make location classification more precise"
This reverts commit
b05f5b90a12098660a4fc16da0b4d421ddfe14e2.
There are thread sanitizer buildbot failures in simple_stack.c.
I think that's because this ended up affecting the handling of
volatile accesses to allocas. Reverting for now.
Nikita Popov [Mon, 10 Oct 2022 12:12:18 +0000 (14:12 +0200)]
[ModRef] Move ModRefInfo and FunctionModRefBehavior into IR (NFC)
This is in preparation for
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579.
FunctionModRefBehavior will be used by attributes, and as such has
to be available in IR, not just Analysis.
Differential Revision: https://reviews.llvm.org/D135589
Sam McCall [Wed, 12 Oct 2022 23:43:49 +0000 (01:43 +0200)]
[clangd] Block clang-tidy misc-const-correctness check
This check performs an extremely large amount of work (for each variable, it
runs very many full matcher-driven traversals of the whole scope the variable
is defined in).
When (inadvertently) enabled for Fuchsia, it regressed BuildAST times by >10x
(400ms -> 7s on my machine).
Differential Revision: https://reviews.llvm.org/D135829
Valentin Clement [Thu, 13 Oct 2022 09:40:40 +0000 (11:40 +0200)]
[flang] Add optional tdesc operand to fir.embox for polymorphic entities
In some cases, it is useful to be able to embox a polymorphic entity
together with its dynamic type. This patch adds an optional tdesc operand
to fir.embox so the dynamic type can be provided while emboxing the entity.
This will be used in follow-up patch that lowers tbp calls for element of
polymorphic entities array.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135809
Archibald Elliott [Tue, 11 Oct 2022 13:02:33 +0000 (14:02 +0100)]
[ARM] Support fp16/bf16 using w constraint
fp16 and bf16 values can be used in GCC's inline assembly using the "w"
constraint, which means "VFP floating-point registers d0-d31" - fp16 and
bf16 values are stored in S registers (which alias the D registers).
This change ensures that LLVM is compatible with GCC for programs that
use fp16 and the 'w' constraint.
Differential Revision: https://reviews.llvm.org/D135662