Kai Nacke [Tue, 22 Feb 2022 18:54:16 +0000 (13:54 -0500)]
[SystemZ/z/OS] Add va intrinsics for XPLINK
Add support for va intrinsics for the XPLINK ABI.
Only the extended vararg variant, which uses a pointer to next
argument, is supported. The standard variant will build on this.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D120148
Zarko Todorovski [Tue, 22 Feb 2022 19:34:10 +0000 (14:34 -0500)]
[libc++][AIX] Add AIX error message as expected output
AIX's libc generates "Error -1 occurred" instead of the "Unknown Error"
expected by these test cases. Add this as expected output for AIX only.
Reviewed By: daltenty, #powerpc, #libc, zibi, Quuxplusone
Differential Revision: https://reviews.llvm.org/D119982
Rainer Orth [Tue, 22 Feb 2022 19:18:22 +0000 (20:18 +0100)]
[sanitizer_common] Use GetStaticTlsBoundary on Solaris 11.4
This is a restricted alternative to D91605
<https://reviews.llvm.org/D91605> which only works on Solaris 11.4 SRU 10+,
but would break the build on Solaris 11.3 and Illumos which lack
`dlpi_tls_modid`.
Apart from that, the patch is trivial. One caveat is that the
`sanitizer_common` and `asan` tests need to be linked explicitly with `ld
-z relax=transtls` on Solaris/amd64 since the archives with calls to
`__tls_get_addr` are linked in directly.
Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D120048
Rainer Orth [Tue, 22 Feb 2022 19:14:33 +0000 (20:14 +0100)]
[Driver] Support Solaris/amd64 GetTls
This is the driver part of D91605 <https://reviews.llvm.org/D91605>, a
workaround to allow direct calls to `__tls_get_addr` on Solaris/amd64.
Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D119829
Adrian Prantl [Thu, 11 Nov 2021 00:25:26 +0000 (16:25 -0800)]
Add support for chained fixup load commands to MachOObjectFile
This is part of a series of patches to upstream support for Mach-O chained fixups.
This patch adds support for parsing the chained fixup load command and
parsing the chained fixups header. It also puts into place the
abstract interface that will be used to iterate over the fixups.
Differential Revision: https://reviews.llvm.org/D113630
Adrian Prantl [Wed, 10 Nov 2021 00:00:29 +0000 (16:00 -0800)]
Add a (nonfunctional) -dyld_info flag to llvm-objdump.
Darwin otool implements this flag as a one-stop solution for
displaying bind and rebase info. As I am working on upstreaming
chained fixup support this command will be useful to write testcases.
Differential Revision: https://reviews.llvm.org/D113573
Reid Kleckner [Tue, 22 Feb 2022 18:48:25 +0000 (10:48 -0800)]
Reland "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"
This reverts commit
9865c3f28aa812364584b55629eef9b52bb1230e.
Looks like our commits raced and Jeff fixed the build issue.
Mogball [Tue, 22 Feb 2022 18:47:07 +0000 (18:47 +0000)]
[mlir][pdl] NFC fix missing include
Reid Kleckner [Tue, 22 Feb 2022 18:46:49 +0000 (10:46 -0800)]
Revert "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"
This reverts commit
63eb963e58663541d6feb58f53a1bd4903e3dabf.
Breaks MLIR build.
Reid Kleckner [Tue, 22 Feb 2022 18:31:09 +0000 (10:31 -0800)]
Revert "[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors"
This reverts commit
9fc1a0dcb79afb31470751651c30e843c12e9ca5.
We have bisected a compiler crash to this revision and will provide a
test case soon.
Mogball [Tue, 22 Feb 2022 18:26:52 +0000 (18:26 +0000)]
[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op
Philip Reames [Tue, 22 Feb 2022 18:27:00 +0000 (10:27 -0800)]
[SLP] Use isInSchedulingRegion consistently [NFC]
Wouter van Oortmerssen [Mon, 14 Feb 2022 23:55:24 +0000 (15:55 -0800)]
[WebAssembly] Allow .data shorthand for .section .data,"",@
Shubham Sandeep Rastogi [Tue, 22 Feb 2022 00:44:38 +0000 (16:44 -0800)]
Updated reflection-dump.test for mpenum section
With
1c1e2cce9a50ac9fe6b884b79925d71914cf5a30 a new swift5 reflection section for multi-payload enum mask information was added, which is called mpenum. This change simply adds a check to make sure dsymutil can dump out information in that section into the dSYM bundle.
Differential Revision: https://reviews.llvm.org/D120291
Mogball [Mon, 21 Feb 2022 00:28:21 +0000 (00:28 +0000)]
[pdl] Remove `NoSideEffect` from all PDL ops
This trait results in PDL ops being erroneously CSE'd. These ops are side-effect free in the rewriter but not in the matcher (where unused values aren't allowed anyways). These ops should have a more nuanced side-effect modeling, this is fixing a bug introduced by a previous change.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D120222
Philip Reames [Tue, 22 Feb 2022 18:13:14 +0000 (10:13 -0800)]
[SLP] Schedule only sub-graph of vectorizable instructions
SLP currently schedules all instructions within a scheduling window which stretches from the first instruction potentially vectorized to the last. This window can include a very large number of unrelated instructions which are not being considered for vectorization. This change switches the code to only schedule the sub-graph consisting of the instructions being vectorized and their transitive users.
This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:
Before this patch:
704357 SLP - Number of calcDeps actions
699021 SLP - Number of schedule calls
5598 SLP - Number of ReSchedule actions
59 SLP - Number of ReScheduleOnFail actions
10084 SLP - Number of schedule resets
8523 SLP - Number of vector instructions generated
After this patch:
102895 SLP - Number of calcDeps actions
161916 SLP - Number of schedule calls
5637 SLP - Number of ReSchedule actions
55 SLP - Number of ReScheduleOnFail actions
10083 SLP - Number of schedule resets
8403 SLP - Number of vector instructions generated
I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.
The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.
For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.
Differential Revision: https://reviews.llvm.org/D118538
Valentin Clement [Tue, 22 Feb 2022 18:08:51 +0000 (19:08 +0100)]
[flang] Update PFTBuilder
This patch update the PFTBuilder to be able to lower
the construct present in semantics.
This is a building block for other lowering patches that will be posted soon.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D120336
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Fangrui Song [Tue, 22 Feb 2022 18:07:58 +0000 (10:07 -0800)]
[ELF] Move duplicate symbol check after input file parsing
https://discourse.llvm.org/t/parallel-input-file-parsing/60164
To decouple symbol initialization and section initialization, `Defined::section`
assignment should be postponed after input file parsing. To avoid spurious
duplicate definition error due to two definitions in COMDAT groups of the same
signature, we should postpone the duplicate symbol check.
The function is called postScan instead of a more specific name like
checkDuplicateSymbols, because we may merge Symbol::mergeProperties into
postScan. It is placed after compileBitcodeFiles to apply to ET_REL files
produced by LTO. This causes minor diagnostic regression
for skipLinkedOutput configurations: ld.lld --thinlto-index-only a.bc b.o
(bitcode definition prevails) won't detect duplicate symbol error. I think this
is an acceptable compromise. The important cases where (a) both files are
bitcode or (b) --thinlto-index-only is unused are still detected.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D119908
Shilei Tian [Tue, 22 Feb 2022 17:59:56 +0000 (12:59 -0500)]
[Clang][OpenMP] Add the codegen support for `atomic compare`
This patch adds the codegen support for `atomic compare` in clang.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D118632
Aaron Ballman [Tue, 22 Feb 2022 17:50:39 +0000 (12:50 -0500)]
Jay Foad [Fri, 18 Feb 2022 11:24:05 +0000 (11:24 +0000)]
[StableHashing] Hash machine basic blocks and functions
This adds very basic support for hashing MachineBasicBlock
and MachineFunction, for use in MachineFunctionPass to
detect passes that modify the MachineFunction wrongly.
Differential Revision: https://reviews.llvm.org/D120122
Jay Foad [Tue, 22 Feb 2022 09:49:19 +0000 (09:49 +0000)]
[StructurizeCFG] Fix boolean not bug
D118623 added code to fold not-of-compare into a compare
with the inverted predicate, if the compare had no other
uses. This relies on accurate use lists in the IR but it
was run before setPhiValues, when some phi inputs are still
stored in a data structure on the side, instead of being
real uses in the IR. The effect was that a phi that should
be using the original compare result would now get an
inverted result instead.
Fix this by moving simplifyConditions after setPhiValues.
Differential Revision: https://reviews.llvm.org/D120312
Simon Atanasyan [Tue, 22 Feb 2022 13:46:28 +0000 (16:46 +0300)]
[MIPS] Add `-no-pie` option to the clang driver's tests depend on it
Stanislav Mekhanoshin [Mon, 21 Feb 2022 22:48:59 +0000 (14:48 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global saddr loads
This adds handling of the _SADDR forms to the GLOBAL_LOAD combining.
TODO: merge global stores.
TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.
Differential Revision: https://reviews.llvm.org/D120285
Nikita Popov [Tue, 22 Feb 2022 16:56:01 +0000 (17:56 +0100)]
[InstCombine] Add test for missed select fold due to one use limitation (NFC)
The eq sub zero fold currently has an artificial one-use limitation,
causing us to miss this fold.
Stanislav Mekhanoshin [Mon, 21 Feb 2022 19:17:58 +0000 (11:17 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global loads
There can be situations where global and flat loads and stores are not
combined by the vectorizer, in particular if their address space
differ in the IR but they end up the same class instructions after
selection. For example a divergent load from constant address space
ends up being the same global_load as a load from global address space.
TODO: merge global stores.
TODO: handle SADDR forms.
TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.
Differential Revision: https://reviews.llvm.org/D120279
Nikita Popov [Mon, 14 Feb 2022 16:00:41 +0000 (17:00 +0100)]
[Bitcode] Store type IDs for values
This is the next step towards supporting bitcode auto upgrade with
opaque pointers. The ValueList now stores the Value* together with
its associated type ID, which allows inspecting the original pointer
element type of arbitrary values.
This is a largely mechanical change threading the type ID through
various places. I've left TODOTypeID placeholders in a number of
places where determining the type ID is either non-trivial or
requires allocating a new type ID not present in the original
bitcode. For this reason, the new type IDs are also not used for
anything yet (apart from propagation). They will get used once the
TODOs are resolved.
Differential Revision: https://reviews.llvm.org/D119821
serge-sans-paille [Sun, 20 Feb 2022 08:05:46 +0000 (09:05 +0100)]
Restore documentation for __builtin_assume
This got removed by
6cacd420a1d72bca7809e6b516fb1e18ac6056c8, and that was a
mistake.
Differential Revision: https://reviews.llvm.org/D120205
tyb0807 [Tue, 1 Feb 2022 21:41:23 +0000 (21:41 +0000)]
[AArch64] Remove unused feature flags from AArch64TargetInfo
This removes two feature flags from `AArch64TargetInfo` class:
- `HasHBC`: this feature does not involve generating any IR intrinsics,
so clang does not need to know about whether it is set
- `HasCrypto`: this feature is deprecated in favor of finer grained
features such as AES, SHA2, SHA3 and SM4. The associated ACLE macro
__ARM_FEATURE_CRYPTO is thus no longer used.
Differential Revision: https://reviews.llvm.org/D118757
Marek Kurdej [Tue, 22 Feb 2022 14:46:28 +0000 (15:46 +0100)]
[clang-format] Avoid parsing "requires" as a keyword in non-C++-like languages.
Fixes the issue raised post-review in D113319 (cf. https://reviews.llvm.org/D113319#3337485).
Reviewed By: krasimir
Differential Revision: https://reviews.llvm.org/D120324
Nemanja Ivanovic [Tue, 22 Feb 2022 15:52:19 +0000 (09:52 -0600)]
[PowerPC] Allow absolute expressions in relocations
The Linux kernel build uses absolute expressions suffixed with @lo/@ha
relocations. This currently doesn't work for DS/DQ form instructions and
there is no reason for it not to. It also works with GAS.
This patch allows this as long as the value is a multiple of 4/16
for DS/DQ form.
Differential revision: https://reviews.llvm.org/D115419
Marek Kurdej [Tue, 22 Feb 2022 15:40:30 +0000 (16:40 +0100)]
[clang-format] Use FormatToken::is* functions without passing through `Tok`. NFC.
Timm Bäder [Tue, 22 Feb 2022 15:34:12 +0000 (16:34 +0100)]
Fix docs build after
f8cedc642d9b85720cb7175ef25ddde90a3fbca2
Looks like rst doesn't like '#' in link texts. Just remove it.
Nikita Popov [Tue, 22 Feb 2022 15:31:46 +0000 (16:31 +0100)]
[CodeGen] Add test for PR53990 (NFC)
Timm Bäder [Fri, 11 Feb 2022 07:27:33 +0000 (08:27 +0100)]
[clang] Never wrap a nullptr in CXXNewExpr::getArraySize()
Otherwise callers of these functions have to check both the return value
for and the contents of the returned llvm::Optional.
Fixes #53742
Differential Revision: https://reviews.llvm.org/D119525
Matthias Springer [Tue, 22 Feb 2022 14:58:57 +0000 (23:58 +0900)]
[mlir][bufferize] Fix GCC build
Differential Revision: https://reviews.llvm.org/D120326
Pavel Labath [Mon, 21 Feb 2022 14:38:52 +0000 (15:38 +0100)]
[lldb] Remove HostProcess:GetMainModule
the function is unused, and the posix implementation is only really correct on linux.
Timm Bäder [Tue, 22 Feb 2022 10:07:39 +0000 (11:07 +0100)]
[clang][www] Port make_cxx_dr_status script to Python3
And run it to re-generate the cxx_dr_status.html
Differential Revision: https://reviews.llvm.org/D120313
Krasimir Georgiev [Tue, 22 Feb 2022 14:43:09 +0000 (15:43 +0100)]
[clang-format] Fix preprocessor nesting after commit
529aa4b011c4ae808d658022ef643c44dd9b2c9c
In https://github.com/llvm/llvm-project/commit/
529aa4b011c4ae808d658022ef643c44dd9b2c9c
by setting the identifier info to nullptr, we started to subtly
interfere with the parts in the beginning of the function,
https://github.com/llvm/llvm-project/blob/
529aa4b011c4ae808d658022ef643c44dd9b2c9c/clang/lib/Format/UnwrappedLineParser.cpp#L991
causing the preprocessor nesting to change in some cases. E.g., for the
added regression test, clang-format started incorrectly guessing the
language as C++.
This tries to address this by introducing an internal identifier info
element to use instead.
Reviewed By: curdeius, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D120315
Sander de Smalen [Tue, 22 Feb 2022 13:48:21 +0000 (13:48 +0000)]
[AArch64][SME] Remove term 'streaming-sve' from assembler diagnostics.
'streaming-sve' is not a feature that users should be able to set,
hence why it shouldn't show up in user-diagnostics. The only
flag that end-users should be able to set is '+sme'.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D120256
Egor Zhdan [Mon, 24 Jan 2022 14:18:14 +0000 (14:18 +0000)]
Add DriverKit support
This patch is the first in a series of patches to upstream the support for Apple's DriverKit. Once complete, it will allow targeting DriverKit platform with Clang similarly to AppleClang.
This code was originally authored by JF Bastien.
Differential Revision: https://reviews.llvm.org/D118046
Simon Moll [Tue, 22 Feb 2022 13:29:29 +0000 (14:29 +0100)]
[VE] Split unsupported v512.32 ops
Split v512.32 binary ops into two v256.32 ops using packing support
opcodes (vec_unpack_lo|hi, vec_pack).
Depends on D120053 for packing opcodes.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D120146
Paul Walker [Mon, 14 Feb 2022 20:01:29 +0000 (20:01 +0000)]
[SVE] Add isel patterns for SABA/UABA.
Differential Revision: https://reviews.llvm.org/D119830
Sanjay Patel [Tue, 22 Feb 2022 13:01:09 +0000 (08:01 -0500)]
[x86] add load folding restriction to pushAddIntoCmovOfConsts()
With only a load-fold the diffs look neutral. If there's a load and store (rmw)
fold opportunity as shown in the test based on #53862, then we end up with an
extra instruction.
Fixes #53862
Differential Revision: https://reviews.llvm.org/D120281
Kiran Chandramohan [Tue, 22 Feb 2022 10:12:04 +0000 (10:12 +0000)]
[Flang] Initial patch to lower a Fortran intrinsic
This patch brings in some initial changes for lowering Fortran
intrinsics. Intrinsics are generally lowered to a mix of FIR and
MLIR operations, runtime calls or LLVM intrinsics. This patch
particularly brings in the lowering of the Fortran `andi` intrinsic
to `arith.andi` in MLIR.
The significant changes are in ConvertExpr.cpp and IntrinsicCall.cpp.
Intrinsic functions occur as part of expressions. Lowering deals with this
in ConvertExpr.cpp in `genval(const Fortran::evaluate::FunctionRef<A> &funcRef)`.
The code in the above mentioned function kicks of a sequence of calls
that ultimately results in a call to the `genIand ` function in
IntrinsicCall.cpp which creates the MLIR `arith.andi` operation.
A few tests are also included.
Note: Generally intrinsics like `iand` can occur in array (elemental)
context, but since that part is not fully supported in lowering, tests
are only added for the scalar context.
This patch is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D119990
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: zacharyselk <zrselk@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Thomas Symalla [Tue, 22 Feb 2022 12:27:26 +0000 (13:27 +0100)]
[AMDGPU] Fix typo in comment [NFC]
This replaces "V_MOB_B32" with "V_MOV_B32" in some comment.
Simon Pilgrim [Tue, 22 Feb 2022 11:52:45 +0000 (11:52 +0000)]
[GISel] Silence 'sideeffect in assertion' coverity warnings. NFCI.
Use llvm::enumerate to keep track of index.
Kerry McLaughlin [Tue, 22 Feb 2022 10:49:34 +0000 (10:49 +0000)]
[LoopVectorize] Support conditional in-loop vector reductions
Extends getReductionOpChain to look through Phis which may be part of
the reduction chain. adjustRecipesForReductions will now also create a
CondOp for VPReductionRecipe if the block is predicated and not only if
foldTailByMasking is true.
Changes were required in tryToBlend to ensure that we don't attempt
to convert the reduction Phi into a select by returning a VPBlendRecipe.
The VPReductionRecipe will create a select between the Phi and the reduction.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D117580
Ilya Nozhkin [Tue, 22 Feb 2022 11:48:32 +0000 (12:48 +0100)]
[lldb] Fix race condition between lldb-vscode and stop hooks executor
The race is between these two pieces of code that are executed in two separate
lldb-vscode threads (the first is in the main thread and another is in the
event-handling thread):
```
// lldb-vscode.cpp
g_vsc.debugger.SetAsync(false);
g_vsc.target.Launch(launch_info, error);
g_vsc.debugger.SetAsync(true);
```
```
// Target.cpp
bool old_async = debugger.GetAsyncExecution();
debugger.SetAsyncExecution(true);
debugger.GetCommandInterpreter().HandleCommands(GetCommands(), exc_ctx,
options, result);
debugger.SetAsyncExecution(old_async);
```
The sequence that leads to the bug is this one:
1. Main thread enables synchronous mode and launches the process.
2. When the process is launched, it generates the first stop event.
3. This stop event is catched by the event-handling thread and DoOnRemoval
is invoked.
4. Inside DoOnRemoval, this thread runs stop hooks. And before running stop
hooks, the current synchronization mode is stored into old_async (and
right now it is equal to "false").
5. The main thread finishes the launch and returns to lldb-vscode, the
synchronization mode is restored to asynchronous by lldb-vscode.
6. Event-handling thread finishes stop hooks processing and restores the
synchronization mode according to old_async (i.e. makes the mode synchronous)
7. And now the mode is synchronous while lldb-vscode expects it to be
asynchronous. Synchronous mode forbids the process to broadcast public stop
events, so, VS Code just hangs because lldb-vscode doesn't notify it about
stops.
So, this diff makes the target intercept the first stop event if the process is
launched in the synchronous mode, thus preventing stop hooks execution.
The bug is only present on Windows because other platforms already
intercept this event using their own hijacking listeners.
So, this diff also fixes some problems with lldb-vscode tests on Windows to make
it possible to run the related test. Other tests still can't be enabled because
the debugged program prints something into stdout and LLDB can't intercept this
output and redirect it to lldb-vscode properly.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D119548
Nikita Popov [Tue, 22 Feb 2022 11:25:30 +0000 (12:25 +0100)]
[MergeICmps] Don't call comesBefore() if in different blocks (PR53959)
Only call comesBefore() if the instructions are in the same block.
Otherwise make a conservative assumption.
Fixes https://github.com/llvm/llvm-project/issues/53959.
Alexander Batashev [Tue, 22 Feb 2022 11:04:21 +0000 (14:04 +0300)]
[mlir][spirv] Fix SPIR-V spec parser
Header class in SPIR-V HTML spec has changed. Update script to reflect that.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D120179
Arjun P [Tue, 22 Feb 2022 08:48:55 +0000 (08:48 +0000)]
[MLIR][Presburger] rename get*LexMin -> find*LexMin
This reflects the fact that we are performing some non-trivial computations
here. Also, this is more uniform in line with findIntegerSample.
Max Kazantsev [Tue, 22 Feb 2022 09:54:27 +0000 (16:54 +0700)]
[SCEV] Do not erase LoopUsers. PR53969
This patch fixes a logical error in how we work with `LoopUsers` map.
It maps a loop onto a set of AddRecs that depend on it. The Addrecs
are added to this map only once when they are created and put to
the UniqueSCEVs` map.
The only purpose of this map is to make sure that, whenever we forget
a loop, all (directly or indirectly) dependent SCEVs get forgotten too.
Current code erases SCEVs from dependent set of a given loop whenever
we forget this loop. This is not a correct behavior due to the following scenario:
1. We have a loop `L` and an AddRec `AR` that depends on it;
2. We modify something in the loop, but don't destroy it. We still call forgetLoop on it;
3. `AR` is no longer dependent on `L` according to `LoopUsers`. It is erased from
ValueExprMap` and `ExprValue map, but still exists in UniqueSCEVs;
4. We can later request the very same AddRec for the very same loop again, and get existing
SCEV `AR`.
5. Now, `AR` exists and is used again, but its notion that it depends on `L` is lost;
6. Then we decide to delete `L`. `AR` will not be forgotten because we have lost it;
7. Just you wait when you run into a dangling pointer problem, or any other kind of problem
because an active SCEV is now referecing a non-existent loop.
The solution to this is to stop erasing values from `LoopUsers`. Yes, we will maybe forget something
that is already not used, but it's cheap.
This fixes a functional bug and potentially may have negative compile time impact on methods with
huge or numerous loops.
Differential Revision: https://reviews.llvm.org/D120303
Reviewed By: nikic
Sven van Haastregt [Tue, 22 Feb 2022 10:15:40 +0000 (10:15 +0000)]
[OpenCL] opencl-c.h: use uint/ulong consistently
Most places already seem to use the short spelling instead of
'unsigned int/long', so perform the following substitutions:
s/unsigned int /uint /g
s/unsigned long /ulong /g
This simplifies completeness comparisons against OpenCLBuiltins.td.
Differential Revision: https://reviews.llvm.org/D120032
Jay Foad [Tue, 22 Feb 2022 09:40:05 +0000 (09:40 +0000)]
[StructurizeCFG] Precommit test case for D120312
Iain Sandoe [Mon, 29 Nov 2021 08:05:56 +0000 (08:05 +0000)]
[C++20][Modules][2/8] Add enumerations for partition modules and stream them.
This is an initial enabling patch for module partition support.
We add enumerations for partition interfaces/implementations.
This means that the module kind enumeration now occupies three
bits, so the AST streamer is adjusted for this. Adding one bit there
seems preferable to trying to overload the meanings of existing
kinds (and we will also want to add a C++20 header unit case later).
Differential Revision: https://reviews.llvm.org/D114714
Sunho Kim [Tue, 22 Feb 2022 09:59:36 +0000 (09:59 +0000)]
[AARCH64][DAGCombine] Add combine for negation of CSEL absolute value pattern.
This folds a negation through a csel, which can come up during the
lowering of negative abs.
Fixes https://github.com/llvm/llvm-project/issues/51558.
Differential Revision: https://reviews.llvm.org/D112204
David Spickett [Thu, 17 Feb 2022 11:57:26 +0000 (11:57 +0000)]
[libcxx][ci] Switch to CMAKE_CXX_COMPILER_TARGET for Arm bots
As suggested by the cmake warning:
CMake Warning at <...>/llvm-project/libcxx-ci/libcxx/CMakeLists.txt:289 (message):
LIBCXX_TARGET_TRIPLE is deprecated, please use CMAKE_CXX_COMPILER_TARGET instead
Depends on D119948
Differential Revision: https://reviews.llvm.org/D120038
David Spickett [Wed, 16 Feb 2022 15:47:16 +0000 (15:47 +0000)]
[libcxx][CI] Set Arm triples to match native clang build's default
We were using:
armv8-linux-gnueabihf
But for a native clang build the default target is:
armv8l-linux-gnueabihf
(ditto for v7)
Add the "l" to the target triples and update the one test
that is unsupported to look for the various possible names.
armv(7 or 8)(m or l, optionally)
The UNSUPPORTED does not include aarch64 because aarch64 Linux
(and others that follow Arm's AAPCS64) use quad precision for
long double where arm64 (darwin) does not:
https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#811arithmetic-types
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D119948
David Sherwood [Tue, 22 Feb 2022 09:36:52 +0000 (09:36 +0000)]
Sunho Kim [Tue, 22 Feb 2022 09:26:47 +0000 (09:26 +0000)]
[NFC][AARCH64] Add test cases for negation of select
Add tests to demonstrate new dag combine pattern.
Differential Revision: https://reviews.llvm.org/D120214
David Sherwood [Mon, 21 Feb 2022 10:38:08 +0000 (10:38 +0000)]
[InstCombine] Bail out of load-store forwarding for scalable vector types
This patch fixes an invalid TypeSize->uint64_t implicit conversion in
FoldReinterpretLoadFromConst. If the size of the constant is scalable
we bail out of the optimisation for now.
Tests added here:
Transforms/InstCombine/load-store-forward.ll
Differential Revision: https://reviews.llvm.org/D120240
tyb0807 [Thu, 3 Feb 2022 22:30:41 +0000 (22:30 +0000)]
[ARM][AArch64] Add missing v8.x checks
Summary:
This patch adds checks that were missing in clang for Armv8.5/6/7-A. These include:
* ACLE macro defines for AArch32.
* Handling of crypto and SM4, SHA and AES feature flags on clang's driver.
Reviewers: dmgreen, SjoerdMeijer, tmatheson
Differential Revision: https://reviews.llvm.org/D116153
Nikita Popov [Tue, 22 Feb 2022 08:53:32 +0000 (09:53 +0100)]
[GlobalStatus] Keep Visited set in isSafeToDestroyConstant()
Constants cannot be cyclic, but they can be tree-like. Keep a
visited set to ensure we do not degenerate to exponential run-time.
This fixes the problem reported in https://reviews.llvm.org/D117223#3335482,
though I haven't been able to construct a concise test case for
the issue. This requires a combination of dead constants and the
kind of constant expression tree that textual IR cannot represent
(because the textual representation, unlike the in-memory
representation, is also exponential in size).
Sam McCall [Mon, 21 Feb 2022 21:42:35 +0000 (22:42 +0100)]
[Format] Remove unused LineContainsContinuedForLoopSection. NFC
Differential Revision: https://reviews.llvm.org/D120282
Matthias Springer [Tue, 22 Feb 2022 08:39:04 +0000 (17:39 +0900)]
[mlir][bufferize] Do not assert destination passing style for non-bufferizable ops
Matthias Springer [Tue, 22 Feb 2022 08:14:03 +0000 (17:14 +0900)]
[mlir][bufferize][NFC] Rename `comprehensive-function-bufferize` to `one-shot-bufferize`
The related functionality is moved over to the bufferization dialect. Test cases are cleaned up a bit.
Differential Revision: https://reviews.llvm.org/D120191
jacquesguan [Wed, 19 Jan 2022 07:32:06 +0000 (15:32 +0800)]
[RISCV] Add patterns for vector widening integer reduction instructions
Add patterns for vector widening integer reduction instructions.
Differential Revision: https://reviews.llvm.org/D117643
Brad Smith [Tue, 22 Feb 2022 05:20:46 +0000 (00:20 -0500)]
[Driver][OpenBSD] Add comments for C++ tests
Brad Smith [Tue, 22 Feb 2022 04:44:18 +0000 (23:44 -0500)]
[Driver][OpenBSD] Test tweaking and clean up
owenca [Tue, 8 Feb 2022 06:58:50 +0000 (22:58 -0800)]
[clang-format] Add option to insert braces after control statements
Adds a new option InsertBraces to insert the optional braces after
if, else, for, while, and do in C++.
Differential Revision: https://reviews.llvm.org/D120217
Brad Smith [Tue, 22 Feb 2022 04:11:13 +0000 (23:11 -0500)]
[Driver][OpenBSD] Pass sysroot to the linker
Tanya Lattner [Tue, 22 Feb 2022 02:58:48 +0000 (18:58 -0800)]
Update references to the mailing lists that have moved to Discourse.
Shafik Yaghmour [Tue, 22 Feb 2022 02:46:12 +0000 (18:46 -0800)]
[LLDB] Remove recursive include of GDBRemoteCommunicationServerCommon.h
GDBRemoteCommunicationServerCommon.h includes itself, removing this include.
Differential Revision: https://reviews.llvm.org/D120105
Joseph Huber [Mon, 21 Feb 2022 17:40:16 +0000 (12:40 -0500)]
[OpenMP] Ensure offloading sections do not have SHF_ALLOC flag
We use offloading sections in the new Clang driver scheme to embed
device code into the host. We later use these sections to link the
device image, after which point they are completely unused and should
not be loaded into memory if they are still in the executable.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D120275
Lian Wang [Tue, 22 Feb 2022 02:20:32 +0000 (02:20 +0000)]
[RISCV] Add more tests for SHLFI and UNSHFLI aliaes in Zbp extension
RV32/RV64:
zip.n/zip2.b/zip.b/zip4.h/zip2.h/zip.h
unzip.n/unzip2.b/unzip.b/unzip4.h/unzip2.h/unzip.h
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120241
Jessica Paquette [Wed, 16 Feb 2022 20:50:31 +0000 (12:50 -0800)]
[MachineOutliner][AArch64] NFC: Split MBBs into "outlinable ranges"
We found a case in the Swift benchmarks where the MachineOutliner introduces
about a 20% compile time overhead in comparison to building without the
MachineOutliner.
The origin of this slowdown is that the benchmark has long blocks which incur
lots of LRU checks for lots of candidates.
Imagine a case like this:
```
bb:
i1
i2
i3
...
i123456
```
Now imagine that all of the outlining candidates appear early in the block, and
that something like, say, NZCV is defined at the end of the block.
The outliner has to check liveness for certain registers across all candidates,
because outlining from areas where those registers are used is unsafe at call
boundaries.
This is fairly wasteful because in the previously-described case, the outlining
candidates will never appear in an area where those registers are live.
To avoid this, precalculate areas where we will consider outlining from.
Anything outside of these areas is mapped to illegal and not included in the
outlining search space. This allows us to reduce the size of the outliner's
suffix tree as well, giving us a potential memory win.
By precalculating areas, we can also optimize other checks too, like whether
or not LR is live across an outlining candidate.
Doing all of this is about a 16% compile time improvement on the case.
This is likely useful for other targets (e.g. ARM + RISCV) as well, but for now,
this only implements the AArch64 path. The original "is the MBB safe" method
still works as before.
Stanislav Mekhanoshin [Mon, 21 Feb 2022 19:22:11 +0000 (11:22 -0800)]
[AMDGPU] Remove redundand check in the SILoadStoreOptimizer
Differential Revision: https://reviews.llvm.org/D120268
Zakk Chen [Mon, 21 Feb 2022 22:31:14 +0000 (14:31 -0800)]
[RISCV] Optimize tail agnostic vmv.s.x which don't need to select tail value.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120250
Michael Gottesman [Mon, 21 Feb 2022 20:07:31 +0000 (12:07 -0800)]
[move-function] Make test more generally by removing unneeded line.
Otherwise this is can be sensitive in the face of changes in register names.
I also gardened the test case a little to make it look a little nicer.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D120276
Vang Thao [Mon, 21 Feb 2022 22:14:25 +0000 (14:14 -0800)]
[AMDGPU] Regenerate tests to include -NEXT. NFC.
LLVM GN Syncbot [Mon, 21 Feb 2022 22:08:44 +0000 (22:08 +0000)]
[gn build] Port
68f4131c94d4
Nikolas Klauser [Mon, 21 Feb 2022 22:07:02 +0000 (23:07 +0100)]
[libc++][ranges] Add ranges::in_found_result
Reviewed By: Quuxplusone, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D119763
Nikolas Klauser [Mon, 21 Feb 2022 21:56:14 +0000 (22:56 +0100)]
[libc++] Replace [[no_unique_addredd]] with _LIBCPP_NO_UNIQUE_ADDRESS in __algorithm/min_max_result.h
LLVM GN Syncbot [Mon, 21 Feb 2022 21:52:37 +0000 (21:52 +0000)]
[gn build] Port
807766be3a89
Nikolas Klauser [Mon, 21 Feb 2022 21:48:36 +0000 (22:48 +0100)]
[libc++][ranges] Add ranges::min_max_result
Reviewed By: Quuxplusone, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D119751
Sanjay Patel [Mon, 21 Feb 2022 20:19:23 +0000 (15:19 -0500)]
[x86] add tests for rmw add with cmov; NFC
Petr Hosek [Mon, 21 Feb 2022 21:23:39 +0000 (13:23 -0800)]
[CMake][Fuchsia] Disable assertions and analyzer for stage 1
We don't need these in the first stage compiler and disabling these
helps a bit with the compile time and runtime performance.
Differential Revision: https://reviews.llvm.org/D120280
Groverkss [Mon, 21 Feb 2022 20:57:26 +0000 (02:27 +0530)]
[MLIR][Presburger] Add support for IntegerRelation
This patch adds a class to represent a relation in Presburger Library.
This patch only adds the skeleton class. Functionality from IntegerPolyhedron
will be moved to IntegerRelation in later patches to make it easier to review.
This patch is a part of a series of patches adding support for relations in
Presburger Library.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120156
Martin Storsjö [Thu, 13 Jan 2022 10:28:41 +0000 (10:28 +0000)]
[libcxx] [test] Fix the thousands_sep expectation for fr_FR locales on Windows
Windows uses U+00A0 NO-BREAK SPACE as thousands separator in the
fr_FR locale.
Differential Revision: https://reviews.llvm.org/D120090
Martin Storsjö [Tue, 18 Jan 2022 09:33:08 +0000 (09:33 +0000)]
[libcxx] [test] Fix moneypunct grouping tests on Windows
For grouping strings, "\3" and "\3\3" are equivalent.
Differential Revision: https://reviews.llvm.org/D120091
Arjun P [Mon, 21 Feb 2022 19:04:12 +0000 (19:04 +0000)]
[MLIR][Presburger] Support finding integer lexmin in IntegerPolyhedron
Note: this does not yet support PrebsurgerSets.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D120239
Paweł Bylica [Mon, 21 Feb 2022 19:27:47 +0000 (20:27 +0100)]
[NFC][DAGCombine] Use isOperandOf() in combineCarryDiamond
Pre-commit for https://reviews.llvm.org/D118362.
George Koehler [Mon, 21 Feb 2022 20:15:53 +0000 (15:15 -0500)]
[libunwind] Further fix for 32-bit PowerPC processors without AltiVec
https://reviews.llvm.org/D91906 did most of the work necessary to fix libunwind on
32-bit PowerPC processors without AltiVec, but there was one more piece necessary.
Reviewed By: luporl
Differential Revision: https://reviews.llvm.org/D120197
Alexey Bataev [Fri, 26 Mar 2021 19:43:25 +0000 (12:43 -0700)]
[OPENMP]Fix PR49366: crash on VLAs in task untied regions.
We need to capture the local variables into a record in task untied
regions but clang does not support record with VLA data members.
Differential Revision: https://reviews.llvm.org/D99436
Craig Topper [Mon, 21 Feb 2022 19:52:57 +0000 (11:52 -0800)]
[RISCV] Teach shouldSinkOperands to sink splat operands of vp.fma intrinsics.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120167
Kristof Beyls [Wed, 16 Feb 2022 13:53:18 +0000 (14:53 +0100)]
Create office hours documentation.
Differential Revision: https://reviews.llvm.org/D120036
Shilei Tian [Mon, 21 Feb 2022 16:47:02 +0000 (11:47 -0500)]
[Clang][OpenMP] Add Sema support for atomic compare capture
This patch adds Sema support for `atomic compare capture`.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D120200
Casey Carter [Wed, 29 Dec 2021 22:26:30 +0000 (14:26 -0800)]
[libcxx][test] array and basic_string_view iterators are not portably pointers
Fixup tests that believe them to be so. Most notably including some heavy refactoring in `std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp`, which now detects pointers and validates that `iterator_concept` is present only for pointers.
Differential Revision: https://reviews.llvm.org/D117368
Nico Weber [Mon, 21 Feb 2022 18:29:37 +0000 (13:29 -0500)]
Revert "[ArgPromotion] Regenerate test checks for crash.ll - removed ALL_NEWPM prefix."
This reverts commit
52577cd26f26f6428c72395e7337af3fc84bc6f6.
Breaks check-llvm, see comments on https://reviews.llvm.org/D120207