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
Jacques Pienaar [Mon, 3 Oct 2022 16:38:17 +0000 (09:38 -0700)]
[mlir][c] Init MLProgram C API
Add MLIR upstream C api library definition.
Differential Revision: https://reviews.llvm.org/D135083
Zain Jaffal [Mon, 3 Oct 2022 16:06:47 +0000 (17:06 +0100)]
[AArch64] Add support to loop vectorization for non temporal loads
Currently, AArch64 doesn't support vectorization for non temporal loads because `isLegalNTLoad` is not implemented for the target.
This patch applies similar functionality as `D73158` but for non temporal loads
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D131964
Alex Richardson [Mon, 3 Oct 2022 15:43:50 +0000 (15:43 +0000)]
[SimplifyLibCalls] Reduce code duplication. NFC
Reviewed By: nikic, nickdesaulniers, xbolva00
Differential Revision: https://reviews.llvm.org/D135073
Joseph Huber [Mon, 3 Oct 2022 14:02:53 +0000 (09:02 -0500)]
[Clang] Make offloading flags accept '-' and '--'
Currently all of the flags beginning with `--offload` such as
`--offload-arch` or `--offload-device-only` require the double-dash
form. However, if a user uses a single dash it will instead name a file
'ffload-arch' for example. This has been the cause of a lot of user
confusion. This patch changes these options to also accept a single
dash. This is similar to many other driver arguments beginning with
`-o`.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D135076
Sam Clegg [Sat, 1 Oct 2022 01:28:58 +0000 (18:28 -0700)]
[WebAssembly] Fix return type of __builtin_return_address under wasm64
Differential Revision: https://reviews.llvm.org/D135005
Jonathan Peyton [Thu, 8 Sep 2022 20:51:56 +0000 (15:51 -0500)]
[OpenMP][libomp] Allow unused-but-set warnings
Only a few remaining which are taken care of by this patch.
Differential Revision: https://reviews.llvm.org/D133528
Sanjay Patel [Mon, 3 Oct 2022 15:20:33 +0000 (11:20 -0400)]
Revert "[InstSimplify] reduce code duplication for fmul folds; NFC"
This reverts commit
7b7940f9da80de6aa0b8f28a0ef809dafe4cdffc.
This missed a test update.
Florian Hahn [Mon, 3 Oct 2022 14:55:35 +0000 (15:55 +0100)]
[ConstraintElimination] Add tests for chained GEPs with const offsets.
Add extra tests for chained GEPs where the second GEP has a constant
offset. Inspired by missed optimizations from #51358.
Yevgeny Rouban [Mon, 3 Oct 2022 14:47:43 +0000 (21:47 +0700)]
Fix compilation of CodeLayout.cpp for MacOS
llvm/lib/Transforms/Utils/CodeLayout.cpp uses std::abs() with double argument,
which is provided by cmath header, which is not explicitly included into CodeLayout.cpp.
The implicit include in llvm/include/llvm/Support/MathExtras.h was removed in
commit
16544cbe64b81a50800a88296ef37f4873a37b25
Inserting explicit include of cmath into CodeLayout.cpp in order to fix build on MacOS.
Committed on behalf of alsemenov (Aleksei Semenov)
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D135072
Sanjay Patel [Mon, 3 Oct 2022 13:17:23 +0000 (09:17 -0400)]
[InstSimplify] reduce code duplication for fmul folds; NFC
The constant is already commuted for an fmul opcode,
but this code can be called more directly for fma,
so we have to swap for that caller. There are tests
in InstSimplify and InstCombine to verify that this
works as expected.
David Green [Mon, 3 Oct 2022 14:27:23 +0000 (15:27 +0100)]
[ARM][AArch64] Dont use macros for half instrinsics in NeonEmitter
We don't require arm_neon.h fp16 intrinsics to be treated as macros any
more.
Differential Revision: https://reviews.llvm.org/D131504
David Green [Mon, 3 Oct 2022 14:08:46 +0000 (15:08 +0100)]
[AArch64] Add pr58109 tests, one showing incorrect lowering of SUBS. NFC
Also added global-isel coverage for the same file.
Igor Kirillov [Mon, 3 Oct 2022 13:37:08 +0000 (14:37 +0100)]
[LoopVectorize] Add missing test for D133687
Christian Sigg [Mon, 3 Oct 2022 13:45:33 +0000 (15:45 +0200)]
[mlir][shape] fix test added in 9f77909.
The stderr to stdout piping results in the two streams being interleaved on Windows.
Write stderr to a temp-file instead and run separate FileCheck on it.
Tomasz Kamiński [Mon, 3 Oct 2022 13:14:04 +0000 (15:14 +0200)]
[analyzer][NFC] Add tests for D132236
D132236 would have introduced regressions in the symbol lifetime
handling. However, the testsuite did not catch this, so here we have
some tests, which would have break if D132236 had landed.
This patch addresses the comment https://reviews.llvm.org/D132236#3753238
Co-authored-by: Balazs Benics <balazs.benics@sonarsource.com>
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D134941
Hansang Bae [Fri, 30 Sep 2022 19:16:16 +0000 (14:16 -0500)]
[OpenMP] Ignore schedule modifier in static scheduling
The modifier bits in the schedule type is not used/supported in the
static scheduler, so it should be ignored.
Differential Revision: https://reviews.llvm.org/D134983
chenglin.bi [Mon, 3 Oct 2022 13:20:33 +0000 (21:20 +0800)]
[ARM64EC][clang-cl] Add /arm64EC flag
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D134788
Nico Weber [Sun, 2 Oct 2022 13:20:22 +0000 (09:20 -0400)]
[lld/mac] Extract a reportUndefinedSymbol function
Makes things look more similar to the ELF port, and removes some
slightly deep nesting.
No behavior change.
Differential Revision: https://reviews.llvm.org/D135032
Alex Zinenko [Mon, 3 Oct 2022 13:17:10 +0000 (13:17 +0000)]
[mlir] fix markdown headers in structured ops doc
Markus Böck [Mon, 3 Oct 2022 13:09:14 +0000 (15:09 +0200)]
[SelectionDAG] Fix use-after-free introduced in D130881
The code introduced in https://reviews.llvm.org/D130881 has a bug as it may cause a use-after-free error that can be caught by ASAN.
The bug essentially boils down to iterator invalidation of `DenseMap`. The expression `SDEI[To] = I->second;` may cause `SDEI` to grow if `To` is inserted for the very first time. When that happens, all existing iterators to the map are invalidated as their backing storage has been freed. Accessing `I->second` is then invalid and attempts to access freed memory (as `I` is an iterator of `SDEI`).
This patch fixes that quite simply by first making a copy of `I->second`, and then moving into the possibly newly inserted KV of the ` DenseMap`.
No test attached as I am not sure it is practible to test.
Differential revision: https://reviews.llvm.org/D135019
Hans Wennborg [Mon, 3 Oct 2022 12:56:07 +0000 (14:56 +0200)]
Revert "[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI"
It casued some runtimes builds to fail with cmake error
No target "libcxx-abi-static"
see code review.
> When in-tree libcxx is selected as the sanitizer C++ ABI, use
> libcxx-abi-* targets rather than libcxxabi and libunwind directly.
>
> Differential Revision: https://reviews.llvm.org/D134855
This reverts commit
414f9b7d2f45670019dc8ec284b685a9e238718f.
Alex Richardson [Mon, 3 Oct 2022 09:39:21 +0000 (09:39 +0000)]
[libc++] Avoid relying on non-portable behaviour in std::align
Round-tripping pointers via size_t is not portable, the C/C++ standards
only require this to be valid when using (u)intptr_t.
Originally committed to the CHERI fork of LLVM as
https://github.com/CTSRD-CHERI/llvm-project/commit/
dd01245185ab9e71b70b418bee8f11ea0199e1a3,
but I forgot to upstream the change. I rediscovered this issue due to a
compiler warning when building libc++ on a Arm Morello system.
Reviewed By: #libc, ldionne, philnik
Differential Revision: https://reviews.llvm.org/D134363
Tobias Gysi [Mon, 3 Oct 2022 12:13:26 +0000 (15:13 +0300)]
[mlir][llvmir] Add filename debug info when converting from LLVMIR.
The revision enriches the debug locations generated during LLVMIR to MLIR translation with file name information and adds a separate test to exercise the debug location translation.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D135069
Rainer Orth [Mon, 3 Oct 2022 12:03:35 +0000 (14:03 +0200)]
[flang] Add Sparc support to Optimizer/CodeGen/Target.cpp
As described in Issue #57642, `flang` currently lacks SPARC support in
`Optimizer/CodeGen/Target.cpp`, which causes a considerable number of tests
to `FAIL` with
error: flang/lib/Optimizer/CodeGen/Target.cpp:310: not yet implemented:
target not implemented
This patch fixes this by following GCC`s documentation of the ABI described
in the Issue.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D133561
Petar Avramovic [Mon, 3 Oct 2022 10:34:12 +0000 (12:34 +0200)]
[SelectionDAG] Add check for BUILD_VECTOR in isKnownNeverNaN
Includes handling of constants with vector type in isKnownNeverNaN.
For AMDGPU results in not making fcanonicalize during legalization
for vector inputs to fmaxnum_ieee and fminnum_ieee. Does not affect
end result since there is a combine that eliminates fcanonicalize.
Differential Revision: https://reviews.llvm.org/D88573
Bjorn Pettersson [Wed, 28 Sep 2022 12:23:52 +0000 (14:23 +0200)]
[Analysis][SimplifyLibCalls] Refactor code related to size_t in lib func signatures. NFC
Added a helper in TargetLibraryInfo to get size of "size_t" in bits,
given a Module reference. The new getSizeTSize helper is using the
same strategy as for example isValidProtoForLibFunc has been using
in the past, assuming that the size can be derived by asking
DataLayout about the size/type of a pointer to int.
FortifiedLibCallSimplifier::optimizeStrpCpyChk was changed to use
the new getSizeTSize helper instead of assuming that sizeof(size_t)
is equal to sizeof(int*) by itself (that is the assumption used in
TargetLibraryInfoImpl::getSizeTSize so the result will be the same).
Having a common helper for this ensure that we use the same strategy
when deriving the size of "size_t" in different parts of the code.
One bonus with this refactoring (basing it on Module instead of just
DataLayout) is that it makes it easier to override this for a specific
target triple, in case the assumption of using getPointerSizeInBits
wouldn't hold.
Differential Revision: https://reviews.llvm.org/D110585
Javier Setoain [Mon, 26 Sep 2022 09:14:01 +0000 (10:14 +0100)]
[mlir][Affine] Add pass options to supervectorizer
The only current options to create a supervectorization pass from an
external dialect is to use `createSuperVectorizePass` with the virtual
vector dimensions as a parameter, but the pass accepts other parameters.
This patch enables external users to create a supervectorizer pass
exposing all available option.
Differential Revision: https://reviews.llvm.org/D134632
Jean Perier [Mon, 3 Oct 2022 09:41:33 +0000 (11:41 +0200)]
[flang] Do not resolve TRIM/REPEAT length to its argument length
For TRIM and REPEAT calls, semantics was creating ProcedureDesignators
using the length parameter of the arguments. This caused bugs when
folding LEN(TRIM(char_explicit_constant_length)). The same did not
appeared in folding for REPEAT because it is rewritten at a higher
level to LEN(c)*N.
This is not only a folding issue since any place (like lowering) may
try to use the bad length parameter from the created ProcedureDesignator.
Update intrinsic resolution to not copy the length parameter for TRIM
and REPEAT.
Differential Revision: https://reviews.llvm.org/D134970
Max Kazantsev [Mon, 3 Oct 2022 09:40:41 +0000 (16:40 +0700)]
[Test] Add test showing that Constraint Elimination can deal with case where SCEV fails
Weining Lu [Fri, 30 Sep 2022 01:29:43 +0000 (09:29 +0800)]
[DebugInfo][test] XFAIL DebugInfo/Generic/missing-abstract-variable.ll on LoongArch
The same as SPARC and RISCV. See D119122.
Differential Revision: https://reviews.llvm.org/D134932
Valentin Clement [Mon, 3 Oct 2022 09:02:23 +0000 (11:02 +0200)]
[flang][NFC] Use prefixed accessors for fircg dialect
The raw accessor is going away soon so switch to prefixed accessors in the
fircg dialect. The main dialect was switched some months ago.
https://github.com/llvm/llvm-project/issues/58090
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D135061
Alvin Wong [Mon, 3 Oct 2022 07:40:16 +0000 (10:40 +0300)]
[Clang][MinGW][cygwin] Fix __declspec with -fdeclspec enabled
Fixes https://github.com/llvm/llvm-project/issues/49958
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D135027
Alvin Wong [Mon, 3 Oct 2022 07:40:01 +0000 (10:40 +0300)]
[LLD][COFF] Reduce chance of symbol name collision with delay-load
Delay-loaded imports creats a load thunk with a symbol name. Before this
change, the name uses a `__imp_load_` prefix. On the other hand, normal
import uses the `__imp_` prefix for the import address pointer. If an
import symbol named `load_func` is imported normally and another named
`func` is imported using delay-load, this can cause a symbol name
collision.
This patch changes delay-load imports to use `__imp___load_` prefix.
Because it is less likely for normal imports to have a name starting in
`__load_` this should reduce the chance of a name collision.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D134464
Alvin Wong [Mon, 3 Oct 2022 07:39:48 +0000 (10:39 +0300)]
[LLD][COFF] Set OrdinalBase to 1 for export table
Before this, LLD sets OrdinalBase to 0, which deviates from usual
practices. This technically would allow LLD to export a symbol using
ordinal 0, however LLD never use export ordinal 0, which results in
binaries with export tables always having an empty export at ordinal 0.
This change makes LLD set OrdinalBase to 1 and not create the empty
export with ordinal 0, which makes its behaviour more in line with both
the MSVC linker and the GNU linker.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D134140
Vitaly Buka [Mon, 3 Oct 2022 07:49:52 +0000 (00:49 -0700)]
[libc++] Remove a part of reverted D131898 or D130695
Vitaly Buka [Mon, 3 Oct 2022 07:39:19 +0000 (00:39 -0700)]
Revert "[libc++] Updates generated transitve includes."
Looks like a part of reverted D131898.
This reverts commit
cfd5b8f11195f5c23ae6d4aa2df2d95cae9b976e.