Craig Topper [Thu, 26 May 2022 19:13:37 +0000 (12:13 -0700)]
[RISCV] Simplfy creation of IndexVT in lowerMaskedGather/lowerMaskedScatter. NFC
The scalar element width is not a factor in how ContainerVT is
determined. We don't need to check the relative size of VT and
IndexVT.
LLVM GN Syncbot [Thu, 26 May 2022 20:01:22 +0000 (20:01 +0000)]
[gn build] Port
b58a420ff4f9
Argyrios Kyrtzidis [Thu, 12 May 2022 04:56:29 +0000 (21:56 -0700)]
[Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources
This is a commit with the following changes:
* Remove `ExcludedPreprocessorDirectiveSkipMapping` and related functionality
Removes `ExcludedPreprocessorDirectiveSkipMapping`; its intended benefit for fast skipping of excluded directived blocks
will be superseded by a follow-up patch in the series that will use dependency scanning lexing for the same purpose.
* Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources
Replaces the "source minimization" mechanism with a mechanism that produces lexed dependency directives tokens.
* Make the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`
This is bringing the following benefits:
* Full access to the preprocessor state during dependency scanning. E.g. a component can see what includes were taken and where they were located in the actual sources.
* Improved performance for dependency scanning. Measurements with a release+thin-LTO build shows ~ -11% reduction in wall time.
* Opportunity to use dependency scanning lexing to speed-up skipping of excluded conditional blocks during normal preprocessing (as follow-up, not part of this patch).
For normal preprocessing measurements show differences are below the noise level.
Since, after this change, we don't minimize sources and pass them in place of the real sources, `DependencyScanningFilesystem` is not technically necessary, but it has valuable performance benefits for caching file `stat`s along with the results of scanning the sources. So the setup of using the `DependencyScanningFilesystem` during a dependency scan remains.
Differential Revision: https://reviews.llvm.org/D125486
Differential Revision: https://reviews.llvm.org/D125487
Differential Revision: https://reviews.llvm.org/D125488
Argyrios Kyrtzidis [Thu, 12 May 2022 04:21:17 +0000 (21:21 -0700)]
[Tooling/DependencyScanning] Rename refactorings towards transitioning dependency scanning to use pre-lexed preprocessor directive tokens
This is first of a series of patches for making the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`.
This patch only includes NFC renaming changes to make reviewing of the functionality changing parts easier.
Differential Revision: https://reviews.llvm.org/D125484
python3kgae [Tue, 24 May 2022 18:04:51 +0000 (11:04 -0700)]
[DirectX] Update test for dxil-dis.
Update metadata index which changed for dx.valver.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D126311
Louis Dionne [Thu, 26 May 2022 14:19:25 +0000 (10:19 -0400)]
[libunwind] Tidy-up the testing configuration for libunwind
Start testing Apple backdeployment with older libunwinds, and stop
explicitly specifying the libunwind testing config, since it is
already selected correctly by default.
Differential Revision: https://reviews.llvm.org/D126470
Stella Stamenova [Thu, 26 May 2022 19:16:24 +0000 (12:16 -0700)]
[lldb] Fix enums-layout test on Windows
The test was broken by: https://reviews.llvm.org/D125604
Will Hawkins [Thu, 26 May 2022 19:14:22 +0000 (12:14 -0700)]
[lldb] Fix broken bad-address-breakpoint test
After changing the "fallback" behavior when a user sets a breakpoint
without specifying a module the bad-address-breakpoint test case failed
incorrectly. This patch updates that test case in order to more
thoroughly discover an illegal address and use that as the means for
testing whether a breakpoint set at an illegal address fails to resolve.
Differential revision: https://reviews.llvm.org/D126109
Joel E. Denny [Thu, 26 May 2022 18:59:16 +0000 (14:59 -0400)]
[OpenMP] Extend omp teams to permit nested omp atomic
OpenMP 5.2, sec. 10.2 "teams Construct", p. 232, L9-12 restricts what
regions can be strictly nested within a `teams` construct. This patch
relaxes Clang's enforcement of this restriction in the case of nested
`atomic` constructs unless `-fno-openmp-extensions` is specified.
Cases like the following then seem to work fine with no additional
implementation changes:
```
#pragma omp target teams map(tofrom:x)
#pragma omp atomic update
x++;
```
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D126323
Louis Dionne [Thu, 26 May 2022 18:58:24 +0000 (14:58 -0400)]
[libc++] Time tests during CI
Mircea Trofin [Thu, 26 May 2022 18:48:29 +0000 (11:48 -0700)]
Fix break introduced by D124306
argparse.BooleanOptionalAction is not supported until python 3.9.
Aaron Ballman [Thu, 26 May 2022 18:43:28 +0000 (14:43 -0400)]
Roll back use of #warning for header deprecations
e5ccd668019888de2704ae670da88a7be8cf7e0f and
5029dce492b3cf3ac191eda0b5bf268c3acac2e0 added deprecation warnings to
the <stdbool.h> and <stdnoreturn.h> headers, respectively, because the
headers are deprecated in C2x.
However, there are system headers that include these headers
unconditionally, and #warning diagnostics within system headers are
shown to users instead of suppressed, which means these deprecation
warnings are being triggered in circumstances that users have no
control over except to disable all the warnings through the
_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro or other means.
This removes the problematic #warning uses until we find a more
palatable solution.
Adrian Tong [Wed, 4 May 2022 23:00:42 +0000 (23:00 +0000)]
Give option to use isCopyInstr to determine which MI is
treated as Copy instruction in MCP.
This is then used in AArch64 to remove copy instructions after taildup
ran in machine block placement
Differential Revision: https://reviews.llvm.org/D125335
Jason Molenda [Thu, 26 May 2022 18:24:13 +0000 (11:24 -0700)]
One further tweak for realpathing filepath to match dyld
I missed one place I need to realpath the build artifact path,
to make it match the path we get back from dyld.
Zongwei Lan [Thu, 26 May 2022 18:22:41 +0000 (11:22 -0700)]
[Target] use getSubtarget<> instead of static_cast<>(getSubtarget())
Differential Revision: https://reviews.llvm.org/D125391
Jason Molenda [Thu, 26 May 2022 18:11:43 +0000 (11:11 -0700)]
Check that a FileSpec has a Directory component before using
A follow on to my patch for https://reviews.llvm.org/D126435
hit by an x86_64 linux bot; I assumed that a FileSpec had a
directory component and checked if the first character was a
'~'. This was not a valid assumption.
Jason Molenda [Thu, 26 May 2022 07:30:12 +0000 (00:30 -0700)]
Defer source path remap tilde expansion until source file use
When reading source path remappings out of a dSYM, lldb currently
does tilde expansion -- expanding the tilde-username and checking
that the destination pathname exists, for each dSYM with the path
remappings. This cost happens during lldb's initial process launch
/ load, an especially perf-sensitive time. Inside Apple, we have
dSYMs with source path remappings pointing to NFS directories where
these extra stats for every dSYM can be very expensive if the network
is slow.
This patch instead keeps the source path mapping in the original
tilde-username terms and does the tilde expansion when we need
to read a specific source file from one of the modules. We'll
be stat'ing all of those inodes to load the source file anyway,
so the fact that we do the tilde expansion on every source file
we load, it doesn't cost us significantly.
Differential Revision: https://reviews.llvm.org/D126435
rdar://
77091379
(cherry picked from commit
c274b6e5830ea88d3f55d6dc1d2b99e38cf6595e)
Bruno Cardoso Lopes [Tue, 24 May 2022 23:56:22 +0000 (16:56 -0700)]
[Clang][CoverageMapping] Fix switch counter codegen compile time explosion
C++ generated code with huge amount of switch cases chokes badly while emitting
coverage mapping, in our specific testcase (~72k cases), it won't stop after hours.
After this change, the frontend job now finishes in 4.5s and shrinks down `@__covrec_`
by 288k when compared to disabling simplification altogether.
There's probably no good way to create a testcase for this, but it's easy to
reproduce, just add thousands of cases in the below switch, and build with
`-fprofile-instr-generate -fcoverage-mapping`.
```
enum type : int {
FEATURE_INVALID = 0,
FEATURE_A = 1,
...
};
const char *to_string(type e) {
switch (e) {
case type::FEATURE_INVALID: return "FEATURE_INVALID";
case type::FEATURE_A: return "FEATURE_A";}
...
}
```
Differential Revision: https://reviews.llvm.org/D126345
Mircea Trofin [Fri, 22 Apr 2022 19:49:15 +0000 (12:49 -0700)]
[UpdateTestChecks] Auto-generate stub bodies for unused prefixes
This is scoped to autogenerated tests.
The goal is to support having each RUN line specify a list of
check-prefixes where one can specify potentially redundant prefixes. For example,
for X86, if one specified prefixes for both AVX1 and AVX2, and the codegen happened to
match today, one of the prefixes would be used and the onther one not.
If the unused prefix were dropped, and later, codegen differences were
introduced, one would have to go figure out where to add what prefix
(paraphrasing
https://lists.llvm.org/pipermail/llvm-dev/2021-February/148326.html)
To avoid getting errors due to unused prefixes, whole directories can be
opted out (as discussed on that thread), but that means that tests that
aren't autogenerated in such directories could have undetected unused
prefix bugs.
This patch proposes an alternative that both avoids the above, dir-level
optout, and supports the main autogen scenario discussed first. The autogen
tool appends at the end of the test file the list of unused prefixes,
together with a note explaining that is the case. Each prefix is set up
to always pass.
This way, unexpected unused prefixes are easily discoverable, and
expected cases "just work".
Differential Revision: https://reviews.llvm.org/D124306
Florian Hahn [Thu, 26 May 2022 17:16:37 +0000 (18:16 +0100)]
[SCEV] Collect conditions from assumes same way as for branches.
Also collect conditions from assume up-front in applyLoopGuards.
This allows re-using the logic to handle logical ANDs as assume
conditions.
It should should pave the road for a fix for #55645.
David Penry [Mon, 28 Mar 2022 19:18:37 +0000 (12:18 -0700)]
[ARM] Recognize t2LoopEnd for software pipelining
- Add t2LoopEnd to TargetInstrInfo::analyzeBranch and
related functions. As there are many side effects of
analyzing a branch, only do so if software pipelining
is enabled to maintain previous behavior when pipelining
is not desired.
- Make sure that t2LoopEndDec is immediately followed by
a t2B when it is synthesized from a t2LoopEnd. This is
done because the t2LoopEnd might have acquired a
fall-through path, but IfConversion assumes that
fall-through are only possible on analyzable branches.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D126322
Mike Rice [Wed, 25 May 2022 22:02:26 +0000 (15:02 -0700)]
[OpenMP] Use the align clause value from 'omp allocate' for globals
Refactor the code that handles the align clause of 'omp allocate' so
it can be used with globals as well as local variables.
Differential Revision: https://reviews.llvm.org/D126426
Owen Anderson [Thu, 26 May 2022 16:50:36 +0000 (09:50 -0700)]
Revert "Replace the custom linked list in LeaderTableEntry with TinyPtrVector."
This reverts commit
1e9114984490b83d4665f12a11f84c83f50ca8f0.
Pending further discussion.
Philip Reames [Thu, 26 May 2022 15:55:47 +0000 (08:55 -0700)]
[RISCV] reorganize getFrameIndexReference to reduce code duplication [nfc]
This change reorganizes the majority of frame index resolution into a two strep process.
Step 1 - Select which base register we're going to use.
Step 2 - Compute the offset from that base register.
The key point is that this allows us to share the step 2 logic for the SP case. This reduces the code duplication, and (I think) makes the code much easier to follow.
I also went ahead and added assertions into phase 2 to catch errors where we select an illegal base pointer. In general, we can't index from a base register to a stack location if that requires crossing a variable and unknown region. In practice, we have two such cases: dynamic stack realign and var sized objects. Note that crossing the scalable region is fine since while variable, it's a known variability which can be expressed in the offset.
Differential Revision: https://reviews.llvm.org/D126403
Shoaib Meenai [Thu, 26 May 2022 16:34:18 +0000 (09:34 -0700)]
Revert "[runtimes] Detect changes to Tests.cmake"
This reverts commit
ec10ac750a8ad96983d85263323635f3dabe92fd.
See https://discourse.llvm.org/t/cmake-regeneration-is-broken/62788.
This change caused Ninja's CMake regeneration to depend on the build,
which prevented CMake regeneration from functioning properly and caused
spurious build failures on incremental builds when a CMake change
occurred.
Shoaib Meenai [Thu, 26 May 2022 04:39:12 +0000 (21:39 -0700)]
[libunwind] Use process_vm_readv to avoid potential segfaults
We've observed segfaults in libunwind when attempting to check for the
Linux aarch64 sigreturn frame, presumably because of bad unwind info
leading to an incorrect PC that we attempt to read from. Use
process_vm_readv to read the memory safely instead.
The s390x code path should likely follow suit, but I don't have the
hardware to be able to test that, so I didn't modify it here either.
Reviewed By: MaskRay, rprichard, #libunwind
Differential Revision: https://reviews.llvm.org/D126343
Shoaib Meenai [Tue, 24 May 2022 05:11:34 +0000 (22:11 -0700)]
[libunwind] Factor out sigreturn check condition. NFC
Create a macro for this instead of duplicating the architecture checks
everywhere. (It's a little redundant to use it when we're checking for a
specific architecture, but I'm also applying it there for consistency.)
Reviewed By: rprichard, MaskRay, #libunwind
Differential Revision: https://reviews.llvm.org/D126342
Nikita Popov [Thu, 26 May 2022 15:59:27 +0000 (17:59 +0200)]
[ControlHeightReduction] Use logical and
Use logical instead of bitwise and to combine conditions, to avoid
propagating poison from a later condition if an earlier one is
already false. This avoids introducing branch on poison.
Differential Revision: https://reviews.llvm.org/D125898
Philip Reames [Thu, 26 May 2022 14:56:38 +0000 (07:56 -0700)]
[RISCV] Allow compatible VTYPE in AVL Reg Forward cases
During insertion of VSETVLI, we have two related bits of code which decide whether we can reuse a previous vsetvli result. As was pointed out in the original review, these cases can allow any prior state for which we know that VL is the same for any value of AVL.
This was originally separated out of a desire for separate tests and review. As it turns out, finding a test case for this has been quite challenging. Most of the cases I tried, we manage to already get through other chains of logic. We do have one correct test change, but that only exercises one of the two changes.
Differential Revision: https://reviews.llvm.org/D126400
Alexey Bataev [Wed, 25 May 2022 13:27:30 +0000 (06:27 -0700)]
[SLP]Improve compile time, NFC.
Patch improves compile time. For function calls, which cannot be
vectorized, create a unique group for each such a call instead of
subgroup. It prevents them from being grouped by a subgroups and
attempts for their vectorization.
Also, looks through casts operand to try to check their
groups/subgroups.
Reduces number of vectorization attempts. No changes in the statistics
for SPEC2017/2006/llvm-test-suite.
Differential Revision: https://reviews.llvm.org/D126476
Alexey Bataev [Tue, 24 May 2022 13:53:19 +0000 (06:53 -0700)]
[SLP]Fix PR55653: emit undefs where required, not poison.
Need to handle a corner case correctly, if all elements are Undefs/Poisons,
need to emit actual values, not just poisons.
Differential Revision: https://reviews.llvm.org/D126298
Alex Zhikhartsev [Wed, 25 May 2022 23:10:57 +0000 (19:10 -0400)]
[DFAJumpThreading] Relax analysis to handle unpredictable initial values
Responding to a feature request from the Rust community:
https://github.com/rust-lang/rust/issues/80630
void foo(X) {
for (...)
switch (X)
case A
X = B
case B
X = C
}
Even though the initial switch value is non-constant, the switch
statement can still be threaded: the initial value will hit the switch
statement but the rest of the state changes will proceed by jumping
unconditionally.
The early predictability check is relaxed to allow unpredictable values
anywhere, but later, after the paths through the switch statement have
been enumerated, no non-constant state values are allowed along the
paths. Any state value not along a path will be an initial switch value,
which can be safely ignored.
Differential Revision: https://reviews.llvm.org/D124394
Florian Hahn [Thu, 26 May 2022 15:08:31 +0000 (16:08 +0100)]
[SCEV] Add test with loop guarded by assume with an AND condition.
Show a missed case where the AND is currently blocks applying the
information from the assume.
Krzysztof Parzyszek [Wed, 25 May 2022 18:20:02 +0000 (11:20 -0700)]
[ADT] Explicitly delete copy/move constructors and operator= in IntervalMap
The default implementations will perform a shallow copy instead of a deep
copy, causing some internal data structures to be shared between different
objects. Disable these operations so they don't get accidentally used.
Differential Revision: https://reviews.llvm.org/D126401
Anastasia Stulova [Thu, 26 May 2022 14:47:56 +0000 (15:47 +0100)]
[OpenCL][Doc] Misc improvements related to SPIR-V support.
LLVM GN Syncbot [Thu, 26 May 2022 14:50:15 +0000 (14:50 +0000)]
[gn build] Port
0e3dc1a52ffe
Nikolas Klauser [Thu, 26 May 2022 14:42:46 +0000 (16:42 +0200)]
[libc++] Implement ranges::{all, any, none}_of
Reviewed By: ldionne, var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D123016
Simon Pilgrim [Thu, 26 May 2022 14:23:49 +0000 (15:23 +0100)]
[SLP] Move canVectorizeLoads implementation to simplify the diff in D105986. NFC.
Stefan Pintilie [Thu, 26 May 2022 13:35:59 +0000 (08:35 -0500)]
[PowerPC][Future] Add an ISA Future to go with mcpu=future.
On Power PC we have ISA3.0 for Power 9, ISA3.1 for Power 10.
This patchs adds an ISA for mcpu=future. The idea is to have a placeholder ISA
for work that is experimental and may not be supported by existing ISAs.
Reviewed By: lei
Differential Revision: https://reviews.llvm.org/D126075
Paul Robinson [Wed, 25 May 2022 19:39:23 +0000 (12:39 -0700)]
[PS5] Allow dllimport/dllexport same as PS4
Tyler Chatow [Thu, 26 May 2022 13:16:02 +0000 (15:16 +0200)]
[clang-format] Handle attributes in enum declaration.
Fixes https://github.com/llvm/llvm-project/issues/55457
Ensures that attributes in the enum declaration are interpreted
correctly, for instance:
```
enum class [[nodiscard]] E {
a,
b
};
```
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D125848
Nathan Sidwell [Wed, 25 May 2022 17:11:39 +0000 (10:11 -0700)]
[clang][PR55406] CFG for coroutine
CoreturnStmt needs to keep the operand value distinct from its use in
any return_value call, so that instantiation may rebuild the latter.
But it also needs to keep the operand value separate in the case of
calling return_void. Code generation checks the operand value form to
determine whether it is a distincte entity to the promise call. This
adds the same logic to CFG generation.
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D126399
NAKAMURA Takumi [Thu, 26 May 2022 13:37:14 +0000 (22:37 +0900)]
[bazel] Introduce "VE" CodeGen in LLVM.
Louis Dionne [Thu, 26 May 2022 13:35:01 +0000 (09:35 -0400)]
[libc++] Remove temporary workaround for existing CMake caches
If you are broken by this change, you should remove your CMake cache and
re-run the CMake generation step.
Alexey Bataev [Wed, 25 May 2022 14:15:49 +0000 (07:15 -0700)]
[SLP]Fix crash on reordering of ScatterVectorize nodes.
ScatterVectorize nodes should be handled same way as gathers in
reorderBottomToTop function, since we can simple reorder the loads in
this node. Because of that need to include such nodes to the list of
gathered nodes to fix compiler crash.
Differential Revision: https://reviews.llvm.org/D126378
Emil Kieri [Sun, 22 May 2022 20:28:04 +0000 (22:28 +0200)]
[flang][NFC] Make semantics test dosemantics03.f90 warning-correct
This is a preparation for D125804, which makes test_errors.py test
warnings the same way it already tests errors, i.e., assert that the
emitted and expected errors are identical. The following changes are
made to the test:
- Add the WARNING directive where warnings are expected.
- Remove -Werror in the RUN line. It does not serve much purpose here:
with -Werror flang makes compilation fail in the presence of
warnings, but warnings are still printed as warnings and not as
errors. And I anyway find it better to test the warnings as warnings
instead of promoting them and test both warnings and errors as
errors.
- Update the header comment describing the test case, mostly in
response to the removal of -Werror.
- Remove the reference to 'issue 458', referring to
https://github.com/flang-compiler/f18/issues/458, from the header.
I think the relevant reference here is to C1120 of the standard,
and references to bug trackers from other projects (from before
upstreaming) can be confusing.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D126176
Joseph Huber [Wed, 18 May 2022 13:19:15 +0000 (09:19 -0400)]
[Cuda] Use fallback method to mangle externalized decls if no CUID given
CUDA requires that static variables be visible to the host when
offloading. However, The standard semantics of a stiatc variable dictate
that it should not be visible outside of the current file. In order to
access it from the host we need to perform "externalization" on the
static variable on the device. This requires generating a semi-unique
name that can be affixed to the variable as to not cause linker errors.
This is currently done using the CUID functionality, an MD5 hash value
set up by the clang driver. This allows us to achieve is mostly unique
ID that is unique even between multiple compilations of the same file.
However, this is not always availible. Instead, this patch uses the
unique ID from the file to generate a unique symbol name. This will
create a unique name that is consistent between the host and device side
compilations without requiring the CUID to be entered by the driver. The
one downside to this is that we are no longer stable under multiple
compilations of the same file. However, this is a very niche use-case
and is not supported by Nvidia's CUDA compiler so it likely to be good
enough.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D125904
Sanjay Patel [Thu, 26 May 2022 12:23:36 +0000 (08:23 -0400)]
[InstCombine] fold icmp equality with udiv and large constant
With large compare constant:
(X u/ Y) == C --> (X == C) && (Y == 1)
(X u/ Y) != C --> (X != C) || (Y != 1)
https://alive2.llvm.org/ce/z/EhKwh6
There are various potential missing icmp (div) transforms shown here:
https://github.com/llvm/llvm-project/issues/55695
This is a generalization for part of the udiv + equality.
I didn't check in detail, but some of those may only make sense as
codegen transforms.
This results in one extra instruction in IR, but it is better for
analysis, and looks much better in codegen on all targets that I tried.
Differential Revision: https://reviews.llvm.org/D126410
Sanjay Patel [Wed, 25 May 2022 18:22:56 +0000 (14:22 -0400)]
[InstCombine] add tests for icmp with udiv operand; NFC
This covers a generalization of one of the transforms
suggested in #55695.
Louis Dionne [Mon, 9 May 2022 15:54:10 +0000 (11:54 -0400)]
[libc++abi] Use from-scratch testing configs for libc++abi by default
Like we have been doing for libc++ for a while now, start using
from-scratch testing configurations for libc++abi.
As a fly-by fix, remove the LIBCXXABI_NO_TIMER macro, which was defined
but never used.
Differential Revision: https://reviews.llvm.org/D125242
Simon Pilgrim [Thu, 26 May 2022 13:05:00 +0000 (14:05 +0100)]
[DAG] Generalize (sra (trunc (sra x, c1)), c2) -> (trunc (sra x, c1 + c2)) constant folding
Remove local (uniform) constant folding and rely on getNode() to perform it
Minor cleanup step toward adding non-uniform shift amount support
Marek Kurdej [Fri, 20 May 2022 22:05:51 +0000 (00:05 +0200)]
[clang-format] Fix QualifierAlignment with global namespace qualified types.
Fixes https://github.com/llvm/llvm-project/issues/55610.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D126096
Aaron Ballman [Thu, 26 May 2022 12:46:11 +0000 (08:46 -0400)]
Fix failing test case with strict prototype changes
Amends
681c50c62e9338afdf58ebfd663f8e3ff43439fb and hopefully fixes:
https://lab.llvm.org/buildbot/#/builders/109/builds/39347
https://lab.llvm.org/buildbot/#/builders/188/builds/14634
and others
Aaron Ballman [Thu, 26 May 2022 11:52:19 +0000 (07:52 -0400)]
Improve the strict prototype diagnostic behavior
Post-commit feedback on https://reviews.llvm.org/D122895 pointed out
that the diagnostic wording for some code was using "declaration" in a
confusing way, such as:
int foo(); // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x
int foo(int arg) { // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x
return 5;
}
And that we had other minor issues with the diagnostics being somewhat
confusing.
This patch addresses the confusion by reworking the implementation to
be a bit more simple and a bit less chatty. Specifically, it changes
the warning and note diagnostics to be able to specify "declaration" or
"definition" as appropriate, and it changes the function merging logic
so that the function without a prototype is always what gets warned on,
and the function with a prototype is sometimes what gets noted.
Additionally, when diagnosing a K&R C definition that is preceded by a
function without a prototype, we don't note the prior declaration, we
warn on it because it will also be changing behavior in C2x.
Differential Revision: https://reviews.llvm.org/D125814
Gabor Marton [Fri, 13 May 2022 13:52:48 +0000 (15:52 +0200)]
[analyzer][solver] Handle UnarySymExpr in SMTConv
Dependent patch adds UnarySymExpr, now I'd like to handle that for SMT
conversions like refutation.
Differential Revision: https://reviews.llvm.org/D125547
Gabor Marton [Wed, 11 May 2022 15:40:25 +0000 (17:40 +0200)]
[analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver
Fixes https://github.com/llvm/llvm-project/issues/55241
Differential Revision: https://reviews.llvm.org/D125395
Gabor Marton [Tue, 10 May 2022 15:13:07 +0000 (17:13 +0200)]
[analyzer] Add UnarySymExpr
This patch adds a new descendant to the SymExpr hierarchy. This way, now
we can assign constraints to symbolic unary expressions. Only the unary
minus and bitwise negation are handled.
Differential Revision: https://reviews.llvm.org/D125318
Gabor Marton [Wed, 25 May 2022 19:27:29 +0000 (21:27 +0200)]
[analyzer] Return from reAssume if State is posteriorly overconstrained
Depends on D124758. That patch introduced serious regression in the run-time in
some special cases. This fixes that.
Differential Revision: https://reviews.llvm.org/D126406
Ivan Kosarev [Thu, 26 May 2022 11:41:55 +0000 (12:41 +0100)]
[AMDGPU][GFX9] Support base+soffset+offset SMEM loads.
Resolves part of
https://github.com/llvm/llvm-project/issues/38652
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D125700
Aaron Ballman [Thu, 26 May 2022 11:40:10 +0000 (07:40 -0400)]
Use the canonical type when matching a generic selection association
This ensures that a deduced type like __auto_type matches the correct
association instead of matching all associations.
This addresses a regression from
e4a42c5b64d044ae28d9483b0ebd12038d5b5917
Fixes #55702
Simon Pilgrim [Thu, 26 May 2022 11:34:02 +0000 (12:34 +0100)]
[DAG] Cleanup "and/or of cmp with single bit diff" fold to use ISD::matchBinaryPredicate
Prep work as I'm investigating some cases where TLI::convertSetCCLogicToBitwiseLogic should accept vectors.
Ivan Kosarev [Thu, 26 May 2022 11:20:15 +0000 (12:20 +0100)]
[FileCheck] GetCheckTypeAbbreviation() to handle the misspelled case.
Also fix directives not covered by D125604.
Chen Zheng [Tue, 19 Apr 2022 07:40:17 +0000 (03:40 -0400)]
[MachineSink] replace MachineLoop with MachineCycle
reapply
62a9b36fcf728b104ea87e6eb84c0be69b779df7 and fix module build
failue:
1: remove MachineCycleInfoWrapperPass in MachinePassRegistry.def
MachineCycleInfoWrapperPass is a anylysis pass, should not be there.
2: move the definition for MachineCycleInfoPrinterPass to cpp file.
Otherwise, there are module conflicit for MachineCycleInfoWrapperPass
in MachinePassRegistry.def and MachineCycleAnalysis.h after
62a9b36fcf728b104ea87e6eb84c0be69b779df7.
MachineCycle can handle irreducible loop. Natural loop
analysis (MachineLoop) can not return correct loop depth if
the loop is irreducible loop. And MachineSink is sensitive
to the loop depth, see MachineSinking::isProfitableToSinkTo().
This patch tries to use MachineCycle so that we can handle
irreducible loop better.
Reviewed By: sameerds, MatzeB
Differential Revision: https://reviews.llvm.org/D123995
Ivan Kosarev [Thu, 26 May 2022 08:48:01 +0000 (09:48 +0100)]
[FileCheck] Catch missspelled directives.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D125604
Alex Zinenko [Wed, 25 May 2022 13:57:22 +0000 (15:57 +0200)]
[mlir] Use-after-free checker for the Transform dialect
The Transform dialect uses the side effect modeling mechanism to record the
effects of the transform ops on the mapping between Transform IR values and
Payload IR ops. Introduce a checker pass that warns if a Transform IR value is
used after it has been freed (consumed). This pass is mostly intended as a
debugging aid in addition to the verification/assertion mechanisms in the
transform interpreter. It reports all potential use-after-free situations.
The implementation makes a series of simplifying assumptions to be simple and
conservative. A more advanced implementation would rely on the data flow-like
analysis associated with a side-effect resource rather than a value, which is
currently not supported by the analysis infrastructure.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D126381
Simon Pilgrim [Thu, 26 May 2022 10:13:13 +0000 (11:13 +0100)]
[X86] Add non-uniform vector tests for 'one bit diff' comparison fold
Florian Hahn [Thu, 26 May 2022 09:35:38 +0000 (10:35 +0100)]
[AArch64] Add additional tests for sinking free shuffles for FMAs.
David Spickett [Thu, 26 May 2022 09:27:23 +0000 (09:27 +0000)]
[llvm][DWARF] Move test using X86 triple into X86 tests
Fixes failure seen when building without X86 backend:
https://lab.llvm.org/buildbot/#/builders/171/builds/15124
David Green [Thu, 26 May 2022 09:16:21 +0000 (10:16 +0100)]
[AArch64] Costmodel tests for llvm.vscale intrinsics. NFC
These shows that the cost of a @llvm.vscale is indeed 1, not 10.
Fraser Cormack [Thu, 26 May 2022 09:00:33 +0000 (10:00 +0100)]
[RISCV][NFC] Add braces to 'else' to match braced 'if'
LLVM GN Syncbot [Thu, 26 May 2022 08:51:13 +0000 (08:51 +0000)]
[gn build] Port
569d6630204d
Nikolas Klauser [Wed, 25 May 2022 09:09:43 +0000 (11:09 +0200)]
[libc++] Implement ranges::equal
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D123681
Florian Hahn [Thu, 26 May 2022 08:46:23 +0000 (09:46 +0100)]
[SimpleLoopUnswitch] Always skip trivial select and set condition.
When updating the branch instruction outside the loopduring non-trivial
unswitching, always skip trivial selects and update the condition.
Otherwise we might create invalid IR, because the trivial select is
inside the loop, while the condition is outside the loop.
Fixes #55697.
Kito Cheng [Fri, 20 May 2022 02:47:15 +0000 (10:47 +0800)]
[RISCV] Fix state persistence bugs (PR55548)
We didn't implement RISCVELFStreamer::reset and cause some very strange
section output for attribute section...just reference D15950 to see how
ARM implement that.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D125905
Florian Hahn [Thu, 26 May 2022 07:53:33 +0000 (08:53 +0100)]
[LV] Fix indentation in tryToCreateWidenRecipe (NFC).
Jason Molenda [Thu, 26 May 2022 07:46:54 +0000 (00:46 -0700)]
Revert "Defer source path remap tilde expansion until source file use"
This reverts commit
c274b6e5830ea88d3f55d6dc1d2b99e38cf6595e.
The x86_64 debian bot got a failure with this patch,
https://lab.llvm.org/buildbot#builders/68/builds/33078
where
SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
is crashing here -
#2 0x0000000000425a9f SignalHandler(int) Signals.cpp:0:0
#3 0x00007f57160e9140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#4 0x00007f570d911e43 lldb_private::SourceManager::GetFile(lldb_private::FileSpec const&) crtstuff.c:0:0
#5 0x00007f570d914270 lldb_private::SourceManager::DisplaySourceLinesWithLineNumbers(lldb_private::FileSpec const&, unsigned int, unsigned int, unsigned int, unsigned int, char const*, lldb_private::Stream*, lldb_private::SymbolContextList const*) crtstuff.c:0:0
#6 0x00007f570da662c8 lldb_private::StackFrame::GetStatus(lldb_private::Stream&, bool, bool, bool, char const*) crtstuff.c:0:0
I don't get a failure here my mac, I'll review this method more
closely tomorrow.
Jason Molenda [Thu, 26 May 2022 07:30:12 +0000 (00:30 -0700)]
Defer source path remap tilde expansion until source file use
When reading source path remappings out of a dSYM, lldb currently
does tilde expansion -- expanding the tilde-username and checking
that the destination pathname exists, for each dSYM with the path
remappings. This cost happens during lldb's initial process launch
/ load, an especially perf-sensitive time. Inside Apple, we have
dSYMs with source path remappings pointing to NFS directories where
these extra stats for every dSYM can be very expensive if the network
is slow.
This patch instead keeps the source path mapping in the original
tilde-username terms and does the tilde expansion when we need
to read a specific source file from one of the modules. We'll
be stat'ing all of those inodes to load the source file anyway,
so the fact that we do the tilde expansion on every source file
we load, it doesn't cost us significantly.
Differential Revision: https://reviews.llvm.org/D126435
rdar://
77091379
Jason Molenda [Thu, 26 May 2022 07:19:57 +0000 (00:19 -0700)]
Update three tests to realpath paths that we compare to dyld paths
I get to my work directory through a symlink, so the pathnames the
tests get for their build artifacts etc are via that symlink. There
are three tests which compare those symlink paths to a directory
received from dyld on macOS, which is the actual real pathname.
These tests have always failed for me on my dekstop but I finally
sat down to figure out why. Easy quick fix.
Fangrui Song [Thu, 26 May 2022 07:14:08 +0000 (00:14 -0700)]
[MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC
John Paul Adrian Glaubitz [Thu, 26 May 2022 07:00:16 +0000 (00:00 -0700)]
[scudo] Link against libatomic on all MIPS targets
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D126418
Owen Anderson [Mon, 9 May 2022 05:34:43 +0000 (22:34 -0700)]
Replace the custom linked list in LeaderTableEntry with TinyPtrVector.
The purpose of the custom linked list was to optimize for the case
of a single-element list. It turns out that TinyPtrVector handles
the same basic scenario even better, reducing the size of
LeaderTableEntry by 33%, and requiring only log2(N) allocations
as the size of the list grows. The only downside is that we have
to store the Value's and BasicBlock's in separate vectors, which
is slightly awkward in a few cases. Fortunately that ends up being
entirely encapsulated inside helper functions.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D125205
Serguei Katkov [Wed, 25 May 2022 06:37:06 +0000 (13:37 +0700)]
[GuardWidening] Remove nuw/nsw flags for hoisted instructions
When we hoist instructions over guard we must clear flags due to these flags
might be implied using this guard, so they make sense only after the guard.
As an example of the bug due to current behavior.
L is known to be in range say [0, 100)
c1 = x u< L
guard (c1)
x1 = add x, 1
c2 = x1 u< L
guard(c2)
basing on guard(c1) we can say that x1 = add nuw nsw x, 1
after guard widening we get
c1 = x u< L
x1 = add nuw nsw x, 1
c2 = x1 u< L
c = and c1, c2
guard(c)
now, basing on fact that x + 1 < L and x >= 0 due to x + 1 is nuw
we can prove that x + 1 u< L implies that x u< L, so we can just remove c1
x1 = add nuw nsw x, 1
c2 = x1 u< L
guard(c2)
But that is not correct due to we will pass x == -1 value.
Reviewed By: mkazantsev
Subscribers: llvm-commits, nikic
Differential Revision: https://reviews.llvm.org/D126354
serge-sans-paille [Wed, 25 May 2022 20:29:51 +0000 (16:29 -0400)]
[iwyu] Handle regressions in libLLVM header include
Running iwyu-diff on LLVM codebase since
7030654296a0416bd9402a0278 detected a few
regressions, fixing them.
Differential Revision: https://reviews.llvm.org/D126417
Serguei Katkov [Wed, 25 May 2022 06:37:06 +0000 (13:37 +0700)]
[GuardWidening] Add test showing incorrect behavior with nuw/nsw flags
when we move instruction over the guard we must clear nuw/nsw flags
but we do not.
Serguei Katkov [Thu, 26 May 2022 05:17:16 +0000 (12:17 +0700)]
[GuardWidening] Update test with update_test_checks.py
River Riddle [Tue, 24 May 2022 08:55:27 +0000 (01:55 -0700)]
[mlir:Printer][NFC] Add utility methods for printing escaped/hex strings
This simplifies quite a few cases where we manually duplicate the
escaping logic.
River Riddle [Sat, 21 May 2022 01:20:13 +0000 (18:20 -0700)]
[mlir:LSP] Link the test dialect into mlir-lsp-server
This allows for more easily interacting with lit files that utilize
the test dialect.
Matthias Springer [Wed, 25 May 2022 22:37:51 +0000 (00:37 +0200)]
[mlir][bufferization] Clean up imports and code comments
Differential Revision: https://reviews.llvm.org/D126427
Congzhe Cao [Thu, 26 May 2022 03:31:17 +0000 (23:31 -0400)]
[NFC][LoopCacheAnalysis] Update test cases to make sure the outputs follow the right order
In this patch we change test cases from using "CHECK" to using
"CHECK-NEXT", which is to ensure the order of loops output by
loop cache analysis is correct. After D124725 we fixed the
non-deterministic output order hence we did not use "CHECK-DAG"
anymore, and now we should really use "CHECK-NEXT" to make sure
the loops in the output loop vector follow the right order.
Reviewed By: bmahjour, #loopoptwg
Differential Revision: https://reviews.llvm.org/D124984
Chenbing Zheng [Thu, 26 May 2022 03:07:18 +0000 (11:07 +0800)]
[InstCombine] [NFC] refector foldXorOfICmps
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D126268
Chenbing Zheng [Thu, 26 May 2022 02:16:54 +0000 (10:16 +0800)]
[InstCombine] bitcast(logic(bitcast(X), bitcast(Y))) -> bitcast'(logic(bitcast'(X), Y))
This patch break foldBitCastBitwiseLogic limite the destination
must have an integer element type, and eliminate one bitcast by
doing the logic op in the type of the input that has an integer
element type.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D126184
jacquesguan [Wed, 11 May 2022 09:17:43 +0000 (09:17 +0000)]
[RISCV] Replace ISD::FP_EXTEND and ISD::FP_ROUND with RVV VL op.
This patch tries to solve the incoordination between the direct and intermediate cast caused by D123975.
This patch replaces ISD::FP_EXTEND and ISD::FP_ROUND with RVV VL op in the lowering of FP scalable vector direct cast to unify with the intermediate cast.
And it also changes the FP widenning pattern with the VL op.
Differential Revision: https://reviews.llvm.org/D125364
Alan Zhao [Wed, 25 May 2022 22:06:08 +0000 (18:06 -0400)]
[llvm-ml] Add support for the .S extension
Even though MASM files typically have the .asm extension, there are some
use cases [0] where they have the .S extension. MSVC ml assembles such
files with no problems, so llvm-ml should as well.
Additionally, fix the implementation of the /Ta flag and add a test for
it.
[0]: https://crrev.com/c/3668287
Reviewed By: epastor
Differential Revision: https://reviews.llvm.org/D126425
Lian Wang [Thu, 19 May 2022 07:11:18 +0000 (07:11 +0000)]
[LegalizeTypes][VP] Add widen and split support for VP_TRUNCATE
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D125950
Haocong.Lu [Thu, 26 May 2022 01:54:52 +0000 (09:54 +0800)]
[RISCV][NFC] Remove solved TODO for combining constant shifts
Reviewed By: benshi001, asb
Differential Revision: https://reviews.llvm.org/D126185
Peter Klausler [Wed, 25 May 2022 23:44:58 +0000 (16:44 -0700)]
[flang] Allow forward reference to ENTRY from generic interface
The CreateEntry() function in name resolution needs to allow for the name
of an alternate entry point already having been declared in the outer scope
as the homonymous specific procedure of a generic interface; e.g.,
interface foo
module procedure foo
end interface
subroutine bar
entry foo
end subroutine
Differential Revision: https://reviews.llvm.org/D126436
V Donaldson [Wed, 25 May 2022 22:32:02 +0000 (15:32 -0700)]
[flang] Update intrinsic module source files
The f18 standard defines several intrinsic modules containing definitions
and declarations for various constants, types, and procedures. This PR adds
declarations for missing procedures in these modules.
bixia1 [Tue, 24 May 2022 23:07:31 +0000 (16:07 -0700)]
[mlir][sparse] Add more complex operations.
Support complex operations sqrt, expm1, and tanh.
Add tests.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D126393
bixia1 [Wed, 25 May 2022 19:39:37 +0000 (12:39 -0700)]
Lower complex.expm1 to standard dialect.
Add a test.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D126409
Jason Molenda [Wed, 25 May 2022 23:05:16 +0000 (16:05 -0700)]
Skip testing of watchpoint hit-count/ignore-count on multithreaded
Skip all watchpoint hit-count/ignore-count tests for multithreaded
API tests for now on arm64 Darwin.
On AArch64, insns that trigger a WP are rolled back and we are
notified. lldb needs to disable the WP, insn step, re-enable it,
then report it to the user. lldb only does this full step action
for the "selected thread", and so when a program stops with
multiple threads hitting a stop reason, some of them watchpoints,
any non-selected-thread will not be completed in this way. But
all threads with the initial watchpoint exception will have their
hit-count/ignore-counts updated. When we resume execution, the
other threads sitting at the instruction will again execute &
trigger the WP exceptoin again, repeating until we've gone through
all of the threads.
This bug is being tracked in llvm.org/pr49433 and inside apple
in rdar://
93863107