Sanjay Patel [Thu, 29 Apr 2021 14:43:11 +0000 (10:43 -0400)]
[ADT] fix typo in code block comment; NFC
Anirudh Prasad [Thu, 29 Apr 2021 15:27:56 +0000 (11:27 -0400)]
[AsmParser][SystemZ][z/OS] Reject "Dot" as current PC on z/OS
- Currently, the "." (Dot) character, when not identifying an Identifier or a Constant, refers to the current PC (Program Counter)
- However, in z/OS, for the HLASM dialect, it strictly accepts only the "*" as the current PC (Support for this will be put up in a follow-up patch)
- The changes in this patch allow individual platforms to choose whether they would like to use the "." (Dot) character as a marker for the current PC or not.
- It is achieved by introducing a new field in MCAsmInfo.h called `DotIsPC` (similar to `DollarIsPC`)
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D100975
Fangrui Song [Thu, 29 Apr 2021 15:51:09 +0000 (08:51 -0700)]
[ELF] Support .rela.eh_frame with unordered r_offset values
GNU ld -r can create .rela.eh_frame with unordered r_offset values.
(With LLD, we can craft such a case by reordering sections in .eh_frame.)
This is currently unsupported and will trigger
`assert(pieces[i].inputOff <= off ...` in `OffsetGetter::get`
(the content is corrupted in a -DLLVM_ENABLE_ASSERTIONS=off build).
This patch supports this case.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D101116
Craig Topper [Thu, 29 Apr 2021 15:10:39 +0000 (08:10 -0700)]
[RISCV] Enable SPLAT_VECTOR for fixed vXi64 types on RV32.
This replaces D98479.
This allows type legalization to form SPLAT_VECTOR_PARTS so we don't
lose the splattedness when the scalar type is split.
I'm handling SPLAT_VECTOR_PARTS for fixed vectors separately so
we can continue using non-VL nodes for scalable vectors.
I limited to RV32+vXi64 because DAGCombiner::visitBUILD_VECTOR likes
to form SPLAT_VECTOR before seeing if it can replace the BUILD_VECTOR
with other operations. Especially interesting is a splat BUILD_VECTOR of
the extract_vector_elt which can become a splat shuffle, but won't if
we form SPLAT_VECTOR first. We either need to reorder visitBUILD_VECTOR
or add visitSPLAT_VECTOR.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D100803
Craig Topper [Thu, 29 Apr 2021 15:00:10 +0000 (08:00 -0700)]
[RISCV] Teach computeKnownBits that vsetvli returns number less than 2^31.
This seems like a reasonable upper bound on VL. WG discussions for
the V spec would probably allow us to use 2^16 as an upper bound
on VLEN, but this is good enough for now.
This allows us to remove sext and zext if user happens to assign
the size_t result into an int and then uses it as a VL intrinsic
argument which is size_t.
Reviewed By: frasercrmck, rogfer01, arcbbb
Differential Revision: https://reviews.llvm.org/D101472
Sander de Smalen [Thu, 29 Apr 2021 14:37:57 +0000 (15:37 +0100)]
Revert "[LV] Calculate max feasible scalable VF."
Temporarily reverting this patch due to some unexpected issue found
by one of the PPC buildbots.
This reverts commit
584e9b6e4b4987b882719923e640eed854613d91.
Jay Foad [Thu, 29 Apr 2021 15:03:00 +0000 (16:03 +0100)]
[AMDGPU] Add a v_swap_b32 test case to be fixed
Chirag Khandelwal [Thu, 29 Apr 2021 13:36:07 +0000 (19:06 +0530)]
[Clang][OpenMP] Frontend work for sections - D89671
This patch is child of D89671, contains the clang
implementation to use the OpenMP IRBuilder's section
construct.
Co-author: @anchu-rajendran
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D91054
David Zarzycki [Thu, 29 Apr 2021 14:01:37 +0000 (10:01 -0400)]
Unbreak no-asserts testing
Anastasia Stulova [Thu, 29 Apr 2021 13:08:21 +0000 (14:08 +0100)]
[OpenCL][Docs] Misc updates to C++ for OpenCL and offline compilation
Differential Revision: https://reviews.llvm.org/D101092
Chirag Khandelwal [Thu, 29 Apr 2021 13:08:24 +0000 (18:38 +0530)]
[LLVM][OpenMP] Adding support for OpenMP sections construct in OpenMPIRBuilder
This patch adds section support in the OpenMP IRBuilder module, along with a test for the same.
Reviewed By: fghanim
Differential Revision: https://reviews.llvm.org/D89671
Anastasia Stulova [Thu, 29 Apr 2021 13:02:29 +0000 (14:02 +0100)]
[OpenCL][Docs] Describe extension for legacy atomics with generic addr space.
This extension is primarily targeting SPIR-V compilations flow
as the IR translation is the same between 1.x and 2.x atomics.
Differential Revision: https://reviews.llvm.org/D101089
Florian Hahn [Thu, 29 Apr 2021 12:17:37 +0000 (13:17 +0100)]
[VPlan] Add getVPSingleValue helper.
As suggested in D99294, this adds a getVPSingleValue helper to use for
recipes that are guaranteed to define a single value. This replaces uses
of getVPValue() which used to default to I = 0.
Arnamoy Bhattacharyya [Thu, 29 Apr 2021 12:29:58 +0000 (08:29 -0400)]
[flang][OpenMP] Add semantic checks for strict nesting inside `teams` construct.
Alex Zinenko [Thu, 29 Apr 2021 11:26:54 +0000 (13:26 +0200)]
[mlir] fix shared-lib build
Bradley Smith [Fri, 23 Apr 2021 15:34:26 +0000 (16:34 +0100)]
[AArch64][SVE] Use SIMD variant of INSR when scalar is the result of a vector extract
At the intrinsic layer the sve.insr operation takes a scalar. When this
scalar is an integer we are forcing a data transition between GPRs and
ZPRs that is potentially costly.
Often the integer scalar is the result of a vector extract, when
performing a reduction for example. In such cases we should keep all
data within the ZPRs.
Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D101169
Bradley Smith [Fri, 23 Apr 2021 12:55:42 +0000 (13:55 +0100)]
[AArch64][SVE] Convert svdup(vec, SV_VL1, elm) to insertelement(vec, elm, 0)
By converting the SVE intrinsic to a normal LLVM insertelement we give
the code generator a better chance to remove transitions between GPRs
and VPRs
Co-authored-by: Paul Walker <paul.walker@arm.com>
Depends on D101302
Differential Revision: https://reviews.llvm.org/D101167
Bradley Smith [Mon, 26 Apr 2021 15:19:25 +0000 (16:19 +0100)]
[AArch64][SVE] Move convert.{from,to}.svbool optimization into InstCombine
As part of this the ptrue coalescing done in SVEIntrinsicOpts has been
modified to not introduce redundant converts, since the convert removal
will no longer run after that optimisation to clean up.
Differential Revision: https://reviews.llvm.org/D101302
Alex Zinenko [Thu, 29 Apr 2021 11:15:21 +0000 (13:15 +0200)]
[mlir] support max/min lower/upper bounds in affine.parallel
This enables to express more complex parallel loops in the affine framework,
for example, in cases of tiling by sizes not dividing loop trip counts perfectly
or inner wavefront parallelism, among others. One can't use affine.max/min
and supply values to the nested loop bounds since the results of such
affine.max/min operations aren't valid symbols. Making them valid symbols
isn't an option since they would introduce selection trees into memref
subscript arithmetic as an unintended and undesired consequence. Also
add support for converting such loops to SCF. Drop some API that isn't used in
the core repo from AffineParallelOp since its semantics becomes ambiguous in
presence of max/min bounds. Loop normalization is currently unavailable for
such loops.
Depends On D101171
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D101172
Alex Zinenko [Thu, 29 Apr 2021 11:14:58 +0000 (13:14 +0200)]
[mlir] Affine: parallelize affine loops with reductions
Introduce a basic support for parallelizing affine loops with reductions
expressed using iteration arguments. Affine parallelism detector now has a flag
to assume such reductions are parallel. The transformation handles a subset of
parallel reductions that are can be expressed using affine.parallel:
integer/float addition and multiplication. This requires to detect the
reduction operation since affine.parallel only supports a fixed set of
reduction operators.
Reviewed By: chelini, kumasento, bondhugula
Differential Revision: https://reviews.llvm.org/D101171
Lorenzo Chelini [Thu, 29 Apr 2021 11:06:40 +0000 (13:06 +0200)]
[mlir] Fix top-level comments (NFC)
Nathan Sidwell [Wed, 28 Apr 2021 11:03:11 +0000 (04:03 -0700)]
Update libstdc++ hack comment
This libstc++ hack isn't ready for removal. Updating the comment to
note what I found. While I have not proven Ville's
__is_throw_swappable patch made this go away, that patch did remove
the use of noexcept(noexcept(swap(....))). I'm not sure when gcc grew
deferred noexcept parsing.
Differential Revision: https://reviews.llvm.org/D101441
Sebastian Neubauer [Thu, 29 Apr 2021 10:52:29 +0000 (12:52 +0200)]
[AMDGPU] Allow buildSpillLoadStore in empty bb
This allows calling buildSpillLoadStore for an empty basic block, where
MI points at the end of the block instead of to an instruction.
This only happens with downstream CFI changes, so I was not able to
create a testcase that works with upstream LLVM.
Differential Revision: https://reviews.llvm.org/D101356
Amara Emerson [Thu, 29 Apr 2021 10:40:50 +0000 (03:40 -0700)]
Try to fix bots. We shouldn't be setting the entrybuilder's DL to a null one.
This was causing a DILocation verifier error, the old code path didn't try to do
this when building constants via the finishPendingPhis() method.
Fraser Cormack [Thu, 29 Apr 2021 10:38:10 +0000 (11:38 +0100)]
[RISCV][NFC] Combine identical RV32 and RV64 test checks
Tres Popp [Thu, 29 Apr 2021 10:20:28 +0000 (12:20 +0200)]
[mlir] Add LinalgTransforms dependency on Complex
David Green [Thu, 29 Apr 2021 09:59:14 +0000 (10:59 +0100)]
[ARM] Ensure CSINC has one use in CSINV combine
Otherwise the CMP glue may be used in multiple nodes, needing to be
emitted multiple times. Currently this either increases instruction
count or fails as it attempt to insert the same node multiple times.
Tres Popp [Tue, 6 Apr 2021 10:39:07 +0000 (12:39 +0200)]
[mlir] Support complex numbers in Linalg promotion
FillOp allows complex ops, and filling a properly sized buffer with
a default zero complex number is implemented.
Differential Revision: https://reviews.llvm.org/D99939
Serguei Katkov [Thu, 29 Apr 2021 05:22:19 +0000 (12:22 +0700)]
[Greedy RA] Replace ll to mir test to make more stable to check an error.
Alex Zinenko [Thu, 22 Apr 2021 15:32:10 +0000 (17:32 +0200)]
[mlir] Split out Python bindings entry point into a separate file
This will allow the bindings to be built as a library and reused in out-of-tree
projects that want to provide bindings on top of MLIR bindings.
Reviewed By: stellaraccident, mikeurbach
Differential Revision: https://reviews.llvm.org/D101075
David Spickett [Thu, 29 Apr 2021 08:54:03 +0000 (09:54 +0100)]
[NVPTX] Fix unused var warning with asserts disabled
<...>/llvm-project/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp:191:15:
warning: unused variable ‘ASC’ [-Wunused-variable]
191 | if (auto *ASC =
dyn_cast<AddrSpaceCastInst>(I.OldInstruction)) {
| ^~~
Nick Lewycky [Wed, 28 Apr 2021 20:15:39 +0000 (13:15 -0700)]
Improve error messages for attributes in the wrong context.
verifyFunctionAttrs has a comment that the value V is printed in error messages. The recently added errors for attributes didn't print V. Make them print V.
Change the stringification of AttributeList. Firstly they started with 'PAL[' which stood for ParamAttrsList. Change that to 'AttributeList[' matching its current name AttributeList. Print out semantic meaning of the index instead of the raw index value (i.e. 'return', 'function' or 'arg(n)').
Differential revision: https://reviews.llvm.org/D101484
Qiu Chaofan [Thu, 29 Apr 2021 08:28:34 +0000 (16:28 +0800)]
[SPE] Support constrained float operations on SPE
This patch enables support on SPE for constrained arithmetic and
comparison operations. This fixes bugzilla 50070.
One thing not covered is fcmp vs. fcmps on SPE. Some condition code
generates singaling comparison while some not. In this patch, all are
considered as singaling. So there might be still some issue when
compiling from C code.
Reviewed By: jhibbits
Differential Revision: https://reviews.llvm.org/D101282
David Spickett [Wed, 14 Apr 2021 16:11:26 +0000 (17:11 +0100)]
[lldb][AArch64] Don't check for VmFlags in smaps files
AArch64 kernel builds default to having /smaps and
the "VmFlags" line was added in 3.8. Long before MTE
was supported.
So we can assume that if you're AArch64 with MTE,
you can run this test.
The previous method of checking had a race condition
where the process we read smaps for, could finish before
we get to read the file.
I explored some alternatives but in the end I think
it's fine to just assume we have what we need.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D100493
Vitaly Buka [Thu, 29 Apr 2021 08:23:44 +0000 (01:23 -0700)]
[NFC][scudo] Suppress "division by zero" warning
Fraser Cormack [Mon, 22 Mar 2021 15:54:04 +0000 (15:54 +0000)]
[RISCV] Fix stack slot for argument types (Bug 49500)
This is an complementary/alternative fix for D99068. It takes a slightly
different approach by explicitly summing up all of the required split
part type sizes and ensuring we allocate enough space for them. It also
takes the maximum alignment of each part.
Compared with D99068 there are fewer changes to the stack objects in
existing tests. However, @luismarques has shown in that patch that there
are opportunities to reduce our stack usage in the future.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D99087
Frederik Gossen [Thu, 29 Apr 2021 08:07:20 +0000 (10:07 +0200)]
[MLIR][Shape] Fix `shape.broadcast` to standard lowering
Differential Revision: https://reviews.llvm.org/D101456
Marek Kurdej [Thu, 29 Apr 2021 08:06:46 +0000 (10:06 +0200)]
[clang-format] Fix build on gcc < 7 introduced in rG9363aa9.
This fixes another bogus build error on gcc, e.g. https://lab.llvm.org/buildbot/#/builders/110/builds/2974.
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3412:34: error: binding ‘const clang::format::FormatStyle’ to reference of type ‘clang::format::FormatStyle&’ discards qualifiers
auto ShouldAddSpacesInAngles = [&Style = this->Style,
^
Amara Emerson [Thu, 29 Apr 2021 07:59:12 +0000 (00:59 -0700)]
[GlobalISel] Bump CallLoweringInfo::OrigArgs initial size to 32. NFC.
We spend some time during sqlite3 compilation regrowing this vector,
bump it up to avoid this.
Gives around 1-2% improvement in codegen-only time for sqlite3 at -O0.
Fraser Cormack [Wed, 28 Apr 2021 15:23:13 +0000 (16:23 +0100)]
[Utils][vim] Highlight 'vscale' constant
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D101466
Marek Kurdej [Thu, 29 Apr 2021 07:56:11 +0000 (09:56 +0200)]
[clang-format] Fix build on gcc < 7 introduced in rG9363aa9.
This fixes a bogus build error on gcc, e.g. https://lab.llvm.org/buildbot/#/builders/110/builds/2973.
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3097:53: error: binding ‘const clang::SourceRange’ to reference of type ‘clang::SourceRange&’ discards qualifiers
auto HasExistingWhitespace = [&Whitespace = Right.WhitespaceRange]() {
^
Nicolas Vasilache [Wed, 28 Apr 2021 21:52:30 +0000 (21:52 +0000)]
[mlir][Linalg] Generalize linalg vectorization
This revision adds support for vectorizing more general linalg operations with projected permutation maps.
This is achieved by eagerly broadcasting the intermediate vector to the common size
of the iteration domain of the linalg op. This allows a much more natural expression of
generalized vectorization but may introduce additional computations until all the
proper canonicalizations are implemented.
This generalization modifies the vector.transfer_read/write permutation logic and
exposes the fact that the logic employed in vector.contract was too ad-hoc.
As a consequence, changes occur in the permutation / transposition logic for contraction. In turn this prompts supporting more cases in the lowering of contract
to matrix intrinsics, which is required to make the corresponding tests pass.
Differential revision: https://reviews.llvm.org/D101165
Sjoerd Meijer [Thu, 29 Apr 2021 07:29:57 +0000 (08:29 +0100)]
Follow up of rGddb3b26a1269: added 'requires asserts' to test case.
Harald van Dijk [Thu, 29 Apr 2021 07:33:22 +0000 (08:33 +0100)]
[X32][CET] Fix handling of indirect branches
As X32 uses 32-bit pointers without having 32-bit indirect branch
instructions, we need to fix up indirect branches by extending the
branch targets to 64 bits. This was already done for BRIND but not yet
for NT_BRIND. The same logic works for both, so this applies that
existing logic to NT_BRIND as well.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101499
Evgeny Leviant [Thu, 29 Apr 2021 07:29:42 +0000 (10:29 +0300)]
[NewPM] Add an option to dump pass structure
Patch adds -debug-pass-structure option to dump pass structure when
new pass manager is used.
Differential revision: https://reviews.llvm.org/D99599
Tobias Gysi [Thu, 29 Apr 2021 06:45:34 +0000 (06:45 +0000)]
[mlir][Python][Linalg] Adding const, capture, and index support to the OpDSL.
The patch extends the OpDSL with support for:
- Constant values
- Capture scalar parameters
- Access the iteration indices using the index operation
- Provide predefined floating point and integer types.
Up to now the patch only supports emitting the new nodes. The C++/yaml path is not fully implemented. The fill_rng_2d operation defined in emit_structured_generic.py makes use of the new DSL constructs.
Differential Revision: https://reviews.llvm.org/D101364
Marek Kurdej [Thu, 29 Apr 2021 06:57:33 +0000 (08:57 +0200)]
[clang-format] Add `SpacesInAngles: Leave` option to keep spacing inside angle brackets as is.
A need for such an option came up in a few libc++ reviews. That's because libc++ has both code in C++03 and newer standards.
Currently, it uses `Standard: C++03` setting for clang-format, but this breaks e.g. u8"string" literals.
Also, angle brackets are the only place where C++03-specific formatting needs to be applied.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D101344
Amara Emerson [Thu, 29 Apr 2021 06:16:54 +0000 (23:16 -0700)]
[GlobalISel][IRTranslator] Move line zero DebugLoc creation to constant translation. NFC.
This is a compile time optimization. DILocation:get() is expensive to call, and
we were calling it to create a line zero debug loc for *every* instruction we
translated. We only really need to do this just before we build constants in the
entry block, so I moved this code there. This reduces the LLVM -O0 codegen time
of sqlite3 IR by around 0.7% instructions executed and by about ~2% in CPU time.
We can probably do better with a more involved change, since the reason we need
to create one for each new constant is because we're using the debug scope and
inlined-at loc. If we just use a single instruction's scope and drop the
inlined-at, we can just cache these and have them be free.
David Green [Thu, 29 Apr 2021 06:44:04 +0000 (07:44 +0100)]
[ARM] Use just ARM::t2B in ARMBlockPlacementPass
The ARMConstantIsland pass will convert any t2B to tB if they are within
range after it has added or moved any constant pools. They don't need to
be deliberately converted beforehand, and it doesn't deal with needing
to convert tB to t2B very well.
Dmitry Vyukov [Wed, 28 Apr 2021 06:36:03 +0000 (08:36 +0200)]
tsan: fix warnings in tests
Fix format specifier.
Fix warnings about non-standard attribute placement.
Make free_race2.c test a bit more interesting:
test access with/without an offset.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D101424
Reshabh Sharma [Thu, 29 Apr 2021 05:34:23 +0000 (11:04 +0530)]
[ASAN] NFC: Use addrspace cast for pointers in non-zero addrspace
Pointers in non-zero address spaces need to be address space
casted before appending to the used list.
Reviewed by: vitalybuka
Differential Revision: https://reviews.llvm.org/D101363
Dmitry Vyukov [Fri, 23 Apr 2021 13:47:21 +0000 (15:47 +0200)]
tsan: increase dense slab alloc capacity
We've got a user report about heap block allocator overflow.
Bump the L1 capacity of all dense slab allocators to maximum
and be careful to not page the whole L1 array in from .bss.
If OS uses huge pages, this still may cause a limited RSS increase
due to boundary huge pages, but avoiding that looks hard.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D101161
Reshabh Sharma [Thu, 29 Apr 2021 04:49:12 +0000 (10:19 +0530)]
[ASAN] NFC: Copy address space when creating globals with redzones
This patch makes sure that globals in supported address spaces
will be replaced by globals with red zones in the same address
space by copying the address space.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D101362
Dan Liew [Wed, 28 Apr 2021 21:06:28 +0000 (14:06 -0700)]
[NFC] Rename SanitizeAddressDtorKind codegen opt to not have `Kind` suffix.
This is post commit follow up based on discussions in
https://reviews.llvm.org/D101122.
Differential Revision: https://reviews.llvm.org/D101490
(cherry picked from commit
f4c7e82d1b21e637c4e0c53125b126c407d8bdbf)
Mike Urbach [Sat, 24 Apr 2021 02:54:04 +0000 (20:54 -0600)]
[mlir][python] Add `destroy` method to PyOperation.
This adds a method to directly invoke `mlirOperationDestroy` on the
MlirOperation wrapped by a PyOperation.
Reviewed By: stellaraccident, mehdi_amini
Differential Revision: https://reviews.llvm.org/D101422
Roland McGrath [Wed, 28 Apr 2021 23:45:20 +0000 (16:45 -0700)]
[gwp_asan] Use __sanitizer_fast_backtrace on Fuchsia
Reviewed By: phosek, cryptoad, hctim
Differential Revision: https://reviews.llvm.org/D101407
John Demme [Wed, 28 Apr 2021 23:16:45 +0000 (16:16 -0700)]
[mlir] Move PyConcreteType to header. NFC.
This allows out-of-tree users to derive PyConcreteType to bind custom
types.
The Type version of https://reviews.llvm.org/D101063/new/
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D101496
Alexander Shaposhnikov [Wed, 28 Apr 2021 23:27:53 +0000 (16:27 -0700)]
[llvm-objcopy][MachO] Add support for LC_THREAD/LC_UNIXTHREAD
Add support for LC_THREAD/LC_UNIXTHREAD
(these load commands can be copied over without any modifications).
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D101384
Craig Topper [Wed, 28 Apr 2021 22:43:44 +0000 (15:43 -0700)]
[TableGen] Remove predicate filtering from GenerateVariants.
After D100691, predicates should be cheap to compare again so
we don't need to filter anymore.
This is mostly just a revert of several patches going back to 2018.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D100695
Amanieu d'Antras [Mon, 12 Apr 2021 17:05:18 +0000 (18:05 +0100)]
[ConstantMerge] Don't merge thread_local constants with non-thread_local constants
Fixes PR49932
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D100322
Roman Lebedev [Wed, 28 Apr 2021 22:23:44 +0000 (01:23 +0300)]
[SimplifyCFG] Common code sinking: fixup variable name
As noticed in post-commit review.
I've gone through several iterations of that name,
and somehow managed to end up with an incorrect one.
Dávid Bolvanský [Wed, 28 Apr 2021 22:16:57 +0000 (00:16 +0200)]
[BuildLibCalls] Remove inaccessiblememonly inference for calloc
Solves regression mentioned in PR50143.
As noted in D101440, proper modelling for calloc would require new attribute inaccessible_or_returned_memonly.
Denys Petrov [Mon, 26 Apr 2021 16:17:56 +0000 (19:17 +0300)]
[analyzer] Wrong type cast occurs during pointer dereferencing after type punning
Summary: During pointer dereferencing CastRetrievedVal uses wrong type from the Store after type punning. Namely, the pointer casts to another type and then assigns with a value of one more another type. It produces NonLoc value when Loc is expected.
Differential Revision: https://reviews.llvm.org/D89055
Fixes:
https://bugs.llvm.org/show_bug.cgi?id=37503
https://bugs.llvm.org/show_bug.cgi?id=49007
Roman Lebedev [Wed, 28 Apr 2021 19:47:15 +0000 (22:47 +0300)]
[SimplifyCFG] Common code sinking: relax restriction on non-uncond predecessors
While we have a known profitability issue for sinking in presence of
non-unconditional predecessors, there isn't any known issues
for having multiple such non-unconditional predecessors,
so said restriction appears to be artificial. Lift it.
Roman Lebedev [Wed, 28 Apr 2021 19:56:45 +0000 (22:56 +0300)]
[NFC][SimplifyCFG] Add test for sinking common code with multuple cond predecessors
Roman Lebedev [Wed, 28 Apr 2021 21:49:21 +0000 (00:49 +0300)]
[NFC][SimplifyCFG] Add test showing that profitability check for sinking is broken
Essentially, we can't promise that the instruction is sinkable without
introducing PHI's until we know that it is profitable to sink.
Roman Lebedev [Wed, 28 Apr 2021 20:40:58 +0000 (23:40 +0300)]
[NFC][SimplifyCFG] Common code sinking: check profitability once
We can just eagerly pre-check all the instructions that we *could*
sink that we'd actually want to sink them, clamping the number of
instructions that we'll sink to stop just before the first unprofitable one.
Roman Lebedev [Wed, 28 Apr 2021 19:40:07 +0000 (22:40 +0300)]
[NFC][SimplifyCFG] SinkCommonCodeFromPredecessors(): reword comment about PR30244
Vitaly Buka [Wed, 28 Apr 2021 21:56:08 +0000 (14:56 -0700)]
[NFC][scudo] Add reference to a QEMU bug
D101031 added workaround for the bug.
Nathan James [Wed, 28 Apr 2021 21:39:54 +0000 (22:39 +0100)]
[clangd][NFC] Reserve storage when creating semantic token encoding.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D101461
Philip Reames [Wed, 28 Apr 2021 21:36:33 +0000 (14:36 -0700)]
Generalize getInvertibleOperand recurrence handling slightly
Follow up to D99912, specifically the revert, fix, and reapply thereof.
This generalizes the invertible recurrence logic in two ways:
* By allowing mismatching operand numbers of the phi, we can recurse through a pair of phi recurrences whose operand orders have not been canonicalized.
* By allowing recurrences through operand 1, we can invert these odd (but legal) recurrence.
Differential Revision: https://reviews.llvm.org/D100884
Nick Lewycky [Wed, 28 Apr 2021 21:33:00 +0000 (14:33 -0700)]
NFC: Run clang-format over llvm-link.
Bardia Mahjour [Wed, 28 Apr 2021 21:24:26 +0000 (17:24 -0400)]
[LV] Consider Loop Unroll Hints When Making Interleave Decisions
This patch causes the loop vectorizer to not interleave loops that have
nounroll loop hints (llvm.loop.unroll.disable and llvm.loop.unroll_count(1)).
Note that if a particular interleave count is being requested
(through llvm.loop.interleave_count), it will still be honoured, regardless
of the presence of nounroll hints.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D101374
Petr Hosek [Wed, 15 Jul 2020 21:10:56 +0000 (14:10 -0700)]
[libc++] Support per-target __config_site in per-target runtime build
When using the per-target runtime build, it may be desirable to have
different __config_site headers for each target where all targets cannot
share a single configuration.
The layout used for libc++ headers after this change is:
```
include/
c++/
v1/
<libc++ headers except for __config_site>
<target1>/
c++/
v1/
__config_site
<target2>/
c++/
v1/
__config_site
<other targets>
```
This is the most optimal layout since it avoids duplication, the only
headers that's per-target is __config_site, all other headers are
shared across targets. This also means that we no need two
-isystem flags: one for the target-agnostic headers and one for
the target specific headers.
Differential Revision: https://reviews.llvm.org/D89013
Sanjay Patel [Wed, 28 Apr 2021 20:13:32 +0000 (16:13 -0400)]
[InstCombine] relax masking requirement for truncated funnel/rotate match
I was investigating a seemingly unrelated improvement in demanded
bits for shift-left, but that caused regressions on these tests
because we were able to look through/eliminate the mask.
https://alive2.llvm.org/ce/z/Ztdr22
define i8 @src(i32 %x, i32 %y, i32 %shift) {
%and = and i32 %shift, 3
%conv = and i32 %x, 255
%shr = lshr i32 %conv, %and
%sub = sub i32 8, %and
%shl = shl i32 %y, %sub
%or = or i32 %shr, %shl
%conv2 = trunc i32 %or to i8
ret i8 %conv2
}
define i8 @tgt(i32 %x, i32 %y, i32 %shift) {
%x8 = trunc i32 %x to i8
%y8 = trunc i32 %y to i8
%shift8 = trunc i32 %shift to i8
%and = and i8 %shift8, 3
%conv2 = call i8 @llvm.fshr.i8(i8 %y8, i8 %x8, i8 %and)
ret i8 %conv2
}
declare i8 @llvm.fshr.i8(i8,i8,i8)
Sanjay Patel [Wed, 28 Apr 2021 19:49:19 +0000 (15:49 -0400)]
[InstCombine] add tests for rotate/funnel; NFC
Jessica Paquette [Wed, 28 Apr 2021 18:13:19 +0000 (11:13 -0700)]
[AArch64][GlobalISel] Don't match thread-local globals in matchFoldGlobalOffset
SelectionDAG has separate ISD opcodes for regular global values and thread-local
global values, while GlobalISel does not.
This combine was ported from SDAG directly without knowing that. As a result,
it was running on TLS globals.
This makes it so that `matchFoldGlobalOffset` doesn't match on TLS globals, and
adds an assert to `selectTLSGlobalValue` to make sure that TLS globals never
have offsets.
Differential Revision: https://reviews.llvm.org/D101478
Philip Reames [Wed, 28 Apr 2021 20:46:26 +0000 (13:46 -0700)]
[tests] Precommit some extra tests for D100884
Mike Urbach [Sat, 24 Apr 2021 02:32:54 +0000 (20:32 -0600)]
[mlir][python] Update `PyOpResult.owner` to get the parent object.
Previously, this API would return the PyObjectRef, rather than the
underlying PyOperation.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D101416
Duncan P. N. Exon Smith [Wed, 28 Apr 2021 01:02:22 +0000 (18:02 -0700)]
Linker: Avoid scheduling the link of a global value twice due to an alias
3d4f3a0da90bd1a3 (https://reviews.llvm.org/D20586) avoided rescheduling
a global value that was materialized first through a regular value, and
then again through an alias. This commit catches the dual, avoiding
rescheduling when the global value is first materialized through an
alias.
Differential Revision: https://reviews.llvm.org/D101419
Radar-Id: rdar://
75752728
Philip Reames [Wed, 28 Apr 2021 19:47:32 +0000 (12:47 -0700)]
[SCEV] Avoid range intersection idiom in getRangeForUnkownRecurrence [NFC]
Addresses a review comment from D101181
Arthur Eubanks [Wed, 28 Apr 2021 19:42:54 +0000 (12:42 -0700)]
Revert "[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable"
This reverts commit
9b0501abc7b515b740fb5ee929817442dd3029a5.
False positives reported in D100581.
Anirudh Prasad [Wed, 28 Apr 2021 19:42:23 +0000 (15:42 -0400)]
[AsmParser][SystemZ][z/OS] Use updated framework in AsmLexer to accept special tokens as Identifiers
- Previously, https://reviews.llvm.org/D99889 changed the framework in the AsmLexer to treat special tokens, if they occur at the start of the string, as Identifiers.
- These are used by the MASM Parser implementation in LLVM, and we can extend some of the changes made in the previous patch to SystemZ.
- In SystemZ, the special "tokens" referred to here are "_", "$", "@", "#". [_|$|@|#] are already supported as "part" of an Identifier.
- The changes in this patch ensure that these special tokens, when they occur at the start of the Identifier, are treated as Identifiers.
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D100959
Philip Reames [Wed, 28 Apr 2021 19:35:22 +0000 (12:35 -0700)]
[SCEV] Compute ranges for ashr recurrences
Straight forward extension to the recently added infrastructure which was pioneered with shl. This was originally posted as part of D99687, but split off for ease of review.
(I also decided to exclude the unknown start sign case explicitly for simplicity of understanding.)
Differential Revision: https://reviews.llvm.org/D101181
Louis Dionne [Wed, 28 Apr 2021 19:28:37 +0000 (15:28 -0400)]
[libc++][NFC] Remove stray whitespace
This might have helped align static_asserts originally, but it doesn't
anymore since we use LIBCPP_STATIC_ASSERT.
Florian Hahn [Wed, 28 Apr 2021 19:02:47 +0000 (20:02 +0100)]
[LAA] Support pointer phis in loop by analyzing each incoming pointer.
SCEV does not look through non-header PHIs inside the loop. Such phis
can be analyzed by adding separate accesses for each incoming pointer
value.
This results in 2 more loops vectorized in SPEC2000/186.crafty and
avoids regressions when sinking instructions before vectorizing.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D101286
Craig Topper [Wed, 28 Apr 2021 18:13:10 +0000 (11:13 -0700)]
[TableGen] Store predicates in PatternToMatch as ListInit *. Add string for HwModeFeatures
This uses to be how predicates were handled prior to HwMode being
added. When the Predicates were converted to a std::vector it
significantly increased the cost of a compare in GenerateVariants.
Since ListInit's are uniquified by tablegen, we can use a simple
pointer comparison to check for identical lists.
In order to store the HwMode, we now add a separate string to
PatternToMatch. This will be appended separately to the predicate
string in getPredicateCheck. A new getPredicateRecords is added
to allow GlobalISel and getPredicateCheck to both get the sorted
list of Records. GlobalISel was ignoring any HwMode predicates
before and still is.
There is one slight change here, ListInits with different predicate
orders aren't sorted so the filtering in GenerateVariants might
fail to detect two isomorphic patterns with different predicate
orders. This doesn't seem to be happening in tree today.
My hope is this will allow us to remove all the BitVector tracking
in GenerateVariants that was making up for predicates beeing
expensive to compare. There's a decent amount of heap allocations
there on large targets like X86, AMDGPU, and RISCV.
Differential Revision: https://reviews.llvm.org/D100691
Sanjay Patel [Wed, 28 Apr 2021 18:11:46 +0000 (14:11 -0400)]
[InstCombine] add tests for demand of shl op; NFC
Martin Storsjö [Tue, 27 Apr 2021 21:11:46 +0000 (00:11 +0300)]
[libcxx] Stop hardcoding the bash path in the Windows CI
The buildbots now have bash available in the path from the start.
Differential Revision: https://reviews.llvm.org/D101436
Ryan Santhirarajan [Wed, 28 Apr 2021 18:59:40 +0000 (11:59 -0700)]
[ARM] Neon Polynomial vadd Intrinsic fix
The Neon vadd intrinsics were added to the ARMSIMD intrinsic map,
however due to being defined under an AArch64 guard in arm_neon.td,
were not previously useable on ARM. This change rectifies that.
It is important to note that poly128 is not valid on ARM, thus it was
extracted out of the original arm_neon.td definition and separated
for the sake of AArch64.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D100772
MaheshRavishankar [Wed, 28 Apr 2021 18:01:22 +0000 (11:01 -0700)]
[mlir][Linalg] Avoid changing the rank of the result in canonicalizations of subtensor.
Canonicalizations for subtensor operations defaulted to use the
rank-reduced version of the operation, but the cast inserted to get
back the original type would be illegal if the rank was actually
reduced. Instead make the canonicalization not reduce the rank of the
operation.
Differential Revision: https://reviews.llvm.org/D101258
Jonas Devlieghere [Tue, 27 Apr 2021 01:20:49 +0000 (18:20 -0700)]
[dsymutil] Add flag to force a static variable to keep its enclosing function
Add a flag to change dsymutil's behavior and force a static variable to
keep its enclosing function. The test shows a situation where that could
be useful. I'm not convinced this behavior makes sense as a default,
which is why it's behind a flag.
rdar://
74918374
Differential revision: https://reviews.llvm.org/D101337
Sam Clegg [Wed, 28 Apr 2021 17:42:08 +0000 (10:42 -0700)]
Fix typo from https://reviews.llvm.org/D101399
Joe Nash [Mon, 29 Mar 2021 18:58:29 +0000 (14:58 -0400)]
[AMDGPU] Make some VOP3 insts commutable
Note, only src0 and src1 will be commuted if the isCommutable flag
is set. This patch does not change that, it just makes it possible
to commute src0 and src1 of some U/I/B vop3 instructions.
This patch revises
d35d8da7d6ac6c08578ec0569b072292631691e0.
It contains the commute opportunities excluding float insts
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D101474
Change-Id: I62938173d750453839f2457a3851661a29135faf
Alexander Belyaev [Wed, 28 Apr 2021 17:48:27 +0000 (19:48 +0200)]
[mlir] Fix canonicalization of tiled_loop if not all opresults fold.
The current canonicalization did not remap operation results correctly
and attempted to erase tiledLoop, which is incorrect if not all tensor
results are folded.
Sam Clegg [Tue, 27 Apr 2021 20:45:10 +0000 (13:45 -0700)]
[lld][WebAssembly] Allow relocations against non-live global symbols
Just like the in case for function and data symbols this is needed to
support relocations in debug info sections which are allowed contains
relocations against non-live symbols.
The motivating use case is an object file that contains debug info that
references `__stack_pointer` (a local symbol) but does not actually
contain any uses of `__stack_pointer`.
Fixes: https://github.com/emscripten-core/emscripten/issues/14025
Differential Revision: https://reviews.llvm.org/D101399
Mark de Wever [Wed, 28 Apr 2021 17:13:52 +0000 (19:13 +0200)]
[libc++][CI] Fix check-generated-output.
Before the script detected non-ASCII characters but let them pass. This
fixes the issue. I had a way to solve the issue, during review @Quuxplusone
suggested a better alternative. The patch has been changed to use this alternative.
Intended failed builds:
- Not updated generated files https://buildkite.com/llvm-project/libcxx-ci/builds/2822
- Not updated generated files and non-ASCII usage https://buildkite.com/llvm-project/libcxx-ci/builds/2835
- Non-ASCII usage https://buildkite.com/llvm-project/libcxx-ci/builds/2836
Reviewed By: #libc, Quuxplusone, curdeius
Differential Revision: https://reviews.llvm.org/D101303
Craig Topper [Wed, 28 Apr 2021 16:55:36 +0000 (09:55 -0700)]
[RISCV] Add explanatory comment to RISCVOp::OPERAND_AVL.
Nico Weber [Tue, 20 Apr 2021 14:58:19 +0000 (10:58 -0400)]
[clang] Make libBasic not depend on MC
Reduces numbers of files built for clang-format from 575 to 449.
Requires two small changes:
1. Don't use llvm::ExceptionHandling in LangOptions. This isn't
even quite the right type since we don't use all of its values.
Tweaks the changes made in:
- https://reviews.llvm.org/D93215
- https://reviews.llvm.org/D93216
2. Move section name validation code added (long ago) in commit
30ba67439 out
of libBasic into Sema and base the check on the triple. This is a bit less
OOP-y, but completely in line with what we do in many other places in Sema.
No behavior change.
Differential Revision: https://reviews.llvm.org/D101463
Roman Lebedev [Wed, 28 Apr 2021 15:28:39 +0000 (18:28 +0300)]
[SimplifyCFG] Try 2: sink all-indirect indirect calls
Note that we don't want to turn a partially-direct call
into an indirect one, that will break ICP amongst other things.