Stefan Gränitz [Wed, 7 Apr 2021 07:44:18 +0000 (09:44 +0200)]
[Orc][examples] Add lit ToolSubst for LLJITWithRemoteDebugging example
The test case added in
258f055ed936 was lacking two important details for the test infrastructure.
ae217bf1f327 added the executable to LLVM_TEST_DEPENDS in CMake to make sure the exectubale gets built before we run the test suite. This patch adds a ToolSubst for the executable in LIT, which replaces the tool invokation in the RUN line with an absolute path. It makes sure we don't run accidentally run some other tool from the user's PATH. The test works without it in case LLVM's main binary directory happens to be the working directory (which is default apparently). Configurations that don't build the examples ignore failures for this ToolSubst (and won't run the test).
Reviewed By: echristo
Differential Revision: https://reviews.llvm.org/D99931
LemonBoy [Tue, 6 Apr 2021 18:40:15 +0000 (20:40 +0200)]
[X86] Initialize TargetOptions::StackProtectorGuardOffset member to its default value
D88631 introduced a set of knobs to tweak how the stack protector is codegen'd for x86 targets, including the offset from the base register where the stack cookie is located. The `StackProtectorGuardOffset` field in `TargetOptions` was left uninitialized instead of being reset to its neutral value -1, making it possible to emit nonsensical code if the frontend doesn't change the field value at all before feeding the `TargetOptions` to the target machine initializer.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D99952
Max Kazantsev [Wed, 7 Apr 2021 06:14:53 +0000 (13:14 +0700)]
[SCEV] Fix false-positive recognition of simple recurrences. PR49856
A value from reachable block may come to a Phi node as its input from
unreachable block. This may confuse matchSimpleRecurrence which
has no access to DomTree and can falsely recognize something as a recurrency
because of this effect, as the attached test shows.
Patch `ae7b1e` deals with half of this problem, but it only accounts from
the case when an unreachable instruction comes to Phi as an input.
This patch provides a generalization by checking that no Phi block's
predecessor is unreachable (no matter what the input is).
Differential Revision: https://reviews.llvm.org/D99929
Reviewed By: reames
Petr Hosek [Wed, 7 Apr 2021 06:22:08 +0000 (23:22 -0700)]
Revert "[NFC][Clang] Speculative fix for builtins-ppc-quadword-noi128.c"
This reverts commit
849d3729433e05e6d89892c1814fa07ed3ec18e2 which
depends on
31d219d2997fed1b7dc97e0adf170d5aaf65883e that was reverted.
Christopher Di Bella [Fri, 2 Apr 2021 21:33:39 +0000 (21:33 +0000)]
[libcxx] fixes `common_reference` requirement for `swappable_with`
LWG3175 identifies that the `common_reference` requirement for
`swappable_with` is over-constraining and doesn't need to concern itself
with cv- or reference qualifiers.
Differential Revision: https://reviews.llvm.org/D99817
Petr Hosek [Wed, 7 Apr 2021 05:30:28 +0000 (22:30 -0700)]
Revert "[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)"
This reverts commit
31d219d2997fed1b7dc97e0adf170d5aaf65883e which
causes an infinite loop when compiling the XRay runtime.
Jacques Pienaar [Wed, 7 Apr 2021 03:22:42 +0000 (20:22 -0700)]
[mlir,shape] Add max/min folder for simple case
When both arguments are the same for these ops, propagate this argument.
Jonas Devlieghere [Wed, 7 Apr 2021 03:15:40 +0000 (20:15 -0700)]
[dsymutil] Stop emulating dsymutil-classic CIE caching behavior
Stop emulating dsymutil-classic which only cached the last used CIE for
reuse.
Jonas Devlieghere [Wed, 7 Apr 2021 02:50:15 +0000 (19:50 -0700)]
[dsymutil] Don't keep old abbreviations
Don't keep the old abbreviations around. This code existed for
compatibility with dsymutil-classic.
Jonas Devlieghere [Wed, 7 Apr 2021 00:23:51 +0000 (17:23 -0700)]
[dsymutil] Don't emit .debug_pubnames and .debug_pubtypes
Consider the .debug_pubnames and .debug_pubtypes their own kind of
accelerator and stop emitting them together with the Apple-style
accelerator tables. The only reason we were still emitting both was for
(byte-for-byte) compatibility with dsymutil-classic.
- This patch adds a new accelerator table kind "Pub" which can be
specified with --accelerator=Pub.
- This patch removes the ability to emit both pubnames/types and apple
style accelerator tables. I don't think anyone is relying on that but
it's worth pointing out.
- This patch removes the --minimize option and makes this behavior the
default. Specifying the flag will result in a warning but won't abort
the program.
Differential revision: https://reviews.llvm.org/D99907
Alex Orlov [Wed, 7 Apr 2021 01:37:46 +0000 (05:37 +0400)]
Removed redundant code.
Yevgeny Rouban [Wed, 7 Apr 2021 01:34:30 +0000 (08:34 +0700)]
[NewPM] Set verify-cfg-preserved=1 by default for debug builds
Weverything [Wed, 7 Apr 2021 00:28:52 +0000 (17:28 -0700)]
Add missing CHECK lines in test
Jacques Pienaar [Wed, 7 Apr 2021 00:58:12 +0000 (17:58 -0700)]
[shape] Add min and max ops
These are element-wise operations that operates on shapes with equal ranks.
Also add missing printer/parser for join operator.
Differential Revision: https://reviews.llvm.org/D99986
Yaxun (Sam) Liu [Wed, 7 Apr 2021 00:32:16 +0000 (20:32 -0400)]
Minor fix for test hip-code-object-version.hip
Changed the order of checking of v2 and v3.
Change-Id: Ifea8197b398afdfb0aa1bd40140cda30f00f0c17
Yaxun (Sam) Liu [Tue, 27 Oct 2020 18:10:02 +0000 (14:10 -0400)]
[HIP] Change to code object v4
Change to code object v4 by default to match ROCm 4.1.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D99235
Craig Topper [Tue, 6 Apr 2021 23:48:07 +0000 (16:48 -0700)]
[RISCV] Add an assertion to the ReplaceNodeResults handling of bitcasts to make sure the VT is always a scalar integer.
Nicolás Alvarez [Tue, 6 Apr 2021 22:15:04 +0000 (00:15 +0200)]
[docs] Fix doxygen comments wrongly attached to the llvm namespace
Looking at the Doxygen-generated documentation for the llvm namespace
currently shows all sorts of random comments from different parts of the
codebase. These are mostly caused by:
- File doc comments that aren't marked with \file, so they're attached to
the next declaration, which is usually "namespace llvm {".
- Class doc comments placed before the namespace rather than before the
class.
- Code comments before the namespace that (in my opinion) shouldn't be
extracted by doxygen at all.
This commit fixes these comments. The generated doxygen documentation now
has proper docs for several classes and files, and the docs for the llvm
and llvm::detail namespaces are now empty.
Reviewed By: thakis, mizvekov
Differential Revision: https://reviews.llvm.org/D96736
Peter Steinfeld [Tue, 6 Apr 2021 16:25:35 +0000 (09:25 -0700)]
[flang] Improve constant folding for type parameter inquiries
We were not folding type parameter inquiries for the form 'var%typeParam'
where 'typeParam' was a KIND or LEN type parameter of a derived type and 'var'
was a designator of the derived type. I fixed this by adding code to the
function 'FoldOperation()' for 'TypeParamInquiry's to handle this case. I also
cleaned up the code for the case where there is no designator.
In order to make the error messages correctly refer to both the points of
declaration and instantiation, I needed to add an argument to the function
'InstantiateIntrinsicType()' for the location of the instantiation.
I also changed the formatting of 'TypeParamInquiry' to correctly format this
case. I also added tests for both KIND and LEN type parameter inquiries in
resolve104.f90.
Making these changes revealed an error in resolve89.f90 and caused one of the
error messages in assign04.f90 to be different.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D99892
Craig Topper [Tue, 6 Apr 2021 21:57:01 +0000 (14:57 -0700)]
[RISCV] Don't custom type legalize fixed vector to scalar integer bitcasts if the fixed vector type isn't legal.
We encountered a hang in our internal code base. I'm having trouble
creating a test case because the test that hit it was testing some
code that is not upstream.
Hansang Bae [Thu, 25 Mar 2021 00:12:00 +0000 (19:12 -0500)]
[OpenMP] Define omp_is_initial_device() variants in omp.h
omp_is_initial_device() is marked as a built-in function in the current
compiler, and user code guarded by this call may be optimized away,
resulting in undesired behavior in some cases. This patch provides a
possible fix for such cases by defining the routine as a variant
function and removing it from builtin list.
Differential Revision: https://reviews.llvm.org/D99447
Jez Ng [Tue, 6 Apr 2021 21:52:30 +0000 (17:52 -0400)]
[lld-macho] Symbol::value should always be uint64_t
D98837 migrated a bunch of `value`s to uint64_t, but missed these.
Craig Topper [Tue, 6 Apr 2021 19:43:14 +0000 (12:43 -0700)]
[MachineValueTypes] Add blank lines between floating point vectors with different element types. NFC
John Demme [Tue, 6 Apr 2021 21:15:22 +0000 (14:15 -0700)]
[MLIR] [Python] Add capsule methods for pybind11 to PyOperation
Add the `getCapsule()` and `createFromCapsule()` methods to the PyOperation class.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D99927
Sidharth Baveja [Tue, 6 Apr 2021 21:24:40 +0000 (21:24 +0000)]
[SplitEdge] Update SplitCriticalEdge to return a nullptr only when the edge is not critical
Summary:
The function SplitCriticalEdge (called by SplitEdge) can return a nullptr in
cases where the edge is a critical. SplitEdge uses SplitCriticalEdge assuming it
can always split all critical edges, which is an incorrect assumption.
The three cases where the function SplitCriticalEdge will return a nullptr is:
1. DestBB is an exception block
2. Options.IgnoreUnreachableDests is set to true and
isa(DestBB->getFirstNonPHIOrDbgOrLifetime()) is not equal to a nullptr
3. LoopSimplify form must be preserved (Options.PreserveLoopSimplify is true)
and it cannot be maintained for a loop due to indirect branches
For each of these situations they are handled in the following way:
1. Modified the function ehAwareSplitEdge originally from
llvm/lib/Transforms/Coroutines/CoroFrame.cpp to handle the cases when the DestBB
is an exception block. This function is called directly in SplitEdge.
SplitEdge does not call SplitCriticalEdge in this case
2. Options.IgnoreUnreachableDests is set to false by default, so this situation
does not apply.
3. Return a nullptr in this situation since the SplitCriticalEdge also returned
nullptr. Nothing we can do in this case.
Reviewed By: asbirlea
Differential Revision:https://reviews.llvm.org/D94619
Vince Bridgers [Tue, 6 Apr 2021 20:47:36 +0000 (15:47 -0500)]
[docs] Update documentation for bugprone-misplaced-widening-cast
The default setting for CheckImplicitCasts was changed in
https://reviews.llvm.org/D32164 but the documentation was not updated.
This simple change just syncs the documentation with the behavior of
that checker.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D99991
Rob Suderman [Wed, 31 Mar 2021 18:18:27 +0000 (11:18 -0700)]
[mlir][tosa] Add tosa.table lowering to linalg.generic
Table op lowering to linalg.generic for both i8 (behaves like a gather) and a
pair of gathers with a quantized interpolation.
Differential Revision: https://reviews.llvm.org/D99756
Aaron Puchert [Tue, 6 Apr 2021 20:29:44 +0000 (22:29 +0200)]
Thread safety analysis: Don't warn about managed locks on join points
We already did so for scoped locks acquired in the constructor, this
change extends the treatment to deferred locks and scoped unlocking, so
locks acquired outside of the constructor. Obviously this makes things
more consistent.
Originally I thought this was a bad idea, because obviously it
introduces false negatives when it comes to double locking, but these
are typically easily found in tests, and the primary goal of the Thread
safety analysis is not to find double locks but race conditions.
Since the scoped lock will release the mutex anyway when the scope ends,
the inconsistent state is just temporary and probably fine.
Reviewed By: delesley
Differential Revision: https://reviews.llvm.org/D98747
Philip Reames [Tue, 6 Apr 2021 20:23:58 +0000 (13:23 -0700)]
Replace calls to IntrinsicInst::Create with CallInst::Create [nfc]
There is no IntrinsicInst::Create. These are binding to the method in the super type. Be explicitly about which method is being called.
Philip Reames [Tue, 6 Apr 2021 20:17:35 +0000 (13:17 -0700)]
Use AssumeInst in a few more places [nfc]
Follow up to
a6d2a8d6f5. These were found by simply grepping for "::assume", and are the subset of that result which looked cleaner to me using the isa/dyn_cast patterns.
Louis Dionne [Tue, 6 Apr 2021 20:15:18 +0000 (16:15 -0400)]
[libc++] NFCI: Fix test pinning down RTTI implementation on Apple platforms
The test didn't handle arm64 correctly.
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, AArch64] Fix use of var defined in CHECK-NOT
LLVM test CodeGen/AArch64/speculation-hardening.ll tries to check for
the absence of a sequence of instructions with several CHECK-NOT with
one of those directives using a variable defined in another. However
CHECK-NOT are checked independently so that is using a variable defined
in a pattern that should not occur in the input.
This commit removes the dependency between those CHECK-NOT by replacing
single occurence of the undefined variable by a regex match, and
multiple occurences by a definition followed by a use.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D99866
Artem Belevich [Thu, 1 Apr 2021 18:25:36 +0000 (11:25 -0700)]
[NVPTX] Handle bitcast and ASC(101) when trying to avoid argument copy.
This allows us to skip the copy in few more cases.
Differential Revision: https://reviews.llvm.org/D99979
Philip Reames [Tue, 6 Apr 2021 19:45:20 +0000 (12:45 -0700)]
Plumb AssumeInst through operand bundle apis [nfc]
Follow up to
a6d2a8d6f5. This covers all the public interfaces of the bundle related code. I tried to cleanup the internals where the changes were obvious, but there's definitely more room for improvement.
Jacques Pienaar [Tue, 6 Apr 2021 19:53:27 +0000 (12:53 -0700)]
[mlir] Hoist out getRequestedOpDefinitions helper
Enables performing the same filtering in the op doc definition as in the op definition generator.
Differential Revision: https://reviews.llvm.org/D99793
Luís Marques [Tue, 6 Apr 2021 19:48:00 +0000 (20:48 +0100)]
[lit testing] Fix xfail-cl.py test worker count
This would fail in test environments with < 3 hardware threads.
Differential Revision: https://reviews.llvm.org/D99858
Luís Marques [Tue, 6 Apr 2021 19:42:48 +0000 (20:42 +0100)]
[ASan][RISCV] Fix RISC-V memory mapping
Fixes the ASan RISC-V memory mapping (originally introduced by D87580 and
D87581). This should be an improvement both in terms of first principles
soundness and observed test failures --- test failures would occur
non-deterministically depending on the ASLR random offset.
On RISC-V Linux (64-bit), `TASK_UNMAPPED_BASE` is currently defined as
`PAGE_ALIGN(TASK_SIZE / 3)`. The non-power-of-two divisor makes the result
be the not very round number 0x1555556000. That address had to be further
rounded to ensure page alignment after the shadow scale shifting is applied.
Still, that value explains why the mapping table may look less regular than
expected.
Further cleanups:
- Moved the mapping table comment, to ensure that the two Linux/AArch64
tables stayed together;
- Removed mention of Sv48. Neither the original mapping nor this one are
compatible with an actual Linux Sv48 address space (mainline Linux still
operates Sv48 in Sv39 mode). A future patch can improve this;
- Removed the additional comments, for consistency.
Differential Revision: https://reviews.llvm.org/D97646
Yaxun (Sam) Liu [Wed, 20 May 2020 19:11:42 +0000 (15:11 -0400)]
Let clang atomic builtins fetch add/sub support floating point types
Recently atomicrmw started to support fadd/fsub:
https://reviews.llvm.org/D53965
However clang atomic builtins fetch add/sub still does not support
emitting atomicrmw fadd/fsub.
This patch adds that.
Reviewed by: John McCall, Artem Belevich, Matt Arsenault, JF Bastien,
James Y Knight, Louis Dionne, Olivier Giroux
Differential Revision: https://reviews.llvm.org/D71726
Felix Berger [Tue, 16 Mar 2021 19:55:44 +0000 (15:55 -0400)]
[clang-tidy] performance-* checks: Match AllowedTypes against qualified type names when they contain "::".
This allows users to be more precise and exclude a type in a specific namespace
from triggering the check instead of excluding all types with the same
unqualified name.
This change should not interfere with correctly configured clang-tidy setups
since an AllowedType with "::" would never match.
Differential Revision: https://reviews.llvm.org/D98738
Reviewed-by: ymandel, hokein
Alexandre Ganea [Tue, 6 Apr 2021 19:35:17 +0000 (15:35 -0400)]
[Windows] Add test coverage for line endings when rewriting includes
Validate that we're properly generating a single line ending on Windows when
using -frewrite-includes. Otherwise we're breaking split-line macros. The test
fails before
23929af383f27a6ddf23704192a25591481152b3.
See discussion in https://reviews.llvm.org/D96363#2650460 and D99426
Differential Revision: https://reviews.llvm.org/D99973
Arthur O'Dwyer [Wed, 24 Mar 2021 22:19:12 +0000 (18:19 -0400)]
[libc++] Header inclusion tests.
As mandated by the Standard's various synopses, e.g. [iterator.synopsis].
Searching the TeX source for '#include' is a good way to find all of these
mandates.
The new tests are all autogenerated by utils/generate_header_inclusion_tests.py.
I was SHOCKED by how many mandates there are, and how many of them
libc++ wasn't conforming with.
Differential Revision: https://reviews.llvm.org/D99309
Arthur O'Dwyer [Tue, 6 Apr 2021 18:11:09 +0000 (14:11 -0400)]
[libc++] Post-commit review on D99928.
The "user-defined conversion by implicit constructor" codepath is already
handled by `B(int)`; we don't need to test `A(const A&)` a second time
via `DA` (nor the isomorphic case with `DB`).
We don't need `&` anywhere in this test.
Generally, `operator()` should be const; this test needn't be special.
(No functional change in test coverage.)
Christian Sigg [Tue, 6 Apr 2021 13:43:49 +0000 (15:43 +0200)]
[mlir] Remove no-op array assignment in dictionaryAttrSort().
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D99954
Jez Ng [Tue, 6 Apr 2021 19:09:14 +0000 (15:09 -0400)]
[lld-macho] Fix & refactor symbol size calculations
I noticed two problems with the previous implementation:
* N_ALT_ENTRY symbols weren't being handled correctly -- they should
determine the size of the previous symbol, even though they don't
cause a new section to be created
* The last symbol in a section had its size calculated wrongly;
the first subsection's size was used instead of the last one
I decided to take the opportunity to refactor things as well, mainly to
realize my observation
[here](https://reviews.llvm.org/D98837#inline-931511) that we could
avoid doing a binary search to match symbols with subsections. I think
the resulting code is a bit simpler too.
N Min Max Median Avg Stddev
x 20 4.31 4.43 4.37 4.3775 0.
034162922
+ 20 4.32 4.43 4.38 4.3755 0.
02799906
No difference proven at 95.0% confidence
Reviewed By: #lld-macho, alexshap
Differential Revision: https://reviews.llvm.org/D99972
Jez Ng [Tue, 6 Apr 2021 19:09:12 +0000 (15:09 -0400)]
[lld-macho][nfc] Remove HelpHidden from aliases to implemented flags
This is a no-op. Just cleaning up Options.td...
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D99874
Jez Ng [Tue, 6 Apr 2021 19:09:09 +0000 (15:09 -0400)]
[lld-macho][nfc] Rename some tests
"stub" is a bit too overloaded... we were using it to refer to
TAPI files, but it's also the name for the PLT trampolines in Mach-O.
Going ahead, let's just use "TAPI" or ".tbd" to refer to TAPI stuff.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D99807
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[MLIR, test] Fix use of undef FileCheck var
MLIR test Dialect/Linalg/transform-patterns.mlir tries to check for the
absence of a sequence of instructions with several CHECK-NOT with one of
those directives using a variable defined in another. However CHECK-NOT
are checked independently so that is using a variable defined in a
pattern that should not occur in the input.
This commit removes the dependency between those CHECK-NOT by replacing
occurences of variables by the regex that were used to define them.
Note to reviewers: please pay attention to whether the remaining
reference to l0 is correct. There was a l0 defined in those CHECK-NOT
and one defined before. I'm not sure what was the intent there.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D99957
Amy Kwan [Tue, 6 Apr 2021 17:25:53 +0000 (12:25 -0500)]
[PowerPC] Materialize 34-bit constants with pli directly
Previously, 34-bit constants were materialized in selectI64Imm(), and we relied
on td pattern matching to instead produce a pli. This becomes problematic as
there is no guarantee that the 34-bit constant will reach the td pattern
selection for pli. It is also possible for other transformations (such as complex
bit permutations) to also produce and utilize the 34-bit constant materialized
through selectI64Imm().
This patch instead produces pli on Power10 directly whenever the constant fits
within 34-bits.
Differential Revision: https://reviews.llvm.org/D99906
Fangrui Song [Tue, 6 Apr 2021 18:30:19 +0000 (11:30 -0700)]
[NewPM] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds after D91327
Philip Reames [Tue, 6 Apr 2021 18:27:28 +0000 (11:27 -0700)]
More precisely type code used for gc.relocate assertions [nfc]
Jez Ng [Tue, 6 Apr 2021 18:05:15 +0000 (14:05 -0400)]
[lld-macho] clang-format cleanup
find . -type f -name "*.cpp" -o -name "*.h" | xargs clang-format -i
Jez Ng [Tue, 6 Apr 2021 17:58:37 +0000 (13:58 -0400)]
[lld-macho] Rename SubsectionMapping to SubsectionMap
We bikeshedded about it here: https://reviews.llvm.org/D98837#inline-931557
I initially suggested SubsectionMapping, but I thought the discussion
landed on doing `std::vector<SubsectionEntry>`. @alexshap went and did
both, but on hindsight I regret adding 3 more characters to an already
long name, and I think SubsectionEntry is descriptive enough...
This diff also renames `subsectionMap` to `subsecMap` for consistency
with other variable names in the codebase.
Philip Reames [Tue, 6 Apr 2021 18:11:44 +0000 (11:11 -0700)]
Add a subclass of IntrinsicInst for llvm.assume [nfc]
Add the subclass, update a few places which check for the intrinsic to use idiomatic dyn_cast, and update the public interface of AssumptionCache to use the new class. A follow up change will do the same for the newer assumption query/bundle mechanisms.
James Y Knight [Tue, 6 Apr 2021 18:10:26 +0000 (14:10 -0400)]
Fix
f6ee97d8271e1dfd9b6572222fefe8f40433952e:
PrintAddress needs to be false (as it was before), or this breaks sanitizer backtraces.
Martin Storsjö [Tue, 9 Mar 2021 09:37:44 +0000 (11:37 +0200)]
[libcxx] [test] Allow C:\System Volume Information to be missing
If running in a Windows Container, there is no such directory at all.
If running from within bash on Windows Server, the directory seems to
be fully accessible. (The mechanics of this isn't fully understood, and
it doesn't seem to happen on desktop versions.)
If the directory isn't available with the expected behaviour, mark those
individual tests as unsupported. (The test as a whole is considered to
pass, but the unsupported test is mentioned in a test summary printed on
stdout.)
Differential Revision: https://reviews.llvm.org/D98960
Arthur Eubanks [Tue, 6 Apr 2021 00:09:53 +0000 (17:09 -0700)]
[GVN] Add missing ICF update
performScalarPREInsertion() inserts instructions into blocks that we
need to tell ImplicitControlFlowTracking about, otherwise the ICF cache
may be invalid.
Fixes PR49193.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D99909
Jonas Devlieghere [Tue, 6 Apr 2021 17:03:26 +0000 (10:03 -0700)]
[lldb] Fix else-after-return in AppleObjCRuntimeV2 (NFC)
Use early returns to associate the error message with the corresponding
condition and eliminate some else-after-returns in the process.
Florian Hahn [Tue, 6 Apr 2021 16:34:21 +0000 (17:34 +0100)]
[SimplifyInst] Use correct type for GEPs with vector indices.
The current code does not properly handle vector indices unless they are
the first index.
At the moment LangRef gives the impression that the vector index must be
the one and only index (https://llvm.org/docs/LangRef.html#getelementptr-instruction).
But vector indices can appear at any position and according to the
verifier there may be multiple vector indices. If that's the case, the
number of elements must match.
This patch updates SimplifyGEPInst to properly handle those additional
cases.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D99961
Nicolas Vasilache [Tue, 6 Apr 2021 16:52:06 +0000 (16:52 +0000)]
[mlir][python] Add missing affine map compression test
Martin Storsjö [Tue, 6 Apr 2021 07:55:33 +0000 (10:55 +0300)]
[libcxx] Fix the type attribute for a couple templates
Use `_LIBCPP_TEMPLATE_VIS` instead of `_LIBCPP_TYPE_VIS` for a template
class.
This fixes the nodiscard_extensions.pass.cpp and a couple
func.search.default test cases when built in MSVC/DLL configurations.
Differential Revision: https://reviews.llvm.org/D99932
Martin Storsjö [Tue, 6 Apr 2021 07:20:59 +0000 (10:20 +0300)]
[libcxx] [test] Use dedicated types for the invocable concept tests for multiple overloads
This should be clearer, instead of relying on rules for implicit
conversions regarding built in float/integer types.
Differential Revision: https://reviews.llvm.org/D99928
Craig Topper [Tue, 6 Apr 2021 05:06:24 +0000 (22:06 -0700)]
[RISCV] Add helper function to share some of the code for isel of vector load/store intrinsics.
Many of the operands are handled the same or in the same order
for all these intrinsics. Factor out the code for selecting and
pushing them into the Operands vector.
Differential Revision: https://reviews.llvm.org/D99923
Jay Foad [Tue, 6 Apr 2021 16:48:31 +0000 (17:48 +0100)]
[AMDGPU] SIFoldOperands: use isUseMIInFoldList. NFC.
Jonas Devlieghere [Tue, 6 Apr 2021 16:47:46 +0000 (09:47 -0700)]
[lldb] Format Plugins/Language/ObjC/Cocoa.cpp (NFC)
Christopher Di Bella [Wed, 31 Mar 2021 05:28:25 +0000 (05:28 +0000)]
[libcxx] adds remaining callable concepts
* `std::predicate`
* `std::relation`
* `std::equivalence_relation`
* `std::strict_weak_order`
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Differential Revision: https://reviews.llvm.org/D96477
Arthur Eubanks [Tue, 6 Apr 2021 04:09:18 +0000 (21:09 -0700)]
[llvm-reduce] Remove unwanted module inline asm
We can clear line by line, but that's likely not very important.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D99921
Paul Robinson [Tue, 23 Mar 2021 17:45:37 +0000 (10:45 -0700)]
Pass -fcrash-diagnostics-dir along to LLVM
This allows frontend and backend diagnostic files to all go into the
same place. Have it control the Windows (mini-)dump location.
Differential Revision: https://reviews.llvm.org/D99199
Alexander Belyaev [Tue, 6 Apr 2021 16:13:46 +0000 (18:13 +0200)]
[mlir][linalg] Add helpers for linalg.tiled_loop [nfc].
Differential Revision: https://reviews.llvm.org/D99968
Jonas Devlieghere [Tue, 6 Apr 2021 15:39:03 +0000 (08:39 -0700)]
[lldb] Fix bug where memory read --outfile is not truncating the file
The memory read --outfile command should truncate the output when unless
--append-outfile. Fix the bug and add a test.
rdar://
76062318
Differential revision: https://reviews.llvm.org/D99890
Julian Lettner [Tue, 6 Apr 2021 00:57:02 +0000 (17:57 -0700)]
[Sanitizer] Adopt Python 3 for iOS simulator test scripts
Differential Revision: https://reviews.llvm.org/D99911
Ben Langmuir [Tue, 23 Mar 2021 22:22:58 +0000 (15:22 -0700)]
[index] Improve macro indexing support
The major change here is to index macro occurrences in more places than
before, specifically
* In non-expansion references such as `#if`, `#ifdef`, etc.
* When the macro is a reference to a builtin macro such as __LINE__.
* When using the preprocessor state instead of callbacks, we now include
all definition locations and undefinitions instead of just the latest
one (which may also have had the wrong location previously).
* When indexing an existing module file (.pcm), we now include module
macros, and we no longer report unrelated preprocessor macros during
indexing the module, which could have caused duplication.
Additionally, we now correctly obey the system symbol filter for macros,
so by default in system headers only definition/undefinition occurrences
are reported, but it can be configured to report references as well if
desired.
Extends FileIndexRecord to support occurrences of macros. Since the
design of this type is to keep a single list of entities organized by
source location, we incorporate macros into the existing DeclOccurrence
struct.
Differential Revision: https://reviews.llvm.org/D99758
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, GVN] Fix use of var defined in CHECK-NOT
Commit
22ce5eb051591b828b1ce4238624b6e95d334a5b, changed checks in
GVN/big-endian.ll into CHECK-NOT. The intent was to check that a
succession of lines does not occur but each CHECK-NOT is checked
independently. In other word, one CHECK-NOT uses a variable defined
in a pattern (the one defining the variable) that should not occur in
the input. The bug was then copied over in NewGVN/big-endian.ll.
This commit only checks for the absence of i16 load which rules out the
presence of the whole sequence and does not involve an undefined
variable.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D99581
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[MLIR, test] Fix use of undef FileCheck var
MLIR test Transforms/canonicalize.mlir tries to check for the absence of
a sequence of instructions with several CHECK-NOT with one of those
directives using a variable defined in another. However CHECK-NOT are
checked independently so that is using a variable defined in a pattern
that should not occur in the input.
This commit removes the dependency between those CHECK-NOT by replacing
occurences of variables by the regex that were used to define them.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D99958
Victor Huang [Tue, 6 Apr 2021 14:58:39 +0000 (09:58 -0500)]
[AIX][TLS] Add support for TLS variables to XCOFF object writer
This patch adds support for TLS variables to the XCOFF object writer:
- Add TData and TBSS sections
- Add CsectGroups for the mapping classes XCOFF::XMC_TL and XCOFF::XMC_UL
- Add XMC_UL in the enum entry of CsectStorageMapping class to print the string
while reading the symbol properties for TLS variables
- Fix the starting address of TData and TBSS sections
Reviewed by: hubert.reinterpretcast, DiggerLin
Differential Revision: https://reviews.llvm.org/D98946
Simon Pilgrim [Tue, 6 Apr 2021 15:26:47 +0000 (16:26 +0100)]
[X86][SSE] canonicalizeShuffleWithBinOps - add MOVSD/MOVSS handling.
Nicolas Vasilache [Tue, 6 Apr 2021 15:23:47 +0000 (15:23 +0000)]
[mlir][Linalg] Fix fusion on tensors operands / bbArg mismatch
Linalg fusion on tensors has mismatching assumptions on the operand side than on the region bbArg side.
Relax the behavior on the operand/indexing map side so that we better support output operands that may also be read from.
Differential revision: https://reviews.llvm.org/D99499
Zbigniew Sarbinowski [Tue, 6 Apr 2021 15:17:06 +0000 (15:17 +0000)]
[SystemZ][z/OS] correct rc and errno within nanosleep()
This patch fixes rc and errno within nanosleep(). It also updates __rem parameter as well it introduces cast to handle conversions from long into unsigned int to avoid warnings.
Reviewed By: Mordante
Differential Revision: https://reviews.llvm.org/D99373
Philip Reames [Tue, 6 Apr 2021 15:32:13 +0000 (08:32 -0700)]
Move GCRelocateInst and GCResultInst to IntrinsicInst.h [nfc]
These two are part of the IntrinsicInst class hierarchy and it helps to cut down on some redundant includes.
Dan Liew [Tue, 30 Mar 2021 20:47:07 +0000 (13:47 -0700)]
[CMake][Compiler-rt] Make it possible to configure standalone compiler-rt without `LLVMConfig.cmake`.
Previously it wasn't possible to configure a standalone compiler-rt
build if the `LLVMConfig.cmake` file isn't present in a shipped
toolchain.
This patch adds a fallback behaviour for when `LLVMConfig.cmake` is not
available in the toolchain being used for configure. The fallback
behaviour mocks out the bare minimum required to make a configure
succeed when the host is Darwin. Support for other platforms could
be added in future patches.
The new code path is taken either in one of the following cases:
* `llvm-config` is not available.
* `llvm-config` is available but it provides an invalid path for the CMake files.
The motivation here is to be able to generate the compiler-rt lit test
suites for an arbitrary LLVM toolchain and then run the tests against
it.
The invocation to do this looks something like.
```
CC=/path/to/cc \
CXX=/path/to/c++ \
cmake \
-G Ninja \
-DLLVM_CONFIG_PATH=/path/to/llvm-config \
-DCOMPILER_RT_INCLUDE_TESTS=ON \
/path/to/llvm-project/compiler-rt
# Note we don't compile compiler-rt in this workflow.
bin/llvm-lit -v test/path/to/generated/test_suite
```
A possible alternative approach is to configure the
`cmake/modules/LLVMConfig.cmake.in` file in the LLVM source tree
and then include it. This approach was not taken because it is more
complicated.
An interesting side benefit of this patch is that it is now
possible to configure on Darwin without `llvm-config` being available
by configuring with `-DLLVM_CONFIG_PATH=""`. This moves us a step
closer to a world where no LLVM build artefacts are required to
build compiler-rt.
rdar://
76016632
Differential Revision: https://reviews.llvm.org/D99621
Dan Liew [Tue, 30 Mar 2021 19:50:59 +0000 (12:50 -0700)]
[CMake][Compiler-rt] Compute `LLVM_MAIN_SRC_DIR` assuming the monorepo
layout.
When doing a standalone compiler-rt build we currently rely on
getting information from the `llvm-config` binary. Previously
we would rely on calling `llvm-config --src-root` to find the
LLVM sources. Unfortunately the returned path could easily be wrong
if the sources were built on another machine.
Now that compiler-rt is part of a monorepo we can easily fix this
problem by finding the LLVM source tree next to `compiler-rt` in
the monorepo. We do this regardless of whether or not the `llvm-config`
binary is available which moves us one step closer to not requiring
`llvm-config` to be available.
To try avoid anyone breaking anyone who relies on the current behavior,
if the path assuming the monorepo layout doesn't exist we invoke
`llvm-config --src-root` to get the path. A deprecation warning is
emitted if this path is taken because we should remove this path
in the future given that other runtimes already assume the monorepo
layout.
We also now emit a warning if `LLVM_MAIN_SRC_DIR` does not exist.
The intention is that this should be a hard error in future but
to avoid breaking existing users we'll keep this as a warning
for now.
rdar://
76016632
Differential Revision: https://reviews.llvm.org/D99620
Thomas Preud'homme [Tue, 6 Apr 2021 12:57:28 +0000 (13:57 +0100)]
[MLIR, test] Fix use of undef FileCheck var
MLIR test Dialect/Linalg/tile-indexed-generic.mlir has a CHECK-NOT
directive referring to a variable only defined in a CHECK directive with
a different prefix, and thus undefined in the CHECK-NOT.
This commit removes the variable reference altogether to error on any
content it might have.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D99956
oToToT [Tue, 6 Apr 2021 15:21:19 +0000 (23:21 +0800)]
[clang][clangd] Avoid inconsistent target creation
As proposed in D97109, I tried to make target creation consistent in `clang` and `clangd` by replacing the original procedure with a single function introduced in D97493.
This also helps `clangd` works with CUDA, OpenMP, etc.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D98128
Erik Pilkington [Mon, 5 Apr 2021 23:23:27 +0000 (19:23 -0400)]
[ObjC] Add a command line flag that disables recognition of objc_direct for testability
Programmers would like to be able to test direct methods by calling them from a
different linkage unit or mocking them, both of which are impossible. This
patch adds a flag that effectively disables the attribute, which will fix this
when enabled in testable builds. rdar://
71190891
Differential revision: https://reviews.llvm.org/D95845
Konstantin Zhuravlyov [Tue, 6 Apr 2021 14:54:20 +0000 (10:54 -0400)]
AMDGPU: Add isBranch=1 to SOPP branch instructions
Differential Revision: https://reviews.llvm.org/D99955
Philip Reames [Tue, 6 Apr 2021 14:54:13 +0000 (07:54 -0700)]
Remove last remnants of PR49607 migration [NFC]
The key change (4f5e92c) to switch gc.result and gc.relocate to being readnone landed nearly two weeks ago, and we haven't seen any fallout. Time to remove the code added to make reverting easy.
Abhina Sreeskantharajan [Tue, 6 Apr 2021 14:48:40 +0000 (10:48 -0400)]
[Windows] Turn off text mode correctly in Rewriter to stop CRLF translation
I incorrectly changed the RewriteTestAction::ExecuteAction's file to binary instead of the proper RewriteIncludesAction::BeginSourceFileAction in https://reviews.llvm.org/rGbc5d4bcc2deb71ab647270c9754a83484b3d6f87. In the original commit, I actually changed RewriteIncludesAction::BeginSourceFileAction in https://reviews.llvm.org/rGfdb640ea30d416368b76b68b106deda580c6aced. This should fix the issue @aganea is facing.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D99837
Jan Svoboda [Tue, 6 Apr 2021 14:33:28 +0000 (16:33 +0200)]
Revert "[IR] Ignore bitcasts of function pointers which are only used as callees in callbase instruction"
This reverts commit
167ea67d
This causes a bunch of build failures:
* http://lab.llvm.org:8011/#/builders/121/builds/6287
* http://green.lab.llvm.org/green/job/clang-stage1-RA/19915
Benjamin Kramer [Tue, 6 Apr 2021 14:25:19 +0000 (16:25 +0200)]
Avoid unused variable warning in Release builds
Jay Foad [Tue, 6 Apr 2021 09:59:02 +0000 (10:59 +0100)]
[AMDGPU] SIFoldOperands: use MachineRegisterInfo::hasOneNonDBGUser
NFC.
Jay Foad [Tue, 6 Apr 2021 09:27:10 +0000 (10:27 +0100)]
[AMDGPU] SIFoldOperands: use range-based loops and make_early_inc_range
NFC.
Jay Foad [Wed, 31 Mar 2021 12:50:31 +0000 (13:50 +0100)]
[AMDGPU] SIFoldOperands: rename tryFoldInst to tryFoldCndMask
This follows the pattern of the other tryFold* functions. NFC.
Jay Foad [Wed, 31 Mar 2021 12:48:37 +0000 (13:48 +0100)]
[AMDGPU] SIFoldOperands: use getVRegDef instead of getUniqueVRegDef
We are in SSA so getVRegDef is equivalent but simpler. NFC.
Simon Pilgrim [Tue, 6 Apr 2021 14:21:34 +0000 (15:21 +0100)]
[llvm-symbolizer] Don't use the same 'OutputStyle' name for the enum type and instance. NFCI.
This was causing some buildbot problems, e.g. http://lab.llvm.org:8011/#/builders/110/builds/2306
Jay Foad [Tue, 6 Apr 2021 13:31:24 +0000 (14:31 +0100)]
[AMDGPU][SDag] Add IMG init also for image_gather4 instructions
This fixes an oversight in D99747 which moved the IMG init code from
SIAddIMGInit to AdjustInstrPostInstrSelection, but did not set the
hasPostISelHook flag on gather4 instructions.
Differential Revision: https://reviews.llvm.org/D99953
Kerry McLaughlin [Tue, 6 Apr 2021 12:28:14 +0000 (13:28 +0100)]
[LoopVectorize] Add strict in-order reduction support for fixed-width vectorization
Previously we could only vectorize FP reductions if fast math was enabled, as this allows us to
reorder FP operations. However, it may still be beneficial to vectorize the loop by moving
the reduction inside the vectorized loop and making sure that the scalar reduction value
be an input to the horizontal reduction, e.g:
%phi = phi float [ 0.0, %entry ], [ %reduction, %vector_body ]
%load = load <8 x float>
%reduction = call float @llvm.vector.reduce.fadd.v8f32(float %phi, <8 x float> %load)
This patch adds a new flag (IsOrdered) to RecurrenceDescriptor and makes use of the changes added
by D75069 as much as possible, which already teaches the vectorizer about in-loop reductions.
For now in-order reduction support is off by default and controlled with the `-enable-strict-reductions` flag.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D98435
Simon Pilgrim [Tue, 6 Apr 2021 13:42:30 +0000 (14:42 +0100)]
[InstCombine] Add PR38929 test case
Fold (~x & y) | ~(x | y) --> ~x
Simon Pilgrim [Tue, 6 Apr 2021 13:15:59 +0000 (14:15 +0100)]
[X86] Improve optimizeCompareInstr for signed comparisons after ANDN instructions
Extend D94856 to handle 'andn' instructions as well
Roman Lebedev [Tue, 6 Apr 2021 13:15:23 +0000 (16:15 +0300)]
[NFC][Clang] Speculative fix for builtins-ppc-quadword-noi128.c
Roman Lebedev [Tue, 6 Apr 2021 12:02:53 +0000 (15:02 +0300)]
[InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)
https://alive2.llvm.org/ce/z/67w-wQ
We prefer `add`s over `sub`, and this particular xform
allows further folds to happen:
Fixes https://bugs.llvm.org/show_bug.cgi?id=49858
Roman Lebedev [Tue, 6 Apr 2021 11:58:21 +0000 (14:58 +0300)]
[NFC][InstCombine] Add tests for '((X - Y) - Z)' pattern (PR49858)