Sanjay Patel [Fri, 13 May 2022 14:30:58 +0000 (10:30 -0400)]
[SDAG] freeze operand when expanging urem
This is a potential miscompile as discussed in issue #55291.
The related IR transform was patched with:
d428f09b2c9d49f6a32
Sanjay Patel [Fri, 13 May 2022 14:28:22 +0000 (10:28 -0400)]
[x86] add test to show potential miscompile with undef value; NFC
This is based on:
c2a5a87500d92c
Balazs Benics [Fri, 13 May 2022 14:54:13 +0000 (16:54 +0200)]
[clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks
The check should not report includes wrapped by `extern "C" { ... }` blocks,
such as:
```lang=C++
#ifdef __cplusplus
extern "C" {
#endif
#include "assert.h"
#ifdef __cplusplus
}
#endif
```
This pattern comes up sometimes in header files designed to be consumed
by both C and C++ source files.
The check now reports false reports when the header file is consumed by
a C++ translation unit.
In this change, I'm not emitting the reports immediately from the
`PPCallback`, rather aggregating them for further processing.
After all preprocessing is done, the matcher will be called on the
`TranslationUnitDecl`, ensuring that the check callback is called only
once.
Within that callback, I'm recursively visiting each decls, looking for
`LinkageSpecDecls` which represent the `extern "C"` specifier.
After this, I'm dropping all the reports coming from inside of it.
After the visitation is done, I'm emitting the reports I'm left with.
For performance reasons, I'm sorting the `IncludeMarkers` by their
corresponding locations.
This makes the scan `O(log(N)` when looking up the `IncludeMarkers`
affected by the given `extern "C"` block. For this, I'm using
`lower_bound()` and `upper_bound()`.
Reviewed By: whisperity
Differential Revision: https://reviews.llvm.org/D125209
PeixinQiao [Fri, 13 May 2022 14:43:12 +0000 (22:43 +0800)]
[flang] Warn for the limit on name length
As fortran 2018 C601, the maximum length of a name is 63 characters.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D125371
Nikita Popov [Fri, 13 May 2022 14:41:27 +0000 (16:41 +0200)]
[LoopVectorize] Regenerate test checks (NFC)
zhijian [Fri, 13 May 2022 14:40:15 +0000 (10:40 -0400)]
[AIX] support write operation of big archive.
SUMMARY
1. Enable supporting the write operation of big archive.
2. the first commit come from https://reviews.llvm.org/D104367
3. refactor the first commit and implement writing symbol table.
4. fixed the bugs and add more test cases in the second commit.
Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D123949
Simon Pilgrim [Fri, 13 May 2022 14:29:51 +0000 (15:29 +0100)]
[X86] LowerStore - use is64BitVector() wrapper. NFCI.
Kristof Beyls [Fri, 13 May 2022 14:28:06 +0000 (16:28 +0200)]
Update my office hours
Aaron Puchert [Fri, 13 May 2022 14:26:31 +0000 (16:26 +0200)]
Try to disambiguate between overloads on Mac
Presumably Mac has a different understanding of how long `long` is.
Should fix a build error introduced by D125429 that's not visible on
other architectures.
Jay Foad [Fri, 13 May 2022 13:17:23 +0000 (14:17 +0100)]
[APInt] Fix documentation of *OrSelf methods
Document that truncOrSelf, zextOrSelf and sextOrSelf only enforce
an upper or lower bound on the bitwidth of the result.
Aaron Ballman [Fri, 13 May 2022 14:23:23 +0000 (10:23 -0400)]
Remove a stale FIXME comment; NFC
Sanjay Patel [Fri, 13 May 2022 13:15:22 +0000 (09:15 -0400)]
[ValueTracking] recognize sub X, (X % Y) as not overflowing
I fixed some poison-safety violations on related patterns in InstCombine
and noticed that we missed adding nsw/nuw on them, so this adds clauses
to the underlying analysis for that.
We need the undef input restriction to make this safe according to Alive2:
https://alive2.llvm.org/ce/z/48g9K8
Differential Revision: https://reviews.llvm.org/D125500
Sanjay Patel [Thu, 12 May 2022 20:08:51 +0000 (16:08 -0400)]
[InstCombine] add tests for sub with rem operand; NFC
Nico Weber [Fri, 13 May 2022 13:48:01 +0000 (09:48 -0400)]
Revert "In MSVC compatibility mode, friend function declarations behave as function declarations"
This reverts commit
ad47114ad8500c78046161d492ac13a8e3e610eb.
See discussion on https://reviews.llvm.org/D124613.
Stephen Long [Fri, 13 May 2022 13:39:19 +0000 (06:39 -0700)]
[MSVC] Add support for pragma function
MSVC pragma function tells the compiler to generate calls to functions in the pragma function list, instead of using the builtin. Needs https://reviews.llvm.org/D124701
https://docs.microsoft.com/en-us/cpp/preprocessor/function-c-cpp?view=msvc-170
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D124702
Jonas Paulsson [Tue, 8 Mar 2022 20:51:43 +0000 (15:51 -0500)]
[SystemZ] Patchset for expanding memcpy/memset using at most two stores.
* Set MaxStoresPerMemcpy and MaxStoresPerMemset to 2.
* Optimize stores of replicated values in SystemZ::combineSTORE(). This
handles the now expanded memory operations and as well some other
pre-existing cases.
* Reject a big displacement in isLegalAddressingMode() for a vector type.
* Return true from shouldConsiderGEPOffsetSplit().
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D122105
Nikita Popov [Fri, 13 May 2022 13:29:20 +0000 (15:29 +0200)]
[ControlHeightReduction] Simplify addToMergedCondition() (NFC)
Ken Matsui [Fri, 13 May 2022 13:09:32 +0000 (09:09 -0400)]
Suggest typo corrections for preprocessor directives
When a preprocessor directive is unknown outside of a skipped
conditional block, we give an error diagnostic because we don't know
how to proceed with preprocessing. But when the directive is in a
skipped conditional block, we would not diagnose it on the theory that
the directive may be known to an implementation other than Clang.
Now, for unknown directives inside a skipped conditional block, we
diagnose the unknown directive as a warning if it is sufficiently
similar to a directive specific to preprocessor conditional blocks. For
example, we'll warn about `#esle` and suggest `#else` but we won't warn
about `#progma` because it's not a directive specific to preprocessor
conditional blocks.
Fixes #51598
Differential Revision: https://reviews.llvm.org/D124726
David Sherwood [Fri, 6 May 2022 14:14:06 +0000 (15:14 +0100)]
[LoopVectorize] Add overflow checks when tail-folding with scalable vectors
In InnerLoopVectorizer::getOrCreateVectorTripCount there is an
assert that the known minimum value for the VF is a power of 2
when tail-folding is enabled. However, for scalable vectors the
value of vscale may not be a power of 2, which means we have
to worry about the possibility of overflow. I have solved this
problem by adding preheader checks that prevent us from entering
the vector body if the canonical IV would overflow, i.e.
if ((IntMax - TripCount) < (VF * UF)) ... skip vector loop ...
Differential Revision: https://reviews.llvm.org/D125235
Nikita Popov [Fri, 13 May 2022 08:38:33 +0000 (10:38 +0200)]
[InstSimplify] Fold and/or using implied conditions
This adds two conjugated folds:
* A | B -> B if A implies B (https://alive2.llvm.org/ce/z/R6GU4j)
* A & B -> A if A implies B (https://alive2.llvm.org/ce/z/EGMqyy)
If A and B are icmps themselves, we will usually fold this through
other logic already (though the tests show a couple additional cases
we previously missed). However, isImpliedCond() also supports A
being of the form X & Y, which allows us to handle cases like
(X & Y) | B where X implies B. This addresses the regression from
D125398.
Something that notably doesn't work yet is the (X | Y) & B case.
This is due to an asymmetry in the isImpliedCondition()
implementation that will have to be addressed separately.
Differential Revision: https://reviews.llvm.org/D125530
Simon Pilgrim [Fri, 13 May 2022 13:07:27 +0000 (14:07 +0100)]
[SLP][X86] Add common CHECK prefix to sub-128-bit vector tests
Nico Weber [Fri, 13 May 2022 12:56:54 +0000 (08:56 -0400)]
fix typos to cycle bots
Louis Dionne [Tue, 1 Mar 2022 13:42:13 +0000 (08:42 -0500)]
[libc++] Overhaul how we select the ABI library
This patch overhauls how we pick up the ABI library. Instead of setting
ad-hoc flags, it creates interface targets that can be linked against by
the rest of the build, which is easier to follow and extend to support
new ABI libraries.
This is intended to be a NFC change, however there are some additional
simplifications and improvements we can make in the future that would
require a slight behavior change.
Differential Revision: https://reviews.llvm.org/D120727
Aaron Ballman [Fri, 13 May 2022 12:25:40 +0000 (08:25 -0400)]
Silence some false positive -Wstrict-prototype warnings
Before issuing the warning about use of a strict prototype, check if
the declarator is required to have a prototype through some other means
determined at parse time.
This silences false positives in OpenCL code (where the functions are
forced to have a prototype) and block literal expressions.
Nikita Popov [Fri, 13 May 2022 10:48:52 +0000 (12:48 +0200)]
[IRBuilder] Add IsInBounds parameter to CreateGEP()
We commonly want to create either an inbounds or non-inbounds GEP
based on a boolean value, e.g. when preserving inbounds from
existing GEPs. Directly accept such a boolean in the API, rather
than requiring a ternary between CreateGEP and CreateInBoundsGEP.
This change is not entirely NFC, because we now preserve an
inbounds flag in a constant expression edge-case in InstCombine.
Florian Hahn [Fri, 13 May 2022 12:19:41 +0000 (13:19 +0100)]
[ConstraintElimination] Simplify ssub(A,B) if B s>=b && B s>=0.
A first patch to use the reasoning in ConstraintElimination to simplify
sub with overflow to a regular sub, if the operation is guaranteed to
not overflow.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D125264
Aaron Puchert [Fri, 13 May 2022 11:47:22 +0000 (13:47 +0200)]
Comment parsing: Treat properties as zero-argument inline commands
That is more accurate, and using a separate class in TableGen seems
appropriate since these are not parts of the text but properties of the
declaration itself.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125473
Aaron Puchert [Fri, 13 May 2022 11:37:30 +0000 (13:37 +0200)]
Comment parsing: Allow inline commands to have 0 or more than 1 argument
That's required to support `\n`, but can also be used for other commands.
We already had the infrastructure in place to parse a varying number of
arguments, we simply needed to generalize it so that it would work not
only for block commands.
This should fix #55319.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125429
Aaron Puchert [Fri, 13 May 2022 11:36:05 +0000 (13:36 +0200)]
Comment parsing: Specify argument numbers for some block commands
The command traits have a member NumArgs for which all the parsing
infrastructure is in place, but no command was setting it to a value
other than 0. By doing so we get warnings when passing an empty
paragraph to \retval (the first argument is the return value, then comes
the description). We also take \xrefitem along for the ride, although as
the documentation states it's unlikely to be used directly.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125422
Nathan Sidwell [Mon, 28 Mar 2022 19:55:45 +0000 (12:55 -0700)]
[demangler] Avoid special-subst code duplication
We need to expand special substitutions in four different ways. This
refactors to only have one conversion from enum to string, and derive
the other 3 needs off that.
The SpecialSubstitution node is derived from the
ExpandedSpecialSubstitution. While this may seem unintuitive, it
works out quite well, as SpecialSubstitution can then use the former's
getBaseName and remove an unneeded 'basic_' prefix, for those
substitutions that are instantiations (to known typedef). Similarly
all those instantiations use the same set of template arguments (with
'basic_string', getting an additional 'allocator' arg).
Expansion tests were added in D123134, and remain unchanged.
Reviewed By: MaskRay, dblaikie
Differential Revision: https://reviews.llvm.org/D125257
Denys Shabalin [Mon, 9 May 2022 10:46:36 +0000 (12:46 +0200)]
[mlir] Fix declaration of nano time function in benchmark infra
In
d4555698f89af373f43dcb4aa1587231496bcd31, the name of nano precision timer function has changed from `nano_time` to `nanoTime`, but benchmarks were not updated to reflect that. This change addresses the discrepancy.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D125217
Simon Pilgrim [Fri, 13 May 2022 11:08:02 +0000 (12:08 +0100)]
[X86] Add tests for vector widening with freeze(undef)
As noted on D103874, the 'no-op' vector widening intrinsics currently depend on undef shuffle mask indices, moving to poison we need to adjust this to reference a 'undefined' second vector operand, which will be a freeze(undef).
Whisperity [Wed, 11 May 2022 13:33:27 +0000 (15:33 +0200)]
[ASTMatchers][clang-tidy][NFC] Hoist `forEachTemplateArgument` matcher into the core library
Fixes the `FIXME:` related to adding `forEachTemplateArgument` to the
core AST Matchers library.
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D125383
Groverkss [Fri, 13 May 2022 10:44:27 +0000 (16:14 +0530)]
[MLIR] Fix areIdsUnique in AffineStructures
This patch fixes a bug in areIdsUnique where it ignores the [start, end] range.
No test case is added since there are no use cases through IR from where it
can be tested, and it is hard to create a unittest since we do not currently
have Values in unittests.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D124735
Nikita Popov [Fri, 13 May 2022 10:42:53 +0000 (12:42 +0200)]
[InstCombine] Fix unused variable warning (NFC)
Nikita Popov [Fri, 13 May 2022 10:42:03 +0000 (12:42 +0200)]
[IRBuilder] Remove redundant createGEP() overloads (NFC)
ArrayRef<Value *> also accepts a single Value *, there's no need
to create separate overloads for this.
Tres Popp [Fri, 13 May 2022 10:33:06 +0000 (12:33 +0200)]
Add cmake dependency for TensorToLinalg
Pavel Samolysov [Fri, 13 May 2022 09:57:16 +0000 (12:57 +0300)]
[ArgPromotion] Add tests for already seen offsets (NFC)
If a load with the same offset has already been seen but the load had
a lower alignment, the pass has to check whether the pointer is
dereferenceable and is sufficiently aligned (so, the new alignment must
be taken into account).
Tres Popp [Wed, 11 May 2022 12:10:12 +0000 (14:10 +0200)]
[mlir] Add TensorToLinalgPass
This pass is to handle computationally complex operations like
tensor.pad which are not simply lowered to the exact same operation in
the memref dialect.
Differential Revision: https://reviews.llvm.org/D125384
Nikita Popov [Fri, 13 May 2022 10:07:57 +0000 (12:07 +0200)]
[InstSimplify] Add tests for and/or with implied conditions (NFC)
LLVM GN Syncbot [Fri, 13 May 2022 09:48:26 +0000 (09:48 +0000)]
[gn build] Port
3a24df992cf8
Archibald Elliott [Fri, 13 May 2022 09:40:43 +0000 (10:40 +0100)]
[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum
This adds a late Machine Pass to work around a Cortex CPU Erratum
affecting Cortex-A57 and Cortex-A72:
- Cortex-A57 Erratum 1742098
- Cortex-A72 Erratum 1655431
The pass inserts instructions to make the inputs to the fused AES
instruction pairs no longer trigger the erratum. Here the pass errs on
the side of caution, inserting the instructions wherever we cannot prove
that the inputs came from a safe instruction.
The pass is used:
- for Cortex-A57 and Cortex-A72,
- for "generic" cores (which are used when using `-march=`),
- when the user specifies `-mfix-cortex-a57-aes-1742098` or
`mfix-cortex-a72-aes-1655431` in the command-line arguments to clang.
Reviewed By: dmgreen, simon_tatham
Differential Revision: https://reviews.llvm.org/D119720
Alex Zinenko [Fri, 13 May 2022 09:41:23 +0000 (11:41 +0200)]
[mlir] use dynamic sections in MLIR Doxygen
Due to an apparent bug in the Doxygen version <1.8.16 used to generate
documentation for MLIR, parts of the navigation (specifically, the lists
of inherited methods for classes) are unusable due to dynsections.js
missing from the output generated by Doxygen. Setting this flag makes
Doxygen always produce the file.
Archibald Elliott [Fri, 13 May 2022 09:38:19 +0000 (10:38 +0100)]
[NFC][ARM] Tests for Cortex-A57 and Cortex-A72 Fused AES Erratum
These are the tests for the pass added in
https://reviews.llvm.org/D119720
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D122747
Matthias Springer [Fri, 13 May 2022 09:32:14 +0000 (11:32 +0200)]
[mlir][sparse][NFC] Use RewriterBase/OpBuilder when possible
Most functions do not need a PatternRewriter or ConversionPatternRewriter.
Differential Revision: https://reviews.llvm.org/D125466
Matthias Springer [Fri, 13 May 2022 09:26:40 +0000 (11:26 +0200)]
[mlir][bufferize][NFC] Make getContiguousMemRefType a static function
No need to expose this as public API anymore.
Differential Revision: https://reviews.llvm.org/D125361
Zakk Chen [Tue, 10 May 2022 15:36:13 +0000 (08:36 -0700)]
[RISCV] Add the passthru operand for RVV unmasked segment load IR intrinsics.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D125323
Sam Parker [Fri, 13 May 2022 08:42:52 +0000 (09:42 +0100)]
[TypePromotion] Avoid some unnecessary truncs
Recommit.
Check for legal zext 'sinks' before inserting a trunc.
Differential Revision: https://reviews.llvm.org/D115451
Jay Foad [Thu, 20 Jan 2022 09:38:24 +0000 (09:38 +0000)]
[GlobalISel] Change ConstantFoldVectorBinop to return vector of APInt
Previously it built MIR for the results and returned a Register.
This avoids building constants for earlier elements of the vector if
later elements will fail to fold, and allows CSEMIRBuilder::buildInstr
to avoid unconditionally building a copy from the result.
Use a new helper function MachineIRBuilder::buildBuildVectorConstant
to build a G_BUILD_VECTOR of G_CONSTANTs.
Differential Revision: https://reviews.llvm.org/D117758
Sam Parker [Fri, 13 May 2022 08:22:12 +0000 (09:22 +0100)]
[NFC][TypePromotion][AArch64] Tests
Simplify existing test and also add it as a codegen test for aarch64.
Daniel Kiss [Fri, 13 May 2022 07:12:07 +0000 (09:12 +0200)]
[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.
Program may set the RA_SIGN_STATE pseudo register by expressions.
Libunwind expected only the DW_CFA_AARCH64_negate_ra_state could change the value
of the register which leads to runtime errors on PAC enabled systems.
In the recent version of the aadwarf64[1] a limitation is added[2] to forbid the mixing the
DW_CFA_AARCH64_negate_ra_state with other DWARF Register Rule Instructions.
[1] https://github.com/ARM-software/abi-aa/releases/tag/2022Q1
[2] https://github.com/ARM-software/abi-aa/pull/129
Reviewed By: #libunwind, MaskRay
Differential Revision: https://reviews.llvm.org/D123692
Endre Fülöp [Wed, 11 May 2022 08:54:48 +0000 (10:54 +0200)]
[analyzer] Add taint to the BoolAssignmentChecker
BoolAssignment checker is now taint-aware and warns if a tainted value is
assigned.
Original author: steakhal
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D125360
Dmitry Makogon [Thu, 12 May 2022 09:48:12 +0000 (16:48 +0700)]
[RS4GC] Cache BDVs and bases alogn with IsKnownBase flag (NFC)
This refactors RS4GC to cache results returned findBaseDefiningValue
and also gets rid of BaseDefiningValueResult by caching the
IsKnownBase flag for BDVs and bases.
Differential Revision: https://reviews.llvm.org/D125000
Lian Wang [Thu, 12 May 2022 08:28:41 +0000 (08:28 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.setcc
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D125453
Alex Bradbury [Fri, 13 May 2022 05:55:31 +0000 (06:55 +0100)]
[WebAssembly] Implement ref.is_null MC layer support and codegen
Custom type-checking (in WebAssemblyAsmTypeCheck.cpp) is used to
workaround the fact that separate variants of the instruction are
defined for externref and funcref.
Based on an initial patch by Paulo Matos <pmatos@igalia.com>.
Differential Revision: https://reviews.llvm.org/D123484
Timm Bäder [Thu, 12 May 2022 08:49:42 +0000 (10:49 +0200)]
[compiler-rt] Add NO_EXEC_STACK_DIRECTIVE on s390x
Differential Revision: https://reviews.llvm.org/D125454
Timm Bäder [Thu, 5 May 2022 10:09:52 +0000 (12:09 +0200)]
[clang][preprocessor] Fix unsigned-ness of utf8 char literals
UTF8 char literals are always unsigned.
Fixes https://github.com/llvm/llvm-project/issues/54886
Differential Revision: https://reviews.llvm.org/D124996
Zi Xuan Wu (Zeson) [Thu, 12 May 2022 07:27:54 +0000 (15:27 +0800)]
[Object] Support relocation resolver for CSKY
It enables relocation resolver for CSKY to pass some check-all test,
and also add some test about dwarf relocs.
Differential Revision: https://reviews.llvm.org/D125450
Fangrui Song [Fri, 13 May 2022 03:41:22 +0000 (20:41 -0700)]
Revert D125410 "[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size"
This reverts commit
ebdb9d635a077274e38baa8584f5b0e631b4b1d3.
Changing p_memsz is insufficient and may make PT_GNU_RELRO extend beyond the
PT_LOAD.
Lian Wang [Thu, 12 May 2022 07:31:06 +0000 (07:31 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.merge
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D125452
bzcheeseman [Thu, 12 May 2022 17:38:49 +0000 (13:38 -0400)]
[LLVM][Casting.h] Don't create a temporary while casting.
C-style casting can create a temporary when compiled by a C++ compiler, which was emitting a warning casting a reference to another reference. We can't use C++-style casting directly because it doesn't always work with incomplete types. In order to support the current use-cases, for references we switch to pointer space to perform the cast.
Reviewed By: qiongsiwu1
Differential Revision: https://reviews.llvm.org/D125482
Chen Zheng [Fri, 13 May 2022 02:42:12 +0000 (22:42 -0400)]
[NFC] add the missing //@}
address code review comments for D123995
Ping Deng [Fri, 13 May 2022 02:19:41 +0000 (02:19 +0000)]
[RISCV][NFC] Add an RV64 RUN line to rv32zfhmin-invalid.s
Reviewed By: sunshaoce, asb, craig.topper
Differential Revision: https://reviews.llvm.org/D125363
Xiang Li [Thu, 12 May 2022 23:27:00 +0000 (16:27 -0700)]
[DirectX] Fix typo in CMakeLists.txt.
Change Bitwriter to BitWriter.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D125507
Chenbing Zheng [Fri, 13 May 2022 01:54:10 +0000 (09:54 +0800)]
[InstCombine] fix sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))
This patch fix bug left in D124503. We should do
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Z,Y)) instead of
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Y,Z)).
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D125352
Julian Lettner [Fri, 13 May 2022 01:03:05 +0000 (18:03 -0700)]
[TSan] Relax pthread introspection-based test
Thread create/destroy events are not guaranteed to belivered on the
parent thread, e.g., output from a CI job:
```
5: THREAD_CREATE 0x7e8000104000, self: 0x1102ebdc0, name: n/a
6: THREAD_START 0x7e8000104000, self: 0x7e8000104000, name: n/a
7: Hello from pthread
8: THREAD_TERMINATE 0x7e8000104000, self: 0x7e8000104000, name: child thread
9: THREAD_DESTROY 0x7e8000104000, self: 0x7e8000104000, name: child thread
```
Here, THREAD_DESTROY is delivered on the thread being destroyed.
rdar://
92679941
Joseph Huber [Thu, 12 May 2022 17:22:08 +0000 (13:22 -0400)]
[LinkerWrapper] Group static libraries in their own buffer
Summary:
Static libraries need to be handled differently from regular inpout
files, namely they are loaded lazily. Previously we used a flag to
indicate a file camm from a static library. This patch simplifies this
by simply keeping a different array that contains the static libraries
so we don't need to parse them out again.
Joseph Huber [Thu, 12 May 2022 16:39:15 +0000 (12:39 -0400)]
[LinkerWrapper] Remove stripping features from the linker wrapper
Summary:
The linker wrapper previously had functionality to strip the sections
manually. We don't use this at all because this is much better done by
the linker via the `SHF_EXCLUDE` flag. This patch simply removes the
support for thi sfeature to simplify the code.
Med Ismail Bennani [Fri, 13 May 2022 00:09:43 +0000 (17:09 -0700)]
[lldb/test] Skip TestCppIncompleteTypeMembers.py for -gmodules on macOS
Following
8b9caad8eb449c1dc4df13e566a5f6c59de9be7c, this only skips
TestCppIncompleteTypeMembers.py on macOS if we test with `-gmodules` enabled.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Jim Ingham [Thu, 12 May 2022 20:27:22 +0000 (13:27 -0700)]
In
92eaad2dd7adb5ee92f397cef85ab11f2612294e I made it possible to run
a debug session with only a remote path to the file you are debugging
using the SB API's. This patch makes it possible to do this using
target create --remote-file <some_path> without supplying a local file
as well.
Prior to this change we errored out saying that we haven't implemented
copying the binary back from the remote. I didn't implement the copy
back (in the case I'm interested in - iOS debugging - we don't
actually have a way for lldb to do that). This patch doesn't impede
doing that, I just didn't need it. I think for some object file
formats debugging w/o the binary file is hard because of what doesn't
get mapped in. I didn't try to arbitrate that, I'm assuming anybody
who has to do this knows what they are going to get.
If there's a connected platform that can check that the remote file
exists, it will do so, otherwise we trust the user's input - if it
isn't there the process launch is going to fail with no-such-file so
it will be pretty clear what went wrong.
Differential Revision: https://reviews.llvm.org/D124947
wren romano [Wed, 11 May 2022 22:58:42 +0000 (15:58 -0700)]
[mlir][sparse] Factoring out an enumerator over elements of SparseTensorStorage
Work towards fixing: https://github.com/llvm/llvm-project/issues/51652
Depends On D122928
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122060
Med Ismail Bennani [Thu, 12 May 2022 23:53:20 +0000 (16:53 -0700)]
[lldb/test] Skip TestCppIncompleteTypeMembers.py on Darwin (NFC)
This skips `TestCppIncompleteTypeMembers.py` on Darwin platforms since
it requires `-flimit-debug-info` which is not supported.
This should fix the Green Dragon bot test run:
https://green.lab.llvm.org/green/job/lldb-cmake/43678
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 May 2022 02:33:37 +0000 (19:33 -0700)]
[lldb/API] Add SBCompileUnit::GetIndexForLineEntry method to SB API
This patch adds a new `GetIndexForLineEntry` method to the `SBCompileUnit`
class. As the name suggests, given an `SBLineEntry` object, this will
return the line entry index within a specific compile unit.
This method can take a `exact` boolean that will make sure that the
provided line entry matches perfectly another line entry in the compile unit.
rdar://
47450887
Differention Revision: https://reviews.llvm.org/D125437
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
owenca [Thu, 12 May 2022 07:40:37 +0000 (00:40 -0700)]
[clang-format] Handle comments below r_brace in RemoveBracesLLVM
If a closing brace is followed by a non-trailing comment, the
newline before the closing brace must also be removed.
Differential Revision: https://reviews.llvm.org/D125451
David Goldman [Thu, 12 May 2022 20:32:29 +0000 (16:32 -0400)]
[Lit] Add pushd and popd builtins
This behaves just like the sh/cmd.exe equivalents.
pushd/popd are useful to verify path handling of the driver,
typically testing prefix maps or relative path handling.
Differential Revision: https://reviews.llvm.org/D125502
Tobias Ribizel [Thu, 12 May 2022 22:59:41 +0000 (15:59 -0700)]
[llvm][lldb] use FindLibEdit.cmake everywhere
Currently, LLVM's LineEditor and LLDB both use libedit, but find them in different (inconsistent) ways.
This causes issues e.g. when you are using a locally installed version of libedit, which will not be used
by clang-query, but by lldb if picked up by FindLibEdit.cmake
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D124673
Aart Bik [Thu, 12 May 2022 18:39:20 +0000 (11:39 -0700)]
[mlir][sparse] add sparse sign integration test
Implements a floating-point sign operator (using the new semi-ring ops)
that accomodates +/-Inf and +/-NaN in consistent way.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D125494
River Riddle [Thu, 12 May 2022 22:52:46 +0000 (15:52 -0700)]
[mlir] Bump mlir-vscode to 0.0.7
The syntax highlighting for mlir has gotten a significant facelift,
we also have some recent bug fixes for server launches.
River Riddle [Thu, 12 May 2022 10:02:51 +0000 (03:02 -0700)]
[mlir] Significantly overhaul the textmate grammar
The current grammar is really crusty, only supports a handful of
cases, and is also out-of-date after various refactorings. This commit
refactors the textmate grammar to handle significantly more cases,
and now provides proper coloring for a majority of cases (including
dialect attributes, operations, types, etc.)
Differential Revision: https://reviews.llvm.org/D125458
Simon Dardis [Sun, 1 May 2022 00:06:41 +0000 (01:06 +0100)]
[MIPS} Address ISel failures for 64 bit fpus in microMIPS
Add the instructions and patterns for loads and stores in microMIPSr3
when a 64 bit FPU is present. Previously, this would lead to an
instruction selection failure.
This resolves PR/49200.
Thanks to jdeguire for reporting the issue!
Differential Revision: https://reviews.llvm.org/D124723
Florian Hahn [Thu, 12 May 2022 21:40:27 +0000 (22:40 +0100)]
[LV] Add crashing test from #55096.
Simon Dardis [Sun, 1 May 2022 18:25:03 +0000 (19:25 +0100)]
[MIPS] Correct the implementation of the msub optimization
The MIPS backend attempts to combine integer multiply and addition or
subtraction into a madd or msub operation. This optimization is
heavily restricted due to its utility in many cases.
PR/51114 highlighted that the optimization was performed on an
associative basis which is correct in the `add` case but not in
the `sub` case.
Resolve this bug by performing an early exit in the case where the
multiply is the LHS operand of the subtraction.
This resolves PR/51114.
Thanks to digitalseraphim for reporting the issue!
Differential Revision: https://reviews.llvm.org/D124742
Jim Ingham [Thu, 12 May 2022 21:30:09 +0000 (14:30 -0700)]
Revision
3339000e0bda696c2e29173d15958c0a4978a143 caused the Language
plugin to get queried earlier on in the startup, so that for .s files
we call the language "unknown" not "not-loaded". This test was checking
against that string, so I fixed it for the change.
Martin Storsjö [Mon, 25 Apr 2022 06:24:00 +0000 (09:24 +0300)]
[runtimes] [CMake] Fix checks for -Werror when building with incomplete toolchains
When we add `--unwindlib=none` during the CMake configure phase (to
make CMake linking tests succeed before the unwind library has been
built for the first time - when bootstrapping a cross toolchain from
scratch), we add it to `CMAKE_REQUIRED_FLAGS` to make later CMake tests
pass.
When the option is added to `CMAKE_REQUIRED_FLAGS`, it gets added to
both compilation and linking commands. When --unwindlib=none is added
to the compilation command, it causes warnings (about being unused
during compilation, as it only affects linking).
When all CMake test compilations produce warnings, later CMake tests
for `-Werror` fail.
Add `--{start,end}-no-unused-arguments` around `--unwindlib=none`, if
supported, to avoid unnecessary warnings due to this option.
If the CMake requirement is bumped to 3.14, we could use
`CMAKE_REQUIRED_LINK_OPTIONS` instead, removing the need for the
`--{start,end}-no-unused-arguments` options. (However, do note that
`CMAKE_REQUIRED_LINK_OPTIONS` is problematic in combination with
`CMAKE_TRY_COMPILE_TARGET_TYPE` set to `STATIC_LIBRARY`; see
https://gitlab.kitware.com/cmake/cmake/-/issues/23454.)
Differential Revision: https://reviews.llvm.org/D124377
Karl Meakin [Thu, 12 May 2022 21:21:20 +0000 (22:21 +0100)]
[AArch64] Add `foldADCToCINC` DAG combine.
Differential revision: https://reviews.llvm.org/D123781
Karl Meakin [Thu, 12 May 2022 21:16:21 +0000 (22:16 +0100)]
[AArch64] Replace `performANDSCombine` with `performFlagSettingCombine`.
`performFlagSettingCombine` is a generalised version of `performANDSCombine` which also works on `ADCS` and `SBCS`.
Differential revision: https://reviews.llvm.org/D124464
Eli Friedman [Thu, 12 May 2022 20:57:19 +0000 (13:57 -0700)]
[yaml2obj][COFF] Add missing RISCV constants
River Riddle [Thu, 12 May 2022 20:40:16 +0000 (13:40 -0700)]
[mlir] Fix pipeline-parsing.mlir on windows
We shouldn't be making assumptions about the result of llvm::getTypeName,
which may have different results for anonymous namespaces depending
on the platform.
River Riddle [Mon, 11 Apr 2022 09:36:10 +0000 (02:36 -0700)]
[mlir:Pass] Add support for op-agnostic pass managers
This commit refactors the current pass manager support to allow for
operation agnostic pass managers. This allows for a series of passes
to be executed on any viable pass manager root operation, instead
of one specific operation type. Op-agnostic/generic pass managers
only allow for adding op-agnostic passes.
These types of pass managers are extremely useful when constructing
pass pipelines that can apply to many different types of operations,
e.g., the default inliner simplification pipeline. With the advent of
interface/trait passes, this support can be used to define FunctionOpInterface
pass managers, or other pass managers that effectively operate on
specific interfaces/traits/etc (see #52916 for an example).
Differential Revision: https://reviews.llvm.org/D123536
Michael Jones [Tue, 10 May 2022 17:15:18 +0000 (10:15 -0700)]
[libc] add printf converter
This adds the main pieces of the last piece of printf, the converter.
This takes the completed format section from the parser and then
converts it to a string for the writer, which is why it was the last
piece to be written. So far it supports chars and strings, but more
pieces are coming. Additionally, it supports replacing all of the
conversion functions with user supplied versions at compile time to
allow for additional functionality.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D125327
Michael Jones [Thu, 14 Apr 2022 21:32:16 +0000 (14:32 -0700)]
[libc][docs] Add doc for libc stdio functions
This patch adds a document describing the status of the string functions
in LLVM-libc.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D123823
Craig Topper [Thu, 12 May 2022 19:09:11 +0000 (12:09 -0700)]
[RISCV] Add extra space into error message about unsupported extension version.
Differential Revision: https://reviews.llvm.org/D125491
Martin Storsjö [Thu, 12 May 2022 11:33:49 +0000 (14:33 +0300)]
[llvm-readobj] [COFF] Fix the printout for ARM64 packed homed parameters
If the function has homed parameters but the number of saved registers
is odd, the homed parameters are aligned at the top of the stack (so
they line up with later varargs on the stack), not tightly after the
other saved registers.
Differential Revision: https://reviews.llvm.org/D125462
Jim Ingham [Thu, 12 May 2022 18:00:18 +0000 (11:00 -0700)]
We don't require users to type out the full context of a function, for
symbol name matches. Instead, we extract the incoming path's base
name, look up all the symbols with that base name, and then compare
the rest of the context that the user provided to make sure it
matches. However, we do this comparison using just a strstr. So for
instance:
break set -n foo::bar
will match not only "a::foo::bar" but "notherfoo::bar". The former is
pretty clearly the user's intent, but I don't think the latter is, and
results in breakpoints picking up too many matches.
This change adds a Language::DemangledNameContainsPath API which can
do a language aware match against the path provided. If the language
doesn't provide this we fall back to the strstr (though that's changed
to StringRef::contains in the patch).
Differential Revision: https://reviews.llvm.org/D124579
Martin Storsjö [Mon, 25 Apr 2022 07:54:04 +0000 (10:54 +0300)]
[runtimes] [cmake] Fix -Werror detection in common build configs
We add `--unwindlib=none` to `CMAKE_REQUIRED_FLAGS`
to make sure that builds with a yet-incomplete toolchain succeed,
to avoid linker failures about missing unwindlib.
When this option is added to `CMAKE_REQUIRED_FLAGS`, it gets added to
both compile and link commands in CMake compile tests. If
`--unwindlib=none` is included in compilation commands, it causes
warnings about unused arguments, as the flag only is relevant for
linking.
Due to the warnings in CMake tests, the later CMake test for the
`-Werror` option failed (as the tested `-Werror` option caused the
preexisting warning due to unused `--unwindlib=none` to become a
hard error). Therefore, most CI configurations that build with
`LIBCXX_ENABLE_WERROR` didn't actually end up enabling `-Werror`
after all.
When looking at the CI build log of recent CI builds, they do
end up printing:
-- Performing Test LIBCXX_SUPPORTS_WERROR_FLAG
-- Performing Test LIBCXX_SUPPORTS_WERROR_FLAG - Failed
-- Performing Test LIBCXX_SUPPORTS_WX_FLAG
-- Performing Test LIBCXX_SUPPORTS_WX_FLAG - Failed
Thus while the configurations are meant to error out on warnings,
they actually haven't done that, due to the interaction of these
options.
To fix this, remove the individual cases of adding `--unwindlib=none`
into `CMAKE_REQUIRED_FLAGS` in libcxx and libunwind.
`runtimes/CMakeLists.txt` still adds `--unwindlib=none` if needed, but
not otherwise. (The same issue with enabling `-Werror` does remain
if `--unwindlib=none` strictly is needed though - that can be fixed
separately afterwards.)
These individual cases in libunwind and libcxx were added while
standalone builds of the runtimes still were supported - but no longer
are necessary now.
Differential Revision: https://reviews.llvm.org/D124375
Ashay Rane [Thu, 5 May 2022 20:18:28 +0000 (13:18 -0700)]
[mlir] translate memref.reshape ops that have static shapes
This patch references code for translating memref.reinterpret_cast ops
to add translation rules for memref.reshape ops that have a static shape
argument. Since reshape ops don't have offsets, sizes, or strides, this
patch simply sets the allocated and aligned pointers of the MemRef
descriptor.
Reviewed By: ftynse, cathyzhyi
Differential Revision: https://reviews.llvm.org/D125039
Louis Dionne [Thu, 12 May 2022 18:43:20 +0000 (14:43 -0400)]
[libc++] Mark <stdatomic.h> as requiring C++23
Otherwise, we might get errors with modules in pre-C++23 when mixing
<atomic> and <stdatomic.h>. This should fix breakage on Green Dragon.
Michael Jones [Thu, 12 May 2022 18:38:31 +0000 (11:38 -0700)]
[libc] fix uint includes and libc bazel
This patch fixes the includes for the new UInt class so that the api
test now passes, additionally it fixes the bazel files to account for
the new dependencies.
Differential Revision: https://reviews.llvm.org/D125490
Florian Hahn [Thu, 12 May 2022 18:33:48 +0000 (19:33 +0100)]
[LAA] Initial support for runtime checks with pointer selects.
Scaffolding support for generating runtime checks for multiple SCEV expressions
per pointer. The initial version just adds support for looking through
a single pointer select.
The more sophisticated logic for analyzing forks is in D108699
Reviewed By: huntergr
Differential Revision: https://reviews.llvm.org/D114487
Vasileios Porpodas [Thu, 12 May 2022 02:09:38 +0000 (19:09 -0700)]
[SLP][NFC] Added test to exercise the cause of a crash caused by reordering.
This is to support
0950d4060cd916a1d08da657db2513d2ce3e38fa.
External users that can affect reordering, with range == VL.size() but
non consecutive (like stores to A[0],A[0],A[3],A[3]) would escape the check
for consecutive accesses and would cause a crash.