Commit Graph

413392 Commits

Author SHA1 Message Date
Nicolas Vasilache c2fa5ff5ad 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.
2022-02-01 07:24:49 -05:00
Nico Weber 93dc66a088 [gn build] unconfuse sync script after 762f0b5463 2022-02-01 07:22:33 -05:00
Alexander Shaposhnikov d03076223b [CodeGen][AArch64] Fix typo in legalizer-info-validation.mir 2022-02-01 12:14:25 +00:00
Alexander Shaposhnikov 80c27fbf94 [CodeGen][AArch64] Fix typo in arm64-zero-cycle-zeroing.ll 2022-02-01 12:08:06 +00:00
Alexander Shaposhnikov 3f53722347 [llvm-objcopy][COFF] Add missing RUN in bigobj.test 2022-02-01 12:00:13 +00:00
Alexander Shaposhnikov 7244901ef6 [lld][MachO] Fix typo in rename.s 2022-02-01 11:57:04 +00:00
Simon Pilgrim d83a96f59f [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.
2022-02-01 11:32:14 +00:00
Alexander Shaposhnikov f131d4d0d0 [lld][ELF] Add missing RUN in aarch64-adrp-ldr-got.s 2022-02-01 11:25:16 +00:00
Fraser Cormack e9ceeedf30 [RISCV][3/3] Switch undef -> poison in scalable-vector RVV tests 2022-02-01 11:06:56 +00:00
Fraser Cormack 8d1169cf74 [RISCV][2/3] Switch undef -> poison in fixed-vector RVV tests 2022-02-01 11:06:56 +00:00
Fraser Cormack 414f21ed23 [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.
2022-02-01 11:06:55 +00:00
Benjamin Kramer a0ea73394f [mlir] Attempt working around a GCC 5 bug
It doesn't like implicit `this` in generic lambdas.
2022-02-01 11:58:27 +01:00
Nicolas Vasilache 42398b5142 [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
2022-02-01 05:56:14 -05:00
Nikita Popov ccda3d4ec1 [AArch64] Regenerate test checks (NFC)
The check lines were in the wrong order.
2022-02-01 11:55:02 +01:00
Prashant Kumar 1e7c464d2c [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
2022-02-01 16:24:28 +05:30
Benjamin Kramer 5281f0dab2 Revert "[SLP]Alternate vectorization for cmp instructions."
This reverts commit afaaecc88c.

Crashes when compiling SciPy, test case https://reviews.llvm.org/P8276
2022-02-01 11:40:43 +01:00
tyb0807 762f0b5463 [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
2022-02-01 10:39:14 +00:00
tyb0807 dd88f40c80 [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
2022-02-01 10:39:14 +00:00
Fraser Cormack b00bce2a93 [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
2022-02-01 10:21:29 +00:00
David Spickett df3d121bb9 [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.
2022-02-01 10:13:23 +00:00
Bjorn Pettersson 3885879046 [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
2022-02-01 10:51:35 +01:00
Bjorn Pettersson 06105f2ef1 Pre-commit test cases missing SSHLSAT/USHLSAT folds. NFC 2022-02-01 10:51:35 +01:00
Florian Hahn 7fe4fa9a0a
[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
2022-02-01 09:50:47 +00:00
David Sherwood daa80339df [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
2022-02-01 09:50:00 +00:00
Nikita Popov a24cc48bc6 [ArgPromotion] Add alignment test (NFC)
This shows a miscompile in the current argpromotion implementation:
We may speculatively execute overaligned loads.
2022-02-01 10:45:14 +01:00
Jay Foad d2e5d3512b [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
2022-02-01 09:35:37 +00:00
Nikita Popov db04266bf6 [ArgPromotion] Regenerate test checks (NFC) 2022-02-01 10:34:14 +01:00
Nikita Popov 79179a378b [ArgPromotion] Use range-based for loop (NFC) 2022-02-01 10:34:14 +01:00
David Green aaa16eb023 [LV][AArch64] Add test for scalar interleaving with predication. NFC 2022-02-01 09:21:49 +00:00
Siva Chandra be7c865af1 [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.
2022-02-01 00:26:36 -08:00
Johannes Doerfert 3b8ffe668d [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.
2022-02-01 02:25:44 -06:00
Markus Lavin 8a8af12028 [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
2022-02-01 09:24:59 +01:00
Johannes Doerfert d19e530240 [UpdateTestChecks][FIX] Expected output changed with Attributor 2022-02-01 02:18:57 -06:00
Marek Kurdej fd33cca762 [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
2022-02-01 09:17:59 +01:00
Fangrui Song 4d38d7684c [ELF] Change vector<Symbol *> to SmallVector. NFC 2022-02-01 00:16:42 -08:00
Siva Chandra Reddy 4c1b44160a [libc] Adjust few fcntl macros for aarch64. 2022-02-01 08:14:32 +00:00
Fangrui Song 196aedb843 [ELF] Change vector<InputSection *> to SmallVector. NFC
My x86-64 lld executable is 8KiB smaller.
2022-02-01 00:14:21 -08:00
Johannes Doerfert 783544bd16 [Attributor][FIX] Repair broken unit test 2022-02-01 02:13:17 -06:00
Fangrui Song d97749fabc [ELF] Switch split-stack to use SmallVector. NFC
My x86-64 lld executable is 1.1KiB smaller.
2022-02-01 00:09:30 -08:00
Marek Kurdej 95bf0a9ebd [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
2022-02-01 08:51:10 +01:00
Johannes Doerfert a265cf22af [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
2022-02-01 01:40:45 -06:00
Johannes Doerfert b51b83f68e [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
2022-02-01 01:40:44 -06:00
Johannes Doerfert 09802f8458 [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.
2022-02-01 01:40:44 -06:00
Kuter Dinel b2d1ae0611 [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
2022-02-01 01:40:44 -06:00
Johannes Doerfert ac3ec22df9 [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
2022-02-01 01:40:44 -06:00
Johannes Doerfert d1186ce7a9 [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).
2022-02-01 01:40:44 -06:00
Christian Sigg 9b078f8fd2 [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
2022-02-01 08:33:48 +01:00
Mogball 0bc0ad86e2 [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
2022-02-01 07:28:37 +00:00
Johannes Doerfert a1db0e523d [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.
2022-02-01 01:18:52 -06:00
Johannes Doerfert 0f471710f8 [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.
2022-02-01 01:18:51 -06:00