Olle Fredriksson [Tue, 1 Feb 2022 16:01:15 +0000 (11:01 -0500)]
[DFAJumpThreading] make update order deterministic
We tracked down some non-determinism in compilation output to the
DFAJumpThreading pass. These changes fixed our issue:
* Make the DefMap type a MapVector to make its iteration order depend on
insertion order.
* Sort the values to be inserted into NewDefs by instruction order to
make the insertion order deterministic. Since these values come from
iterating over a ValueMap, which doesn't have deterministic iteration
order, I couldn't fix this at its source.
Reviewed By: alexey.zhikhar
Differential Revision: https://reviews.llvm.org/D118590
Mircea Trofin [Tue, 1 Feb 2022 15:58:00 +0000 (07:58 -0800)]
[nfc][regalloc] Move DefaultEvictionAdvisor::* to RegAllocEvictionAdvisor.cpp
This is leftover from the advisor refactoring. Straight-forward copy and
paste.
Craig Topper [Tue, 1 Feb 2022 15:39:51 +0000 (07:39 -0800)]
[RISCC] Add missing words to comment. NFC
Craig Topper [Tue, 1 Feb 2022 15:23:35 +0000 (07:23 -0800)]
[RISCV] Fix a vsetvli insertion bug involving loads/stores.
The first phase of the analysis can avoid a vsetvli if an earlier
instruction in the block used an SEW and LMUL that when combined with
the EEW of the load/store would produce the desired EMUL. If we
avoided a vsetvli this will affect the global analysis we do in the
second phase.
The third phase where we really insert the vsetvlis needs to agree
with the first phase. If it doesn't we can insert vsetvlis that
invalidate the global analysis.
In the test case there is a VSETVLI in the preheader that sets
SEW=64 and LMUL=1. Inside the loop there is a VADD with SEW=64 and LMUL=1.
This VADD is followed by a store that wants wants SEW=32 LMUL=1/2.
Because it has EEW=32 as part of the opcode the SEW=64 LMUL=1 from the
VADD can be become EMUL=1 for the store. So the first phase determines no
vsetvli is needed.
The third phase manages CurInfo differently than BBInfo.Change from the
first phase. CurInfo is only updated when we see a vsetvli or insert
a vsetvli. This was done to allow predecessor block information from
the global analysis to be applied to multiple instructions. Since the
loop body has no vsetvli we won't update CurInfo for either the VADD
or the VSE. This prevented us from checking the store vsetvli elision
for the VSE resulting in a vsetvli SEW=32 LMUL=1/2 being emitted which
invalidated the global analysis.
To mitigate this, I've added a BBLocalInfo variable that more closely
matches the first phase propagation. This gets updated based on the
VADD and prevents emitting a vsetvli for the store like we did in the
first phase.
I wonder if we should do an earlier phase to handle the load/store case
by adding more pseudo opcodes and changing the SEW/LMUL for those
instructions before the insertion analysis. That might be more robust
than trying to guarantee two phases make the same decision.
Fixes the test from D118629.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D118667
Stanislav Gatev [Mon, 31 Jan 2022 10:43:07 +0000 (10:43 +0000)]
[clang][dataflow] Enable comparison of distinct values in Environment
Make specializations of `DataflowAnalysis` extendable with domain-specific
logic for comparing distinct values when comparing environments.
This includes a breaking change to the `runDataflowAnalysis` interface
as the return type is now `llvm::Expected<...>`.
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D118596
Craig Topper [Tue, 1 Feb 2022 07:01:26 +0000 (23:01 -0800)]
[RISCV] Don't make it an error have Zve* and V at the same time.
This should not be an error. V is a valid implementation of Zve.
Spec clarified here
https://github.com/riscv/riscv-v-spec/commit/
9a877e8553362ff03a9b22b98e321b59aff50398
Differential Revision: https://reviews.llvm.org/D118679
Sam McCall [Tue, 1 Feb 2022 15:01:46 +0000 (16:01 +0100)]
[clangd] Fix handling of co_await in go-to-type
Nikita Popov [Tue, 1 Feb 2022 14:56:42 +0000 (15:56 +0100)]
[GlobalOpt] Avoid early exit before dead constant check
In a similar vein to
236fbf571dc6cebcb81ac5187a170c8de6d5bc0e,
make sure we don't early-exit before the dead constant check.
Jon Chesterfield [Tue, 1 Feb 2022 14:56:14 +0000 (14:56 +0000)]
Revert "[OpenMP][FIX] Explicit barriers in SPMD mode are not aligned"
This seems to be the root cause of hangs on amdgpu. Reverting while investigating.
This reverts commit
7b9844cc8dd0045f5251450ba2980d6d6ac48ef9.
Joseph Huber [Tue, 1 Feb 2022 14:49:58 +0000 (09:49 -0500)]
[OpenMP] Temporarily remove checks to fix failing test on MACOS
Summary:
This patch removes some of the check lines that are problematic on
MACOS. The output on the MAC systems works but should be slightly
different. Because this is simply the output being slightly different
rather than broken functionality the test is being changed.
Shao-Ce SUN [Tue, 1 Feb 2022 14:52:24 +0000 (22:52 +0800)]
[RISCV] Adjust some comments.
Sam McCall [Tue, 1 Feb 2022 14:51:05 +0000 (15:51 +0100)]
[clangd] Group and extend release notes
Nikita Popov [Tue, 1 Feb 2022 14:49:38 +0000 (15:49 +0100)]
[GlobalStatus] Skip non-pointer dead constant users
Constant expressions with a non-pointer result type used an early
exit that bypassed the later dead constant user check, and resulted
in different optimization outcomes depending on whether dead users
were present or not.
This fixes the issue reported in https://reviews.llvm.org/D117223#3287039.
David Green [Tue, 1 Feb 2022 14:51:23 +0000 (14:51 +0000)]
[AArch64] Add signed version of uaddlv test. NFC
Amy Kwan [Fri, 28 Jan 2022 15:26:12 +0000 (09:26 -0600)]
[PowerPC] Update P10 vector insert patterns to use refactored load/stores, and update handling of v4f32 vector insert.
This patch updates the P10 patterns with a load feeding into an insertelt to
utilize the refactored load and store infrastructure, as well as updating any
tests that exhibit any codegen changes.
Furthermore, custom legalization is added for v4f32 on Power9 and above to not
only assist with adjusting the refactored load/stores for P10 vector insert,
but also it enables the utilization of direct moves.
Differential Revision: https://reviews.llvm.org/D115691
Valentin Clement [Tue, 1 Feb 2022 14:26:47 +0000 (15:26 +0100)]
[flang] Add lowering for basic empty SUBROUTINE
This patch adds the ability to lower an empty subroutine.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D118695
Nikita Popov [Tue, 1 Feb 2022 08:42:36 +0000 (09:42 +0100)]
[AArch64] Do not use ABI alignment for mops.memset.tag
Pointer element types do not imply that the pointer is ABI aligned.
We should be using either an explicit align attribute here, or fall
back to an alignment of 1. This fixes a new element type access
introduced in D117764.
I don't think this makes any practical difference though, as the
lowering does not depend on alignment.
Differential Revision: https://reviews.llvm.org/D118681
Pavel Labath [Fri, 28 Jan 2022 09:53:49 +0000 (10:53 +0100)]
[lldb] Convert ProcessGDBRemoteLog to the new API
Christian Kühnel [Tue, 1 Feb 2022 10:14:07 +0000 (10:14 +0000)]
[clangd] Cleanup of readability-identifier-naming
Auto-generated patch based on clang-tidy readability-identifier-naming.
Only some manual cleanup for `extern "C"` declarations and a GTest change was required.
I'm not sure if this cleanup is actually very useful. It cleans up clang-tidy findings to the number of warnings from clang-tidy should be lower. Since it was easy to do and required only little cleanup I thought I'd upload it for discussion.
One pattern that keeps recurring: Test **matchers** are also supposed to start with a lowercase letter as per LLVM convention. However GTest naming convention for matchers start with upper case. I would propose to keep stay consistent with the GTest convention there. However that would imply a lot of `//NOLINT` throughout these files.
To re-product this patch run:
```
run-clang-tidy -checks="-*,readability-identifier-naming" -fix -format ./clang-tools-extra/clangd
```
To convert the macro names, I was using this script with some manual cleanup afterwards:
https://gist.github.com/ChristianKuehnel/
a01cc4362b07c58281554ab46235a077
Differential Revision: https://reviews.llvm.org/D115634
Nathan Sidwell [Mon, 24 Jan 2022 14:38:47 +0000 (06:38 -0800)]
[demangler] Preserve line numbering in copied demangler sources
While prepending lines to the copied source files is functional, it
disturbs the line numbering between the original and the copy. That
makes development more awkward than necessary, as it is the copy that
generally gets compiled first and emits compiler errors.
This uses sed to alter the first two lines, and also emits better
emacs mode setting, getting both C++ mode and read-only mode.
While here, also update and clarify documentation.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118135
Marek Kurdej [Tue, 1 Feb 2022 13:29:31 +0000 (14:29 +0100)]
[clang-format] Use std::iota and reserve when sorting Java imports. NFC.
This way we have at most 1 allocation even if the number of includes is greater than the on-stack size of the small vector.
Marek Kurdej [Tue, 1 Feb 2022 13:24:01 +0000 (14:24 +0100)]
[clang-format] Use std::iota and reserve. NFC.
This way we have at most 1 allocation even if the number of includes is greater than the on-stack size of the small vector.
Marek Kurdej [Tue, 1 Feb 2022 13:10:19 +0000 (14:10 +0100)]
[clang-format] De-pessimize appending newlines. NFC.
* Avoid repeatedly calling std::string::append(char) in a loop.
* Reserve before calling std::string::append(const char *) in a loop.
Marek Kurdej [Tue, 1 Feb 2022 12:55:05 +0000 (13:55 +0100)]
[clang-format] Use ranged for loops. NFC.
Jon Chesterfield [Tue, 1 Feb 2022 12:59:35 +0000 (12:59 +0000)]
[openmp] Disable tests that presently hang on CI
Nicolas Vasilache [Tue, 1 Feb 2022 12:59:11 +0000 (07:59 -0500)]
[mlir][vector][integration] Reactivate LLI in vector integration test.
The test introduced in https://reviews.llvm.org/D118006 was missing a return and would
introduce a non-0 return which would fail tests.
Valentin Clement [Tue, 1 Feb 2022 12:49:49 +0000 (13:49 +0100)]
[flang] Add lowering placeholders
This patch puts in place the differents
function to lower the evaluation list. All functions
are just placholders with TODOs for now.
Follow up patches will bring the proper lowering in these
functions.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D118678
Simon Pilgrim [Tue, 1 Feb 2022 12:33:17 +0000 (12:33 +0000)]
[DAG] SimplifyMultipleUseDemandedBits - add default Depth = 0 argument.
Simplifies an upcoming change.
Nicolas Vasilache [Tue, 1 Feb 2022 12:24:49 +0000 (07:24 -0500)]
Temporarily disable LLI to investigate weird non 0 error code
Somehow the test introduced in https://reviews.llvm.org/D118006 produces the expected result but running
through lli with Intel SDE activated sneaks in an error code 2 (before this commit) or an error code 10
(after this commit).
The test as is is still meaningful in that the LLVMIR generation would crash if the `elementtype` is set
improperly.
Still, this should run with lli turned on.
Nico Weber [Tue, 1 Feb 2022 12:22:33 +0000 (07:22 -0500)]
[gn build] unconfuse sync script after
762f0b546328
Alexander Shaposhnikov [Tue, 1 Feb 2022 12:14:25 +0000 (12:14 +0000)]
[CodeGen][AArch64] Fix typo in legalizer-info-validation.mir
Alexander Shaposhnikov [Tue, 1 Feb 2022 12:08:06 +0000 (12:08 +0000)]
[CodeGen][AArch64] Fix typo in arm64-zero-cycle-zeroing.ll
Alexander Shaposhnikov [Tue, 1 Feb 2022 12:00:13 +0000 (12:00 +0000)]
[llvm-objcopy][COFF] Add missing RUN in bigobj.test
Alexander Shaposhnikov [Tue, 1 Feb 2022 11:56:26 +0000 (11:56 +0000)]
[lld][MachO] Fix typo in rename.s
Simon Pilgrim [Tue, 1 Feb 2022 11:31:42 +0000 (11:31 +0000)]
[DAG] Make it clear mul(x,x) knownbits bit[1] == 0 check should be for x is undef only
As raised on rGffd0e464b4b9, if x is poison, this fold is still ok.
Alexander Shaposhnikov [Tue, 1 Feb 2022 11:25:16 +0000 (11:25 +0000)]
[lld][ELF] Add missing RUN in aarch64-adrp-ldr-got.s
Fraser Cormack [Tue, 1 Feb 2022 10:54:39 +0000 (10:54 +0000)]
[RISCV][3/3] Switch undef -> poison in scalable-vector RVV tests
Fraser Cormack [Tue, 1 Feb 2022 10:54:19 +0000 (10:54 +0000)]
[RISCV][2/3] Switch undef -> poison in fixed-vector RVV tests
Fraser Cormack [Tue, 1 Feb 2022 10:51:01 +0000 (10:51 +0000)]
[RISCV][1/3] Switch undef -> poison in VP RVV tests
Inspired by a recent Discourse post on undef vs. poison usage, this
series of patches should reduce the number of undefs in LLVM tests by
around 10%.
Only undef vector operands to insertelement/shufflevector have been
handled, which are by far the most common we've got.
The switchover is split into 3 fairly arbitrary clusters to make it
slightly more manageable: vector predication, fixed-length vectors,
scalable vectors.
Benjamin Kramer [Tue, 1 Feb 2022 10:58:27 +0000 (11:58 +0100)]
[mlir] Attempt working around a GCC 5 bug
It doesn't like implicit `this` in generic lambdas.
Nicolas Vasilache [Wed, 26 Jan 2022 10:57:09 +0000 (05:57 -0500)]
[mlir][LLVM] Add support for operand_attrs to InlineAsmOp
This revision adds enough support to allow InlineAsmOp to work properly with indirect memory constraints "*m".
These require an explicit "elementtype" TypeAttr on the operands to pass LLVM verification and need to be provided.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D118006
Nikita Popov [Tue, 1 Feb 2022 10:52:31 +0000 (11:52 +0100)]
[AArch64] Regenerate test checks (NFC)
The check lines were in the wrong order.
Prashant Kumar [Sat, 22 Jan 2022 18:52:46 +0000 (00:22 +0530)]
[MLIR] Extract division representation from equality expressions.
Extract the division representation from equality constraints.
For example:
32*k == 16*i + j - 31 <-- k is the localVariable
expr = 16*i + j - 31, divisor = 32
k = (16*i + j - 32) floordiv 32
The dividend of the division is set to [16, 1, -32] and the divisor is set
to 32.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D117959
Benjamin Kramer [Tue, 1 Feb 2022 10:37:15 +0000 (11:37 +0100)]
Revert "[SLP]Alternate vectorization for cmp instructions."
This reverts commit
afaaecc88c6e5989de8a6a0266610860ef99d9d6.
Crashes when compiling SciPy, test case https://reviews.llvm.org/P8276
tyb0807 [Sun, 23 Jan 2022 22:29:33 +0000 (22:29 +0000)]
[ARM] Make getInstSizeInBytes() use instruction size from InstrInfo.td
Currently, ARMBaseInstrInfo::getInstSizeInBytes() uses hard-coded
instruction size for some pseudo-instructions, while this
information should ideally be found in ARMInstrInfo.td,
ARMInstrThumb(2).td files (which can be accessed via MCInstrDesc). Hence,
the .td files should be updated and no hard-coded instruction sizes
should be used by getInstSizeInBytes() anymore.
Differential Revision: https://reviews.llvm.org/D118009
tyb0807 [Sat, 22 Jan 2022 10:31:56 +0000 (10:31 +0000)]
[AArch64] Make getInstSizeInBytes() use instruction size from InstrInfo.td
Currently, AArch64InstrInfo::getInstSizeInBytes() uses hard-coded
instruction size for some pseudo-instructions, while this
information should ideally be found in AArch64InstrInfo.td file (which
can be accessed via MCInstrDesc). Hence, the .td file should be updated
and no hard-coded instruction sizes should be used by
getInstSizeInBytes() anymore.
Differential Revision: https://reviews.llvm.org/D117970
Fraser Cormack [Mon, 31 Jan 2022 17:43:37 +0000 (17:43 +0000)]
[RISCV] Add a test showing an incorrect VSETVLI insertion
This test shows a loop, whose preheader uses a SEW=64, LMUL=1 vector
operation. The loop body starts off with another SEW=64, LMUL=1 VADD
vector operation, before switching to a SEW=32, LMUL=1/2 vector store
instruction.
We can see that the VSETVLI insertion pass omits a VSETVLI before the
VADD (thinking it inherits its configuration from the preheader) but
does place a SEW=32, LMUL=1/2 VSETVLI before the store. This results in
a miscompilation as when the loop comes back around, the VADD is
incorrectly configured with SEW=32, LMUL=1/2.
It appears to be a bad load/store optimization, as replacing the vector
store with an SEW=32, LMUL=1/2 VADD does correctly insert a VSETVLI. The
issue is therefore possibly arising from canSkipVSETVLIForLoadStore.
Differential Revision: https://reviews.llvm.org/D118629
David Spickett [Tue, 1 Feb 2022 10:11:02 +0000 (10:11 +0000)]
[compiler-rt][fuzzer] Disable 2 tests for Arm Thumb builds
These tests appear to be causing timeouts on our silent
Thumbv7 bot: https://lab.llvm.org/staging/#/builders/162/builds/260
It is possible they would complete given enough time. value-profile-switch
seems to take a long time even on a powerful Armv8 machine.
Bjorn Pettersson [Fri, 28 Jan 2022 12:23:47 +0000 (13:23 +0100)]
[DAGCombine] Add simple folds for SSHLSAT/USHLSAT
Do "simplifyShift" and "FoldConstantArithmetic" folds for the SSHLSAT
and USHLSAT DAG nodes.
This includes folds such as:
(shlsat undef/poison, x) -> 0
(shlsat x, undef/poison) -> undef
(shlsat x, too_large_shamt) -> undef
(shlsat 0, x) -> 0
(shlsat x, 0) -> x
(shlsat c1, c2) -> c3
Differential Revision: https://reviews.llvm.org/D118603
Bjorn Pettersson [Mon, 31 Jan 2022 22:23:48 +0000 (23:23 +0100)]
Pre-commit test cases missing SSHLSAT/USHLSAT folds. NFC
Florian Hahn [Tue, 1 Feb 2022 09:50:47 +0000 (09:50 +0000)]
[LV] Use onlyFirstLaneDemanded when widening pointer phis (NFCI).
This removes another instance of recipe execution still relying on
the cost model.
Depends on D116554.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D116656
David Sherwood [Thu, 13 Jan 2022 11:07:54 +0000 (11:07 +0000)]
[CodeGen] Support folds of not(cmp(cc, ...)) -> cmp(!cc, ...) for scalable vectors
I have updated TargetLowering::isConstTrueVal to also consider
SPLAT_VECTOR nodes with constant integer operands. This allows the
optimisation to also work for targets that support scalable vectors.
Differential Revision: https://reviews.llvm.org/D117210
Nikita Popov [Tue, 1 Feb 2022 09:42:34 +0000 (10:42 +0100)]
[ArgPromotion] Add alignment test (NFC)
This shows a miscompile in the current argpromotion implementation:
We may speculatively execute overaligned loads.
Jay Foad [Mon, 31 Jan 2022 16:56:32 +0000 (16:56 +0000)]
[StructurizeCFG] Clean up some boolean not instructions
In some cases StructurizeCFG inserts i1 xor instructions to invert
predicates. Add a quick loop to clean these up afterwards if we can get
away with modifying an existing compare instruction instead.
(StructurizeCFG is generally run late in the pipeline so instcombine
does not clean them up for us.)
Differential Revision: https://reviews.llvm.org/D118623
Nikita Popov [Tue, 1 Feb 2022 09:34:02 +0000 (10:34 +0100)]
[ArgPromotion] Regenerate test checks (NFC)
Nikita Popov [Tue, 1 Feb 2022 09:32:58 +0000 (10:32 +0100)]
[ArgPromotion] Use range-based for loop (NFC)
David Green [Tue, 1 Feb 2022 09:21:49 +0000 (09:21 +0000)]
[LV][AArch64] Add test for scalar interleaving with predication. NFC
Siva Chandra [Tue, 1 Feb 2022 06:17:44 +0000 (22:17 -0800)]
[libc] Add a few missing deps, includes, and fix a few typos.
This allows us to enable rmdir, mkdir, mkdirat, unlink and unlinkat for
aarch64.
Johannes Doerfert [Tue, 1 Feb 2022 08:23:55 +0000 (02:23 -0600)]
[Attributor][FIX] Relax assertion in IRPosition::verify
A call base can be a floating value if we talk about the instruction and
not the return value. This distinction was not made before but is
important for liveness, e.g., a call site return value might be unused
(=dead) but the call site is not.
Markus Lavin [Tue, 1 Feb 2022 08:16:50 +0000 (09:16 +0100)]
[llvm-reduce] Set ShouldPreserveUseListOrder=true
When exporting textual IR during reduction the ShouldPreserveUseListOrder
parameter of the IR printer should be set to get predictable results.
Differential Revision: https://reviews.llvm.org/D118585
Johannes Doerfert [Tue, 1 Feb 2022 08:18:02 +0000 (02:18 -0600)]
[UpdateTestChecks][FIX] Expected output changed with Attributor
Marek Kurdej [Tue, 1 Feb 2022 08:05:26 +0000 (09:05 +0100)]
[clang-format] Fix AlignConsecutiveAssignments breaking lambda formatting.
Fixes https://github.com/llvm/llvm-project/issues/52772.
This patch fixes the formatting of the code:
```
auto
aaaaaaaaaaaaaaaaaaaaa = {};
auto b = g([] {
return;
});
```
which should be left as is, but before this patch was formatted to:
```
auto
aaaaaaaaaaaaaaaaaaaaa = {};
auto b = g([] {
return;
});
```
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D115972
Fangrui Song [Tue, 1 Feb 2022 08:16:42 +0000 (00:16 -0800)]
[ELF] Change vector<Symbol *> to SmallVector. NFC
Siva Chandra Reddy [Tue, 1 Feb 2022 08:13:43 +0000 (08:13 +0000)]
[libc] Adjust few fcntl macros for aarch64.
Fangrui Song [Tue, 1 Feb 2022 08:14:21 +0000 (00:14 -0800)]
[ELF] Change vector<InputSection *> to SmallVector. NFC
My x86-64 lld executable is 8KiB smaller.
Johannes Doerfert [Tue, 1 Feb 2022 08:13:01 +0000 (02:13 -0600)]
[Attributor][FIX] Repair broken unit test
Fangrui Song [Tue, 1 Feb 2022 08:09:30 +0000 (00:09 -0800)]
[ELF] Switch split-stack to use SmallVector. NFC
My x86-64 lld executable is 1.1KiB smaller.
Marek Kurdej [Mon, 31 Jan 2022 17:39:00 +0000 (18:39 +0100)]
[clang-format] Don't break block comments when sorting includes.
Fixes https://github.com/llvm/llvm-project/issues/34626.
Before, the include sorter would break the code:
```
#include <stdio.h>
#include <stdint.h> /* long
comment */
```
and change it into:
```
#include <stdint.h> /* long
#include <stdio.h>
comment */
```
This commit handles only the most basic case of a single block comment on an include line, but does not try to handle all the possible edge cases with multiple comments.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D118627
Johannes Doerfert [Mon, 31 Jan 2022 22:45:17 +0000 (16:45 -0600)]
[Attributor] Introduce the `AA::isPotentiallyReachable` helper APIs
To make usage easier (compared to the many reachability related AAs),
this patch introduces a helper API, `AA::isPotentiallyReachable`, which
performs all the necessary steps. It also does the "backwards"
reachability (see D106720) as that simplifies the AA a lot (backwards
queries were somewhat different from the other query resolvers), and
ensures we use cached values in every stage.
To test inter-procedural reachability in a reasonable way this patch
includes an extension to `AAPointerInfo::forallInterferingWrites`.
Basically, we can exclude writes if they cannot reach a load "during the
lifetime" of the allocation. That is, we need to go up the call graph to
determine reachability until we can determine the allocation would be
dead in the caller. This leads to new constant propagations (through
memory) in `value-simplify-pointer-info-gpu.ll`.
Note: The new code contains plenty debug output to determine how
reachability queries are resolved.
Parts extracted from D110078.
Differential Revision: https://reviews.llvm.org/D118673
Johannes Doerfert [Mon, 31 Jan 2022 20:16:43 +0000 (14:16 -0600)]
[Attributor] Introduce the concept of query AAs
D106720 introduced features that did not work properly as we could add
new queries after a fixpoint was reached and which could not be answered
by the information gathered up to the fixpoint alone.
As an alternative to D110078, which forced eager computation where we
want to continue to be lazy, this patch fixes the problem.
QueryAAs are AAs that allow lazy queries during their lifetime. They are
never fixed if they have no outstanding dependences and always run as
part of the updates in an iteration. To determine if we are done, all
query AAs are asked if they received new queries, if not, we only need
to consider updated AAs, as before. If new queries are present we go for
another iteration.
Differential Revision: https://reviews.llvm.org/D118669
Johannes Doerfert [Tue, 1 Feb 2022 01:16:45 +0000 (19:16 -0600)]
[Attributor] Pre-commit test case
This test shows how we can use alloca position and kernel+AS information
to improve reachability queries and consequently store-load forwarding.
The thirst argument passed to the @use function can be determined
statically (a constant). The others cannot and are there for
verification.
Kuter Dinel [Mon, 31 Jan 2022 20:29:09 +0000 (14:29 -0600)]
[Attributor] AAFunctionReachability, Instruction reachability.
This patch implement instruction reachability for AAFunctionReachability
attribute. It is used to tell if a certain instruction can reach a function
transitively.
NOTE: I created a new commit based of D106720 and set the author back to
Kuter. Other metadata, etc. is wrong. I also addressed the
remaining review comments and fixed the unit test.
Differential Revision: https://reviews.llvm.org/D106720
Johannes Doerfert [Mon, 20 Sep 2021 19:41:52 +0000 (14:41 -0500)]
[Attributor] Use AAFunctionReachability to determine AANoRecurse
We missed out on AANoRecurse in the module pass because we had no call
graph. With AAFunctionReachability we can simply ask if the function may
reach itself.
Differential Revision: https://reviews.llvm.org/D110099
Johannes Doerfert [Sun, 30 Jan 2022 22:40:34 +0000 (16:40 -0600)]
[Attributor] Make interprocedural value explicit in genericValueTraversal
genericValueTraversal can look through arguments and allow value
simplification across function boundaries. In fact, the latter already
happened unchecked. With this change we allow the user of
genericValueTraversal to opt-out of interprocedural traversal if
required. We explicitly look through arguments now which helps to do
various things, incl. the propagation of constants into OpenMP parallel
regions (on the host).
Christian Sigg [Tue, 1 Feb 2022 06:15:35 +0000 (07:15 +0100)]
[MLIR][arith] Mark addf/mulf as commutative
Following the discussion in D118318, mark `arith.addf/mulf` commutative.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D118600
Mogball [Tue, 1 Feb 2022 06:58:02 +0000 (06:58 +0000)]
[mlir][ods] Unify Attr/TypeDef and Operation Format Parsing
Part 2 of 3 of unifying the assembly formats of attributes/types and operations.The last patch that introduced attribute/type formats (D111594) factored out the format lexer entirely. This patch factors out most of the format parsers such that the attribute/type and op parsers only need to implement handling for specific elements.
Certain things could be factored better (element verification, 'seen' variables) but the primary goal of factoring is so that features can be used across both assembly formats.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117971
Johannes Doerfert [Tue, 1 Feb 2022 02:23:18 +0000 (20:23 -0600)]
[Attributor][FIX] Liveness handling in the isAssumedDead helpers
This fixes a conceptual problem with our AAIsDead usage which conflated
call site liveness with call site return value liveness. Without the
fix tests would obviously miscompile as we make genericValueTraversal
more powerful (in a follow up). The effects on the tests are mixed but
mostly marginal. The most prominent one is the lack of `noreturn` for
functions. The reason is that we make entire blocks live at the same
time (for time reasons). Now that we actually look at the block
liveness, which we need to do, the return instructions are live and
will survive. As an example, `noreturn_async.ll` has been modified
to retain the `noreturn` even with block granularity. We could address
this easily but there is little need in practice.
Johannes Doerfert [Mon, 31 Jan 2022 13:55:11 +0000 (07:55 -0600)]
[Attributor] Use edge liveness rather than block liveness
We moved to the edge API a while back, not all uses were adjusted.
Edge liveness is more precise.
Johannes Doerfert [Mon, 31 Jan 2022 13:53:31 +0000 (07:53 -0600)]
[Attributor][FIX] Address two oversights in AAIsDead
No tests as these were found browsing the code and I'm not sure how to
test them properly.
Johannes Doerfert [Mon, 31 Jan 2022 13:52:19 +0000 (07:52 -0600)]
[Attributor][NFCI] Improve debug diagnostic
Johannes Doerfert [Sun, 30 Jan 2022 21:51:14 +0000 (15:51 -0600)]
[Attributor] Provide convenient helpers for isAssumedRead{None,Only}
We have two attributes that can answer readnone queries. While there is
a dependence between them, it seems best to not force the users to know
what AA to ask. The helpers also allow to check for readonly nicely.
Test changes show where we now deduce readnone but haven't before,
mostly because we only asked AAMemoryBehavior and not AAMemoryLocation.
AANoAlias has not been ported to the new API yet.
Johannes Doerfert [Sat, 17 Jul 2021 06:54:43 +0000 (01:54 -0500)]
[Attributor] Use CFG reasoning to filter potentially interfering writes
Since D104432 we can look through memory by analyzing all writes that
might interfere with a load. This patch provides some logic to exclude
writes that cannot interfere with a location, due to CFG reasoning.
We make sure to avoid multi-thread write-read situations properly while
we ignore writes that cannot reach a load or writes that will be
overwritten before the load is reached.
Differential Revision: https://reviews.llvm.org/D106397
Johannes Doerfert [Sun, 30 Jan 2022 21:21:27 +0000 (15:21 -0600)]
[Attributor][NFC] Make debug output more useful and concise
Johannes Doerfert [Wed, 26 Jan 2022 21:53:39 +0000 (15:53 -0600)]
[OpenMP][FIX] Explicit barriers in SPMD mode are not aligned
Due to num_threads (probably also other reasons) we cannot assume
explicit barriers are always executed by all threads in an aligned
fashion. We can optimize them if that property can be proven but
that is different.
Johannes Doerfert [Sun, 23 Jan 2022 20:06:22 +0000 (14:06 -0600)]
[Attributor][NFCI] Expose some nosync reasoning to outside users.
No-sync is a property that we need in more places as complex
transformations emerge. To simplify the query we provide an
`AA::isNoSyncInst` helper now and expose two existing helpers through
the `AANoSync` class.
Johannes Doerfert [Sun, 23 Jan 2022 20:08:06 +0000 (14:08 -0600)]
[Attributor][NFCI] Remove anonymous namespaces
The namespaces made it more complicate to implement static helpers,
among other things. We should not need them at all.
Johannes Doerfert [Sat, 22 Jan 2022 22:24:52 +0000 (16:24 -0600)]
[OpenMP] Eliminate redundant barriers in the same block
Patch originally by Giorgis Georgakoudis (@ggeorgakoudis), typos and
bugs introduced later by me.
This patch allows us to remove redundant barriers if they are part
of a "consecutive" pair of barriers in a basic block with no impacted
memory effect (read or write) in-between them. Memory accesses to
local (=thread private) or constant memory are allowed to appear.
Technically we could also allow any other memory that is not used to
share information between threads, e.g., the result of a malloc that
is also not captured. However, it will be easier to do more reasoning
once the code is put into an AA. That will also allow us to look through
phis/selects reasonably. At that point we should also deal with calls,
barriers in different blocks, and other complexities.
Differential Revision: https://reviews.llvm.org/D118002
Johannes Doerfert [Fri, 21 Jan 2022 21:47:56 +0000 (15:47 -0600)]
[OpenMP] Ensure to remove noinline from all runtime functions eventually
We used to remove noinline from known OpenMP runtime functions (which
are declared in OMPKinds.td). Now we remove noinline from all functions
with the proper prefixes: __kmpc, _ZN4_OMP (= namespace omp), omp_
Amir Ayupov [Mon, 31 Jan 2022 06:02:51 +0000 (22:02 -0800)]
[BOLT][CMAKE] Add extra BOLT_INCLUDE_TESTS condition for merge-fdata emit-relocs option
Only enable --emit-relocs linker option for merge-fdata target if tests are enabled.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D118580
Siva Chandra Reddy [Mon, 31 Jan 2022 17:32:07 +0000 (17:32 +0000)]
[libc] Add implementations of POSIX mkdir, mkdirat, rmdir, unlink and unlinkat.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D118641
Jez Ng [Tue, 1 Feb 2022 04:45:19 +0000 (23:45 -0500)]
[lld-macho][test] Add test for UUID format
Reviewed By: keith
Differential Revision: https://reviews.llvm.org/D118646
Serguei Katkov [Thu, 27 Jan 2022 05:21:09 +0000 (12:21 +0700)]
[RS4GC] Make PointerToBase mapping be independent on call site. NFC.
PointerToBase is a mapping between potentially derived pointer to its base.
As soon as we are in SSA form if there is a base of derived pointer and it
is available at def of derived pointer, the same base will be available at any
point where derived pointer is alive.
So the mapping of derived pointer to base pointer is not a property
of a call site but the same on function level.
Reviewers: reames, yrouban
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D118604
Joseph Huber [Tue, 1 Feb 2022 04:32:33 +0000 (23:32 -0500)]
[OpenMP] Remove new driver tests for AMDGPU
Some of the new driver tests are flaky on AMDGPU, remove for now.
Joseph Huber [Mon, 31 Jan 2022 19:31:54 +0000 (14:31 -0500)]
[Libomptarget] Run GPU offloading tests using the new drvier
This patch adds a new target to the tests to run using the new driver as
the method for generating offloading code.
Depends on D116541
Differential Revision: https://reviews.llvm.org/D118637
Joseph Huber [Fri, 21 Jan 2022 20:43:20 +0000 (15:43 -0500)]
[PassBuilder] Add OpenMPOpt to default LTO pipeline
The LTO support for OpenMP offloading allows us to run the OpenMPOpt
pass during the LTO pipeline. This patch introduces an early run of the
Module pass and a late run of the CGSCC pass. These are quick no-ops if
there is no OpenMP in the module.
Depends on D118198
Differential Revision: https://reviews.llvm.org/D118611
Joseph Huber [Tue, 25 Jan 2022 22:46:01 +0000 (17:46 -0500)]
[OpenMP] Remove call to 'clang-offload-wrapper' binary
Summary:
This patch removes the system call to the `clang-offload-wrapper` tool
by replicating its functionality in a new file. This improves
performance and makes the future wrapping functionality easier to
change.
Differential Revision: https://reviews.llvm.org/D118198
Joseph Huber [Tue, 25 Jan 2022 19:25:39 +0000 (14:25 -0500)]
[OpenMP] Replace sysmtem call to `llc` with target machine
Summary:
This patch replaces the system call to the `llc` binary with a library
call to the target machine interface. This should be faster than
relying on an external system call to compile the final wrapper binary.
Differential Revision: https://reviews.llvm.org/D118197
Joseph Huber [Tue, 25 Jan 2022 16:23:27 +0000 (11:23 -0500)]
[OpenMP] Cleanup the Linker Wrapper
Summary:
Various changes and cleanup for the Linker Wrapper tool.
Joseph Huber [Tue, 18 Jan 2022 15:56:12 +0000 (10:56 -0500)]
[OpenMP] Include the executable name in the temporary files
Summary:
This parses the executable name out of the linker arguments so we can
use it to give more informative temporary file names and so we don't
accidentally use it for device linking.
Joseph Huber [Sun, 16 Jan 2022 21:06:59 +0000 (16:06 -0500)]
[OpenMP] Implement save temps functionality in linker wrapper
Summary:
This patch implements the `-save-temps` flag for the linker wrapper.
This allows the user to inspect the intermeditary outpout that the
linker wrapper creates.