Johannes Doerfert [Thu, 24 Mar 2022 20:08:53 +0000 (15:08 -0500)]
Reapply "[Intrinsics] Add `nocallback` to the default intrinsic attributes"
This reverts commit
c5f789050daab25aad6770790987e2b7c0395936 and
reapplies
7aea3ea8c3b33c9bb338d5d6c0e4832be1d09ac3 with additional test
changes.
Kiran Chandramohan [Fri, 25 Mar 2022 14:22:49 +0000 (14:22 +0000)]
[Flang] Lower achar intrinsic
The intrinsic returns the character located at the position requested
in the ASCII sequence. The intrinsic is lowered to inline FIR code.
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D122480
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Jay Foad [Fri, 25 Mar 2022 09:57:28 +0000 (09:57 +0000)]
[AMDGPU] Move VOP3 classes into VOPInstructions.td. NFC.
These classes are also used by VOP1/2/C instructions.
Differential Revision: https://reviews.llvm.org/D122470
Simon Pilgrim [Fri, 25 Mar 2022 13:41:59 +0000 (13:41 +0000)]
[X86] Add test showing failure to fold multiple constant args in ADC
As noticed on Issue #35256
Javier Setoain [Thu, 3 Jun 2021 09:34:44 +0000 (10:34 +0100)]
[mlir][Vector] Add integration tests for ArmSVE
In order to run these integration tests, it is required access to an
SVE-enabled CPU or and emulator with SVE support. In case of using
an emulator, aarch64 versions of lli and the MLIR C Runner Utils Library
are also required.
Differential Revision: https://reviews.llvm.org/D104517
Sam McCall [Fri, 25 Mar 2022 13:17:31 +0000 (14:17 +0100)]
[pseudo] Use box-drawing chars to prettify debug dumps. NFC
Roman Lebedev [Fri, 25 Mar 2022 12:11:49 +0000 (15:11 +0300)]
[SimplifyCFG] `FoldBranchToCommonDest()`: allow branch-on-select
This whole check is bogus, it's some kind of a profitability check.
For now, simply extend it to not only allow branch-on-binary-ops,
but also on poison-safe logic ops.
Refs. https://github.com/llvm/llvm-project/issues/53861
Refs. https://github.com/llvm/llvm-project/issues/54553
Roman Lebedev [Fri, 25 Mar 2022 12:09:50 +0000 (15:09 +0300)]
[NFC][SimplifyCFG] Add test from https://github.com/llvm/llvm-project/issues/53861
Simon Pilgrim [Fri, 25 Mar 2022 12:52:53 +0000 (12:52 +0000)]
[X86] combineADC - pull out repeated dyn_cast<ConstantSDNode> calls. NFC.
Louis Dionne [Wed, 23 Mar 2022 21:02:07 +0000 (17:02 -0400)]
[libc++] Remove the _LIBCPP_BOOL_CONSTANT macro
I suspect this is a remnant of the times when we were not comfortable
using Clang's C++11/14 extensions everywhere, but now we do, so we can
use _BoolConstant instead and get rid of the macro.
Differential Revision: https://reviews.llvm.org/D122351
Sergei Lebedev [Fri, 25 Mar 2022 12:38:13 +0000 (13:38 +0100)]
Updated MLIR type stubs to work with pytype
The diff is big, but there are in fact only three kinds of changes
* ir.py had a synax error -- underminated [
* forward references are unnecessary in .pyi files (see https://github.com/python/typeshed/blob/
9a76b13127ffa8365431dcc105fc111cdd267e7e/CONTRIBUTING.md?plain=1#L450-L454)
* methods defined via .def_static() are now decorated with @staticmethod
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122300
Aakanksha [Fri, 25 Mar 2022 11:33:25 +0000 (11:33 +0000)]
Prevent comparison with wider type in loop condition
This change fixes the code violations flagged in AMD compute CodeQL scan - "comparison-with-wider-type"
Differential Revision: https://reviews.llvm.org/D122447
Aaron Ballman [Fri, 25 Mar 2022 11:13:26 +0000 (07:13 -0400)]
Fix clang Sphinx build bot
Simon Pilgrim [Fri, 25 Mar 2022 11:06:41 +0000 (11:06 +0000)]
[SDAG] enable binop identity constant folds for multiplies
Add mul to the list of ops that we canonicalize with a select to expose an identity merge
Differential Revision: https://reviews.llvm.org/D122071
Benjamin Kramer [Fri, 25 Mar 2022 11:04:43 +0000 (12:04 +0100)]
[bazel] Add missing dependency after
a75a46db89
Benjamin Kramer [Fri, 25 Mar 2022 11:02:36 +0000 (12:02 +0100)]
[bazel] Add missing dependency after
a75a46db89
Javier Setoain [Thu, 2 Dec 2021 15:09:33 +0000 (15:09 +0000)]
[mlir][Sparse] Add option for VLA sparsification
Use "enable-vla-vectorization=vla" to generate a vector length agnostic
loops during vectorization. This option works for vectorization strategy 2.
Differential Revision: https://reviews.llvm.org/D118379
Simon Pilgrim [Fri, 25 Mar 2022 10:49:04 +0000 (10:49 +0000)]
[X86] combineAdd - fold ADD(ADC(Y,0,W),X) -> ADC(X,Y,W)
This also exposed a missed ADC canonicalization of constant ops to the RHS
Javier Setoain [Wed, 26 Jan 2022 15:01:39 +0000 (15:01 +0000)]
[mlir][Vector] Enable create_mask for scalable vectors
The way vector.create_mask is currently lowered is
vector-length-dependent, and therefore incompatible with scalable vector
types. This patch adds an alternative lowering path for create_mask
operations that return a scalable vector mask.
Differential Revision: https://reviews.llvm.org/D118248
Thomas Symalla [Tue, 1 Feb 2022 09:28:18 +0000 (10:28 +0100)]
[AMDGPU] Improve v_cmpx usage on GFX10.3.
On GFX10.3 targets, the following instruction sequence
v_cmp_* SGPR, ...
s_and_saveexec ..., SGPR
leads to a fairly long stall caused by a VALU write to a SGPR and having the
following SALU wait for the SGPR.
An equivalent sequence is to save the exec mask manually instead of letting
s_and_saveexec do the work and use a v_cmpx instruction instead to do the
comparison.
This patch modifies the SIOptimizeExecMasking pass as this is the last position
where s_and_saveexec instructions are inserted. It does the transformation by
trying to find the pattern, extracting the operands and generating the new
instruction sequence.
It also changes some existing lit tests and introduces a few new tests to show
the changed behavior on GFX10.3 targets.
Same as D119696 including a buildbot and MIR test fix.
Reviewed By: critson
Differential Revision: https://reviews.llvm.org/D122332
Simon Pilgrim [Fri, 25 Mar 2022 10:27:16 +0000 (10:27 +0000)]
[AArch64] isProfitableToHoist - remove nullptr test
User is dereferenced on the main codepath so the null test is likely superfluous
Simon Pilgrim [Fri, 25 Mar 2022 10:25:04 +0000 (10:25 +0000)]
[Utils] stripDebugifyMetadata - use cast<> instead of dyn_cast_or_null<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Fri, 25 Mar 2022 10:23:22 +0000 (10:23 +0000)]
[AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is used immediately inside the getSymbol() call, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Fri, 25 Mar 2022 10:22:05 +0000 (10:22 +0000)]
[clang] CheckSizelessVectorOperands - use castAs<> instead of getAs<> to avoid dereference of nullptr
Move the only uses of the cast to where they are dereferenced.
Simon Pilgrim [Fri, 25 Mar 2022 10:14:11 +0000 (10:14 +0000)]
[X86] Add test showing failure to fold add(adc(x,0,carry),c) -> adc(x,c,carry)
David Green [Fri, 25 Mar 2022 10:03:10 +0000 (10:03 +0000)]
Revert "[AArch64] Lower 3 and 4 sources buildvectors to TBL"
This reverts commit
ec93b28909749619dbe58b092a13da9d1ff1eb1e as problems
with it have been reported.
Marek Kurdej [Fri, 25 Mar 2022 09:44:36 +0000 (10:44 +0100)]
[clang-format] Clean up DefinitionBlockSeparatorTest. NFC.
Kai Luo [Fri, 25 Mar 2022 09:54:34 +0000 (17:54 +0800)]
[PowerPC] Add test for failing lowering llvm.ppc.cfence on i128. NFC.
Dávid Bolvanský [Fri, 25 Mar 2022 09:45:08 +0000 (10:45 +0100)]
[Clang] Added release note for improved -Wunused-but-set-variable warning
Daniil Kovalev [Fri, 25 Mar 2022 09:36:20 +0000 (12:36 +0300)]
[NVPTX] Remove code duplication in LowerCall
In D120129 we enhanced vectorization options of byval parameters. This patch
removes code duplication when handling byval and non-byval cases.
Differential Revision: https://reviews.llvm.org/D122381
Iain Sandoe [Sun, 20 Sep 2020 08:29:14 +0000 (09:29 +0100)]
[C++20][Modules][HU 1/5] Introduce header units as a module type.
This is the first in a series of patches that introduce C++20 importable
header units.
These differ from clang header modules in that:
(a) they are identifiable by an internal name
(b) they represent the top level source for a single header - although
that might include or import other headers.
We name importable header units with the path by which they are specified
(although that need not be the absolute path for the file).
So "foo/bar.h" would have a name "foo/bar.h". Header units are made a
separate module type so that we can deal with diagnosing places where they
are permitted but a named module is not.
Differential Revision: https://reviews.llvm.org/D121095
Nikita Popov [Thu, 24 Mar 2022 10:24:40 +0000 (11:24 +0100)]
[BPF] Don't fetch alignment of llvm.preserve.union.access.index argument
The way the alignment is determined here is not compatible with
opaque pointers -- we'd have to thread it through using either
align or elementtype attributes.
However, as far as I can tell this alignment is actually never
used for this particular intrinsic, so I've dropped the assignment
entirely and converted RecordAlignment to MaybeAlign, so we get an
assertion failure if it does end up being used.
Differential Revision: https://reviews.llvm.org/D122379
Jean Perier [Fri, 25 Mar 2022 08:18:09 +0000 (01:18 -0700)]
[flang][NFC] fix comment typo in SetLowerBound description
Jean Perier [Fri, 25 Mar 2022 08:02:48 +0000 (09:02 +0100)]
[flang][codegen] ensure descriptor lower bounds are LBOUND compliant
Follow-up of https://reviews.llvm.org/D121488 to ensure all descriptors
created inline complies with LBOUND requirement that the lower bound is
`1` when the related dimension extent is zero.
Both fir.xrebox and fir.xembox codegen is updated to enforce this
constraint.
Also upstream the "normalized lower bound" attribute that was added in fir-dev
since embox codegen was upstreamed, it is conflicting with this patch
otherwise.
Differential Revision: https://reviews.llvm.org/D122419
Jean Perier [Fri, 25 Mar 2022 08:00:23 +0000 (09:00 +0100)]
[flang] Fix LBOUND rewrite on descriptor components
GetLowerBoundHelper rewrite in https://reviews.llvm.org/D121488 was
incorrect with POINTER/ALLOCATABLE components. The rewrite created a
descriptor inquiry to the component symbol only instead of the whole
named entity. The base information was lost, and not retrievable.
LBOUND(a(10)%p) became LBOUND(p).
Fix this regression, and also update DescriptorInquiry unparsing to
carry the kind information. DescriptorInquiries are KIND 8 expressions,
while LBOUND/SIZE/RANK, %LEN are default kind expressions.
This caused `print *,lbound(x,kind=8)` to unparse as `print*,lbound(x)` which is not
semantically the same (this unparsing issue was not an issue for
lowering, but I noticed it while writing my regression test).
Differential Revision: https://reviews.llvm.org/D122406
Tom Stellard [Fri, 25 Mar 2022 07:45:25 +0000 (00:45 -0700)]
Release Workflow: Remove cherry-pick-failed label when pull request is created
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D121032
LLVM GN Syncbot [Fri, 25 Mar 2022 07:28:25 +0000 (07:28 +0000)]
[gn build] Port
75112133b83e
Carlos Alberto Enciso [Thu, 24 Mar 2022 16:33:08 +0000 (16:33 +0000)]
[llvm-pdbutil] Move InputFile/FormatUtil/LinePrinter to PDB library.
At Sony we are developing llvm-dva
https://lists.llvm.org/pipermail/llvm-dev/2020-August/144174.html
For its PDB support, it requires functionality already present in
llvm-pdbutil.
We intend to move that functionaly into the PDB library to be
shared by both tools. That change will be done in 2 steps, that
will be submitted as 2 patches:
(1) Replace 'ExitOnError' with explicit error handling.
(2) Move the intended shared code to the PDB library.
Patch for step (1): https://reviews.llvm.org/D121801
This patch is for step (2).
Move InputFile.cpp[h], FormatUtil.cpp[h] and LinePrinter.cpp[h]
files to the debug PDB library.
It exposes the following functionality that can be used by tools:
- Open a PDB file.
- Get module debug stream.
- Traverse module sections.
- Traverse module subsections.
Most of the needed functionality is in InputFile, but there are
dependencies from LinePrinter and FormatUtil.
Some other functionality is in the following functions in
DumpOutputStyle.cpp file:
- iterateModuleSubsections
- getModuleDebugStream
- iterateOneModule
- iterateSymbolGroups
- iterateModuleSubsections
Only these specific functions from DumpOutputStyle are moved to
the PDB library.
Reviewed By: aganea, dblaikie, rnk
Differential Revision: https://reviews.llvm.org/D122226
Valentin Clement [Fri, 25 Mar 2022 07:00:10 +0000 (08:00 +0100)]
[flang] Lower mvbits intrinsic
This patch adds the lowering for the `mvbits`
intrinsic.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122412
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Nathan Ridge [Sun, 14 Nov 2021 06:39:17 +0000 (01:39 -0500)]
[clang] Propagate requires-clause from constructor template to implicit deduction guide
Fixes https://github.com/clangd/clangd/issues/890
Differential Revision: https://reviews.llvm.org/D113874
Fangrui Song [Fri, 25 Mar 2022 04:54:20 +0000 (21:54 -0700)]
[ELF] addSectionSymbols: simplify isec->getOutputSection(). NFC
Thomas Raoux [Fri, 25 Mar 2022 03:31:06 +0000 (03:31 +0000)]
[mlir][gpu] Relax restriction on mma load/store op
Those ops can support more complex layout as long as the most inner
dimension is contiguous.
Differential Revision: https://reviews.llvm.org/D122452
Ben Shi [Thu, 24 Mar 2022 14:29:52 +0000 (14:29 +0000)]
[AVR] Add more devices
Synchronize device list with avr-gcc 7.3.0 and avrlibc 2.0.0.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D122401
Nico Weber [Thu, 24 Mar 2022 19:39:54 +0000 (15:39 -0400)]
Make BLAKE3 a component library
It's unusual that BLAKE3/CMakeLists.txt just defines a list of
files that it injects into its parent scope. The list should either
be defined in llvm/lib/Support/CMakeLists.txt, or
llvm/lib/Support/BLAKE3/CMakeLists.txt should define an object
library.
This does the latter. It makes llvm/lib/Support/BLAKE3/CMakeLists.txt
more self-contained.
No behavior change.
Differential Revision: https://reviews.llvm.org/D122428
Akira Hatanaka [Fri, 25 Mar 2022 00:38:48 +0000 (17:38 -0700)]
Fix a bug where an extended vector of __fp16 was being converted to a
generic vector type
rdar://
86109177
Hubert Tong [Fri, 25 Mar 2022 00:11:54 +0000 (20:11 -0400)]
[Clang] Work with multiple pragmas weak before definition
Update `WeakUndeclaredIdentifiers` to hold a collection of weak
aliases per identifier instead of only one.
This also allows the "used" state to be removed from `WeakInfo`
because it is really only there as an alternative to removing
processed map entries, and we can represent that using an empty set
now. The serialization code is updated for the removal of the field.
Additionally, a PCH test is added for the new functionality.
The records are grouped by the "target" identifier, which was already
being used as a key for lookup purposes. We also store only one record
per alias name; combined, this means that diagnostics are grouped by
the "target" and limited to one per alias (which should be acceptable).
Fixes PR28611.
Fixes llvm/llvm-project#28985.
Reviewed By: aaron.ballman, cebowleratibm
Differential Revision: https://reviews.llvm.org/D121927
Co-authored-by: Rachel Craik <rcraik@ca.ibm.com>
Co-authored-by: Jamie Schmeiser <schmeise@ca.ibm.com>
Groverkss [Thu, 24 Mar 2022 23:46:48 +0000 (05:16 +0530)]
[MLIR][Presburger] Merge PresburgerLocalSpace and PresburgerSpace
This patch is a cleanup patch that merges PresburgerLocalSpace and
PresburgerSpace. Asserting that there are no locals is shifted to the
users of PresburgerSpace themselves.
The reasoning for this patch is that PresburgerLocalSpace did not contribute
much and only introduced additional complexity as locals could still be present
in PresburgerSpace, just not writable. This could introduce problems if a
PresburgerSpace with locals was copied to PresburgerLocalSpace which expected
no locals in a PresburgerSpace.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D122353
Nikolas Klauser [Fri, 18 Mar 2022 16:49:02 +0000 (17:49 +0100)]
[libc++] Rename __identity to __type_identity
In C++20 the type trait `type_identity` was introduced. For the same purpose there is `__identity` for pre-C++20 code. The name is confusing, because since C++20 there is also `identity`, which isn't a type trait.
Reviewed By: ldionne, Mordante, #libc
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D122017
Tom Stellard [Wed, 23 Mar 2022 06:17:39 +0000 (23:17 -0700)]
Re-commit: Driver: Don't warn on -mbranch-protection when linking
This is a re-commit of
98fd3b359866f474ab1c097c22fb5c3be356b996. The
newly added test was failing on the bots, and I've fixed the test now so
that it doesn't actually invoke the linker.
Joseph Huber [Thu, 24 Mar 2022 12:26:32 +0000 (08:26 -0400)]
[OpenMP] Add a semantic check for updating hidden or internal values
A previous patch removed the compiler generating offloading entries
for variables that were declared on the device but were internal or
hidden. This allowed us to compile programs but turns any attempt to run
'#pragma omp target update' on one of those variables a silent failure.
This patch adds a check in the semantic analysis for if the user is
attempting the update a variable on the device from the host that is not
externally visible.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D122403
Thomas Raoux [Thu, 24 Mar 2022 21:02:17 +0000 (21:02 +0000)]
[mlir][linalg] Add pattern to split reduction dimension in a linalg op
This transformation allow to break up a reduction dimension in a
parallel and a reduction dimension. This is followed by a separate
reduction op. This allows to generate tree reduction which is beneficial
on target allowing to take advantage parallelism.
Differential Revision: https://reviews.llvm.org/D122045
Jason Molenda [Thu, 24 Mar 2022 21:35:46 +0000 (14:35 -0700)]
Don't search for sim SDK path until we know we need it
When iterating over all Platforms looking for the best one, on a Mac the
Simulator platforms (iOS, tvOS, watchOS) will first find their SDK
directory by calling xcrun, then decide if they should activate or not.
When that SDK is absent, the call to xcrun to find it can be very slow.
This patch delays that directory search until we know we're activating
this platform, so non-simulator environments don't pay a perf cost ever
time they go through the list of platforms.
Differential Revision: https://reviews.llvm.org/D122373
rdar://
87960090
Fangrui Song [Thu, 24 Mar 2022 22:26:40 +0000 (15:26 -0700)]
[Bazel] Add BLAKE3 files to llvm:Support
Hope someone can figure out how to leverage SSE42/AVE2/Arm Neon.
Peter Steinfeld [Wed, 23 Mar 2022 22:20:56 +0000 (15:20 -0700)]
[flang] Make not yet implemented messages more consistent
To make it easier to find things that are not yet implemented, I'm changing the
messages that appear in the compiler's output to all have the string "not yet
implemented:".
These changes apply to files in the front end. I have another set of changes
to files in the lowering code.
Differential Revision: https://reviews.llvm.org/D122355
Zixu Wang [Thu, 24 Mar 2022 22:09:25 +0000 (15:09 -0700)]
[NFC][clang][extract-api] Rename variable
Rename a local variable name to avoid potential ambiguity/conflict for
some compilers.
Tue Ly [Wed, 23 Mar 2022 19:37:19 +0000 (15:37 -0400)]
[libc] Improve the performance of exp2f.
Reduce the range-reduction table size from 128 entries down to 64 entries, and
reduce the polynomial's degree from 6 down to 4.
Currently we use a degree-6 minimax polynomial on an interval of length 2^-7
around 0 to compute exp2f. Based on the suggestion of @santoshn and the RLIBM
project (https://github.com/rutgers-apl/rlibm-prog/blob/main/libm/float/exp2.c)
it is possible to have a good polynomial of degree-4 on a subinterval of length
2^(-6) to approximate 2^x.
We did try to either reduce the degree of the polynomial down to 3 or increase
the interval size to 2^(-5), but in both cases the number of exceptional values
exploded. So we settle with using a degree-4 polynomial of the interval of
size 2^(-6) around 0.
Reviewed By: michaelrj, sivachandra, zimmermann6, santoshn
Differential Revision: https://reviews.llvm.org/D122346
Zixu Wang [Thu, 24 Mar 2022 21:30:14 +0000 (14:30 -0700)]
[NFC][clang][extract-api] Add missing virtual anchors
Add missing virtual method anchors for structs in ExtractAPI/API.h
Arthur Eubanks [Thu, 10 Feb 2022 23:39:29 +0000 (15:39 -0800)]
[opt] Remove -analyze option
This is legacy PM-specific, which is deprecated.
Uses of this should be replaced with a corresponding `-passes='print<foo>'`.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D122420
Lei Zhang [Thu, 24 Mar 2022 19:00:39 +0000 (15:00 -0400)]
[mlir][spirv] Add Apple into the vendor list
Reviewed By: ThomasRaoux, hanchung
Differential Revision: https://reviews.llvm.org/D122414
Jennifer Yu [Wed, 23 Mar 2022 14:34:28 +0000 (07:34 -0700)]
Eliminate extra set of simd variant function attribute.
Current clang generates extra set of simd variant function attribute
with extra 'v' encoding.
For example:
_ZGVbN2v__Z5add_1Pf vs _ZGVbN2vv__Z5add_1Pf
The problem is due to declaration of ParamAttrs following:
llvm::SmallVector<ParamAttrTy, 8> ParamAttrs(ParamPositions.size());
where ParamPositions.size() is grown after following assignment:
Pos = ParamPositions[PVD];
So the PVD is not find in ParamPositions.
The problem is ParamPositions need to set for each FD decl. To fix this
Move ParamPositions's init inside while loop for each FD.
Differential Revision: https://reviews.llvm.org/D122338
Stanislav Mekhanoshin [Wed, 23 Mar 2022 18:29:56 +0000 (11:29 -0700)]
[AMDGPU] Use GenericTable to classify DGEMM
Since there is a table introduced for MAI instructions extend it
to use for DGEMM classification.
Differential Revision: https://reviews.llvm.org/D122337
Stanislav Mekhanoshin [Wed, 23 Mar 2022 16:12:34 +0000 (09:12 -0700)]
[AMDGPU] gfx940 MAI hazard recognizer
Differential Revision: https://reviews.llvm.org/D122263
Valentin Clement [Thu, 24 Mar 2022 19:43:11 +0000 (20:43 +0100)]
[flang][NFC] Remove unused variable
Stanislav Mekhanoshin [Mon, 21 Mar 2022 19:59:33 +0000 (12:59 -0700)]
[AMDGPU] Support gfx940 smfmac instructions
Differential Revision: https://reviews.llvm.org/D122191
Kirill Stoimenov [Wed, 16 Mar 2022 14:50:04 +0000 (14:50 +0000)]
[ASan] Reland of D116182 to always link asan_static library.
After landing D121813 the binary size increase introduced by this change can be minimized by using --gc-sections link options. D121813 allows each individual callbacks to be optimized out if not used.
Reviewed By: vitalybuka, MaskRay
Differential Revision: https://reviews.llvm.org/D122407
Nico Weber [Thu, 24 Mar 2022 19:23:36 +0000 (15:23 -0400)]
Revert "[gn build] Manually port llvm/lib/Support/BLAKE3"
This reverts commit
8424d4f641b186f30126c33f76f6a0fb619f903e.
That approach doesn't work. I checked in something that kinda
works 30 min ago or so.
wangyihan [Thu, 24 Mar 2022 19:09:10 +0000 (12:09 -0700)]
[clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct
Fix clang crash and add bitfield support in __builtin_dump_struct.
In clang13.0.x, a struct with three or more members and a bitfield at
the same time will cause a crash. In clang15.x, as long as the struct
has one bitfield, it will cause a crash in clang.
Open issue: https://github.com/llvm/llvm-project/issues/54462
Differential Revision: https://reviews.llvm.org/D122248
Yaxun (Sam) Liu [Wed, 16 Mar 2022 01:45:02 +0000 (21:45 -0400)]
[CUDA][HIP] Fix hostness check with -fopenmp
CUDA/HIP determines whether a function can be called based on
the device/host attributes of callee and caller. Clang assumes the
caller is CurContext. This is correct in most cases, however, it is
not correct in OpenMP parallel region when CUDA/HIP program
is compiled with -fopenmp. This causes incorrect overloading
resolution and missed diagnostics.
To get the correct caller, clang needs to chase the parent chain
of DeclContext starting from CurContext until a function decl
or a lambda decl is reached. Sema API is adapted to achieve that
and used to determine the caller in hostness check.
Reviewed by: Artem Belevich, Richard Smith
Differential Revision: https://reviews.llvm.org/D121765
Fraser Cormack [Wed, 16 Mar 2022 10:14:07 +0000 (10:14 +0000)]
[VectorCombine] Insert addrspacecast when crossing address space boundaries
We can not bitcast pointers across different address spaces. This was
previously fixed in D89577 but then in D93229 an enhancement was added
which peeks further through the ponter operand, opening up the
possibility that address-space violations could be introduced.
Instead of bailing as the previous fix did, simply insert an
addrspacecast cast instruction.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D121787
Stanislav Mekhanoshin [Fri, 18 Mar 2022 19:33:21 +0000 (12:33 -0700)]
[AMDGPU] New gfx940 mfma instructions
Differential Revision: https://reviews.llvm.org/D122044
LLVM GN Syncbot [Thu, 24 Mar 2022 19:11:19 +0000 (19:11 +0000)]
[gn build] Port
Fangrui Song [Thu, 24 Mar 2022 19:06:19 +0000 (12:06 -0700)]
[gn build] Manually port llvm/lib/Support/BLAKE3
Johannes Doerfert [Thu, 24 Mar 2022 19:04:41 +0000 (14:04 -0500)]
Revert "[Intrinsics] Add `nocallback` to the default intrinsic attributes"
This reverts commit
7aea3ea8c3b33c9bb338d5d6c0e4832be1d09ac3 as it
breaks the buildbots.
I didn't see these failures in the pre-merge checks, looking into it.
Nico Weber [Thu, 24 Mar 2022 18:56:42 +0000 (14:56 -0400)]
[gn build] ugly hack to work around sync script for now
David Blaikie [Thu, 24 Mar 2022 18:31:48 +0000 (18:31 +0000)]
DebugInfo: Classify noreturn function types as non-reconstructible
This information isn't preserved in the DWARF description of function
types (though probably should be - it's preserved on the function
declarations/definitions themselves through the DW_AT_noreturn attribute
- but we should move or also include that in the subroutine type itself
too - but for now, with it not being there, the DWARF is lossy and
can't be reconstructed)
Nico Weber [Thu, 24 Mar 2022 18:44:46 +0000 (14:44 -0400)]
[gn build] (manually) port
9aa701984d39 (BLAKE3)
Johannes Doerfert [Tue, 1 Feb 2022 07:03:06 +0000 (01:03 -0600)]
[Intrinsics] Add `nocallback` to the default intrinsic attributes
Most intrinsics, especially "default" ones, will not call back into the
IR module. `nocallback` encodes this nicely. As it was not used before,
this patch also makes use of `nocallback` in the Attributor which
results in many more `norecurse` deductions.
Tablegen part is mechanical, test updates by script.
Differential Revision: https://reviews.llvm.org/D118680
Sanjay Patel [Thu, 24 Mar 2022 18:39:04 +0000 (14:39 -0400)]
[InstCombine] add more tests for nsw propagation; NFC
Follow-up as suggested with
b6efd2510a1efaf2 -
show a couple of examples of general subtraction
(the earlier patch was all negations).
Argyrios Kyrtzidis [Thu, 24 Mar 2022 18:40:28 +0000 (11:40 -0700)]
[Support/BLAKE3] Temporarily disable building neon file to get builders back to green
Fangrui Song [Thu, 24 Mar 2022 18:31:39 +0000 (11:31 -0700)]
[ELF] Implement --build-id={md5,sha1} with truncated BLAKE3
--build-id was introduced as "approximation of true uniqueness across all
binaries that might be used by overlapping sets of people". It does not require
the some resistance mentioned below. In practice, people just use --build-id=md5
for 16-byte build ID and --build-id=sha1 for 20-byte build ID.
BLAKE3 has 256-bit key length, which provides 128-bit security against
(second-)preimage, collision, and differentiability attacks. Its portable
implementation is fast. It additionally provides Arm Neon/AVX2/AVX-512. Just
implement --build-id={md5,sha1} with truncated BLAKE3.
Linking clang 14 RelWithDebInfo with --threads=8 on a Skylake CPU:
* 1.13x as fast with --build-id=md5
* 1.15x as fast with --build-id=sha1
--threads=4 on Apple m1:
* 1.25x as fast with --build-id=md5
* 1.17x as fast with --build-id=sha1
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D121531
Argyrios Kyrtzidis [Thu, 24 Mar 2022 18:28:24 +0000 (11:28 -0700)]
[Support/BLAKE3] Temporarily disable building the assembly files to get the builders back to green
Gulfem Savrun Yeniceri [Thu, 24 Mar 2022 18:10:08 +0000 (18:10 +0000)]
Revert "[clang][deps] NFC: De-duplicate clang-cl tests"
This reverts commit
30cb49b44e4e2af2e0627b2aa33df0ba57ab9e55.
It caused test failures on Fuchsia Toolchain Mac builds:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-mac-x64/
b8818888168677577537/overview
Simon Pilgrim [Thu, 24 Mar 2022 17:59:50 +0000 (17:59 +0000)]
[X86] combineSub - fold SUB(X,ADC(Y,0,W)) -> SBB(X,Y,W)
Arthur Eubanks [Thu, 24 Mar 2022 17:53:50 +0000 (10:53 -0700)]
[gn build] Manually port
0c86198b2
Daniel Grumberg [Wed, 23 Mar 2022 15:03:02 +0000 (15:03 +0000)]
[clang][extract-api] Stop allocating APIRecords via BumpPtrAllocator
Using a BumpPtrAllocator introduced memory leaks for APIRecords as they
contain a std::vector. This meant that we needed to always keep a
reference to the records in APISet and arrange for their destructor to
get called appropriately. This was further complicated by the need for
records to own sub-records as these subrecords would still need to be
allocated via the BumpPtrAllocator and the owning record would now need
to arrange for the destructor of its subrecords to be called
appropriately.
Since APIRecords contain a std::vector so whenever elements get added to
that there is an associated heap allocation regardless. Since
performance isn't currently our main priority it makes sense to use
regular unique_ptr to keep track of APIRecords, this way we don't need
to arrange for destructors to get called.
The BumpPtrAllocator is still used for strings such as USRs so that we
can easily de-duplicate them as necessary.
Differential Revision: https://reviews.llvm.org/D122331
Simon Pilgrim [Thu, 24 Mar 2022 17:41:24 +0000 (17:41 +0000)]
Fix unused variable warning by embedding inside assertion
Argyrios Kyrtzidis [Thu, 24 Mar 2022 01:16:56 +0000 (18:16 -0700)]
[Support/BLAKE3] LLVM-specific changes over the original BLAKE3 C implementation
Changes from original BLAKE3 sources:
* `blake.h`:
* Changes to avoid conflicts if a client also links with its own BLAKE3 version:
* Renamed the header macro guard with `LLVM_C_` prefix
* Renamed the C symbols to add the `llvm_` prefix
* Added a top header comment that references the CC0 license and points to the `LICENSE` file in the repo.
* `blake3_impl.h`: Added `#define`s to remove some of `llvm_` prefixes for the rest of the internal implementation.
* Implementation files:
* Added a top header comment for `blake.c`
* Used `llvm_` prefix for the C public API functions
* Used `LLVM_LIBRARY_VISIBILITY` for internal implementation functions
* Added `.private_extern`/`.hidden` in assembly files to reduce visibility of the internal implementation functions
* `README.md`:
* added a note about where the sources originated from
* Used the C++ BLAKE3 class and `llvm_` prefixed C API in place of examples and API documentation.
* Removed instructions about how to build the files.
Argyrios Kyrtzidis [Sat, 12 Mar 2022 01:32:27 +0000 (17:32 -0800)]
[Support] Introduce the BLAKE3 hashing function implementation
BLAKE3 is a cryptographic hash function that is secure and very performant.
The C implementation originates from https://github.com/BLAKE3-team/BLAKE3/tree/1.3.1/c
License is at https://github.com/BLAKE3-team/BLAKE3/blob/1.3.1/LICENSE
This patch adds:
* `llvm/include/llvm-c/blake3.h`: The BLAKE3 C API
* `llvm/include/llvm/Support/BLAKE3.h`: C++ wrapper of the C API
* `llvm/lib/Support/BLAKE3`: Directory containing the BLAKE3 C implementation files, including the `LICENSE` file
* `llvm/unittests/Support/BLAKE3Test.cpp`: unit tests for the BLAKE3 C++ wrapper
This initial patch contains the pristine BLAKE3 sources, a follow-up patch will introduce
LLVM-specific prefixes to avoid conflicts if a client also links with its own BLAKE3 version.
And here's some timings comparing BLAKE3 with LLVM's SHA1/SHA256/MD5.
Timings include `AVX512`, `AVX2`, `neon`, and the generic/portable implementations.
The table shows the speed-up multiplier of BLAKE3 for hashing 100 MBs:
| Processor | SHA1 | SHA256 | MD5 |
|-------------------------|-------|--------|------|
| Intel Xeon W (AVX512) | 10.4x | 27x | 9.4x |
| Intel Xeon W (AVX2) | 6.5x | 17x | 5.9x |
| Intel Xeon W (portable) | 1.3x | 3.3x | 1.1x |
| M1Pro (neon) | 2.1x | 4.7x | 2.8x |
| M1Pro (portable) | 1.1x | 2.4x | 1.5x |
Differential Revision: https://reviews.llvm.org/D121510
Shraiysh Vaishay [Thu, 24 Mar 2022 16:46:43 +0000 (22:16 +0530)]
[mlir][OpenMP][IRBuilder] Add support for nowait on single construct
This patch adds the nowait parameter to `createSingle` in
OpenMPIRBuilder and handling for IR generation from OpenMP Dialect.
Also added tests for the same.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122371
Simon Pilgrim [Thu, 24 Mar 2022 17:16:46 +0000 (17:16 +0000)]
[X86] Add additional 'add/sub single bit' patterns
InstCombine can convert some cases to 'splat bit' sra(shl(x,y),bw-1) patterns which we need to handle as well
Michael Jones [Thu, 24 Mar 2022 00:00:45 +0000 (17:00 -0700)]
[libc][obvious] only test FILE on working platforms
The main code for the FILE struct is only enabled on platforms that it
works on, but before this patch the tests were included unconditionally.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D122363
Louis Dionne [Thu, 24 Mar 2022 13:03:56 +0000 (09:03 -0400)]
[libc++] Audit all uses of _LIBCPP_ASSERT and _LIBCPP_DEBUG_ASSERT
I audited all uses of _LIBCPP_ASSERT to make sure that we only used it
for "basic assertions", i.e. assertions with constant-time conditions.
I also audited all uses of _LIBCPP_DEBUG_ASSERT to make sure we used it
only for debug-mode assertions, and in one case had to change for
_LIBCPP_ASSERT instead.
As a fly-by, I also changed a couple of tests against nullptr or 0 to
be more explicit.
After this patch, all uses of _LIBCPP_ASSERT should be with constant-time
conditions, and all uses of _LIBCPP_DEBUG_ASSERT should be with conditions
that we only want to check when the debug mode is enabled.
Differential Revision: https://reviews.llvm.org/D122395
Shafik Yaghmour [Thu, 24 Mar 2022 16:58:58 +0000 (09:58 -0700)]
[LLDB] Cleanup for Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size
Late review on https://reviews.llvm.org/D121408 spotted some nice quick clean-ups on this code.
Arthur Eubanks [Tue, 22 Mar 2022 00:41:06 +0000 (17:41 -0700)]
[polly] Remove last instances of -analyze
As mentioned in D120782, the loop block order can be different depending
on if LoopInfo is incrementally updated or freshly computed.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D122195
Dmitry Vyukov [Thu, 24 Mar 2022 16:07:32 +0000 (17:07 +0100)]
[TSan] Add a runtime flag to print full thread creation stacks up to the main thread
Currently, we only print how threads involved in data race are created from their parent threads.
Add a runtime flag 'print_full_thread_history' to print thread creation stacks for the threads involved in the data race and their ancestors up to the main thread.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D122131
Mike Rice [Wed, 23 Mar 2022 22:37:06 +0000 (15:37 -0700)]
[OpenMP] Initial parsing/sema for the 'omp target parallel loop' construct
Adds basic parsing/sema/serialization support for the
#pragma omp target parallel loop directive.
Differential Revision: https://reviews.llvm.org/D122359
Momchil Velikov [Thu, 24 Mar 2022 15:27:04 +0000 (15:27 +0000)]
[AArch64] Async unwind - function prologues
Re-commit of
32e8b550e5439c7e4aafa73894faffd5f25d0d05
This patch rearranges emission of CFI instructions, so the resulting
DWARF and `.eh_frame` information is precise at every instruction.
The current state is that the unwind info is emitted only after the
function prologue. This is fine for synchronous (e.g. C++) exceptions,
but the information is generally incorrect when the program counter is
at an instruction in the prologue or the epilogue, for example:
```
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
mov x29, sp
.cfi_def_cfa w29, 16
...
```
after the `stp` is executed the (initial) rule for the CFA still says
the CFA is in the `sp`, even though it's already offset by 16 bytes
A correct unwind info could look like:
```
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
...
```
Having this information precise up to an instruction is useful for
sampling profilers that would like to get a stack backtrace. The end
goal (towards this patch is just a step) is to have fully working
`-fasynchronous-unwind-tables`.
Reviewed By: danielkiss, MaskRay
Differential Revision: https://reviews.llvm.org/D111411
Valentin Clement [Thu, 24 Mar 2022 16:15:00 +0000 (17:15 +0100)]
[flang[OpenACC] Lower wait directive
This patch adds lowering for the `!$acc wait` directive
from the PFT to OpenACC dialect.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122399
Craig Topper [Thu, 24 Mar 2022 15:59:00 +0000 (08:59 -0700)]
[SelectionDAG] Add AssertAlign to AddNodeIDCustom so that it will CSE properly.
The alignment needs to be part of the folding set hash. This is
handled by getAssertAlign when nodes are created, but needs to repeated here.
No test case as I found it as part of a very early experimental patch.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D122279
Alexander Belyaev [Thu, 24 Mar 2022 15:29:21 +0000 (16:29 +0100)]
[llvm] Initialize and move UseUpRegs outside of `union` MemOp struct.
Asan complained about uninitialized bool
`invalid-bool-load`
llvm/lib/Target/X86/AsmParser/X86Operand.h:389:12: runtime error: load
of value 171, which is not a valid value for type 'bool'
Differential Revision: https://reviews.llvm.org/D122405