Jan Svoboda [Tue, 4 Oct 2022 19:19:01 +0000 (12:19 -0700)]
[clang][deps] Abolish FileManager sharing
This patch removes the ability of a dependency scanning worker to share a `FileManager` instance between individual scans. It's not sound and doesn't provide performance benefits (due to the underlying caching VFS).
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D134976
Sam McCall [Tue, 4 Oct 2022 19:37:27 +0000 (21:37 +0200)]
[clangd] Don't print locations of anonymous tags
These are usually not interesting when clangd presents results in
context, and the file paths are noisy.
Valentin Clement [Tue, 4 Oct 2022 19:29:28 +0000 (21:29 +0200)]
[flang] Lower TYPE(*) as fir.box<none>
This patch lowers `TYPE(*)` correctly to fir.box<none>.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135141
jeff [Tue, 6 Sep 2022 19:54:53 +0000 (19:54 +0000)]
[DAGCombiner] [AMDGPU] Allow vector loads in MatchLoadCombine
Since SROA chooses promotion based on reaching load / stores of allocas, we may run into scenarios in which we alloca a vector, but promote it to an integer. The result of which is the familiar LoadCombine pattern (i.e. ZEXT, SHL, OR). However, instead of coming directly from distinct loads, the elements to be combined are coming from ExtractVectorElements which stem from a shared load.
This patch identifies such a pattern and combines it into a load.
Change-Id: I0bc06588f11e88a0a975cde1fd71e9143e6c42dd
Siva Chandra Reddy [Tue, 4 Oct 2022 06:43:59 +0000 (06:43 +0000)]
[libc] Add a minimal implementation of the POSIX fork function.
A very simple and minimal implementation of fork is added. Future
changes will add more functionality to satisfy POSIX and Linux
requirements.
An implementation of wait and a few support macros in sys/wait.h
have also been added to help with testing the fork function.
Reviewed By: lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D135131
Jakub Kuderski [Tue, 4 Oct 2022 18:59:54 +0000 (14:59 -0400)]
[mlir][arith] Mark unknown types legal in WIE
Allow unknown types to pass through without being marked as illegal.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D135123
Christian Sigg [Tue, 4 Oct 2022 18:56:49 +0000 (20:56 +0200)]
[mlir][gpu] Fix GCC -Wparenthesis warning
Yuanfang Chen [Tue, 4 Oct 2022 18:15:03 +0000 (11:15 -0700)]
[Clang] make canonical AutoType constraints-free
As @mizvekov suggested in D134772. This works great for D128750 when
dealing with AutoType's.
Reviewed By: mizvekov, erichkeane
Differential Revision: https://reviews.llvm.org/D135088
Ram-NK [Tue, 4 Oct 2022 18:51:07 +0000 (14:51 -0400)]
[NFC][LoopInterchange] Clean up of irrelevent dependency checking with
isOuterMostDepPositive()
The function isOuterMostDepPositive() is checked after negative dependence
vectors are normalized to be non-negative, so there will not be any negative
dependency ('>' as the outermost non-equal sign) after normalization. And
therefore the check in isOuterMostDepPositive() is irrelevent and redundant.
Reviewed By: congzhe
Differential Revision: https://reviews.llvm.org/D132982
Peiming Liu [Tue, 4 Oct 2022 18:16:58 +0000 (18:16 +0000)]
[mlir][sparse] support singleton in loop emitter.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D135185
serge-sans-paille [Wed, 28 Sep 2022 06:36:41 +0000 (08:36 +0200)]
[clang] Unify Sema and CodeGen implementation of isFlexibleArrayMemberExpr
Turn it into a single Expr::isFlexibleArrayMemberLike method, as discussed in
https://discourse.llvm.org/t/rfc-harmonize-flexible-array-members-handling
Keep different behavior with respect to macro / template substitution, and
harmonize sharp edges: ObjC interface now behave as C struct wrt. FAM and
-fstrict-flex-arrays.
This does not impact __builtin_object_size interactions with FAM.
Differential Revision: https://reviews.llvm.org/D134791
Eli Friedman [Tue, 4 Oct 2022 18:41:59 +0000 (11:41 -0700)]
[AArch64] Don't form paired loads from epilogue operations on Windows
AArch64LoadStoreOptimizer has a bunch of different guards to avoid
corrupting Windows SEH prologues/epilogues, but apparently we missed the
case of merging two instructions where the first instruction isn't part
of the epilogue, but the second instruction is.
Fixes issue discovered at https://reviews.llvm.org/D130049#3704064
Differential Revision: https://reviews.llvm.org/D134992
Daniel Thornburgh [Fri, 15 Jul 2022 21:14:13 +0000 (14:14 -0700)]
[llvm-objdump] [debuginfod] Fetch for very-stripped binaries.
When a binary is missing section headers or symbols, objdump can't
provide as good of a disassembly. This change makes objdump try to fetch
a better verion of the binary by its build ID.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D132887
Jim Ingham [Tue, 4 Oct 2022 18:36:25 +0000 (11:36 -0700)]
Turn off the warning that the undefined behavior I am using in
a test generates. The green dragon bot compiler is treating this
warning as an error for some reason, hopefully this will calm its
worries.
Nathan James [Tue, 4 Oct 2022 18:38:09 +0000 (19:38 +0100)]
[clang] Add fix-it note to defaulted-function-deleted warning
Adds a fix to the diagnostic of replacing the `= default` to `= delete`
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D134549
Alex Langford [Thu, 29 Sep 2022 21:40:57 +0000 (14:40 -0700)]
[clang][DebugInfo] Respect fmodule-file-home-is-cwd in skeleton CUs for clang modules
When -fmodule-file-home-is-cwd and the path to the PCM is relative, we
shouldn't assume that the path to the PCM is relative to the modulemap
that produced it. To respect the option -fmodule-file-home-is-cwd, we
should assume the path is relative to the current working directory.
Reviewed By: rmaz
Differential Revision: https://reviews.llvm.org/D134911
Jim Radford [Tue, 4 Oct 2022 17:40:35 +0000 (10:40 -0700)]
[objdump] Support finding --source via --dsym files
Add support for auto-detecting or specifying dSYM files/directories to
allow interleaving source with disassembly.
Differential Revision: https://reviews.llvm.org/D135117
Patch by Jim Radford.
Aart Bik [Tue, 4 Oct 2022 18:11:50 +0000 (11:11 -0700)]
[mlir][sparse] fixed typo in fix of bazel fix
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D135184
Michał Górny [Tue, 4 Oct 2022 14:36:15 +0000 (16:36 +0200)]
[clang-tools-extra] [test] Use CLANG_NO_DEFAULT_CONFIG=1
Set CLANG_NO_DEFAULT_CONFIG=1 for clang-tools-extra tests to prevent
the system configuration files for clang from affecting the test
results.
Differential Revision: https://reviews.llvm.org/D135159
Erich Keane [Tue, 4 Oct 2022 18:07:03 +0000 (11:07 -0700)]
Remove accidentially left assertion
Aart Bik [Tue, 4 Oct 2022 17:57:34 +0000 (10:57 -0700)]
[mlir][sparse] fix bazel breakage
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D135183
Michael Buch [Tue, 4 Oct 2022 16:50:12 +0000 (17:50 +0100)]
[lldb][test] Skip import-std-module/vector tests
These tests have begun failing starting with commit
`
69a6417406a1b0316a1fa6aeb63339d0e1d2abbd`, which
added a new `import` to `ASTNodeImporter::VisitTypedefType`.
This trips an assertion in following way:
1. When creating a persistent variable for the result we call `CopyType`
(in `DeportType`) under a `CompleteTagDeclsScope` (which is supposed to complete all
decls newly imported in the `CopyType` call).
2. During `CopyType` we call `ASTNodeImporter::VisitTypedefType`
3. This now has a second import call on the desugared type
4. In `ASTImporterDelegate::ImportImpl` we will now try to import a decl
that we originally got from the `std` module (which means it has no valid origin).
But since we’re doing this under a CompleteTagDeclsScope, the
`NewDeclListener::NewDeclImported` adds the decl to the list of decls to
complete after the `CopyType` call. But this list shouldn’t contain decls
with invalid origins because we assert this in `~CompleteTagDeclsScope`, which
is where the tests crash.
We suspect that we previously didn’t see this assert trigger because by the time
we create the result variable we are using an AST whose decls all have
a valid debug-info origin (constructed with the help of the std module).
So we never expected decls from modules to be imported under
`CompleteTagDeclsScope` without a m_sema available (which is the case by
the time we get to `DeportType`). Since there is no `m_sema` available,
`CxxModuleHandler::Import` trivially returns and the decls don’t get added
to the `m_decls_to_ignore` list and count as "newly imported decls".
Skip this test for now until we have a fix or the origin tracking gets
refactored (see https://reviews.llvm.org/D101950).
Differential Revision: https://reviews.llvm.org/D135178
Chris Bieneman [Mon, 3 Oct 2022 18:04:13 +0000 (13:04 -0500)]
[DirectX] Generate `dx.resources` metadata entry
This code adds initial support for generating the HLSL resources
metadata entries. It has a lot of `FIXMEs` laying around because there
is a lot more work to do here, but this lays a solid groundwork and can
accurately handle some trivial cases.
I've filed a swath of issues covering the deficiencies here and left the
issues in comments so that we can easily follow them.
One big change to make sooner rather than later is to move some of this
code into a new libLLVMFrontendHLSL so that we can share it with the
Clang CodeGen layer.
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D134682
Erich Keane [Thu, 29 Sep 2022 18:38:52 +0000 (11:38 -0700)]
Implement DR2565: Invalid types in the parameter-declaration-clause of a
requires-expression
As reported: https://github.com/llvm/llvm-project/issues/57487
We properly treated a failed instantiation of a concept as a
unsatisified constraint, however, we need to do this at the 'requires
clause' level as well. This ensures that the parameters on a requires
clause that fail instantiation will cause a satisfaction failure.
This patch implements this by running requires parameter clause
instantiation under a SFINAE trap, then stores any such failure as a
requirement failure, so it can be diagnosed later.
Alex Lorenz [Tue, 4 Oct 2022 06:06:56 +0000 (23:06 -0700)]
[clang][driver][darwin] Ensure that the SDK version passed to -platform_version has a minor version number 0
The linker requires at least a "major.minor" for the SDK version, so it will fail when we don't have
a minor version in the case we don't actually have an SDK info.
Sanjay Patel [Tue, 4 Oct 2022 17:15:01 +0000 (13:15 -0400)]
[SDAG] don't hoist div/rem through a select with neutral constant
This bug was introduced with D134966.
Sanjay Patel [Tue, 4 Oct 2022 17:08:35 +0000 (13:08 -0400)]
[x86] add test for select + sdiv neutral constant; NFC
Fangrui Song [Tue, 4 Oct 2022 17:01:30 +0000 (10:01 -0700)]
[llvm-objdump] Add --no-addresses as an alias for --no-leading-addr
The output is similar to objdump --no-addresses since binutils 2.35.
Depends on D135039
Close #58088
Differential Revision: https://reviews.llvm.org/D135040
Fangrui Song [Tue, 4 Oct 2022 17:00:21 +0000 (10:00 -0700)]
[llvm-objdump] --no-leading-addr: hide inline relocation offsets
It seems to make sense to omit offsets when --no-leading-addr is specified. The output is now closer
to objdump -dr --no-addresses (non-wide output).
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D135039
Nathaniel McVicar [Tue, 4 Oct 2022 16:42:43 +0000 (09:42 -0700)]
[mlir][sparse] Restore case coverage warning fix
This restores the fix from D134925 to make MSVC and clang happy.
Reviewed By: stella.stamenova
Differential Revision: https://reviews.llvm.org/D135126
Mark de Wever [Sat, 17 Sep 2022 10:57:01 +0000 (12:57 +0200)]
[libc++][format] Updates to Unicode 15.
This adds support for the new code points in the Extended Grapheme
Cluster algorithm. The algorithm itself has remained unchanged.
The width estimation still follows the rules of the Standard.
@cor3ntin filed
LWG3780 format's width estimation is too approximate and not forward compatible
to improve the estimate.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D134106
Daniel Rodríguez Troitiño [Tue, 4 Oct 2022 16:27:11 +0000 (09:27 -0700)]
[ObjectYAML] Support for basic data in code.
This is a split of D134250.
Supports for parsing and dumping the LC_DATA_IN_CODE contents (as binary
data).
This allows more complete testing of llvm-objdump in D133974.
Reviewed By: Higuoxing
Differential Revision: https://reviews.llvm.org/D134569
Craig Topper [Tue, 4 Oct 2022 16:15:13 +0000 (09:15 -0700)]
[RISCV] Refactor and improve eliminateFrameIndex.
There are few changes mixed in here.
-Try to reuse the destination register from ADDI instead of always
creating a virtual register. This way we lean on the register
scavenger in fewer case.
-Explicitly reuse the primary virtual register when possible. There's
still a case where both getVLENFactoredAmount and handling large
fixed offsets can both create a secondary virtual register.
-Combine similar BuildMI calls by manipulating the Register variables.
There are still a couple early outs for ADDI, but overall I tried to
arrange the code into steps.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D135009
Craig Topper [Tue, 4 Oct 2022 16:14:41 +0000 (09:14 -0700)]
[RISCV] Restructure eliminateFrameIndex to share more code. NFC
The old code took two different paths based on whether there is
a scalable offset, but these two paths had some code in common.
The main difference between the two code paths was whether we needed
to create a GPR or not for the ADDI that gets created for RVVSpill.
If we had a scalable offset, the same GPR was used as the destination
for adding the scalable offset and the ADDI. To manage this, we now
cache the scratch register and reuse it if it has already been created.
This is a pre-patch for D135009.
Reviewed By: reames, frasercrmck
Differential Revision: https://reviews.llvm.org/D135092
Nicolas Vasilache [Tue, 4 Oct 2022 12:34:12 +0000 (05:34 -0700)]
[mlir][Linalg] NFC - Add result and bbArg pretty printing to linalg.reduce
Differential Revision: https://reviews.llvm.org/D135152
Daniel Rodríguez Troitiño [Tue, 4 Oct 2022 00:46:42 +0000 (17:46 -0700)]
[ObjectYAML][MachO] Encode export trie address as ULEB128, not as SLEB128
The `dumpExportEntry` was dumping everything using signed LEB128, but
the format seems to use unsigned LEB128. This can be cross-checked with
the implementation in MachOObjectFile.cpp, the implementation in LLD's
ExportTrie.cpp, and the implementation in macho2yaml.cpp, which all use
ULEB128 functions..
The difference is only apparent when encoding some values with specific
bit patterns (bit active in the 7th, 14th, ... bits of the binary). The
encoding was not always creating problems in the resulting binaries
because if the extra byte was part of the padding, the result of
decoding it as ULEB128 is the same as decoding as SLEB128, however, the
code of MachOObjectFile.cpp (used by llvm-objdump) checks the buffer
decoding position against the reported length, which triggered an error.
Modified a test that used an address with this pattern (0x3FA0, the 14th
bit is active), to show that a round trip still produces the same
results, and added a check using llvm-objdump to use their extra checks
to verify this implementation.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D134563
Nicolas Vasilache [Tue, 4 Oct 2022 09:24:00 +0000 (02:24 -0700)]
[mlir][Tensor] NFC - Add result pretty printing to TensorOps
Differential Revision: https://reviews.llvm.org/D135135
Aaron Ballman [Tue, 4 Oct 2022 16:12:49 +0000 (12:12 -0400)]
Modify the qualified/unqualified getter for TypeOfType; NFC
Post-commit feedback observed that returning the TypeOfKind from the
type instead of a Boolean cleans up code using that interface.
Tom Honermann [Fri, 6 May 2022 20:55:05 +0000 (13:55 -0700)]
[clang] Correct handling of lambdas in lambda default arguments in dependent contexts.
Previously, a lambda expression in a dependent context with a default argument
containing an immediately invoked lambda expression would produce a closure
class object that, if invoked such that the default argument was used, resulted
in a compiler crash or one of the following assertion failures during code
generation. The failures occurred regardless of whether the lambda expressions
were dependent.
clang/lib/CodeGen/CGCall.cpp:
Assertion `(isGenericMethod || Ty->isVariablyModifiedType() || Ty.getNonReferenceType()->isObjCRetainableType() || getContext() .getCanonicalType(Ty.getNonReferenceType()) .getTypePtr() == getContext().getCanonicalType((*Arg)->getType()).getTypePtr()) && "type mismatch in call argument!"' failed.
clang/lib/AST/Decl.cpp:
Assertion `!Init->isValueDependent()' failed.
Default arguments in declarations in local context are instantiated along with
their enclosing function or variable template (since such declarations can't
be explicitly specialized). Previously, such instantiations were performed at
the same time that their associated parameters were instantiated. However, that
approach fails in cases like the following in which the context for the inner
lambda is the outer lambda, but construction of the outer lambda is dependent
on the parameters of the inner lambda. This change resolves this dependency by
delyaing instantiation of default arguments in local contexts until after
construction of the enclosing context.
template <typename T>
auto f() {
return [](T = []{ return T{}; }()) { return 0; };
}
Refactoring included with this change results in the same code now being used
to instantiate default arguments that appear in local context and those that
are only instantiated when used at a call site; previously, such code was
duplicated and out of sync.
Fixes https://github.com/llvm/llvm-project/issues/49178
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D133500
Sanjay Patel [Tue, 4 Oct 2022 14:42:59 +0000 (10:42 -0400)]
[InstSimplify] try harder to fold fmul with 0.0 operand
https://alive2.llvm.org/ce/z/oShzr3
This was noted as a missing fold in D134876 (with additional
examples based on issue #58046).
I'm assuming that fmul with a zero operand is rare enough
that the use of ValueTracking will not noticeably increase
compile-time.
This adjusts a PowerPC codegen test that was added with D88388
because it would get folded away and no longer provide coverage
for the bug fix.
Alexey Bataev [Wed, 21 Sep 2022 17:19:43 +0000 (10:19 -0700)]
[SLP]Try to emit canonical shuffle with undef operand.
In the canonical form of the shuffle the poison/undef operand is the
second operand, the patch tries to emit canonical form for partial
vectorization of the buildvector sequence.
Also, this patch starts emitting freeze instruction for shuffles with undef indices if the second shuffle operan is undef, not poison. It is an initial step to D93818, where undef mask element are treated as returning poison value.
Differential Revision: https://reviews.llvm.org/D134377
Pierre van Houtryve [Tue, 4 Oct 2022 14:14:56 +0000 (14:14 +0000)]
[AMDGPU][DAG] Fix insert_vector_elt lowering for 8 bit elements
The bitmask used to extract the bits assumed 16 bit elements and wasn't taking the size of the elements into account.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D135156
Sanjay Patel [Tue, 4 Oct 2022 13:25:56 +0000 (09:25 -0400)]
[InstSimplify] add tests for fmul with 0.0 operand; NFC
Sanjay Patel [Mon, 3 Oct 2022 21:36:55 +0000 (17:36 -0400)]
[InstSimplify] reduce code duplication for fmul folds; NFC
This is a modification of the earlier attempt from:
7b7940f9da80
For fma callers, we only want to swap a 0.0 or 1.0 constant.
Pierre van Houtryve [Fri, 30 Sep 2022 14:56:04 +0000 (14:56 +0000)]
[AMDGPU] Always lower SHUFFLE_VECTOR
Make it illegal, remove InstructionSelector logic for it
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D134967
Jay Foad [Tue, 4 Oct 2022 10:24:19 +0000 (11:24 +0100)]
[ISel] Fix crash in new FMA DAG combine
Fix a crash in the FMA combine added by D132837 and amended by D134810.
In cases where the newly created node could be folded, the combiner
would fail this assertion:
llc: DAGCombiner.cpp:268: void (anonymous namespace)::DAGCombiner::AddToWorklist(llvm::SDNode *): Assertion `N->getOpcode() != ISD::DELETED_NODE && "Deleted Node added to Worklist"' failed.
Differential Revision: https://reviews.llvm.org/D135150
Amara Emerson [Tue, 4 Oct 2022 13:45:48 +0000 (14:45 +0100)]
[AArch64] Re-generate some checks for itofp and min/max legalization.
Dominik Adamski [Fri, 16 Sep 2022 09:01:17 +0000 (04:01 -0500)]
[OpenMP][OMPIRBuilder] Add support for order(concurrent) to OMPIRBuilder for SIMD directive
If 'order(concurrent)' clause is specified, then the iterations of SIMD loop
can be executed concurrently.
This patch adds support for LLVM IR codegen via OMPIRBuilder for SIMD loop
with 'order(concurrent)' clause. The functionality added to OMPIRBuilder is
similar to the functionality implemented in 'CodeGenFunction::EmitOMPSimdInit'.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D134046
Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
Florian Hahn [Tue, 4 Oct 2022 13:28:04 +0000 (14:28 +0100)]
[LoopVersioning,LLE] Add -S option to runlines.
Pierrick Bouvier [Tue, 4 Oct 2022 13:21:44 +0000 (15:21 +0200)]
Detect errors in Windows packaging script
- Detect VS devcmd error (missing VS)
- Detect missing python install
- Show commands executed
- Removed pause (blocking CI usage)
Differential revision: https://reviews.llvm.org/D135138
Nikita Popov [Fri, 30 Sep 2022 10:13:40 +0000 (12:13 +0200)]
Reapply [InstCombine] Switch foldOpIntoPhi() to use InstSimplify
Reapply with a fix for the case where an operand simplified back
to the original phi: We need to map this case to the new phi node.
-----
foldOpIntoPhi() currently only folds operations into the phi if all
but one operands constant-fold. The two exceptions to this are freeze
and select, where we allow more general simplification.
This patch makes foldOpIntoPhi() generally simplification based and
removes all the instruction-specific logic. We just try to simplify
the instruction for each operand, and for the (potentially) one
non-simplified operand, we move it into the new block with adjusted
operands.
This fixes https://github.com/llvm/llvm-project/issues/57448, which
was my original motivation for the change.
Alex Richardson [Tue, 4 Oct 2022 11:51:36 +0000 (11:51 +0000)]
[SimplifyLibCalls] Retain attributes added by Builder.CreateMem*
This currently does not make much of a difference (only one tests is
affected), but it is helpful e.g. for the out-of-tree CHERI target where
Builder.CreateMemCpy() can add attributes other than parameter alignment.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D135075
Nikita Popov [Tue, 4 Oct 2022 13:09:04 +0000 (15:09 +0200)]
[InstCombine] Add test where op of phi simplifies to phi (NFC)
Degenerate case for D134954.
Louis Dionne [Wed, 21 Sep 2022 13:50:53 +0000 (09:50 -0400)]
[llvm] Remove libcxx, libcxxabi and libunwind from supported LLVM_ENABLE_PROJECTS
This is a breaking change. If you were passing one of those three runtimes
in LLVM_ENABLE_PROJECTS, you need to start passing them in LLVM_ENABLE_RUNTIMES
instead. The runtimes in LLVM_ENABLE_RUNTIMES will start being built using
the "bootstrapping build" instead, which means that they will be built
using the just-built Clang. This is usually what you wanted anyway.
If you were using LLVM_ENABLE_PROJECTS=all with the explicit goal of
building these three runtimes, you can now use LLVM_ENABLE_RUNTIMES=all
and these runtimes will be built using the bootstrapping build.
NOTE: This is a re-application of
887b8bd733ea which had been reverted
in
6b03a4fea0b4 because it broke the Sphinx documentation publishers.
The Sphinx documentation publishers have now been moved to using
the runtimes build, so this should not be an issue anymore.
Differential Revision: https://reviews.llvm.org/D132480
Denys Shabalin [Tue, 4 Oct 2022 10:58:38 +0000 (10:58 +0000)]
[mlir] Add fully dynamic constructor to StridedLayoutAttr bindings
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D135139
Uday Bondhugula [Mon, 26 Sep 2022 05:23:16 +0000 (10:53 +0530)]
[MLIR] Simplify affine maps + operands exploiting IV info
Simplify affine expressions and maps while exploiting simple range and
step info of any IVs that are operands. This simplification is local,
O(1) and practically useful in several scenarios. Accesses with
floordiv's and mod's where the LHS is non-negative and bounded or is a
known multiple of a constant can often be simplified. This is
implemented as a canonicalization for all affine ops in a generic way:
all affine.load/store, vector_load/store, affine.apply, affine.min/max,
etc. ops.
Eg: For tiled loop nests accessing buffers this way:
affine.for %i = 0 to 1024 step 32 {
affine.for %ii = 0 to 32 {
affine.load [(%i + %ii) floordiv 32, (%i + %ii) mod 32]
}
}
// Note that %i is a multiple of 32 and %ii < 32, hence:
(%i + %ii) floordiv 32 is the same as %i floordiv 32
(%i + %ii) mod 32 is the same as %ii mod 32.
The simplification leads to simpler index/subscript arithmetic for
multi-dimensional arrays and also in turn enables detection of spatial
locality (for vectorization for eg.), temporal locality or loop
invariance for hoisting or scalar replacement.
Differential Revision: https://reviews.llvm.org/D135085
Thomas Symalla [Tue, 4 Oct 2022 12:30:56 +0000 (14:30 +0200)]
[NFC][AMDGPU] Pre-commit test for D134418.
Adrian Kuegel [Tue, 4 Oct 2022 12:07:39 +0000 (14:07 +0200)]
[mlir] Apply ClangTidy performance finding.
loop variable is copied but only used as const reference.
Alex Zinenko [Fri, 30 Sep 2022 14:11:34 +0000 (14:11 +0000)]
[mlir] relax transform dialect multi-handle restriction
Relax the restriction in the transform dialect interpreter utilities
that expected a payload IR op to be assocaited with at most one
transform IR handle value. This was useful during the initial
bootstrapping to avoid use-after-free error equivalents when a payload
IR op could be erased through one of the handles associated with it and
then accessed through another. It was, however, possible to erase an
ancestor of the payload IR operation in question. The expensive-checks
mode of interpretation is able to detect both cases and has proven
sufficiently robust in debugging use-after-free errors.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D134964
Guray Ozen [Mon, 3 Oct 2022 07:56:42 +0000 (09:56 +0200)]
[mlir][transform] Create GPU transform dialect
This revision adds GPU transform dialect. It also introduce a prefix such as "transform.gpu" for all ops related to this dialect.
MLIR already had two GPU transform op in linalg. This revision moves these ops into GPUTransformOps. The Ops are as follows:
`transform.structured.map_nested_foreach_thread_to_gpu_blocks` -> `transform.gpu.map_foreach_to_blocks`
This op selects the outermost (toplevel) foreach_thread and parallelize across GPU blocks. It can also generate `gpu_launch`.
`transform.structured.map_nested_foreach_thread_to_gpu_threads` -> `transform.gpu.map_nested_foreach_to_threads`
This op parallelizes nested foreach_thread that are inside `gpu_launch` across GPU threads.
It doesn't add new functionality, but there are some minor refactoring of the code.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D134800
Bjorn Pettersson [Thu, 29 Sep 2022 20:31:33 +0000 (22:31 +0200)]
[LibCalls] Cast Char argument to 'int' before calling emitFPutC
The helpers in BuildLibCalls normally expect that the Value
arguments already have the correct type (matching the lib call
signature). And exception has been emitFPutC which casted the Char
argument to 'int' using CreateIntCast. This patch moves the cast to
the caller instead of doing it inside emitFPutC.
I think it makes sense to make the BuildLibCall API:s a bit
more consistent this way, despite the need to handle the int cast
in two different places now.
Differential Revision: https://reviews.llvm.org/D135066
Bjorn Pettersson [Wed, 28 Sep 2022 20:59:39 +0000 (22:59 +0200)]
[BuildLibCalls] Use TLI to get 'int' and 'size_t' type sizes
Stop assuming that an 'int' is 32 bits in helpers that emit libcalls
to lib functions that had 'int' in the signature. For most targets
this is NFC. For a target with 16 bit 'int' type this could help out
detecting if trying to emit a libcall with incorrect signature.
Similarly we now derive the type mapping to 'size_t' by asking TLI
about the size of 'size_t'. This should be NFC (at least for in-tree
targets) since getSizeTSize(), in TLI, is deriving the size in the
same way as DataLayout::getIntPtrType().
Differential Revision: https://reviews.llvm.org/D135065
Bjorn Pettersson [Wed, 28 Sep 2022 20:18:59 +0000 (22:18 +0200)]
[BuildLibCalls] Name types to identify when 'int' and 'size_t' is assumed. NFC
Lots of BuildLibCalls helpers are using Builder::getInt32Ty to get
a type matching an 'int', and DataLayout::getIntPtrType to get a
type matching 'size_t'. The former is not true for all targets, since
and 'int' isn't always 32 bits. And the latter is a bit weird as well
as the definition of DataLayout::getIntPtrType isn't clearly mapping
it to 'size_t'.
This patch is not aiming at solving any such problems. It is merely
highlighting when a libcall is expecting to use 'int' and 'size_t'
by naming the types as IntTy and SizeTTy when preparing the type
signatures for the emitted libcalls.
Differential Revision: https://reviews.llvm.org/D135064
Florian Hahn [Tue, 4 Oct 2022 10:51:22 +0000 (11:51 +0100)]
[LAA] Pass LoopAccessInfoManager instead of GetLAA function.
Use LoopAccessInfoManager directly instead of various GetLAA lambdas.
Depends on D134608.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D134609
Amara Emerson [Tue, 4 Oct 2022 09:08:49 +0000 (10:08 +0100)]
Revert "[AArch64][GlobalISel] Fold away lowered vector sign-extend of vector compares."
This reverts commit
dcd02a524befcec71f46ab76d725b2a8f8623d69.
We should instead use the generic combine.
Nikita Popov [Tue, 4 Oct 2022 09:08:45 +0000 (11:08 +0200)]
[ValueTracking] Handle constant exprs in isKnownNonZero()
Handle constant expressions by falling through to the general
operator-based code. In particular, this adds support for bitcast
and GEP expressions.
Daniel Bertalan [Mon, 15 Aug 2022 07:26:28 +0000 (09:26 +0200)]
[lld-macho] Add support for emitting chained fixups
This commit adds support for chained fixups, which were introduced in
Apple's late 2020 OS releases. This format replaces the dyld opcodes
used for supplying rebase and binding information, and encodes most of
that data directly in the memory location that will have the fixup
applied.
This reduces binary size and is a requirement for page-in linking, which
will be available starting with macOS 13.
A high-level overview of the format and my implementation can be found
in SyntheticSections.h.
This feature is currently gated behind the `-fixup_chains` flag, and
will be enabled by default for supported targets in a later commit.
Like in ld64, lazy binding is disabled when chained fixups are in use,
and the `-init_offsets` transformation is performed by default.
Differential Revision: https://reviews.llvm.org/D132560
bipmis [Tue, 4 Oct 2022 09:39:32 +0000 (10:39 +0100)]
Add reverse load pattern tests
Florian Hahn [Tue, 4 Oct 2022 09:27:52 +0000 (10:27 +0100)]
[SimpleLoopUnswitch] Clear block and loop dispos after destroying loop.
SimpleLoopUnswitch may remove loops. Clear block and loop dispositions,
to clean up invalid entries in the cache.
Fixes #58136.
Nikita Popov [Tue, 4 Oct 2022 09:20:54 +0000 (11:20 +0200)]
[SimplifyLibCalls] Place deref attr even if nonnull already set
If nonnull is already set, we currently skip setting both nonnull
and dereferenceable. Make these independent, to avoid regressions
when additional nonnull attributes are inferred earlier.
Nikita Popov [Tue, 4 Oct 2022 09:17:09 +0000 (11:17 +0200)]
Revert "[InstCombine] Switch foldOpIntoPhi() to use InstSimplify"
This reverts commit
b20e34b39f72f2be035dfb7367b6880fd2cf213a.
This causes RAUW type mismatch assertions on some buildbots,
reverting for now.
Nikita Popov [Tue, 4 Oct 2022 09:02:31 +0000 (11:02 +0200)]
[ValueTracking] Avoid known bits fallthrough for freeze (NFCI)
The known bits logic should never produce a better result than
the direct recursive non-zero query here, so skip the fallthrough.
Nikita Popov [Tue, 4 Oct 2022 08:50:29 +0000 (10:50 +0200)]
[ValueTracking] Switch isKnownNonZero() to switch over opcodes (NFCI)
The change in the assume-queries-counter.ll test is because we skip
and unnecessary known bits query for arguments.
Matthias Springer [Tue, 4 Oct 2022 08:06:00 +0000 (17:06 +0900)]
[mlir][tensor][NFC] Rename linalg.init_tensor to tensor.empty
tensor.empty/linalg.init_tensor produces an uninititalized tensor that can be used as a destination operand for destination-style ops (ops that implement `DestinationStyleOpInterface`).
This change makes it possible to implement `TilingInterface` for non-destination-style ops without depending on the Linalg dialect.
RFC: https://discourse.llvm.org/t/rfc-add-tensor-from-shape-operation/65101
Differential Revision: https://reviews.llvm.org/D135129
Nikita Popov [Fri, 30 Sep 2022 10:13:40 +0000 (12:13 +0200)]
[InstCombine] Switch foldOpIntoPhi() to use InstSimplify
foldOpIntoPhi() currently only folds operations into the phi if all
but one operands constant-fold. The two exceptions to this are freeze
and select, where we allow more general simplification.
This patch makes foldOpIntoPhi() generally simplification based and
removes all the instruction-specific logic. We just try to simplify
the instruction for each operand, and for the (potentially) one
non-simplified operand, we move it into the new block with adjusted
operands.
This fixes https://github.com/llvm/llvm-project/issues/57448, which
was my original motivation for the change.
Valentin Clement [Tue, 4 Oct 2022 07:42:39 +0000 (09:42 +0200)]
[flang] Lower polymorphic entities types in dummy argument and function result
This patch updates lowering to produce the correct fir.class types for
various polymorphic and unlimited polymoprhic entities cases. This is only the
lowering. Some TODOs have been added to the CodeGen part to avoid errors since
this part still need to be updated as well.
The fir.class<*> representation for unlimited polymorphic entities mentioned in
the document has been updated to fir.class<none> to avoid useless work in pretty
parse/printer.
This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md
Depends on D134957
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D134959
Florian Hahn [Tue, 4 Oct 2022 07:37:11 +0000 (08:37 +0100)]
[LAA] Use LoopAccessInfoManager in legacy pass.
Simplify LoopAccessLegacyAnalysis by using LoopAccessInfoManager from
D134606. As a side-effect this also removes printing support from
LoopAccessLegacyAnalysis.
Depends on D134606.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D134608
LLVM GN Syncbot [Tue, 4 Oct 2022 07:16:10 +0000 (07:16 +0000)]
[gn build] Port
6d9eb5332913
Balázs Kéri [Tue, 4 Oct 2022 06:43:35 +0000 (08:43 +0200)]
[clang-tidy] Add checker 'bugprone-suspicious-realloc-usage'.
Add a check to detect usages of `realloc` where the result is assigned
to the same variable (or field) as passed to the first argument.
Reviewed By: steakhal, martong
Differential Revision: https://reviews.llvm.org/D133119
Nicolas Vasilache [Fri, 30 Sep 2022 11:07:43 +0000 (04:07 -0700)]
[mlir][Memref] NFC - Addresult pretty printing to MemrefOps
Differential Revision: https://reviews.llvm.org/D134968
Lang Hames [Tue, 4 Oct 2022 02:28:56 +0000 (19:28 -0700)]
[llvm-jitlink] Teach InProcessDeltaMapper to honor -slab-page-size option.
The -slab-page-size option is used to set a simulated page size in -no-exec
tests. In order for this to work we need to use read/write permissions only
on all simulated pages in order to ensure that no simulated page is made
read-only by a permission change to the underlying real page.
The aim of this patch is to make it safe to enable ExecutionEngine regression
tests on arm64. Those tests will be enabled in a follow-up patch.
Lang Hames [Tue, 4 Oct 2022 04:45:31 +0000 (21:45 -0700)]
[ORC] Don't unnecessarily copy collection element.
Craig Topper [Tue, 4 Oct 2022 04:40:03 +0000 (21:40 -0700)]
[RISCV] Use _TIED form of VFWADD(U)_WV/VFWSUB(U)_WV to avoid early clobber.
One of the sources is the same size as the destination so that source
doesn't have an overlap with the destination register. By using the _TIED
form we avoid an early clobber contraint for that source.
This matches what was already done for instrinsics. ConvertToThreeAddress
will fix it if it can't stay tied.
Craig Topper [Tue, 4 Oct 2022 01:50:34 +0000 (18:50 -0700)]
[RISCV] Correct the setcc in vp.floor/ceil/round/roundeven lowering.
We want to emit a masked setcc that preserves zeros in all of the bits
where the original mask is zero. To do this we need to pass the original
mask as the passthru operand as well. Otherwise, we'll use the mask agnostic
policy and replace the zeros with 1s on some CPUs.
Differential Revision: https://reviews.llvm.org/D135122
Lang Hames [Tue, 4 Oct 2022 03:43:48 +0000 (20:43 -0700)]
[ORC] Fix typo in
543790add86.
Lang Hames [Tue, 4 Oct 2022 03:31:31 +0000 (20:31 -0700)]
[ORC] More attempts to fix Windows bots after
d3d9f7caf966.
Move getWindowsProtectionFlags inside namespace to make MemProt type accessible.
Lang Hames [Tue, 4 Oct 2022 03:02:05 +0000 (20:02 -0700)]
[ORC] Attempt to fix Windows bots after
d3d9f7caf966.
That patch failed to include an update to the Windows side of
ExecutorSharedMemoryMapperService.
LLVM GN Syncbot [Tue, 4 Oct 2022 02:36:02 +0000 (02:36 +0000)]
[gn build] Port
d3d9f7caf966
Lang Hames [Sun, 2 Oct 2022 18:19:54 +0000 (11:19 -0700)]
[ORC][JITLink] Move MemoryFlags.h (MemProt, AllocGroup,...) from JITLink to ORC.
Moving these types to OrcShared eliminates the need for the separate
WireProtectionFlags type.
changkaiyan [Tue, 4 Oct 2022 02:16:08 +0000 (10:16 +0800)]
[bug] The additional patch committed file was deleted.
Differential Revision: https://reviews.llvm.org/D134696
deleted:
202209301111.patch
Jez Ng [Tue, 4 Oct 2022 02:14:13 +0000 (22:14 -0400)]
[MC][test] Update arm64-leaf-compact-unwind.s to use llvm-objdump
This addresses the long-standing FIXME in the test. I would like to
update the test, and objdump's output is a lot more readable / editable
than readobj's.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D134690
Jakub Kuderski [Tue, 4 Oct 2022 01:58:48 +0000 (21:58 -0400)]
[mlir] Reduce call stack depth in LogicalResult. NFC.
When debuging a crash or conversion failure in a deep pass pipeline,
there are often many interleaved frames with `failed` and `succeeded`.
`LogicalResult` is used through the pass infrastructure, so by not implementing
failure in terms of a call to succeess, this patch noticeably reduces the total
total call stack depth and improves the debugging experience.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D135116
Jordan Rupprecht [Tue, 4 Oct 2022 01:49:14 +0000 (18:49 -0700)]
changkaiyan [Tue, 4 Oct 2022 01:11:17 +0000 (09:11 +0800)]
[mlir][mlir-translation] patch for standalone-translation command line description missing.
Differential Revision: https://reviews.llvm.org/D134696
modified: mlir/examples/standalone/standalone-translate/standalone-translate.cpp
modified: mlir/include/mlir/Tools/mlir-translate/Translation.h
modified: mlir/lib/Target/Cpp/TranslateRegistration.cpp
modified: mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
modified: mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp
modified: mlir/lib/Target/SPIRV/TranslateRegistration.cpp
modified: mlir/lib/Tools/mlir-translate/Translation.cpp
Jim Ingham [Tue, 4 Oct 2022 00:19:12 +0000 (17:19 -0700)]
Change the Sanitizer report breakpoint callbacks to asynchronous.
The synchronous callbacks are not intended to start the target running
during the callback, and doing so is flakey. This patch converts them
to being regular async callbacks, and adds some testing for sequential
reports that have caused problems in the field.
Differential Revision: https://reviews.llvm.org/D134927
Nemanja Ivanovic [Tue, 4 Oct 2022 00:55:05 +0000 (19:55 -0500)]
[PowerPC] Fix a number of inefficiencies and issues with atomic code gen
There are a few issues with the code we generate for atomic operations and the way we generate it:
- Hard coded CR0 for compares
- Order of operands for compares not conducive to
emitting compare-immediate or for CSE of compares
- Missing MachineMemOperand for st[bhwd]cx intrinsics
- Missing intrinsic properties for the same
- Unnecessary blocks with store conditional
instructions to clear reservation (which ends
up hindering performance)
- Move from CR instructions just to compare the
result of a store conditional with zero (even
though it is a record-form)
This patch aims to resolve all of those issues.
Differential revision: https://reviews.llvm.org/D134783
Victor Michel [Tue, 4 Oct 2022 00:48:20 +0000 (17:48 -0700)]
[llvm-gsymutil] Fix tracking of currently open file
Prior to this change, `CurrentGSYMPath` was never updated. As a consequence, the GSYM file was reopened for every frame, even if all frames were relative to the same GSYM file.
This change brings a 13x speedup on a test I'm doing (symbolizing ~25K frames from libxul)
(This is my first-ever LLVM change - sorry if I missed something in the process!)
Reviewed By: simon.giesecke, clayborg
Differential Revision: https://reviews.llvm.org/D132912
Sam Clegg [Mon, 3 Oct 2022 15:31:23 +0000 (08:31 -0700)]
[lld][WebAssemlby] Improve support for -L / -l and add testing
- Add support -Bdynamic/-Bstatic and their aliases
- Add support for `--library` and `--library-path` long form args
- Add test based on test/ELF/libsearch.s
- In `-Bdynamic` mode search for `.so` files in preference to `.a`.
- Unlike ELF continue to default to static mode until `-pie` or
`-shared` are used.
Differential Revision: https://reviews.llvm.org/D135087
Jeff Niu [Mon, 3 Oct 2022 23:41:49 +0000 (16:41 -0700)]
[mlir][analysis] Remove empty files (NFC)
Nico Weber [Mon, 3 Oct 2022 23:50:21 +0000 (19:50 -0400)]
[gn build] port
d033ece0c985 for now