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
Yuanfang Chen [Mon, 3 Oct 2022 22:50:24 +0000 (15:50 -0700)]
[c++] implements tentative DR1432 for partial ordering of function template
D128745 handled DR1432 for the partial ordering of partial specializations, but
missed the handling for the partial ordering of function templates. This patch
implements the latter. While at it, also simplifies the previous implementation to
be more close to the wording without functional changes.
Fixes https://github.com/llvm/llvm-project/issues/56090
Reviewed By: erichkeane, #clang-language-wg, mizvekov
Differential Revision: https://reviews.llvm.org/D133683
Jessica Paquette [Mon, 3 Oct 2022 23:23:22 +0000 (16:23 -0700)]
NFC: Fix legalizer-info-validation again
Also fix some lines that should have been DEBUG-NEXT, which made it a bit harder to
see what was happening here.
Michael Holman [Mon, 3 Oct 2022 23:19:47 +0000 (16:19 -0700)]
Add functionality to load dynamic libraries temporarily
Previously, it was possible to load dynamic libraries which would be unloaded on llvm_shutdown(), but recently ManagedStatic removal changed this so that loaded libraries really can't ever be unloaded. This functionality was very useful, and so to add it back in a more explicit way, I've added new getLibrary() and closeLibrary() methods to allow callers to use the very convenient platform independent abstraction that LLVM has for dynamic libraries.
As a specific use case, the onnx-mlir project was using this functionality with an API that allows instancing LLVM so you can compile a shared library, and then load that library, and eventually close the instance (and library) and compile something else. This change to llvm_shutdown causes libraries to leak and also locks the libraries for the entire duration of the program which prevents reusing library names.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D134763
Daniel Thornburgh [Tue, 23 Aug 2022 20:44:30 +0000 (13:44 -0700)]
[llvm-objdump] Find debug information with Build ID/debuginfod.
Uses the library introduced in https://reviews.llvm.org/D132504 to add build ID fetching to llvm-objdump. This allows viewing source when disassembling stripped objects.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D131224
Nico Weber [Sun, 2 Oct 2022 15:04:31 +0000 (11:04 -0400)]
[lld/mac] Port typo correction for undefined symbols from ELF port
Ports:
- core feature: https://reviews.llvm.org/D67039
- case mismatch: https://reviews.llvm.org/D70506
- extern "C" suggestions: https://reviews.llvm.org/D69592,
https://reviews.llvm.org/D69650
Does not port https://reviews.llvm.org/D71735 since I believe that that doesn't
apply to lld/Mach-O.
Differential Revision: https://reviews.llvm.org/D135038
Nico Weber [Mon, 3 Oct 2022 22:48:30 +0000 (18:48 -0400)]
[gn build] port
5585d99835e83
Fangrui Song [Mon, 3 Oct 2022 22:35:18 +0000 (15:35 -0700)]
[test] Clean up Driver/baremetal.cpp
* Remove -no-canonical-prefixes. See
980679981fbc311bc07f8cd23e3739fd56c22d2a
* Test a.out and %t.out in few tests and remove excess `-o %t.o`
* Avoid wrapping lines too aggresstively
* Replace `"{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}"` with `ld{{(.exe)?}}"`. The new pattern supports more CLANG_DEFAULT_LINKER.
Jessica Paquette [Mon, 3 Oct 2022 22:28:44 +0000 (15:28 -0700)]
NFC: Update legalizer-info-validation.mir
Zibi Sarbinowski [Mon, 3 Oct 2022 21:41:58 +0000 (16:41 -0500)]
[SystemZ][z/OS] Add ASCII and 32-bit variants for libc++.
This patch enables libc++ build as shared library in all combinations of ASCII/EBCDIC and 32-bit/64-bit variants. In particular it introduces:
# ASCII version of libc++ named as libc++_a.so
# Script to rename DLL name inside the generated side deck
# Various names for dataset members where DLL libraries and their side decks will reside
# Add the following options:
- LIBCXX_SHARED_OUTPUT_NAME
- LIBCXX_ADDITIONAL_COMPILE_FLAGS
- LIBCXX_ADDITIONAL_LIBRARIES
- LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
- LIBCXXABI_ADDITIONAL_LIBRARIES
**Background and rational of this patch**
The linker on z/OS creates a list of exported symbols in a file called side deck. The list contains the symbol name as well as the name of the DLL which implements the symbol. The name of the DLL depends on what is specified in the -o command line option. If it points to a USS file, than the DLL name in the side deck will be the USS file name. If it points to a member of a dataset then the DLL name in the side deck is the member name.
If CMake could deal with z/OS datasets we could use -o that points to a dataset member name, but this does not seem to work so we have to produce a USS file as the DLL and then copy the content of the produced side deck to a dataset as well as rename the USS file name in the side deck to a dataset member name that corresponds to that DLL.
Reviewed By: muiez, SeanP, ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D118503
Jessica Paquette [Mon, 3 Oct 2022 21:48:08 +0000 (14:48 -0700)]
[GlobalISel][AArch64] Lower G_FMAD
Noticed this falling back on CTMark at -Os (bullet).
Seems like we have no 1:1 matching for it, so match SDAG and just lower.
Add testcases for common legal cases as well.
Differential Revision: https://reviews.llvm.org/D135111
Aart Bik [Mon, 3 Oct 2022 21:34:14 +0000 (14:34 -0700)]
[mlir] fix bazel build breakage
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D135105
Alan Hu [Mon, 3 Oct 2022 21:38:19 +0000 (14:38 -0700)]
[llvm-ocaml] Add binding for constructing opaque pointers
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D134916
Fangrui Song [Mon, 3 Oct 2022 21:34:16 +0000 (14:34 -0700)]
Revert D135076 "[Clang] Make offloading flags accept '-' and '--'"
This reverts commit
11adae50892e6e94f10ce41bc738a9823a6b3251.
There are multiple aspects this change is not appealing.
* They conflict with JoinedOrSeparate `-o`. The old exception `-objc-*`
should not be used an excuse.
* We generally want new options to be more rigid and avoid multiple
spellings.
* If users get used to `-offload-*`, a misspelled `-offload-*` option still
gets passed as `-o ffloat-*` without being detected.
Andrew Savonichev [Mon, 13 Jun 2022 16:05:50 +0000 (19:05 +0300)]
[NVPTX] Fix constant expression initializers for global variables
Before this patch the code in printScalarConstant was unable to handle
nested constant expressions like (gep (addrspacecast ptr)) and crashed
with:
LLVM ERROR: Unsupported expression in static initializer:
addrspacecast ([4 x i8] addrspace(1)* @ga to [4 x i8]*)
We can use lowerConstantForGV instead which is a customized version of
lowerConstant that supports generic() and nested expressions.
Differential Revision: https://reviews.llvm.org/D127878
Andrew Savonichev [Mon, 3 Oct 2022 21:23:55 +0000 (00:23 +0300)]
[NVPTX] Fix issues in ptxas integration to LIT tests
1) Fixed a typo in PTXAS_EXECUTABLE CMake variable (PXTAS -> PTXAS).
2) Version check was implemented incorrectly,
now version (major, minor) is converted to int for comparison.
3) ptxas -arch argument was incorrect (or missing) in 3 tests.
Differential Revision: https://reviews.llvm.org/D127866
Shu-Chun Weng [Thu, 29 Sep 2022 00:12:16 +0000 (17:12 -0700)]
[clang] Add cc1 option -fctor-dtor-return-this
This option forces constructors and non-deleting destructors to return
`this` pointer in C++ ABI (except for Microsoft ABI, on which this flag
has no effect).
This is similar to ARM32, Apple ARM64, or Fuchsia C++ ABI, but can be
applied to any target triple.
Differential Revision: https://reviews.llvm.org/D119209
Tom Honermann [Sat, 1 Oct 2022 11:06:58 +0000 (04:06 -0700)]
[clang]: Add DeclContext::dumpAsDecl().
This change enables a declaration to be conveniently displayed within
a debugger when only a pointer to its DeclContext is available. For example,
in gdb:
(gdb) p Ctx
$1 = (const clang::DeclContext *) 0x14c1a580
(gdb) p Ctx->dumpAsDecl()
ClassTemplateSpecializationDecl 0x14c1a540 <t.cpp:1:1, line:7:1> line:2:8 struct ct
`-TemplateArgument type 'int'
`-BuiltinType 0x14bac420 'int'
$2 = void
In the event that the pointed to DeclContext is invalid (that it has an
invalid DeclKind as a result of a dangling pointer, memory corruption, etc...)
it is not possible to dump its associated declaration. In this case, the
DeclContext will be reported as invalid. For example, in gdb:
(gdb) p Ctx->dumpAsDecl()
DeclContext 0x14c1a580 <unrecognized Decl kind 127>
$3 = void
Matheus Izvekov [Sun, 4 Sep 2022 02:45:40 +0000 (04:45 +0200)]
[clang] Implement divergence for TypedefType and UsingType
With this patch, TypedefTypes and UsingTypes can have an
underlying type which diverges from their corresponding
declarations.
For the TypedefType case, this can be seen when getting
the common sugared type between two redeclarations with
different sugar.
For both cases, this will become important as resugaring
is implemented, as this will allow us to resugar these
when they were dependent before instantiation.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D133468
Bjorn Pettersson [Mon, 3 Oct 2022 21:01:32 +0000 (23:01 +0200)]
[test][Transform/Utils] Update tests to opaque pointer syntax. NFC
This patch converts test cases that simly could be rewritten
using the script at
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34