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
Aart Bik [Mon, 3 Oct 2022 20:54:58 +0000 (13:54 -0700)]
[mlir] fix bazel file
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D135104
Philip Reames [Mon, 3 Oct 2022 19:54:38 +0000 (12:54 -0700)]
[RISCV] Generalize select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) ) transforms by removing and-clause
These transforms were recently added (by me) in D134881. Looking at the code again, I realized we don't need the (and x, 0x1) portion of the pattern, we just need to know that the result of that sub-tree is either 0 or 1. Checking for this directly allows us to match slightly more broadly. The test changes are zext i1 arguments, but this could also kick in for e.g. shifts of high bits, or any other source of known bits.
Differential Revision: https://reviews.llvm.org/D135081
Amara Emerson [Mon, 3 Oct 2022 14:19:05 +0000 (15:19 +0100)]
[AArch64][GlobalISel] Fold away lowered vector sign-extend of vector compares.
This fixes a long standing cause of awful code generation when legalization creates
G_SEXT(G_FCMP(...)), for example due to promoting the condition of a vector G_SELECT.
Since on AArch64 vector compares sign-extend the condition value, there's no need
for this extra G_SEXT. Unfortunately by the time we get to post-legalization these
G_SEXTs have already been lowered into shifts, so this combine is a bit more
involved than I'd ideally like. Oh well.
Differential Revision: https://reviews.llvm.org/D135078
Amara Emerson [Mon, 3 Oct 2022 00:46:20 +0000 (01:46 +0100)]
x[AArch64][GlobalISel] Enable vector support for G_SELECT->G_FMAXIMUM/MINIMUM.
Vector support seems to work immediately, as long as we run the combine before
legalization (so the vector SELECTs don't get lowered) and the legalizer rules
are there to enable generation.
Differential Revision: https://reviews.llvm.org/D135047
Bjorn Pettersson [Mon, 3 Oct 2022 20:37:36 +0000 (22:37 +0200)]
[test][Scalarizer] Convert test cases to opaque pointers. NFC
Test cases were converted using the script at
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34
Thomas Raoux [Mon, 3 Oct 2022 19:39:32 +0000 (19:39 +0000)]
[mlir][arithmetic] Add tests for IndexCast folding ops and fix assert
Fix assert in IndexCastUI folding and add tests for both IndexCastOp and
IndexCastUIOp folding
Differential Revision: https://reviews.llvm.org/D135098
Bjorn Pettersson [Mon, 3 Oct 2022 17:05:12 +0000 (19:05 +0200)]
[test][InstCombine] Update even more test cases to use opaque pointer
These tests cases were converted using the script at
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34.
Needed to also re-run update_test_checks.py, otherwise some of them
would fail.
Bjorn Pettersson [Mon, 3 Oct 2022 12:44:29 +0000 (14:44 +0200)]
[test][InstCombine] Update some more test cases to use opaque pointers
These tests cases were converted using the script at
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34,
but there was also a need to re-run update_test_checks.py (impacting
nonnull/dereferencable attributes).
Differential Revision: https://reviews.llvm.org/D135095
Bjorn Pettersson [Mon, 3 Oct 2022 12:24:31 +0000 (14:24 +0200)]
[test][InstCombine] Update some test cases to use opaque pointers
These tests cases were converted using the script at
https://gist.github.com/nikic/
98357b71fd67756b0f064c9517b62a34
Differential Revision: https://reviews.llvm.org/D135094
rkayaith [Mon, 19 Sep 2022 20:59:31 +0000 (16:59 -0400)]
[mlir-reduce] Support parsing operations other than 'builtin.module' as top-level
This adds a `--no-implicit-module` option, which disables the insertion
of a top-level `builtin.module` during parsing. Although other ops can
now be parsed as top-level, the actual reduction passes are still
restricted to `builtin.module` as it didn't seem straightforward to
update them.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D134242
rkayaith [Mon, 3 Oct 2022 20:01:40 +0000 (16:01 -0400)]
[mlir-vulkan-runner] Fix build failure after 200889f
Louis Dionne [Wed, 28 Sep 2022 20:24:20 +0000 (16:24 -0400)]
[libc++] Simplify transitive includes test and fix a bug
This patch incorporates the "sanitize" step of the transitive includes
test into the CSV generator itself. In doing so, it removes complexity
in the test but also fixes a bug where we would filter out <__mutex>
from the output, leading to an incorrect list of includes for the
<shared_mutex> header.
Differential Revision: https://reviews.llvm.org/D134830
jeff [Wed, 21 Sep 2022 18:09:30 +0000 (18:09 +0000)]
[AMDGPU] Use V_PERM to match buildvectors when inputs are not canonicalized (i.e. can't use V_PACK)
If we can not prove that f16 operands of a buildvector are canonicalized, then we can not lower into a V_PACK. In this scenario, we would previously lower into some combination of and(sdwa), shr, or. This patch allows for matching into V_PERM instead.
Change-Id: Ifa4a74fdb81ef44f22ba490c7fdf81ec8aebc945
Florian Hahn [Mon, 3 Oct 2022 19:56:39 +0000 (20:56 +0100)]
[ConstraintElimination] Add test for debug printing.
Florian Hahn [Mon, 3 Oct 2022 19:51:43 +0000 (20:51 +0100)]
[ConstraintElimination] Re-enable debug print when adding facts. (NFC)
Also add test coverage for important debug output.
Philip Reames [Mon, 3 Oct 2022 19:18:21 +0000 (12:18 -0700)]
[DAG] Introduce getSplat utility for common dispatch pattern [nfc]
We have a very common pattern of dispatching between BUILD_VECTOR and SPLAT_VECTOR creation repeated in many cases in code. Common the pattern into a utility function.
Erich Keane [Tue, 27 Sep 2022 13:35:27 +0000 (06:35 -0700)]
[Concepts] Fix Concepts on generic lambda in a VarTemplateSpecDecl
As fallout of the Deferred Concept Instantiation patch (
babdef27c5), we
got a number of reports of a regression, where we asserted when
instantiating a constraint on a generic lambda inside of a variable
template. See: https://github.com/llvm/llvm-project/issues/57958
The problem was that getTemplateInstantiationArgs function only walked
up declaration contexts, and missed that this is not necessarily the
case with a lambda (which can ALSO be in a separate context).
This patch refactors the getTemplateInstantiationArgs function in a way
that is hopefully more readable, and fixes the problem with the concepts
on a generic lambda.
Differential Revision: https://reviews.llvm.org/D134874
Jim Kitchen [Mon, 3 Oct 2022 19:34:53 +0000 (14:34 -0500)]
[mlir][sparse] Implement sparse_tensor.select
The region within sparse_tensor.select is used as the runtime criteria
for whether to keep the existing value in the sparse tensor.
While the sparse element is provided to the comparison, indices may also
be used to decide on whether to keep the original value. This allows, for
example, to only keep the upper triangle of a matrix.
Reviewed by: aartbik
Differential Revision: https://reviews.llvm.org/D134761
rkayaith [Wed, 14 Sep 2022 19:34:27 +0000 (15:34 -0400)]
[mlir-cpu-runner] Support parsing operations other than 'builtin.module' as top-level
This adds a `--no-implicit-module` option, which disables the insertion
of a top-level `builtin.module` during parsing. The top-level op is
required to have the `SymbolTable` trait.
The majority of the change here is removing `ModuleOp` from interfaces.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D134238
Craig Topper [Mon, 3 Oct 2022 18:54:03 +0000 (11:54 -0700)]
[RISCV] Add missing VL arguments to the creation of RISCVISD::VMV_V_X_VL nodes.
VMV_V_X_VL nodes should always have a passthru, a splat, and a VL.
We were sometimes missing the VL.
This went unnoticed because these cases were all selected into the
following node to form a .vx or .vi instruction. The ComplexPattern
that does this, doesn't check the VL operand. I've added an assert
to the ComplexPattern to catch if the operand is missing.
@qcolombet spotted some of these in D134703.
Jonathon Penix [Thu, 29 Sep 2022 20:10:19 +0000 (13:10 -0700)]
[flang] Skip creating AggregateStores for common block associated aggregates
Previously, AggregateStores were created for aggregates associated with common
blocks. As a) AggregateStoreMap uses scope and offset information to search for
aggregate stores and b) variables related to common blocks have their
offsets set relative to the common block itself, if there were multiple
equivalences and at least one involved variables defined in a common block there
was an opportunity for the scope/offset pairs to match between distinct
aggregate stores. As a result, entries in AggregateStoreMap could collide,
resulting in incorrect stores being returned for a particular variable.
To prevent these collisions, skip creating AggregateStores for aggregates which
are associated with common blocks. This information was already unused as
aggregates associated with common blocks are handled by instantiateCommon.
Fixes https://github.com/llvm/llvm-project/issues/57749
Differential Revision: https://reviews.llvm.org/D134828
Craig Topper [Mon, 3 Oct 2022 19:15:01 +0000 (12:15 -0700)]
Revert "foo"
This reverts commit
2138ef354a2a8be9f273804e1133a3b97a493f03.
Forgot to squash
Craig Topper [Mon, 3 Oct 2022 19:14:30 +0000 (12:14 -0700)]
Revert "[RISCV] Add missing VL arguments to the creation of RISCVISD::VMV_V_X_VL nodes."
This reverts commit
4c03c9f375f326a87065443d649c6568a4b7dd67.
Forgot to squash
Craig Topper [Mon, 3 Oct 2022 19:05:23 +0000 (12:05 -0700)]
[RISCV] Add missing VL arguments to the creation of RISCVISD::VMV_V_X_VL nodes.
VMV_V_X_VL nodes should always have a passthru, a splat, and a VL.
We were sometimes missing the VL.
This went unnoticed because these cases were all selected into the
following node to form a .vx or .vi instruction. The ComplexPattern
that does this, doesn't check the VL operand. I've added an assert
to the ComplexPattern to catch if the operand is missing.
@qcolombet spotted some of these in D134703.
Craig Topper [Mon, 3 Oct 2022 18:54:03 +0000 (11:54 -0700)]
foo
River Riddle [Mon, 3 Oct 2022 19:11:34 +0000 (12:11 -0700)]
[mlir][NFC] Use TypeRange in buildWithEntryBlock
This better integrates with builder methods that use TypeRange,
i.e. the recommended thing, instead of ArrayRef<Type>.
River Riddle [Sat, 1 Oct 2022 02:03:08 +0000 (19:03 -0700)]
[mlir] Rename FunctionOpInterface::getBody to getFunctionBody
This is much more explicit, and prevents annoying conflicts with op
specific accessors (which may have a different contract). This is similar
to the past rename of getType -> getFunctionType,
Fixes #58030
Differential Revision: https://reviews.llvm.org/D135007