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
Thomas Raoux [Mon, 3 Oct 2022 18:46:59 +0000 (18:46 +0000)]
[mlir] Add unsigned version of index_cast
This is required to be able to cast integer type to a potential larger index using zero-extend cast.
There is a larger change under discussion to move index ops in a separate dialect: https://discourse.llvm.org/t/rfc-index-dialect/65540/
Based on timing of this work this patch can be included as part of this effort but as a short term solution we may want to add this op to arithmetic dialect for now in order to fill the gap.
Reviewed By: Mogball, stellaraccident
Differential Revision: https://reviews.llvm.org/D135089
Guozhi Wei [Mon, 3 Oct 2022 18:38:33 +0000 (18:38 +0000)]
[IVDescriptors] Before moving an instruction in SinkAfter checking if it is target of other instructions
The attached test case can cause LLVM crash in buildVPlanWithVPRecipes because
invalid VPlan is generated.
FIRST-ORDER-RECURRENCE-PHI ir<%792> = phi ir<%501>, ir<%806>
CLONE ir<%804> = fdiv ir<1.000000e+00>, vp<%17> // use of %17
CLONE ir<%806> = load ir<%805>
EMIT vp<%17> = first-order splice ir<%792> ir<%806> // def of %17
...
There is a use before def error on %17.
When vectorizer generates a VPlan, it generates a "first-order splice"
instruction for a loop carried variable after its definition. All related PHI
users are changed to use this "first-order splice" result, and are moved after
it. The move is guided by a MapVector SinkAfter. And the content of SinkAfter is
filled by RecurrenceDescriptor::isFixedOrderRecurrence.
Let's look at the first PHI and related instructions
%v792 = phi double [ %v806, %Loop ], [ %d1, %Entry ]
%v802 = fdiv double %v794, %v792
%v804 = fdiv double 1.000000e+00, %v792
%v806 = load double, ptr %v805, align 8
%v806 is a loop carried variable, %v792 is related PHI instruction. Vectorizer
will generated a new "first-order splice" instruction for %v806, and it will be
used by %v802 and %v804. So %v802 and %v804 will be moved after %v806 and its
"first-order splice" instruction. So SinkAfter contains
%v802 -> %v806
%v804 -> %v802
It means %v802 should be moved after %v806 and %v804 will be moved after %v802.
Please pay attention that the order is important.
When isFixedOrderRecurrence processing PHI instruction %v794, related
instructions are
%v793 = phi double [ %v813, %Loop ], [ %d1, %Entry ]
%v794 = phi double [ %v793, %Loop ], [ %d2, %Entry ]
%v802 = fdiv double %v794, %v792
%v813 = load double, ptr %v812, align 8
This time its related loop carried variable is %v813, its user is %v802. So
%v802 should also be moved after %v813. But %v802 is already in SinkAfter,
because %v813 is later than %v806, so the original %v802 entry in SinkAfter is
deleted, a new %v802 entry is added. Now SinkAfter contains
%v804 -> %v802
%v802 -> %v813
With these data, %v802 can still be moved after all its operands, but %v804
can't be moved after %v806 and its "first-order splice" instruction. And causes
use before def error.
So when remove/re-insert an instruction I in SinkAfter, we should also
recursively remove instructions targeting I and re-insert them into SinkAfter.
But for simplicity I just bail out in this case.
Differential Revision: https://reviews.llvm.org/D134083
Hussain Kadhem [Mon, 3 Oct 2022 18:42:28 +0000 (11:42 -0700)]
[flang] Write semantics tests for the FORM TEAM statement.
Reviewed By: ktras
Differential Revision: https://reviews.llvm.org/D134205
Kirsten Lee [Mon, 3 Oct 2022 18:40:05 +0000 (18:40 +0000)]
[mlir][memref] Extend multi-buffering transform
Extend multi-buffering to simplify the affine map created if any of its operands are constants. This avoids downstream problems where more complex affine.apply operations cannot be expanded.
Transfer attributes from the old allocation to the new allocation.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D134894
oberrich [Mon, 3 Oct 2022 13:03:14 +0000 (15:03 +0200)]
[lld/COFF] Ignore `/ASSEMBLYDEBUG[:NONE]` and `/EMITPOGOPHASEINFO`
Adds aforementioned link switches in lld-link and ignores them.
Differential revision: https://reviews.llvm.org/D135033
bixia1 [Mon, 3 Oct 2022 03:19:44 +0000 (20:19 -0700)]
[mlir][sparse] Refactor the conversion of the tensor reshape operators.
Move genReshapeDstShape to codegen utils to support the rewriting of the tensor
reshape operators for the codegen path.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D135074
Louis Dionne [Thu, 8 Sep 2022 21:36:11 +0000 (17:36 -0400)]
[libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guides
There are a handful of standard library types that are intended
to support CTAD but don't need any explicit deduction guides to
do so.
This patch adds a dummy deduction guide to those types to suppress
-Wctad-maybe-unsupported (which gets emitted in user code).
This is a re-application of the original patch by Eric Fiselier in
fcd549a7d828 which had been reverted due to reasons lost at this point.
I also added the macro to a few more types. Reviving this patch was
prompted by the discussion on https://llvm.org/D133425.
Differential Revision: https://reviews.llvm.org/D133535
Chris Bieneman [Mon, 3 Oct 2022 17:00:48 +0000 (12:00 -0500)]
[DirectX] Add DXIL metadata `dx.shaderModel`
This captures the target shader model and pipeline stage into the DXIL
metadata for consumption by the DirectX runtime.
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D134469
Craig Topper [Mon, 3 Oct 2022 17:59:35 +0000 (10:59 -0700)]
[RISCV] Pass the destination register to getVLENFactoredAmount instead of returning it. NFC
This is a refactor for another patch. For now we move the vreg
creation to the caller.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D135008
Fangrui Song [Mon, 3 Oct 2022 17:58:34 +0000 (10:58 -0700)]
[Driver] Remove unneeded RenderAsInput flag
RenderAsInput is for -Wa,/-Wl, style options which forward their values
as used by llvm::opt::Arg::renderAsInput. These short options don't use RenderAsInput.
Florian Hahn [Mon, 3 Oct 2022 17:35:58 +0000 (18:35 +0100)]
[ConstraintElimination] Simplify logic for using inverse predicate (NFC)
Recent improvements to the code structure mean we don't need to reset
the condition's predicate in the IR and later restore it. Remove the
restorer logic.
natashaknk [Mon, 3 Oct 2022 17:07:57 +0000 (10:07 -0700)]
[mlir][tosa] Swap the reshape at the end of the reduce op for an expand_shape in tosa-to-linalg
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D133877
Florian Hahn [Mon, 3 Oct 2022 17:20:48 +0000 (18:20 +0100)]
[ConstraintElimination] Remove stray comment (NFC).
The comment doens't apply in the current context, remove it.
Aart Bik [Fri, 30 Sep 2022 16:50:08 +0000 (09:50 -0700)]
[mlir][sparse] sorted coo co-iteration check test
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D134971
Jessica Paquette [Fri, 30 Sep 2022 18:12:06 +0000 (11:12 -0700)]
[GlobalISel] Combine `(x + y) - y -> x` and friends
This adds a combine that handles
```
(x + y) - y -> x
(x + y) - x -> y
x - (y + x) -> 0 - y
x - (x + z) -> 0 - z
```
On AArch64, we get added benefit for `0 - y` because it can be selected to a
`neg` instruction.
Differential Revision: https://reviews.llvm.org/D135010
Florian Hahn [Mon, 3 Oct 2022 17:05:25 +0000 (18:05 +0100)]
[ConstraintElimination] Remove unused StackEntry::IsNot field. (NFC)
The field is no unused and can be removed.
bixia1 [Sun, 2 Oct 2022 14:53:59 +0000 (07:53 -0700)]
[mlir][sparse][taco] Avoid hard-coding DimLevelType values.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D135034
Keith Smiley [Tue, 20 Sep 2022 22:37:49 +0000 (15:37 -0700)]
[llvm-libtool-darwin] Add support for -dependency_info
When using llvm-libtool-darwin as a drop in replacement for cctools
libtool, Xcode expects you to create a dependency info file. This file
is a very simple format describing the input files, the output files,
and the version of the tool. This logic is mirrored from that of
ld64.lld, which supports creating this file as well. Ideally we could
extract it, but I don't think we want to throw this into one of the
grab-bag libraries given how small the logic is.
Differential Revision: https://reviews.llvm.org/D134322
Keith Smiley [Tue, 20 Sep 2022 20:35:17 +0000 (13:35 -0700)]
[llvm-libtool-darwin] Parse and ignore -syslibroot
cctools libtool allows you to link dynamic libraries by passing through
a number of arguments to ld64. Because of this the default arguments
libtool receives in Xcode contains arguments that only matter in that
case. This change ignores this argument, at least until we ever support
that dynamic use case, so that you can use llvm-libtool-darwin as a
drop-in replacement in Xcode for cctools libtool. There are more
arguments we could ignore for this case, but we can probably add those
as the use case comes up.
Differential Revision: https://reviews.llvm.org/D134309
Philip Reames [Mon, 3 Oct 2022 16:47:21 +0000 (09:47 -0700)]
[DAG] Use getSplatBuildVector in a couple more places [nfc]
Michał Górny [Sat, 1 Oct 2022 16:59:28 +0000 (18:59 +0200)]
[lldb] [gdb-remote] Move ReadPacketWithOutputSupport() to client
Move ReadPacketWithOutputSupport() from GDBRemoteCommunication
to GDBRemoteClientBase. This function is client-specific and moving
it there simplifies followup patches that split communication into
separate thread.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D135028