Craig Topper [Fri, 12 Mar 2021 19:05:45 +0000 (11:05 -0800)]
[RISCV] Add test cases for failure to optimize select_cc with X < 1 or X > -1. NFC
We can use BGE with X0 to implement these, but we currently put
1 or -1 into a register.
Roman Lebedev [Fri, 12 Mar 2021 19:05:55 +0000 (22:05 +0300)]
[SCEV] Improve modelling for (null) pointer constants
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`,
we can try to improve SCEV's pointer handling.
In particular, i believe, i will need this in the future
to further fix `SCEVAddExpr`operation type handling.
This removes special handling of `ConstantPointerNull`
from `ScalarEvolution::createSCEV()`, and add constant folding
into `ScalarEvolution::getPtrToIntExpr()`.
This way, `null` constants stay as such in SCEV's,
but gracefully become zero integers when asked.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98147
Peter Steinfeld [Wed, 10 Mar 2021 16:23:26 +0000 (08:23 -0800)]
[flang] Make the symbol count used for collating symbols static
I changed the declaration of symbolCount_ in the type Symbols to be
static to avoid possible problems in the future when we might have
multiple objects of type Symbols. Thanks to Peter for pointing out the
need for this change.
Differential Revision: https://reviews.llvm.org/D98357
Craig Topper [Fri, 12 Mar 2021 18:25:43 +0000 (10:25 -0800)]
[RISCV] Add support for scalable vector masked load/store.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98460
Zahira Ammarguellat [Fri, 12 Mar 2021 18:23:19 +0000 (10:23 -0800)]
[NFC] Fix "unused parameter" error revealed in the Linux self-build.
Stanislav Mekhanoshin [Fri, 12 Mar 2021 17:19:46 +0000 (09:19 -0800)]
[AMDGPU] Fix -amdgpu-inline-arg-alloca-cost
Before D94153 this threshold was in a pre-scaled units.
After D94153 inlining threshold multiplier is not applied
to this portion of the threshold anymore. Restore the
threshold by applying the multiplier.
Differential Revision: https://reviews.llvm.org/D98362
Thomas Preud'homme [Thu, 11 Jun 2020 15:14:24 +0000 (16:14 +0100)]
[FileCheck] Add support for hex alternate form in FileCheck
Add printf-style alternate form flag to prefix hex number with 0x when
present. This works on both empty numeric expression (e.g. variable
definition from input) and when matching a numeric expression. The
syntax is as follows:
[[#%#<precision specifier><format specifier>, ...]
where <precision specifier> and <format specifier> are optional and ...
can be a variable definition or not with an empty expression or not.
This feature was requested in https://reviews.llvm.org/D81144#2075532
for llvm/test/MC/ELF/gen-dwarf64.s
Reviewed By: jdenny
Differential Revision: https://reviews.llvm.org/D97845
Alex Zinenko [Fri, 12 Mar 2021 11:19:47 +0000 (12:19 +0100)]
[mlir] fix a memory leak in NestedPattern
NestedPattern uses a BumpPtrAllocator to store child (nested) pattern
objects to decrease the overhead of dynamic allocation. This assumes all
allocations happen inside the allocator that will be freed as a whole.
However, NestedPattern contains `std::function` as a member, which
allocates internally using `new`, unaware of the BumpPtrAllocator. Since
NestedPattern only holds pointers to the nested patterns allocated in
the BumpPtrAllocator, it never calls their destructors, so the
destructor of the `std::function`s they contain are never called either,
leaking the allocated memory.
Make NestedPattern explicitly call destructors of nested patterns. This
additionally requires to actually copy the nested patterns in
copy-construction and copy-assignment instead of just sharing the
pointer to the arena-allocated list of children to avoid double-free. An
alternative solution would be to add reference counting to the list of
arena-allocated list of children.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D98485
serge-sans-paille [Fri, 12 Mar 2021 17:42:17 +0000 (18:42 +0100)]
[NFC] Use llvm::raw_string_ostream instead of std::stringstream
That's more efficient and we don't loose any valuable feature when doing so.
Yashaswini [Fri, 12 Mar 2021 17:22:21 +0000 (22:52 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.15.3.6 Reduction clause
Implementation of Reduction clause restriction checks.
Files:
flang/lib/Semantics/check-directive-structure.h
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h
flang/lib/Semantics/resolve-directives.cpp
Testcases:
flang/test/Semantics/omp-reduction01.f90
flang/test/Semantics/omp-reduction02.f90
flang/test/Semantics/omp-reduction03.f90
flang/test/Semantics/omp-reduction04.f90
flang/test/Semantics/omp-reduction05.f90
flang/test/Semantics/omp-reduction06.f90
flang/test/Semantics/omp-reduction07.f90
flang/test/Semantics/omp-reduction08.f90
flang/test/Semantics/omp-reduction09.f90
flang/test/Semantics/omp-reduction10.f90
flang/test/Semantics/omp-symbol08.f90
Reviewed by: Kiran Chandramohan @kiranchandramohan and Valentin Clement @clementval.
Differential Revision: https://reviews.llvm.org/D90697
Kadir Cetinkaya [Fri, 12 Mar 2021 08:36:06 +0000 (09:36 +0100)]
[clang] Mark re-injected tokens appropriately during pragma handling
This hides such tokens from TokenWatcher, preventing crashes in clients
trying to match spelled and expanded tokens.
Fixes https://github.com/clangd/clangd/issues/712
Differential Revision: https://reviews.llvm.org/D98483
Nico Weber [Fri, 12 Mar 2021 17:15:52 +0000 (12:15 -0500)]
[gn build] (manually) port
bcdd40f802a5
Anirudh Prasad [Fri, 12 Mar 2021 16:39:03 +0000 (11:39 -0500)]
[AsmParser][SystemZ][z/OS] Introducing HLASM Comment Syntax
- This patch adds in support for the ordinary HLASM comment syntax asm
statements (Reference - Chapter 7, Comment Statements, Ordinary Comment
Statements)
- In brief, the ordinary comment syntax if used, must begin with the "*"
character
- To achieve this, this patch makes use of the CommentString attribute
provided in the base MCAsmInfo class
- In the SystemZMCAsmInfo class, the CommentString attribute was set to
"*" based on the assembler dialect
- Furthermore, a new attribute RestrictCommentString, is provided to only
treat a string as a comment if it appears at the start of the asm
statement. Example: "jo *-4" is valid in HLASM (jump back 4 bytes from
current point - similar to jo -4 in gnu asm) and we don't want "*-4" to
be treated as a comment.
- RFC for HLASM Parser support implementation: https://lists.llvm.org/pipermail/llvm-dev/2021-January/147686.html
Reviewed By: scott.linder, Kai
Differential Revision: https://reviews.llvm.org/D97703
Nico Weber [Sun, 7 Mar 2021 02:13:52 +0000 (21:13 -0500)]
[lit] rewrap a few lines to 80 columns
No behavior change.
Christopher Di Bella [Fri, 12 Mar 2021 07:46:37 +0000 (23:46 -0800)]
[libcxx] adds concept std::regular
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97911
Reviewed By: EricWF, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D98154
Nemanja Ivanovic [Fri, 12 Mar 2021 15:19:58 +0000 (09:19 -0600)]
[PowerPC] Add more missing overloads to altivec.h
We are missing more predicate forms for 'vector double' and some
tests. This adds the missing overloads and completes the set of
test cases for them.
Dave Lee [Fri, 12 Mar 2021 16:47:55 +0000 (08:47 -0800)]
[lldb] Remove unused StackFrame::TrackGlobalVariable
Last used by the Go plugin which was removed in https://reviews.llvm.org/D54057.
Vy Nguyen [Fri, 12 Mar 2021 16:35:50 +0000 (11:35 -0500)]
Revert "Revert "[compiler-rt][asan] Make wild-pointer crash error more useful""
This reverts commit
c578508b5bb20ccce5e2a43dd2afc41a49afec74.
Reland now that unrelated crash has been resolved.
Simon Pilgrim [Fri, 12 Mar 2021 15:13:42 +0000 (15:13 +0000)]
[clang] Use Constant::getAllOnesValue helper. NFCI.
Avoid -1ULL which MSVC tends to complain about
Simon Pilgrim [Fri, 12 Mar 2021 14:42:20 +0000 (14:42 +0000)]
[X86][AVX] Insert zeros byte elements into 256/512-bit vectors using shuffle/and
Avoid extracting/inserting subvectors which makes it more difficult for shuffle combining to merge them together.
Simon Pilgrim [Fri, 12 Mar 2021 12:51:36 +0000 (12:51 +0000)]
[X86] Provide lighter weight getTargetShuffleMask wrapper. NFCI.
Most callers to getTargetShuffleMask don't use the IsUnary flag.
Nico Weber [Fri, 12 Mar 2021 15:02:17 +0000 (10:02 -0500)]
Revert "[IndirectCallPromotion] Don't strip ".__uniq." suffix when it strips"
This reverts commit
90dfbeef5982ecfb5523b48f3c301bea033e5c3d.
Causes PR49554. Also see comments on https://reviews.llvm.org/D98389
Simonas Kazlauskas [Wed, 10 Mar 2021 13:05:36 +0000 (15:05 +0200)]
Test cases for rem-seteq fold with illegal types
This also briefly tests a larger set of architectures than the more
exhaustive functionality tests for AArch64 and x86.
As requested in D88785
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D98339
Matt Arsenault [Sat, 6 Mar 2021 16:49:30 +0000 (11:49 -0500)]
GlobalISel: Fix marking byval arguments as immutable
byval arguments need to be assumed writable. Only implicitly stack
passed arguments which aren't addressable in the IR can be assumed
immutable.
Mips is still broken since for some reason its doing its own thing
with the ValueHandlers (and x86 doesn't actually handle byval
arguments now, although some of the code is there).
Matt Arsenault [Fri, 5 Mar 2021 22:28:32 +0000 (17:28 -0500)]
GlobalISel: Partially fix handling of byval arguments
This was essentially ignoring byval and treating them as a pointer
argument which needed to be loaded from. This should copy the frame
index value to the virtual register, not insert a load from the frame
index into the pointer value.
For AMDGPU, this was producing a load from the byval pointer argument,
to a pointer used for the byval arguments. I do not understand how
AArch64 managed to work before since it appears to be similarly
broken.
We could also change the ValueHandler API to avoid the extra copy from
the frame index, since currently it returns a new register.
I believe there is still an issue with outgoing byval arguments. These
should have a copy inserted in case the callee decided to overwrite
the memory.
Matt Arsenault [Sat, 6 Mar 2021 13:54:38 +0000 (08:54 -0500)]
AArch64/GlobalISel: Don't use common prefix in test
Unlike update_llc_test_checks, update_mir_test_checks isn't actually
smart enough to common functions with identical output.
Matt Arsenault [Wed, 3 Mar 2021 21:57:24 +0000 (16:57 -0500)]
AMDGPU/GlobalISel: Cleanup call lowering sequence
Now that handleAssignments is handling all of the argument splitting,
we don't have to move the insert point around.
serge-sans-paille [Fri, 12 Mar 2021 13:27:15 +0000 (14:27 +0100)]
[NFC] Use StringRef instead of const char* for AsmPrinter
This avoids calling strlen to repeatedly compute some string size.
Florian Hahn [Fri, 12 Mar 2021 13:31:48 +0000 (13:31 +0000)]
[LV] Fix name in CHECK pattern after
fb3ca7076
Florian Hahn [Fri, 12 Mar 2021 13:22:29 +0000 (13:22 +0000)]
[LV] Account IV recipes being uniform in VPTransformState::get().
This patch fixes a crash when trying to get a scalar value using
VPTransformState::get() for uniform induction values or truncated
induction values. IVs and truncated IVs can be uniform and the updated
code accounts for that, fixing the crash.
This should fix
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31981
Christian Sigg [Thu, 11 Mar 2021 07:34:53 +0000 (08:34 +0100)]
[mlir] Remove mlir-cuda-runner
Change CUDA integration tests to use mlir-opt + mlir-cpu-runner instead.
Depends On D98203
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D98396
Sanjay Patel [Fri, 12 Mar 2021 12:56:54 +0000 (07:56 -0500)]
[SimplifyCFG] avoid sinking insts within an infinite-loop
The test is reduced from a C source example in:
https://llvm.org/PR49541
It's possible that the test could be reduced further or
the predicate generalized further, but it seems to require
a few ingredients (including the "late" SimplifyCFG options
on the RUN line) to fall into the infinite-loop trap.
Stefan Gränitz [Fri, 12 Mar 2021 12:51:44 +0000 (13:51 +0100)]
[Orc] Fix race condition in DebugObjectManagerPlugin
During finalization the debug object is registered with the target. Materialization must wait for this process to finish. Otherwise we might start running code before the debugger finished processing the corresponding debug info.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D98417
Valeriy Savchenko [Wed, 10 Mar 2021 13:50:34 +0000 (16:50 +0300)]
[analyzer][solver] Prevent infeasible states (PR49490)
This patch fixes the situation when our knowledge of disequalities
can help us figuring out that some assumption is infeasible, but
the solver still produces a state with inconsistent constraints.
Additionally, this patch adds a couple of assertions to catch this
type of problems easier.
Differential Revision: https://reviews.llvm.org/D98341
Hans Wennborg [Fri, 12 Mar 2021 12:43:36 +0000 (13:43 +0100)]
Revert "[InstrProfiling] Don't generate __llvm_profile_runtime_user"
This broke the check-profile tests on Mac, see comment on the code
review.
> This is no longer needed, we can add __llvm_profile_runtime directly
> to llvm.compiler.used or llvm.used to achieve the same effect.
>
> Differential Revision: https://reviews.llvm.org/D98325
This reverts commit
c7712087cbb505d324e1149fa224f607c91a8c6a.
Also reverting the dependent follow-up commit:
Revert "[InstrProfiling] Generate runtime hook for ELF platforms"
> When using -fprofile-list to selectively apply instrumentation only
> to certain files or functions, we may end up with a binary that doesn't
> have any counters in the case where no files were selected. However,
> because on Linux and Fuchsia, we pass -u__llvm_profile_runtime, the
> runtime would still be pulled in and incur some non-trivial overhead,
> especially in the case when the continuous or runtime counter relocation
> mode is being used. A better way would be to pull in the profile runtime
> only when needed by declaring the __llvm_profile_runtime symbol in the
> translation unit only when needed.
>
> This approach was already used prior to
9a041a75221ca, but we changed it
> to always generate the __llvm_profile_runtime due to a TAPI limitation.
> Since TAPI is only used on Mach-O platforms, we could use the early
> emission of __llvm_profile_runtime there, and on other platforms we
> could change back to the earlier approach where the symbol is generated
> later only when needed. We can stop passing -u__llvm_profile_runtime to
> the linker on Linux and Fuchsia since the generated undefined symbol in
> each translation unit that needed it serves the same purpose.
>
> Differential Revision: https://reviews.llvm.org/D98061
This reverts commit
87fd09b25f8892e07b7ba11525baa9c3ec3e5d3f.
Aaron Ballman [Fri, 12 Mar 2021 12:21:03 +0000 (07:21 -0500)]
Add support for digit separators in C2x.
WG14 adopted N2626 at the meetings this week. This commit adds support
for using ' as a digit separator in a numeric literal which is
compatible with the C++ feature.
Simon Pilgrim [Fri, 12 Mar 2021 12:03:36 +0000 (12:03 +0000)]
[PPC] Fix UBSAN warning about out of range shift. NFCI.
Alex Richardson [Fri, 12 Mar 2021 11:15:17 +0000 (11:15 +0000)]
[builtins] Fix value of ARM_INEXACT
The existing value of 0x1000 sets the IXE bit (Inexact floating-point exception
trap enable), but we really want to be setting IXC, bit 4:
Inexact cumulative floating-point exception bit. This bit is set to 1 to
indicate that the Inexact floating-point exception has occurred since 0 was
last written to this bit.
Reviewed By: kongyi, peter.smith
Differential Revision: https://reviews.llvm.org/D98353
Simon Pilgrim [Fri, 12 Mar 2021 10:34:24 +0000 (10:34 +0000)]
[PPC] Fix static analyzer / UBSAN warnings about out of range shifts. NFCI.
Serguei Katkov [Fri, 12 Mar 2021 08:32:53 +0000 (15:32 +0700)]
Revert "Mark gc.relocate and gc.result as readnone"
As readnone function they become movable and LICM can hoist them
out of a loop. As a result in LCSSA form phi node of type token
is created. No one is ready that GCRelocate first operand is phi node
but expects to be token.
GVN test were also updated, it seems it does not do what is expected.
Test for LICM is also added.
This reverts commit
f352463ade6e49c3b0275f296d9190d828b7630b.
David Spickett [Tue, 2 Mar 2021 15:07:19 +0000 (15:07 +0000)]
[libcxx] Move Linaro 32 bit armv bots to buildkite
Instead of setting mcpu like the previous bots,
set the target triple.
Each config builds either Arm only or Thumb only
code. This gives us some coverage of thumb specific
issues.
The new agents on Linaro's side are running on v8 hardware
so will report arch "armv8l" just like the v8 bots.
(and buildkite can choose any of them for v7/v8 jobs)
Reviewed By: #libc, curdeius, Mordante
Differential Revision: https://reviews.llvm.org/D98019
Florian Hahn [Fri, 12 Mar 2021 09:33:12 +0000 (09:33 +0000)]
[Matrix] Add missing newline to appease sphinx.
Fraser Cormack [Mon, 8 Mar 2021 15:20:37 +0000 (15:20 +0000)]
[RISCV] Optimize INSERT_VECTOR_ELT sequences
This patch optimizes the codegen for INSERT_VECTOR_ELT in various ways.
Primarily, it removes the use of vslidedown during lowering, and the
vector element is inserted entirely using vslideup with a custom VL and
slide index.
Additionally, lowering of i64-element vectors on RV32 has been optimized
in several ways. When the 64-bit value to insert is the same as the
sign-extension of the lower 32-bits, the codegen can follow the regular
path. When this is not possible, a new sequence of two i32 vslide1up
instructions is used to get the vector element into a vector. This
sequence was suggested by @craig.topper. From there, the value is slid
into the final position for more consistent lowering across RV32 and
RV64.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98250
Fraser Cormack [Thu, 11 Mar 2021 09:33:47 +0000 (09:33 +0000)]
[RISCV] Fix up stale VECREDUCE comments. NFC.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98399
Anton Zabaznov [Fri, 5 Mar 2021 13:23:49 +0000 (16:23 +0300)]
[OpenCL] Refactor diagnostic for OpenCL extension/feature
There is no need to check for enabled pragma for core or optional core features,
thus this check is removed
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D97058
Alex Zinenko [Thu, 11 Mar 2021 10:27:00 +0000 (11:27 +0100)]
[mlir] fix memory leak on failure path in parser
Forward references to blocks lead to `Block`s being allocated in the
parser, but they are not necessarily included into a region if parsing
fails, leading to a leak. Clean them up in parser destructor.
Reviewed By: rriddle, mehdi_amini
Differential Revision: https://reviews.llvm.org/D98403
Bjorn Pettersson [Tue, 9 Mar 2021 21:05:41 +0000 (22:05 +0100)]
[InstSimplify] Simplify smul.fix and smul.fix.sat
Add simplification of smul.fix and smul.fix.sat according to
X * 0 -> 0
X * undef -> 0
X * (1 << scale) -> X
This includes the commuted patterns and splatted vectors.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D98299
Bjorn Pettersson [Thu, 11 Mar 2021 10:38:36 +0000 (11:38 +0100)]
[ConstantFold] Handle undef/poison when constant folding smul_fix/smul_fix_sat
Do constant folding according to
posion * C -> poison
C * poison -> poison
undef * C -> 0
C * undef -> 0
for smul_fix and smul_fix_sat intrinsics (for any scale).
Reviewed By: nikic, aqjune, nagisa
Differential Revision: https://reviews.llvm.org/D98410
Marius Brehler [Mon, 8 Mar 2021 21:34:48 +0000 (22:34 +0100)]
[mlir] Fix ConstantOp verifier
This restricts the attributes to integers for constants of type
IndexType. So far an attribute like StringAttr as in
%c1 = constant "" : index
is valid.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D98216
Christopher Di Bella [Fri, 12 Mar 2021 03:49:27 +0000 (19:49 -0800)]
[libcxx] adds concept std::semiregular
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97443
Reviewed By: Quuxplusone, EricWF, #libc
Differential Revision: https://reviews.llvm.org/D97911
Johannes Doerfert [Fri, 12 Mar 2021 05:47:19 +0000 (23:47 -0600)]
Revert "[OpenMP] Do not propagate match extensions to nested contexts"
Two tests failed for some reason, need to investigate:
https://lab.llvm.org/buildbot/#/builders/109/builds/10399
This reverts commit
ad9e98b8efa0138559eb640023695dab54967a8d.
Johannes Doerfert [Fri, 12 Mar 2021 05:47:10 +0000 (23:47 -0600)]
Revert "[OpenMP] Introduce the `disable_selector_propagation` variant selector trait"
Need to revert
ad9e98b8efa0138559eb640023695dab54967a8d which this
commit depends on.
This reverts commit
f771ef7b5f0ed260d00931cd50e6fe462edbacaf.
Johannes Doerfert [Tue, 5 Jan 2021 22:55:54 +0000 (16:55 -0600)]
[Attributor] Derive `willreturn` based on `mustprogress`
Since D86233 we have `mustprogress` which, in combination with
`readonly`, implies `willreturn`. The idea is that every side-effect
has to be modeled as a "write". Consequently, `readonly` means there
is no side-effect, and `mustprogress` guarantees that we cannot "loop"
forever without side-effect.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D94125
Johannes Doerfert [Fri, 12 Mar 2021 05:21:32 +0000 (23:21 -0600)]
[Attributor][NFC] Update tests after D94741
The update_test_checks script can now check for global symbols and is able
to handle them properly when they differ across prefixes, e.g.,
attribute #0 might be different in different runs.
This patch simply updates all the Attributor tests with the new script.
Reviewed By: sstefan1
Differential Revision: https://reviews.llvm.org/D97906
Johannes Doerfert [Wed, 10 Feb 2021 20:04:37 +0000 (14:04 -0600)]
[OpenMP][NFC] Use `AsyncInfo` as the variable name for a `__tgt_async_info`
Reviewed By: grokos, tianshilei1992
Differential Revision: https://reviews.llvm.org/D96444
Johannes Doerfert [Sat, 30 Jan 2021 20:46:58 +0000 (14:46 -0600)]
[OpenMP][DeviceRTL] Extract shuffle idiom and port it to declare variant
The shuffle idiom is differently implemented in our supported targets.
To reduce the "target_impl" file we now move the shuffle idiom in it's
own self-contained header that provides the implementation for AMDGPU
and NVPTX. A fallback can be added later on.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D95752
Johannes Doerfert [Sun, 31 Jan 2021 17:32:29 +0000 (11:32 -0600)]
[OpenMP] Introduce the `disable_selector_propagation` variant selector trait
Nested `omp [begin|end] declare variant` inherit the selectors from
surrounding `omp (begin|end) declare variant` constructs. To stop such
propagation the user can add the `disable_selector_propagation` to the
`extension` set in the `implementation` selector.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D95765
Johannes Doerfert [Sun, 31 Jan 2021 06:37:56 +0000 (00:37 -0600)]
[OpenMP] Do not propagate match extensions to nested contexts
If we have nested declare variant context, it doesn't make sense to
inherit the match extension from the parent. Instead, just skip it.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D95764
Johannes Doerfert [Fri, 15 Jan 2021 03:13:23 +0000 (21:13 -0600)]
[Utils] Check for more global information in update_test_checks
This allows to check for various globals (metadata/attributes/...) and
also resolves problems with globals (metadata/attributes/...) being
reused across different prefixes.
Reviewed By: sstefan1
Differential Revision: https://reviews.llvm.org/D94741
Johannes Doerfert [Thu, 11 Mar 2021 19:43:09 +0000 (13:43 -0600)]
[FIX] Allow non-constant assume operand bundle operands.
Fixes PR49545
Reviewed By: zequanwu, fhahn, lebedev.ri
Differential Revision: https://reviews.llvm.org/D98444
Sriraman Tallam [Fri, 12 Mar 2021 04:05:37 +0000 (20:05 -0800)]
Disable unique linkage suffixes ifor global vars until demanglers can be fixed.
D96109 added support for unique internal linkage names for both internal
linkage functions and global variables. There was a lot of discussion on how to
get the demangling right for functions but I completely missed the point that
demanglers do not support suffixes for global vars. For example:
$ c++filt _ZL3foo
foo
$ c++filt _ZL3foo.uniq.123
_ZL3foo.uniq.123
The demangling for functions works as expected.
I am not sure of the impact of this. I don't understand how debuggers and other
tools depend on the correctness of global variable demangling so I am
pre-emptively disabling it until we can get the demangling support added.
Importantly, uniquefying global variables is not needed right now as we do not
do profile attribution to global vars based on sampling. It was added for
completeness and so this feature is not exactly missed.
Differential Revision: https://reviews.llvm.org/D98392
Esme-Yi [Fri, 12 Mar 2021 04:42:19 +0000 (04:42 +0000)]
[Debug-Info] Add names for the debug line prologue.
Summary: This is a minor patch to add names for the debug line prologue, as a follow-up of D95998.
Reviewed By: dblaikie, ikudrin, shchenz
Differential Revision: https://reviews.llvm.org/D98383
Siva Chandra Reddy [Fri, 12 Mar 2021 04:06:08 +0000 (20:06 -0800)]
[libc][NFC] Move the template implementation of integer_abs to __support.
This eliminates cross-header dependency from stdlib to string.
Craig Topper [Fri, 12 Mar 2021 00:21:42 +0000 (16:21 -0800)]
[RISCV] Return false from isShuffleMaskLegal except for splats.
We don't support any other shuffles currently.
This changes the bswap/bitreverse tests that check for this in
their expansion code. Previously we expanded a byte swapping
shuffle through memory. Now we're scalarizing and doing bit
operations on scalars to swap bytes.
In the future we can probably use vrgather.vx to do a byte swap
shuffle.
Christopher Di Bella [Fri, 12 Mar 2021 03:30:55 +0000 (19:30 -0800)]
[libcxx] adds concept std::copyable
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97359
Reviewed By: EricWF, #libc, Quuxplusone, zoecarver
Differential Revision: https://reviews.llvm.org/D97443
Christopher Di Bella [Fri, 12 Mar 2021 02:54:57 +0000 (18:54 -0800)]
[libcxx] adds concept std::movable
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97162
Reviewed By: EricWF, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D97359
Yonghong Song [Thu, 11 Mar 2021 20:28:04 +0000 (12:28 -0800)]
BPF: provide better error message for unsupported atomic operations
Currently, BPF backend does not support all variants of
atomic_load_{add,and,or,xor}, atomic_swap and atomic_cmp_swap
For example, it only supports 32bit (with alu32 mode) and 64bit
operations for atomic_load_{and,or,xor}, atomic_swap and
atomic_cmp_swap. Due to historical reason, atomic_load_add is
always supported with 32bit and 64bit.
If user used an unsupported atomic operation, currently,
codegen selectiondag cannot find bpf support and will issue
a fatal error. This is not user friendly as user may mistakenly
think this is a compiler bug.
This patch added Custom rule for unsupported atomic operations
and will emit better error message during ReplaceNodeResults()
callback. The following is an example output.
$ cat t.c
short sync(short *p) {
return __sync_val_compare_and_swap (p, 2, 3);
}
$ clang -target bpf -O2 -g -c t.c
t.c:2:11: error: Unsupported atomic operations, please use 64 bit version
return __sync_val_compare_and_swap (p, 2, 3);
^
fatal error: error in backend: Cannot select: t19: i64,ch =
AtomicCmpSwap<(load store seq_cst seq_cst 2 on %ir.p)> t0, t2,
Constant:i64<2>, Constant:i64<3>, t.c:2:11
t2: i64,ch = CopyFromReg t0, Register:i64 %0
t1: i64 = Register %0
t11: i64 = Constant<2>
t10: i64 = Constant<3>
In function: sync
PLEASE submit a bug report ...
Fatal error will still happen since we did not really do proper
lowering for these unsupported atomic operations. But we do get
a much better error message.
Differential Revision: https://reviews.llvm.org/D98471
Vy Nguyen [Fri, 12 Mar 2021 03:06:37 +0000 (22:06 -0500)]
Revert "[compiler-rt][asan] Make wild-pointer crash error more useful"
This reverts commit
f65e1aee4004c25fbeacd5024de1d17f0a7ebc5c.
Jonas Paulsson [Thu, 4 Mar 2021 20:55:41 +0000 (14:55 -0600)]
[libFuzzer] Add attribute noinline on Fuzzer::ExecuteCallback().
The inlining of this function needs to be disabled as it is part of the
inpsected stack traces. It's string representation will look different
depending on if it was inlined or not which will cause it's string comparison
to fail.
When it was inlined in only one of the two execution stacks,
minimize_two_crashes.test failed on SystemZ. For details see
https://bugs.llvm.org/show_bug.cgi?id=49152.
Reviewers: Ulrich Weigand, Matt Morehouse, Arthur Eubanks
Differential Revision: https://reviews.llvm.org/D97975
Carl Ritson [Fri, 12 Mar 2021 01:02:06 +0000 (10:02 +0900)]
[AMDGPU] Do not annotate an else branch if there is a kill
As llvm.amdgcn.kill is lowered to a terminator it can cause
else branch annotations to end up in the wrong block.
Do not annotate conditionals as else branches where there is
a kill to avoid this.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D97427
Vy Nguyen [Tue, 9 Mar 2021 19:54:42 +0000 (14:54 -0500)]
[compiler-rt][asan] Make wild-pointer crash error more useful
Right now, when you have an invalid memory address, asan would just crash and does not offer much useful info.
This patch attempted to give a bit more detail on the access.
Differential Revision: https://reviews.llvm.org/D98280
Mircea Trofin [Fri, 12 Mar 2021 02:29:01 +0000 (18:29 -0800)]
Revert "[NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes"
This reverts commit
5eaeb0fa67e57391f5584a3f67fdb131e93afda6.
It appears there are analyses that assume clearing - example:
https://lab.llvm.org/buildbot#builders/36/builds/5964
Andrzej Hunt [Fri, 12 Mar 2021 02:11:56 +0000 (18:11 -0800)]
[compiler-rt] PR#39514 Support versioned llvm-symbolizer binaries
Some linux distributions produce versioned llvm-symbolizer binaries,
e.g. my llvm-11 installation puts the symbolizer binary at
/usr/bin/llvm-symbolizer-11.0.0 . However if you then try to run
a binary containing ASAN with
ASAN_SYMBOLIZER_PATH=..../llvm-symbolizer-FOO , it will fail on startup
with "isn't a known symbolizer".
Although it is possible to work around this by setting up symlinks,
that's kindof ugly - supporting versioned binaries is a nicer solution.
(There are now multiple stack overflow and blog posts talking about
this exact issue :) .)
Originally added in:
https://reviews.llvm.org/D8285
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D97682
Sergei Grechanik [Fri, 12 Mar 2021 02:07:07 +0000 (18:07 -0800)]
[mlir][Vector] Lowering of transfer_read/write to vector.load/store
This patch introduces progressive lowering patterns for rewriting
vector.transfer_read/write to vector.load/store and vector.broadcast
in certain supported cases.
Reviewed By: dcaballe, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D97822
Mircea Trofin [Thu, 11 Mar 2021 18:43:16 +0000 (10:43 -0800)]
[NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes
Check with the analysis result by calling invalidate instead of clear on
the analysis manager.
Differential Revision: https://reviews.llvm.org/D98440
David Blaikie [Fri, 12 Mar 2021 01:51:31 +0000 (17:51 -0800)]
void cast to suppress -Wunused-variable in non-asserts build
David Blaikie [Fri, 12 Mar 2021 01:35:10 +0000 (17:35 -0800)]
Move (llvm-original-di-preservation) test example output into the Inputs directory (since it's an input to the test execution)
The "Inputs" subdirectory is used for all files read by the test, not
only those used as input to the execution - so even though this file is
used as a golden reference for the output of the test, it's still an
input to the test execution (it is read in the process of executing the
test).
Sergei Grechanik [Fri, 12 Mar 2021 00:56:26 +0000 (16:56 -0800)]
[NFC] Test commit. Add empty lines.
Maksim Panchenko [Fri, 12 Mar 2021 00:49:12 +0000 (16:49 -0800)]
[RuntimeDyld] Speedup resolution of relocations to external symbols
From what I can tell, the loop inside applyExternalSymbolRelocations()
used to call getSymbolAddress(). After the JITSymbolResolver interface
redesign, the functionality has changed, and the loop should no longer
trigger repopulation of ExternalSymbolRelocations. If that's the case,
there is no need to update the loop iterator manually, and
ExternalSymbolRelocations can be cleared at once. This way, when there
are many external symbols in the program, the function runs much faster.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97531
Emily Shi [Thu, 11 Mar 2021 21:59:41 +0000 (13:59 -0800)]
[asan] disable no-fd test on darwin
If a log message is triggered between execv and child, this test fails.
In the meantime, disable the test to unblock CI
rdar://
74992832
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D98453
Carl Ritson [Fri, 12 Mar 2021 00:47:08 +0000 (09:47 +0900)]
[AMDGPU] Restrict image_msaa_load to MSAA dimension types
This instruction is only valid on 2D MSAA and 2D MSAA Array
surfaces. Remove intrinsic support for other dimension types,
and block assembly for unsupported dimensions.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D98397
Mehdi Amini [Fri, 12 Mar 2021 00:12:50 +0000 (00:12 +0000)]
Replace use of OperationState with builder::create in GPU Kernel Outlining (NFC)
OperationState is a low level API that is rarely indicated, the builder
API convenient wrapper is preferred when possible.
Ruiling Song [Tue, 9 Mar 2021 14:05:21 +0000 (22:05 +0800)]
[AMDGPU] Don't check hasStackObjects() when reserving VGPR
We have amdgpu_gfx functions that have high register pressure. If
we do not reserve VGPR for SGPR spill, we will fall into the path
to spill the SGPR to memory, which does not only have correctness issue,
but also have really bad performance.
I don't know why there is the check for hasStackObjects(), in our case,
we don't have stack objects at the time of finalizeLowering(). So just
remove the check that we always reserve a VGPR for possible SGPR spill
in non-entry functions.
Reviewed by: arsenm
Differential Revision: https://reviews.llvm.org/D98345
Ruiling Song [Wed, 10 Mar 2021 13:48:22 +0000 (21:48 +0800)]
[AMDGPU] Free reserved VGPR if no SGPR spill
I met some code generation behavior change when I tried to remove
the hasStackObject() check when reserving VGPR for SGPR spill.
For example, the function `callee_no_stack_no_fp_elim_all` in the lit
test file `callee-frame-setup.ll`.
The generated code changed from:
```
s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
s_mov_b32 s4, s33
s_mov_b32 s33, s32
s_mov_b32 s33, s4
s_setpc_b64 s[30:31]
```
into something like:
```
s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
v_writelane_b32 v63, s33, 0
s_mov_b32 s33, s32
v_readlane_b32 s33, v63, 0
s_setpc_b64 s[30:31]
```
I think we still prefer the old version where only scalar instructions are needed.
The idea here is free the reserved VGPR if no SGPR spills. So we will very likely
to use a free SGPR for fp/sp spill.
Reviewed by: arsenm
Differential Revision: https://reviews.llvm.org/D98344
Aaron Green [Fri, 12 Mar 2021 00:00:53 +0000 (16:00 -0800)]
[crt][fuzzer] Fix up various numeric conversions
Attempting to build a standalone libFuzzer in Fuchsia's default toolchain for the purpose of cross-compiling the unit tests revealed a number of not-quite-proper type conversions. Fuchsia's toolchain include `-std=c++17` and `-Werror`, among others, leading to many errors like `-Wshorten-64-to-32`, `-Wimplicit-float-conversion`, etc.
Most of these have been addressed by simply making the conversion explicit with a `static_cast`. These typically fell into one of two categories: 1) conversions between types where high precision isn't critical, e.g. the "energy" calculations for `InputInfo`, and 2) conversions where the values will never reach the bits being truncated, e.g. `DftTimeInSeconds` is not going to exceed 136 years.
The major exception to this is the number of features: there are several places that treat features as `size_t`, and others as `uint32_t`. This change makes the decision to cap the features at 32 bits. The maximum value of a feature as produced by `TracePC::CollectFeatures` is roughly:
(NumPCsInPCTables + ValueBitMap::kMapSizeInBits + ExtraCountersBegin() - ExtraCountersEnd() + log2(SIZE_MAX)) * 8
It's conceivable for extremely large targets and/or extra counters that this limit could be reached. This shouldn't break fuzzing, but it will cause certain features to collide and lower the fuzzers overall precision. To address this, this change adds a warning to TracePC::PrintModuleInfo about excessive feature size if it is detected, and recommends refactoring the fuzzer into several smaller ones.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D97992
Craig Topper [Thu, 11 Mar 2021 23:42:04 +0000 (15:42 -0800)]
[RISCV] Add test cases for fixed vector bitreverse, bswap, ctlz, cttz, and ctpop.
Codegen needs to be improved, but I wanted to check for crashes.
David Blaikie [Thu, 11 Mar 2021 23:42:54 +0000 (15:42 -0800)]
Fix use of deprecated IRBuilder::CreateLoad in Kaleidoscope
Diego Caballero [Wed, 10 Mar 2021 18:39:39 +0000 (20:39 +0200)]
Reland: [mlir][Affine][Vector] Add initial support for 'iter_args' to Affine vectorizer.
This patch adds support for vectorizing loops with 'iter_args' when those loops
are not a vector dimension. This allows vectorizing outer loops with an inner
'iter_args' loop (e.g., reductions). Vectorizing scenarios where 'iter_args'
loops are vector dimensions would require more work (e.g., analysis,
generating horizontal reduction, etc.) not included in this patch.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D97892
Reid Kleckner [Thu, 11 Mar 2021 21:53:14 +0000 (13:53 -0800)]
[PDB] Improve warning for corrupt debug info
The S_[GL]PROC32_ID symbol records are supposed to point to function ID
records. If they don't, they are corrupt. The warning message here was
very technical, but a user has encountered it in the wild. Add some more
information and some more testing.
Florian Hahn [Thu, 11 Mar 2021 21:54:52 +0000 (21:54 +0000)]
[Matrix] Add support for matrix-by-scalar division.
This patch extends the matrix spec to allow matrix-by-scalar division.
Originally support for `/` was left out to avoid ambiguity for the
matrix-matrix version of `/`, which could either be elementwise or
specified as matrix multiplication M1 * (1/M2).
For the matrix-scalar version, no ambiguity exists; `*` is also
an elementwise operation in that case. Matrix-by-scalar division
is commonly supported by systems including Matlab, Mathematica
or NumPy.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D97857
Diego Caballero [Wed, 10 Mar 2021 18:11:16 +0000 (20:11 +0200)]
Reland: [mlir][Vector][Affine] Improve affine vectorizer algorithm
This patch replaces the root-terminal vectorization approach implemented in the
Affine vectorizer with a topological order approach that vectorizes all the
operations within the target loop nest. These are the most important changes
introduced by the new algorithm:
* Removed tracking of root and terminal ops. Existing vectorization
functionality is preserved and extended so that loop nests without
root-terminal chains can be vectorized.
* Vectorizing a loop nest now only requires a single topological traversal.
* A new vector loop nest is incrementally built along the vectorization
process. The original scalar loop is kept intact. No cloning guard is needed
to recover the scalar loop if vectorization fails. This approach also
simplifies the challenging task of replacing a loop operation amid the
vectorization process without invalidating the analysis information that
depends on the original loop.
* Vectorization of specific operations has been implemented as independent,
preparing them to be moved to a potential vectorization interface.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D97442
Stanislav Mekhanoshin [Thu, 11 Mar 2021 21:54:19 +0000 (13:54 -0800)]
[AMDGPU] Remove dead MTBUF patterns
These patterns are obviously dead, they are using format
operand which is not selected and we have no corresponding
SelectMUBUF() function.
Differential Revision: https://reviews.llvm.org/D98451
Jianzhou Zhao [Thu, 11 Mar 2021 20:02:58 +0000 (20:02 +0000)]
[dfsan] Disable testing origin tracking on non x86_64 arch
Fix test cases related to https://reviews.llvm.org/D95835.
Martin Storsjö [Thu, 11 Mar 2021 20:35:20 +0000 (22:35 +0200)]
[compiler-rt] Partially revert
8bd2722f65cfd7883ed9769f7bad3ff50e4c6905
Don't normalize arm architecture names; doing that loses the ability
to pick the right implementation of builtins for each architecture
variant. When building compiler-rt builtins as part of a
runtimes build, builtins for multiple armv* variants could be built
in the same directory, and with the simplified architecture name,
they'd all be built in the same directory, overlapping each other.
Nikita Popov [Thu, 11 Mar 2021 20:31:46 +0000 (21:31 +0100)]
[Attributor] Don't access pointer elem type in constructPointer (NFC)
Splitting this out as the change is non-trivial: The way this code
handled pointer types doesn't really make sense, as GEPs can only
apply an offset to the outermost pointer, but can't drill down
into interior pointer types (which would require dereferencing
memory).
Instead give special treatment to the first (pointer) index.
I've hardcoded it to zero as that's the only way the function is
used right now, but handling non-zero indexes would be
straightforward.
The original goal here was to have an element type for CreateGEP.
Petr Hosek [Fri, 5 Mar 2021 09:17:42 +0000 (01:17 -0800)]
[InstrProfiling] Generate runtime hook for ELF platforms
When using -fprofile-list to selectively apply instrumentation only
to certain files or functions, we may end up with a binary that doesn't
have any counters in the case where no files were selected. However,
because on Linux and Fuchsia, we pass -u__llvm_profile_runtime, the
runtime would still be pulled in and incur some non-trivial overhead,
especially in the case when the continuous or runtime counter relocation
mode is being used. A better way would be to pull in the profile runtime
only when needed by declaring the __llvm_profile_runtime symbol in the
translation unit only when needed.
This approach was already used prior to
9a041a75221ca, but we changed it
to always generate the __llvm_profile_runtime due to a TAPI limitation.
Since TAPI is only used on Mach-O platforms, we could use the early
emission of __llvm_profile_runtime there, and on other platforms we
could change back to the earlier approach where the symbol is generated
later only when needed. We can stop passing -u__llvm_profile_runtime to
the linker on Linux and Fuchsia since the generated undefined symbol in
each translation unit that needed it serves the same purpose.
Differential Revision: https://reviews.llvm.org/D98061
Weiwei Li [Thu, 11 Mar 2021 20:03:25 +0000 (15:03 -0500)]
Test commit
Valery N Dmitriev [Thu, 11 Mar 2021 19:16:29 +0000 (11:16 -0800)]
[SLP] Fix crash when matching associative reduction for integer min/max.
Associative reduction matcher in SLP begins with select instruction but when
it reached call to llvm.umax (or alike) via def-use chain the latter also matched
as UMax kind. The routine's later code assumes matched instruction to be a select
and thus it merely died on the first encountered cast that did not fit.
Differential Revision: https://reviews.llvm.org/D98432
Marek Kurdej [Thu, 11 Mar 2021 19:49:14 +0000 (20:49 +0100)]
[libc++] [docs] Add link to clang status page for C++2b and fix anchor for C++20.
River Riddle [Thu, 11 Mar 2021 19:24:43 +0000 (11:24 -0800)]
[mlir][StorageUniquer] Properly call the destructor on non-trivially destructible storage instances
This allows for storage instances to store data that isn't uniqued in the context, or contain otherwise non-trivial logic, in the rare situations that they occur. Storage instances with trivial destructors will still have their destructor skipped. A consequence of this is that the storage instance definition must be visible from the place that registers the type.
Differential Revision: https://reviews.llvm.org/D98311