Fraser Cormack [Mon, 24 May 2021 14:24:54 +0000 (15:24 +0100)]
[VP][SelectionDAG] Add a target-configurable EVL operand type
This patch adds a way for the target to configure the type it uses for
the explicit vector length operands of VP SDNodes. The type must be a
legal integer type (there is still no target-independent legalization of
this operand) and must currently be at least as big as i32, the type
used by the IR intrinsics. An implicit zero-extension takes place on
targets which choose a larger type. All VP nodes should be created with
this type used for the EVL operand.
This allows 64-bit RISC-V to avoid custom legalization of all VP nodes,
keeping them in their target-independent form for that bit longer.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D103027
Mats Petersson [Fri, 30 Apr 2021 13:13:55 +0000 (14:13 +0100)]
[OpenMP]Add support for workshare loop modifier in lowering
When lowering the dynamic, guided, auto and runtime types of scheduling,
there is an optional monotonic or non-monotonic modifier. This patch
adds support in the OMP IR Builder to pass this down to the runtime
functions.
Also implements tests for the variants.
Differential Revision: https://reviews.llvm.org/D102008
Aaron Ballman [Thu, 27 May 2021 14:25:39 +0000 (10:25 -0400)]
Hopefully fix the Clang sphinx doc build.
This was broken several days ago in
826905787ae4c8540bb8a2384fac59c606c7eaff.
Erich Keane [Thu, 27 May 2021 14:19:20 +0000 (07:19 -0700)]
Correct the 'KEYALL' mask.
It should technically be a 1, since we are only setting the first bit.
Jamie Schmeiser [Thu, 27 May 2021 14:19:13 +0000 (10:19 -0400)]
Reuse temporary files for print-changed=diff
Summary:
Make the file name and descriptors static so that they are reused by
print-changed=diff. This avoids errors about being unable to create
temporary files when doing the later comparisons in a large compile.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D100116
Erich Keane [Fri, 23 Apr 2021 15:22:35 +0000 (08:22 -0700)]
Reimplement __builtin_unique_stable_name-
The original version of this was reverted, and @rjmcall provided some
advice to architect a new solution. This is that solution.
This implements a builtin to provide a unique name that is stable across
compilations of this TU for the purposes of implementing the library
component of the unnamed kernel feature of SYCL. It does this by
running the Itanium mangler with a few modifications.
Because it is somewhat common to wrap non-kernel-related lambdas in
macros that aren't present on the device (such as for logging), this
uniquely generates an ID for all lambdas involved in the naming of a
kernel. It uses the lambda-mangling number to do this, except replaces
this with its own number (starting at 10000 for readabililty reasons)
for lambdas used to name a kernel.
Additionally, this implements itself as constexpr with a slight catch:
if a name would be invalidated by the use of this lambda in a later
kernel invocation, it is diagnosed as an error (see the Sema tests).
Differential Revision: https://reviews.llvm.org/D103112
Aaron Ballman [Thu, 27 May 2021 13:54:09 +0000 (09:54 -0400)]
Speculatively fix this harder and with improved spelling capabilities.
Aaron Ballman [Thu, 27 May 2021 13:48:43 +0000 (09:48 -0400)]
Speculatively fix a -Woverloaded-virtual diagnostic; NFC
Matt Arsenault [Tue, 18 May 2021 22:22:09 +0000 (18:22 -0400)]
AMDGPU/GlobalISel: Lower constant-32-bit zextload/sextload consistently
We were accidentally leaning on code in lowerLoad which expands
extending loads which should be removed.
Matt Arsenault [Tue, 18 May 2021 21:02:25 +0000 (17:02 -0400)]
AMDGPU/GlobalISel: Remove redundant parameter from function
Aaron Ballman [Thu, 27 May 2021 13:23:20 +0000 (09:23 -0400)]
Fix -Wswitch warning; NFC
Fraser Cormack [Wed, 26 May 2021 15:04:59 +0000 (16:04 +0100)]
[DAGCombine][RISCV] Don't try to trunc-store combined vector stores
DAGCombine's `mergeStoresOfConstantsOrVecElts` optimization is told
whether it's to use vector types and also whether it's to issue a
truncating store. However, the truncating store code path assumes a
scalar integer `ConstantSDNode`, and when using vector types it creates
either a `BUILD_VECTOR` or `CONCAT_VECTORS` to store: neither of which
is a constant.
The `riscv64` target is able to expose a crash here because it switches
on both code paths at the same time. The `f32` is stored as `i32` which
must be promoted to `i64`, necessitating a truncating store.
It also decides later that it prefers a vector store of `v2f32`.
While vector truncating stores are legal, this combine is not able to
emit them. We also don't have a test case. This patch adds an assert to
catch this case more gracefully, and updates one of the caller functions
to the function to turn off the use of truncating stores when preferring
vectors.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103173
Fraser Cormack [Thu, 13 May 2021 16:34:29 +0000 (17:34 +0100)]
[RISCV] Allow passing fixed-length vectors via the stack
The vector calling convention dictates that when the vector argument
registers are exhaused, GPRs are used to pass the address via the stack.
When the GPRs themselves are exhausted, at best we would previously
crash with an assertion, and at worst we'd generate incorrect code.
This patch addresses this issue by passing fixed-length vectors via the
stack with their full fixed-length size and aligned to their element
type size. Since the calling convention lowering can't yet handle
scalable vector types, this patch adds a fatal error to make it clear
that we are lacking in this regard.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D102422
Florian Hahn [Thu, 27 May 2021 12:53:33 +0000 (13:53 +0100)]
[VPlan] Do not sink uniform recipes in sinkScalarOperands.
For uniform ReplicateRecipes, only the first lane should be used, so
sinking them would mean we have to compute the value of the first lane
multiple times. Also, at the moment, sinking them causes a crash because
the value of the first lane is re-used by all users.
Reported post-commit for D100258.
Aaron Ballman [Thu, 27 May 2021 12:41:00 +0000 (08:41 -0400)]
Add support for #elifdef and #elifndef
WG14 adopted N2645 and WG21 EWG has accepted P2334 in principle (still
subject to full EWG vote + CWG review + plenary vote), which add
support for #elifdef as shorthand for #elif defined and #elifndef as
shorthand for #elif !defined. This patch adds support for the new
preprocessor directives.
Nicolas Vasilache [Thu, 27 May 2021 12:19:39 +0000 (12:19 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for subtensor (5/n)
This revision refactors and simplifies the pattern detection logic: thanks to SSA value properties, we can actually look at all the uses of a given value and avoid having to pattern-match specific chains of operations.
A bufferization pattern for subtensor is added and specific inplaceability analysis is implemented for the simple case of subtensor. More advanced use cases will follow.
Differential revision: https://reviews.llvm.org/D102512
Simon Giesecke [Thu, 20 May 2021 08:04:33 +0000 (08:04 +0000)]
Add --quiet option to llvm-gsymutil to suppress output of warnings.
Differential Revision: https://reviews.llvm.org/D102829
Mats Petersson [Thu, 27 May 2021 12:07:20 +0000 (13:07 +0100)]
Revert "[OpenMP]Add support for workshare loop modifier in lowering"
This reverts commit
ea4c5fb04c6d9618d451fb2d2c360dc95c6d9131.
Pushpinder Singh [Thu, 27 May 2021 10:55:38 +0000 (10:55 +0000)]
[AMDGPU][Libomptarget][NFC] Remove atmi_mem_place_t
This struct was used to specify the device on which memory was
being allocated/free in atmi_malloc/free. It has now been replaced
with int DeviceId.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D103239
Mats Petersson [Fri, 30 Apr 2021 13:13:55 +0000 (14:13 +0100)]
[OpenMP]Add support for workshare loop modifier in lowering
When lowering the dynamic, guided, auto and runtime types of scheduling,
there is an optional monotonic or non-monotonic modifier. This patch
adds support in the OMP IR Builder to pass this down to the runtime
functions.
Also implements tests for the variants.
Differential Revision: https://reviews.llvm.org/D102008
David Green [Thu, 27 May 2021 11:20:19 +0000 (12:20 +0100)]
[ARM] Extra test for reverted WLS memset. NFC
Max Sagebaum [Thu, 27 May 2021 11:10:45 +0000 (13:10 +0200)]
[clang-format] [NFC] realign documentation in Format.h...
... and ClanfFormatStyleOptions.rst for EmptyLineAfterAccessModifier
Differential-Revision: https://reviews.llvm.org/D102989
Benjamin Kramer [Thu, 27 May 2021 10:31:00 +0000 (12:31 +0200)]
Add triples to a bunch of x86-specific tests that currently fail on PPC
James Henderson [Wed, 26 May 2021 11:04:24 +0000 (12:04 +0100)]
[lit][test] Improve testing of use_llvm_tool
Reviewed by: MaskRay
Differential Revision: https://reviews.llvm.org/D103154
Florian Hahn [Thu, 27 May 2021 09:54:08 +0000 (10:54 +0100)]
[Matrix] Include matrix pipeline for new PM in new-pm-defaults.ll.
-enable-matrix just adds a single pass, so it's easier to just check in
new-pm-default.ll rather than duplicating the full checks for -O3 with
the new pass manager.
Suggested post-commit by @aeubanks.
Fraser Cormack [Wed, 26 May 2021 09:54:35 +0000 (10:54 +0100)]
[SelectionDAG][RISCV] Don't unroll 0/1-type bool VSELECTs
This patch extends the cases in which the legalizer is able to express
VSELECT in terms of XOR/AND/OR. When dealing with a VSELECT between
boolean vector types, the mask itself is an all-ones or all-ones value
of the operand type, so a 0/1 boolean type behaves identically to a 0/-1
type.
This greatly helps RISC-V which relies on expansion for these nodes. It
also allows scalable-vector bool VSELECTs to use the default expansion,
where before it would crash in SelectionDAG::UnrollVectorOp.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103147
Sebastian Neubauer [Wed, 26 May 2021 16:50:19 +0000 (18:50 +0200)]
[AMDGPU][GlobalISel] Allow amdgpu_gfx calling conv
Calling functions from shaders already works with the SelectionDAG.
Differential Revision: https://reviews.llvm.org/D103183
Matthias Springer [Thu, 27 May 2021 08:26:45 +0000 (17:26 +0900)]
[mlir] Support dialect-wide canonicalization pattern registration
* Add `hasCanonicalizer` option to Dialect.
* Initialize canonicalizer with dialect-wide canonicalization patterns.
* Add test case to TestDialect.
Dialect-wide canonicalization patterns are useful if a canonicalization pattern does not conceptually associate with any single operation, i.e., it should not be registered as part of an operation's `getCanonicalizationPatterns` function. E.g., this is the case for canonicalization patterns that match an op interface.
Differential Revision: https://reviews.llvm.org/D103226
Max Kazantsev [Thu, 27 May 2021 08:18:30 +0000 (15:18 +0700)]
[NFCI][LoopDeletion] Do not call complex analysis for known non-zero BTC
Max Kazantsev [Thu, 27 May 2021 08:01:20 +0000 (15:01 +0700)]
[NFC] Reuse existing variables instead of re-requesting successors
Amara Emerson [Thu, 20 May 2021 04:35:05 +0000 (21:35 -0700)]
[GlobalISel] Implement splitting of G_SHUFFLE_VECTOR.
Thhis is a port from the DAG legalization. We're still missing some of the
canonicalizations of shuffles but it's a start.
Differential Revision: https://reviews.llvm.org/D102828
Alexander Belyaev [Thu, 27 May 2021 06:59:05 +0000 (08:59 +0200)]
[mlir] Add TestLinalgDistribution.cpp to cmake build.
Fangrui Song [Thu, 27 May 2021 06:57:32 +0000 (23:57 -0700)]
[docs] llvm-objdump: Mention -M no-aliases is supported on AArch64
Alexander Belyaev [Wed, 26 May 2021 18:22:49 +0000 (20:22 +0200)]
[mlir] Add a pass to distribute linalg::TiledLoopOp.
Differential Revision: https://reviews.llvm.org/D103194
Max Kazantsev [Thu, 27 May 2021 06:20:57 +0000 (13:20 +0700)]
[NFCI] Lazily evaluate SCEVs of PHIs
Eager evaluation has cost of compile time. Only query them if they are
required for proving predicates.
Max Kazantsev [Thu, 27 May 2021 05:50:54 +0000 (12:50 +0700)]
[NFC] Formatting fix
Max Kazantsev [Thu, 27 May 2021 04:47:30 +0000 (11:47 +0700)]
[NFCI][LoopDeletion] Only query SCEV about loop successor if another successor is also in loop
Esme-Yi [Thu, 27 May 2021 04:53:14 +0000 (04:53 +0000)]
[llvm-objdump] Print the DEBUG type under `--section-headers`.
Summary: Under the option --section-headers, we can only
print the section types of TEXT, DATA, and BSS for now.
This patch adds the DEBUG type.
Reviewed By: jhenderson, Higuoxing
Differential Revision: https://reviews.llvm.org/D102603
LLVM GN Syncbot [Thu, 27 May 2021 04:42:56 +0000 (04:42 +0000)]
[gn build] Port
857fa7b7b187
LLVM GN Syncbot [Thu, 27 May 2021 04:42:55 +0000 (04:42 +0000)]
[gn build] Port
0dc7fd1bc167
Christopher Di Bella [Sun, 16 May 2021 01:39:22 +0000 (01:39 +0000)]
[libcxx][iterator] adds `std::ranges::prev`
Implements part of P0896 'The One Ranges Proposal'.
Implements [range.iter.op.prev].
Depends on D102563.
Differential Revision: https://reviews.llvm.org/D102564
Christopher Di Bella [Sat, 8 May 2021 05:02:43 +0000 (05:02 +0000)]
[libcxx][iterator] adds `std::ranges::next`
Implements part of P0896 'The One Ranges Proposal'.
Implements [range.iter.op.next].
Depends on D101922.
Differential Revision: https://reviews.llvm.org/D102563
Hasyimi Bahrudin [Thu, 27 May 2021 04:01:20 +0000 (04:01 +0000)]
Fix non-global-value-max-name-size not considered by LLParser
`non-global-value-max-name-size` is used by `Value` to cap the length of local value name. However, this flag is not considered by `LLParser`, which leads to unexpected `use of undefined value error`. The fix is to move the responsibility of capping the length to `ValueSymbolTable`.
The test is the one provided by [[ https://bugs.llvm.org/show_bug.cgi?id=45899 | Mikael in the bug report ]].
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D102707
Haowei Wu [Thu, 27 May 2021 00:45:03 +0000 (17:45 -0700)]
[Fuchsia][CMake] Add missing include path.
This patch adds include path for missing header files from "sync".
This patch also fixes the build failures caused by scudo.
Differential Revision: https://reviews.llvm.org/D103218
Yevgeny Rouban [Thu, 27 May 2021 02:01:55 +0000 (09:01 +0700)]
[RS4GC] Introduce intrinsics to get base ptr and offset
There can be a need for some optimizations to get (base, offset)
for any GC pointer. The base can be calculated by generating
needed instructions as it is done by the
RewriteStatepointsForGC::findBasePointer() function. The offset
can be calculated in the same way. Though to not expose the base
calculation and to make the offset calculation as simple as
ptrtoint(derived_ptr) - ptrtoint(base_ptr), which is illegal
outside RS4GC, this patch introduces 2 intrinsics:
@llvm.experimental.gc.get.pointer.base(%derived_ptr)
@llvm.experimental.gc.get.pointer.offset(%derived_ptr)
These intrinsics are inlined by RS4GC along with generation of
statepoint sequences.
With these new intrinsics the GC parseable lowering for atomic
memcpy intrinsics (
6ec2c5e402a724ba99bce82a9cac7a3006d660f4)
could be implemented as a separate pass.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D100445
Zahira Ammarguellat [Thu, 20 May 2021 19:37:26 +0000 (12:37 -0700)]
The compiler is crashing when compiling a coroutine intrinsic without
the use of the option fcoroutines-ts. This is a patch to fix this.
Fix for https://bugs.llvm.org/show_bug.cgi?id=50406
Jessica Paquette [Thu, 27 May 2021 00:49:04 +0000 (17:49 -0700)]
Fix unit test after
324af79dbc6066
Needed to add in an extra parameter to calls to `libcall`.
Lang Hames [Wed, 26 May 2021 21:00:41 +0000 (14:00 -0700)]
[ORC-RT] Add endianness support to the ORC runtime.
endian.h is a cut-down version of llvm/Support/SwapByteOrder.h. It will be used
in upcoming serialization utilities for the ORC runtime.
Jessica Paquette [Tue, 25 May 2021 23:54:20 +0000 (16:54 -0700)]
[GlobalISel] Don't emit lost debug location remarks when legalizing tail calls
There were a bunch of lost debug location remarks that show up when legalizing
tail calls on AArch64.
This would happen because we drop the return in the block where we emit the
tail call. So, we end up dropping the debug location, which makes the
LostDebugLocObserver report a missing debug location.
Although it's *true* that we lose these debug locations, this isn't
a particularly useful remark. We expect to drop these debug locations when
emitting tail calls. Suppressing remarks in this case is preferable, since the
amount of noise could hide actual debug location related bugs.
To do this, I just plumbed the LostDebugLocObserver through the relevant
LegalizerHelper functions. This is the only case I can think of where we need
the LostDebugLocObserver in the LegalizerHelper. So, rather than storing it
in the LegalizerHelper proper and mucking around with the constructors, I
figured it'd be cleanest to take the simplest path for now.
This clears up ~20 noisy lost debug location remarks on CTMark in AArch64 at
-Os.
Differential Revision: https://reviews.llvm.org/D103128
Sriraman Tallam [Thu, 27 May 2021 00:12:31 +0000 (17:12 -0700)]
Emit correct location lists with basic block sections.
This patch addresses multiple things:
1) It ensures that const_value is emitted when possible with basic block
sections.
2) It emits location lists such that the labels are always within the
section boundary.
3) It fixes a bug when the parameter is first used in a non-entry block
which is in a different section from the entry block.
Differential Revision: https://reviews.llvm.org/D85085
Amara Emerson [Wed, 26 May 2021 23:32:42 +0000 (16:32 -0700)]
[AArch64][GlobalISel] Legalize non-power-of-2 vector elements for G_STORE.
The rules were already there, it just needed re-ordering so the odd case didn't
bail out too early.
Mitch Phillips [Wed, 26 May 2021 23:51:43 +0000 (16:51 -0700)]
Revert "[scudo] Build scudo_standalone on Android and Fuchsia."
This reverts commit
2fe987e6bacea8884a397041c13a38e8ba97c2d6.
Broke the Android buildbots. Turns out a couple more tweaks are
necessary to turn them back on.
Frank Laub [Fri, 21 May 2021 01:52:53 +0000 (01:52 +0000)]
[MLIR] Add support for empty IVs to affine.parallel
Allow support for specifying empty IVs in an `affine.parallel`.
For example:
```
affine.parallel () = () to () {
affine.yield
}
```
Reviewed By: bondhugula, jbruestle
Differential Revision: https://reviews.llvm.org/D102895
Krzysztof Parzyszek [Sat, 22 May 2021 18:36:41 +0000 (13:36 -0500)]
[Hexagon] Restore handling of expanding shuffles
Fixed bugs, added testcases. The byte-unpack is actually recognized by
the DAG combiner, but the halfword-unpack it not.
Philip Reames [Wed, 26 May 2021 22:51:16 +0000 (15:51 -0700)]
[tests] Add some basic coverage of multiple exit unrolling
Mitch Phillips [Wed, 26 May 2021 22:29:26 +0000 (15:29 -0700)]
[scudo] Build scudo_standalone on Android and Fuchsia.
This should be fine now, and is necessary for D102543.
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D103200
harsh-nod [Wed, 26 May 2021 22:18:32 +0000 (15:18 -0700)]
[mlir] Add n-D vector lowering to LLVM for cast ops
The casting ops (sitofp, uitofp, fptosi, fptoui) lowering currently does
not handle n-D vectors. This patch fixes that.
Differential Revision: https://reviews.llvm.org/D103207
Matt Morehouse [Wed, 26 May 2021 22:14:37 +0000 (15:14 -0700)]
Revert "Refactor mutation strategies into a standalone library"
This reverts commit
c4a41cd77c15c2905ac74beeec09f8343a65a549 due to
buildbot failure.
Aart Bik [Wed, 26 May 2021 19:44:33 +0000 (12:44 -0700)]
[mlir][python] Provide "all passes" registration module in Python
Currently, passes are registered on a per-dialect basis, which
provides the smallest footprint obviously. But for prototyping
and experimentation, a convenience "all passes" module is provided,
which registers all known MLIR passes in one run.
Usage in Python:
import mlir.all_passes_registration
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D103130
Walter Erquinigo [Wed, 26 May 2021 21:30:48 +0000 (14:30 -0700)]
[lldb] Fix gnu_libstdcpp's update methods
The variable.rst documentation says:
```
If it returns a value, and that value is True, LLDB will be allowed to cache the children and the children count it previously obtained, and will not return to the provider class to ask. If nothing, None, or anything other than True is returned, LLDB will discard the cached information and ask. Regardless, whenever necessary LLDB will call update.
```
However, several update methods in gnu_libstdcpp.py were returning True,
which made lldb unaware of any changes in the corresponding objects.
This problem was visible by lldb-vscode in the following way:
- If a breakpoint is hit and there's a vector with the contents {1, 2},
it'll be displayed correctly.
- Then the user steps and the next stop contains the vector modified.
The program changed it to {1, 2, 3}
- frame var then displays {1, 2} incorrectly, due to the caching caused
by the update method
It's worth mentioning that none of libcxx.py'd update methods return True. Same for LibCxxVector.cpp, which returns false.
Added a very simple test that fails without this fix.
Differential Revision: https://reviews.llvm.org/D103209
Matt Morehouse [Wed, 26 May 2021 21:38:27 +0000 (14:38 -0700)]
[libFuzzer] Add missing FuzzerBuiltinsMsvc.h include.
Should fix the Windows build.
zoecarver [Wed, 26 May 2021 19:00:03 +0000 (12:00 -0700)]
[libcxx][nfc] Fix the ASAN bots: update expected.pass.cpp.
Ensures that `get_return_object`'s return type is the same as the return type for the function calling `co_return`. Otherwise, we try to construct an object, then free it, then return it.
Differential Revision: https://reviews.llvm.org/D103196
naromero77 [Wed, 26 May 2021 20:54:16 +0000 (15:54 -0500)]
[flang][docs] Initial documentation for the Fortran LLVM Test Suite.
Describes how to run the Fortran LLVM Test Suite, specifically the external SPEC CPU 2017 Fortran tests.
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D102877
Fangrui Song [Wed, 26 May 2021 20:35:31 +0000 (13:35 -0700)]
[AArch64] Support llvm-mc/llvm-objdump -M no-aliases
This enables the no-aliases forms of many instructions.
Depends on D103004
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D103005
zoecarver [Wed, 26 May 2021 20:28:32 +0000 (13:28 -0700)]
[libcxx][docs] Take mutex for common_iterator, common_view, and empty_view.
Aaron Green [Tue, 25 May 2021 19:04:12 +0000 (12:04 -0700)]
Refactor mutation strategies into a standalone library
This change introduces libMutagen/libclang_rt.mutagen.a as a subset of libFuzzer/libclang_rt.fuzzer.a. This library contains only the fuzzing strategies used by libFuzzer to produce new test inputs from provided inputs, dictionaries, and SanitizerCoverage feedback.
Most of this change is simply moving sections of code to one side or the other of the library boundary. The only meaningful new code is:
* The Mutagen.h interface and its implementation in Mutagen.cpp.
* The following methods in MutagenDispatcher.cpp:
* UseCmp
* UseMemmem
* SetCustomMutator
* SetCustomCrossOver
* LateInitialize (similar to the MutationDispatcher's original constructor)
* Mutate_AddWordFromTORC (uses callbacks instead of accessing TPC directly)
* StartMutationSequence
* MutationSequence
* DictionaryEntrySequence
* RecommendDictionary
* RecommendDictionaryEntry
* FuzzerMutate.cpp (which now justs sets callbacks and handles printing)
* MutagenUnittest.cpp (which adds tests of Mutagen.h)
A note on performance: This change was tested with a 100 passes of test/fuzzer/LargeTest.cpp with 1000 runs per pass, both with and without the change. The running time distribution was qualitatively similar both with and without the change, and the average difference was within 30 microseconds (2.240 ms/run vs 2.212 ms/run, respectively). Both times were much higher than observed with the fully optimized system clang (~0.38 ms/run), most likely due to the combination of CMake "dev mode" settings (e.g. CMAKE_BUILD_TYPE="Debug", LLVM_ENABLE_LTO=OFF, etc.). The difference between the two versions built similarly seems to be "in the noise" and suggests no meaningful performance degradation.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D102447
Rahman Lavaee [Wed, 26 May 2021 20:12:36 +0000 (13:12 -0700)]
[llvm-readobj] Optimize printing stack sizes to linear time.
Currently, each function name lookup is a linear iteration over all symbols defined in the object file which makes the total running time quadratic.
This patch optimizes the function name lookup by populating an **address to index** map upon the first function name lookup which is used to lookup each function name in O(1).
**impact**: For the clang binary built with `-fstack-size-section`, this improves the running time of `llvm-readobj --stack-size` from 7 minutes to 0.25 seconds.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D103072
Craig Topper [Wed, 26 May 2021 18:51:32 +0000 (11:51 -0700)]
[RISCV] Use X0 as destination of inserted vsetvli when possible.
We aren't going to connect the result to anything so we might
as well avoid allocating a register.
Reviewed By: frasercrmck, HsiangKai
Differential Revision: https://reviews.llvm.org/D102031
Jessica Clarke [Wed, 26 May 2021 20:03:18 +0000 (21:03 +0100)]
[RISCV][NFC] Fix some whitespace nits in MC test RUN lines
Jacob Hegna [Wed, 26 May 2021 19:13:21 +0000 (12:13 -0700)]
Update documentation for InlineModel features.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D103193
Louis Dionne [Tue, 25 May 2021 21:35:35 +0000 (17:35 -0400)]
[libc++] Add a job testing on GCC 11
I'm adding the job as a soft-fail for now, but once all the tests have
been fixed to work on it, we'll switch over from GCC 10 to GCC 11 and
remove the soft-fail.
Differential Revision: https://reviews.llvm.org/D103116
Louis Dionne [Wed, 26 May 2021 19:44:52 +0000 (15:44 -0400)]
[pstl] Workaround more errors in the test suite
Sjoerd Meijer [Wed, 26 May 2021 19:15:29 +0000 (20:15 +0100)]
[CostModel][AArch64] Add floating point arithmetic tests. NFC.
Jeremy Morse [Wed, 26 May 2021 18:53:33 +0000 (19:53 +0100)]
[DebugInstrRef][1/3] Track PHI values through register allocation
This patch introduces "DBG_PHI" instructions, a marker of where a PHI
instruction used to be, before PHI elimination. Under the instruction
referencing model, we want to know where every value in the function is
defined -- and a PHI, even if implicit, is such a place.
Just like instruction numbers, we can use this to identify a value to be
used as a variable value, but we don't need to know what instruction
defines that value, for example:
bb1:
DBG_PHI $rax, 1
[... more insts ... ]
bb2:
DBG_INSTR_REF 1, 0, !1234, !DIExpression()
This specifies that on entry to bb1, whatever value is in $rax is known
as value number one -- and the later DBG_INSTR_REF marks the position
where variable !1234 should take on value number one.
PHI locations are stored in MachineFunction for the duration of the
regalloc phase in the DebugPHIPositions map. The map is populated by
PHIElimination, and then flushed back into the instruction stream by
virtregrewriter. A small amount of maintenence is needed in
LiveDebugVariables to account for registers being split, but only for
individual positions, not for entire ranges of blocks.
Differential Revision: https://reviews.llvm.org/D86812
Louis Dionne [Wed, 26 May 2021 19:24:31 +0000 (15:24 -0400)]
[pstl] Fix -Wundef errors in the test suite
Jon Chesterfield [Wed, 26 May 2021 18:57:48 +0000 (19:57 +0100)]
[libomptarget][nfc][amdgpu] Factor out setting upper bounds
Refactor suggested in D103037 to help avoid similar copy-paste errors.
Change is mechanical. Some parts of this would be more robust with unsigned.
Reviewed By: dhruvachak
Differential Revision: https://reviews.llvm.org/D103090
Roman Lebedev [Wed, 26 May 2021 13:55:06 +0000 (16:55 +0300)]
[NFC][Codegen][X86] Add a few more interleaved load/store patterns w/ i16 element type
Matching the costmodel coverage.
We want them both because they simplify coming up with the patterns
to check their cost, and to track their codegen.
Tests for loads can be fully autogenerated: https://godbolt.org/z/o1fncqo9n
For stores, however, i have done that semi-manually: https://godbolt.org/z/KPzTnvsh1
Roman Lebedev [Wed, 26 May 2021 12:45:10 +0000 (15:45 +0300)]
[NFC][X86][Costmodel] Add some more interleaved load/store test with i16 element type
Not sure if even larger interleaving factors are needed,
but these are what i have seen being queried in the wild.
Philip Reames [Wed, 26 May 2021 18:51:17 +0000 (11:51 -0700)]
[SCEV] Compute trip multiple for multiple exit loops
This patch implements getSmallConstantTripMultiple(L) correctly for multiple exit loops. The previous implementation was both imprecise, and violated the specified behavior of the method. This was fine in practice, because it turns out the function was both dead in real code, and not tested for the multiple exit case.
Differential Revision: https://reviews.llvm.org/D103189
Heejin Ahn [Fri, 21 May 2021 19:12:44 +0000 (12:12 -0700)]
[WebAssembly] Add TargetInstrInfo::getCalleeOperand
DwarfDebug unconditionally assumes for all call instructions the 0th
operand is the callee operand, which seems to be true for other targets,
but not for WebAssembly. This adds `TargetInstrInfo::getCallOperand`
method whose default implementation returns `getOperand(0)` and makes
WebAssembly overrides it to use its own utility method to get the callee
operand.
This also fixes an existing bug in `WebAssembly::getCalleeOp`, which was
uncovered by this CL.
Reviewed By: dschuff, djtodoro
Differential Revision: https://reviews.llvm.org/D102978
Heejin Ahn [Wed, 26 May 2021 15:46:03 +0000 (08:46 -0700)]
[SimplifyCFG] Use make_early_inc_range() while deleting instructions
We are deleting `phi` nodes within the for loop, so this makes sure we
increment the iterator before we delete the instruction pointed by the
iterator.
This started to break in
https://github.com/llvm/llvm-project/commit/
a0be08164622bf938855ff5d19dd8e9d0c96b9b3.
Reviewed By: dschuff, lebedev.ri
Differential Revision: https://reviews.llvm.org/D103181
Stanislav Mekhanoshin [Wed, 26 May 2021 18:02:23 +0000 (11:02 -0700)]
[AMDGPU] Fix kernel LDS lowering for constants
There is a trivial but severe bug in the recent code collecting
LDS globals used by kernel. It aborts scan on the first constant
without scanning further uses. That leads to LDS overallocation
with multiple kernels in certain cases.
Differential Revision: https://reviews.llvm.org/D103190
Dmitry Preobrazhensky [Wed, 26 May 2021 18:30:15 +0000 (21:30 +0300)]
[AMDGPU][MC][GFX90A] Corrected DS_GWS opcodes
Corrected DS_GWS opcodes to use even aligned registers.
Differential Revision: https://reviews.llvm.org/D103185
Jon Chesterfield [Wed, 26 May 2021 18:25:24 +0000 (19:25 +0100)]
[libomptarget][nfc][amdgpu] Refactor uses of KernelInfoTable
Suggested in D103059. Use a single lookup instead of two, more const, less mutation.
Reviewed By: dhruvachak
Differential Revision: https://reviews.llvm.org/D103093
Philip Reames [Wed, 26 May 2021 18:16:11 +0000 (11:16 -0700)]
[SCEV] Generalize getSmallConstantTripCount(L) for multiple exit loops
This came up in review for another patch, see https://reviews.llvm.org/D102982#2782407 for full context.
I've reviewed the callers to make sure they can handle multiple exit loops w/non-zero returns. There's two cases in target cost models where results might change (Hexagon and PowerPC), but the results looked legal and reasonable. If a target maintainer wishes to back out the effect of the costing change, they should explicitly check for multiple exit loops and handle them as desired.
Differential Revision: https://reviews.llvm.org/D103182
thomasraoux [Wed, 26 May 2021 17:28:45 +0000 (10:28 -0700)]
[mlir] Make StripDebugInfo strip out block arguments locs
Differential Revision: https://reviews.llvm.org/D103187
Mitch Phillips [Wed, 26 May 2021 17:50:26 +0000 (10:50 -0700)]
Revert "[Scudo] Make -fsanitize=scudo use standalone. Migrate tests."
This reverts commit
6911114d8cbed06a8a809c34ae07f4e3e89ab252.
Broke the QEMU sanitizer bots due to a missing header dependency. This
actually needs to be fixed on the bot-side, but for now reverting this
patch until I can fix up the bot.
Fangrui Song [Wed, 26 May 2021 17:43:32 +0000 (10:43 -0700)]
[llvm-mc] Add -M to replace -riscv-no-aliases and -riscv-arch-reg-names
In objdump, many targets support `-M no-aliases`. Instead of having a
`-*-no-aliases` for each target when LLVM adds the support, it makes more sense
to introduce objdump style `-M`.
-riscv-arch-reg-names is removed. -riscv-no-aliases has too many uses and thus is retained for now.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D103004
Philip Reames [Wed, 26 May 2021 17:40:25 +0000 (10:40 -0700)]
[SCEV] Add a utility for converting from "exit count" to "trip count"
(Mostly as a logical place to put a comment since this is a reoccuring confusion.)
Craig Topper [Wed, 26 May 2021 17:23:30 +0000 (10:23 -0700)]
[RISCV] Optimize SEW=64 shifts by splat on RV32.
SEW=64 shifts only uses the log2(64) bits of shift amount. If we're
splatting a 64 bit value in 2 parts, we can avoid splatting the
upper bits and just let the low bits be sign extended. They won't
be read anyway.
For the purposes of SelectionDAG semantics of the generic ISD opcodes,
if hi was non-zero or bit 31 of the low is 1, the shift was already
undefined so it should be ok to replace high with sign extend of low.
In order do be able to find the split i64 value before it becomes
a stack operation, I added a new ISD opcode that will be expanded
to the stack spill in PreprocessISelDAG. This new node is conceptually
similar to BuildPairF64, but I expanded earlier so that we could
go through regular isel to get the right VLSE opcode for the LMUL.
BuildPairF64 is expanded in a CustomInserter.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D102521
Philip Reames [Wed, 26 May 2021 17:08:53 +0000 (10:08 -0700)]
[SCEV] Extract out a helper for computing trip multiples
Mitch Phillips [Wed, 26 May 2021 17:03:10 +0000 (10:03 -0700)]
[Scudo] Make -fsanitize=scudo use standalone. Migrate tests.
This patch moves -fsanitize=scudo to link the standalone scudo library,
rather than the original compiler-rt based library. This is one of the
major remaining roadblocks to deleting the compiler-rt based scudo,
which should not be used any more. The standalone Scudo is better in
pretty much every way and is much more suitable for production usage.
As well as patching the litmus tests for checking that the
scudo_standalone lib is linked instead of the scudo lib, this patch also
ports all the scudo lit tests to run under scudo standalone.
This patch also adds a feature to scudo standalone that was under test
in the original scudo - that arguments passed to an aligned operator new
were checked that the alignment was a power of two.
Some lit tests could not be migrated, due to the following issues:
1. Features that aren't supported in scudo standalone, like the rss
limit.
2. Different quarantine implementation where the test needs some more
thought.
3. Small bugs in scudo standalone that should probably be fixed, like
the Secondary allocator having a full page on the LHS of an allocation
that only contains the chunk header, so underflows by <= a page aren't
caught.
4. Slight differences in behaviour that's technically correct, like
'realloc(malloc(1), 0)' returns nullptr in standalone, but a real
pointer in old scudo.
5. Some tests that might be migratable, but not easily.
Tests that are obviously not applicable to scudo standalone (like
testing that no sanitizer symbols made it into the DSO) have been
deleted.
After this patch, the remaining work is:
1. Update the Scudo documentation. The flags have changed, etc.
2. Delete the old version of scudo.
3. Patch up the tests in lit-unmigrated, or fix Scudo standalone.
Reviewed By: cryptoad, vitalybuka
Differential Revision: https://reviews.llvm.org/D102543
Jessica Clarke [Wed, 26 May 2021 16:59:10 +0000 (17:59 +0100)]
[RISCV] Remove --riscv-no-aliases from RVV tests
This serves no useful purpose other than to clutter things up. Diff
summary as the real diff is extremely unwieldy:
24844 -; CHECK-NEXT: jalr zero, 0(ra)
24844 +; CHECK-NEXT: ret
8 -; CHECK-NEXT: vl4re8.v v28, (a0)
8 +; CHECK-NEXT: vl4r.v v28, (a0)
64 -; CHECK-NEXT: vl8re8.v v24, (a0)
64 +; CHECK-NEXT: vl8r.v v24, (a0)
392 -; RUN: --riscv-no-aliases < %s | FileCheck %s
392 +; RUN: < %s | FileCheck %s
1 -; RUN: -verify-machineinstrs --riscv-no-aliases < %s \
1 +; RUN: -verify-machineinstrs < %s \
As discussed in D103004.
Craig Topper [Wed, 26 May 2021 16:31:01 +0000 (09:31 -0700)]
[RISCV] Don't propagate VL/VTYPE across inline assembly in the Insert VSETVLI pass.
It's conceivable someone could put a vsetvli in inline assembly
so its safer to consider them as barriers. The alternative would
be to trust that the user marks VL and VTYPE registers as clobbers
of the inline assembly if they do that, but hat seems error prone.
I'm assuming inline assembly in vector code is going to be rare.
Reviewed By: frasercrmck, HsiangKai
Differential Revision: https://reviews.llvm.org/D103126
Kostya Kortchinsky [Tue, 25 May 2021 22:00:58 +0000 (15:00 -0700)]
[scudo] Get rid of initLinkerInitialized
Now that everything is forcibly linker initialized, it feels like a
good time to get rid of the `init`/`initLinkerInitialized` split.
This allows to get rid of various `memset` construct in `init` that
gcc complains about (this fixes a Fuchsia open issue).
I added various `DCHECK`s to ensure that we would get a zero-inited
object when entering `init`, which required ensuring that
`unmapTestOnly` leaves the object in a good state (tests are currently
the only location where an allocator can be "de-initialized").
Running the tests with `--gtest_repeat=` showed no issue.
Differential Revision: https://reviews.llvm.org/D103119
Alexey Bataev [Wed, 26 May 2021 13:18:34 +0000 (06:18 -0700)]
[SLP]Fix vectorization of insertelements with multiple uses.
SLP vectorizer should not consider in sertelements with multiple uses as
a part of high level build vector, it must be considered as
a terminating insertelement in the vector build, otherwise it may
produce incorrect code.
Differential Revision: https://reviews.llvm.org/D103164
Stephen Tozer [Wed, 26 May 2021 14:27:57 +0000 (15:27 +0100)]
[DebugInfo] Limit the number of values that may be referenced by a dbg.value
Following the addition of salvaging dbg.values using DIArgLists to
reference multiple values, a case has been found where excessively large
DIArgLists are produced as a result of this salvaging, resulting in
large enough performance costs to effectively freeze the compiler.
This patch introduces an upper bound of 16 to the number of values that
may be salvaged into a dbg.value, to limit the impact of these extreme
cases to performance.
Differential Revision: https://reviews.llvm.org/D103162
Richard Howell [Wed, 26 May 2021 16:32:57 +0000 (09:32 -0700)]
[lldb] add LLDB_SKIP_DSYM option
Add an option to skip generating a dSYM when installing the LLDB framework on Darwin.
Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D103124
Shoaib Meenai [Mon, 24 May 2021 03:41:57 +0000 (20:41 -0700)]
[libunwind] Inform ASan that resumption is noreturn
If you're building libunwind instrumented with ASan, `_Unwind_RaiseException`
will poison the stack and then transfer control in a manner which isn't
understood by ASan, so the stack will remain poisoned. This can cause
false positives, e.g. if you call an uninstrumented function (so it
doesn't re-poison the stack) after catching an exception. Add a call to
`__asan_handle_no_return` inside `__unw_resume` to get ASan to unpoison
the stack and avoid this.
`__unw_resume` seems like the appropriate place to make this call, since
it's used for resumption by all unwind implementations except SJLJ. SJLJ
uses `__builtin_longjmp` to handle resumption, which is already
recognized as noreturn (and therefore ASan adds the `__asan_handle_no_return`
call itself), so it doesn't need any special handling.
PR32434 is somewhat similar (in particular needing a component built
without ASan to trigger the bug), and rG781ef03e1012, the fix for that
bug, adds an interceptor for `_Unwind_RaiseException`. This interceptor
won't always be triggered though, e.g. if you statically link the
unwinder into libc++abi in a way that prevents interposing the unwinder
functions (e.g. marking the symbols as hidden, using `--exclude-libs`,
or using `-Bsymbolic`). rG53335d6d86d5 makes `__cxa_throw` call
`__asan_handle_no_return` explicitly, to similarly avoid relying on
interception.
Reviewed By: #libunwind, compnerd
Differential Revision: https://reviews.llvm.org/D103002
Raphael Isemann [Wed, 26 May 2021 15:52:51 +0000 (17:52 +0200)]
[lldb] Remove cache in get_demangled_name_without_arguments
This function has a single-value caching based on function local static variables.
This causes two problems:
* There is no synchronization, so this function randomly returns the demangled
name of other functions that are demangled at the same time.
* The 1-element cache is not very effective (the cache rate is around 0% when
running the LLDB test suite that calls this function around 30k times).
I would propose just removing it.
To prevent anyone else the git archeology: the static result variables were
originally added as this returned a ConstString reference, but that has since
been changed so that this returns by value.
Reviewed By: #lldb, JDevlieghere, shafik
Differential Revision: https://reviews.llvm.org/D103107