platform/upstream/llvm.git
2 years ago[libc++][NFC] Replace enable_if with __enable_if_t in a few places
Nikolas Klauser [Sun, 3 Jul 2022 23:21:44 +0000 (01:21 +0200)]
[libc++][NFC] Replace enable_if with __enable_if_t in a few places

Reviewed By: ldionne, #libc

Spies: jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128400

2 years ago[SimplifyCFG] Remove redundant checks for hoisting (NFCI)
Nikita Popov [Mon, 4 Jul 2022 08:52:12 +0000 (10:52 +0200)]
[SimplifyCFG] Remove redundant checks for hoisting (NFCI)

These conditions are later checked in the HoistTerminator code
path. Checking them here is somewhat confusing, because this code
only checks the first instruction in the block, which is not
necessarily the terminator.

2 years ago[mlir][Tensor] Move ParallelInsertSlice to the tensor dialect
Nicolas Vasilache [Thu, 30 Jun 2022 11:27:41 +0000 (04:27 -0700)]
[mlir][Tensor] Move ParallelInsertSlice to the tensor dialect

This is moslty NFC and will allow tensor.parallel_insert_slice to gain
rank-reducing semantics by reusing the vast majority of the tensor.insert_slice impl.

Depends on D128857

Differential Revision: https://reviews.llvm.org/D128920

2 years ago[AArch64] Add additional tests for D120481.
Florian Hahn [Mon, 4 Jul 2022 08:29:21 +0000 (09:29 +0100)]
[AArch64] Add additional tests for D120481.

2 years ago[LV] Simplify setDebugLocFromInst by using early exit (NFC).
Florian Hahn [Mon, 4 Jul 2022 08:25:26 +0000 (09:25 +0100)]
[LV] Simplify setDebugLocFromInst by using early exit (NFC).

Suggested as separate improvement in D128657.

2 years ago[IR] Remove support for insertvalue constant expression
Nikita Popov [Tue, 28 Jun 2022 09:25:54 +0000 (11:25 +0200)]
[IR] Remove support for insertvalue constant expression

This removes the insertvalue constant expression, as part of
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
This is very similar to the extractvalue removal from D125795.
insertvalue is also not supported in bitcode, so no auto-ugprade
is necessary.

ConstantExpr::getInsertValue() can be replaced with
IRBuilder::CreateInsertValue() or ConstantFoldInsertValueInstruction(),
depending on whether a constant result is required (with the latter
being fallible).

The ConstantExpr::hasIndices() and ConstantExpr::getIndices()
methods also go away here, because there are no longer any constant
expressions with indices.

Differential Revision: https://reviews.llvm.org/D128719

2 years ago[mlir][openmp] Added omp.taskloop
Shraiysh Vaishay [Mon, 4 Jul 2022 05:08:58 +0000 (10:38 +0530)]
[mlir][openmp] Added omp.taskloop

This patch adds omp.taskloop operation to OpenMP Dialect along with
tests.

Reviewed By: peixin

Differential Revision: https://reviews.llvm.org/D127380

2 years ago[RISCV] Add more SHXADD patterns.
Craig Topper [Mon, 4 Jul 2022 04:07:25 +0000 (21:07 -0700)]
[RISCV] Add more SHXADD patterns.

This handles the code we get for this.

int foo(unsigned x, int *y) {
    return y[x >> 3];
}

The srl and shl implied by the array index will be combined to
form (srl (and X, C2), C1). We need to reverse this get to back
the shl to fold into SHXADD.

2 years ago[RISCV] Move some SHXADD matching cases into a ComplexPattern. NFC
Craig Topper [Sun, 3 Jul 2022 21:41:36 +0000 (14:41 -0700)]
[RISCV] Move some SHXADD matching cases into a ComplexPattern. NFC

Some more complex cases require checking the relationship of
operands on different nodes of the match. They also require
additional instructions to be created. Using a ComplexPattern
gives us that flexibility.

I'll be adding another pattern in a future patch.

2 years ago[Driver] Ignore the clang modules validation-related flags if clang modules are not...
Argyrios Kyrtzidis [Sat, 2 Jul 2022 00:18:00 +0000 (17:18 -0700)]
[Driver] Ignore the clang modules validation-related flags if clang modules are not enabled

If clang modules are not enabled it becomes unnecessary to read the session timestamp file in order
to pass `-fbuild-session-timestamp` to the `cc1` invocation.

Differential Revision: https://reviews.llvm.org/D129030

2 years ago[AIX] Handling the label alignment of a global
esmeyi [Mon, 4 Jul 2022 03:16:16 +0000 (23:16 -0400)]
[AIX] Handling the label alignment of a global
variable with its multiple aliases.

This patch handles the case where a variable has
multiple aliases.
AIX's assembly directive .set is not usable for the
aliasing purpose, and using different labels allows
AIX to emulate symbol aliases. If a value is emitted
between any two labels, meaning they are not aligned,
XCOFF will automatically calculate the offset for them.

This patch implements:
1) Emits the label of the alias just before emitting
the value of the sub-element that the alias referred to.
2) A set of aliases that refers to the same offset
should be aligned.
3) We didn't emit aliasing labels for common and
zero-initialized local symbols in
PPCAIXAsmPrinter::emitGlobalVariableHelper, but
emitted linkage for them in
AsmPrinter::emitGlobalAlias, which caused a FAILURE.
This patch fixes the bug by blocking emitting linkage
for the alias without a label.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D124654

2 years ago[mlir][Vector] Fold ShuffleOp(SplatOp(X), SplatOp(X)) to SplatOp(X).
jacquesguan [Fri, 1 Jul 2022 07:08:58 +0000 (15:08 +0800)]
[mlir][Vector] Fold ShuffleOp(SplatOp(X), SplatOp(X)) to SplatOp(X).

This patch folds ShuffleOp(SplatOp(X), SplatOp(X)) to SplatOp(X).

Differential Revision: https://reviews.llvm.org/D128969

2 years ago[SCEV] recognize llvm.annotation intrinsic
Chen Zheng [Wed, 29 Jun 2022 09:21:04 +0000 (05:21 -0400)]
[SCEV] recognize llvm.annotation intrinsic

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D127835

2 years ago[clang-tidy] Properly forward clang-tidy output when running tests
Nicolas van Kempen [Sun, 3 Jul 2022 22:27:57 +0000 (16:27 -0600)]
[clang-tidy] Properly forward clang-tidy output when running tests

When running tests, the check_clang_tidy script encodes the output
string, making it hard to read when debugging checks. This removes the
.encode() call.

Test Plan:
Making a new default check for testing (as of right now, it includes a
failing test):

[~/llvm-project/clang-tools-extra] python3 clang-tidy/add_new_check.py
bugprone example
<...>
Pre-changes:

[~/llvm-project/build] ninja check-clang-tools
<...>
------------------------ clang-tidy output -----------------------
b"1 warning
generated.\n/data/users/nvankempen/llvm-project/build/Debug/tools/clang/tools/extra/test/clang-tidy/checkers/Output/bugprone-example.cpp.tmp.cpp:4:6:
warning: function 'f' is insufficiently awesome [bugprone-example]\nvoid
f();\n
^\n/data/users/nvankempen/llvm-project/build/Debug/tools/clang/tools/extra/test/clang-tidy/checkers/Output/bugprone-example.cpp.tmp.cpp:4:6:
note: insert 'awesome'\nvoid f();\n     ^\n     awesome_\n"

------------------------------------------------------------------
<...>
Post-changes:

[~/llvm-project/build] ninja check-clang-tools
<...>
------------------------ clang-tidy output -----------------------
1 warning generated.
/data/users/nvankempen/llvm-project/build/Debug/tools/clang/tools/extra/test/clang-tidy/checkers/Output/bugprone-example.cpp.tmp.cpp:4:6:
warning: function 'f' is insufficiently awesome [bugprone-example]
void f();
     ^
/data/users/nvankempen/llvm-project/build/Debug/tools/clang/tools/extra/test/clang-tidy/checkers/Output/bugprone-example.cpp.tmp.cpp:4:6:
note: insert 'awesome'
void f();
     ^
     awesome_

------------------------------------------------------------------
<...>

Differential Revision: https://reviews.llvm.org/D127807

2 years ago[clang-tidy] Don't treat invalid branches as identical
Ishaan Gandhi [Sun, 3 Jul 2022 20:42:31 +0000 (14:42 -0600)]
[clang-tidy] Don't treat invalid branches as identical

The clang-tidy check bugprone-branch-clone has a false positive if some
symbols are undefined. This patch silences the warning when the two
sides of a branch are invalid.

Fixes #56057

Differential Revision: https://reviews.llvm.org/D128402

2 years ago[clang] Fix gcc-6 compilation error. (NFC)
Sunho Kim [Sun, 3 Jul 2022 20:30:56 +0000 (05:30 +0900)]
[clang] Fix gcc-6 compilation error. (NFC)

Fix https://github.com/llvm/llvm-project/issues/55626.

Differential Revision: https://reviews.llvm.org/D129049

2 years ago[clang-format] Tweak help text a bit
Nico Weber [Fri, 1 Jul 2022 11:37:29 +0000 (13:37 +0200)]
[clang-format] Tweak help text a bit

In particular, make it clear that `--style=file` is the default,
since there's some confusion about this, e.g. here:
https://stackoverflow.com/questions/61455148/

Differential Revision: https://reviews.llvm.org/D128984

2 years ago[InstCombine] fold negated low-bit-mask to cmp+select
Sanjay Patel [Sun, 3 Jul 2022 16:23:29 +0000 (12:23 -0400)]
[InstCombine] fold negated low-bit-mask to cmp+select

(-(X & 1)) & Y --> (X & 1) == 0 ? 0 : Y
https://alive2.llvm.org/ce/z/rhpH3i

This is noted as a missing IR canonicalization in issue #55618.
We already managed to fix codegen to the expected form.

2 years ago[InstCombine] add tests for and-of-negated-lowbitmask; NFC
Sanjay Patel [Sun, 3 Jul 2022 15:03:16 +0000 (11:03 -0400)]
[InstCombine] add tests for and-of-negated-lowbitmask; NFC

2 years ago[gn build] Port 2aea8af25136
LLVM GN Syncbot [Sun, 3 Jul 2022 16:05:49 +0000 (16:05 +0000)]
[gn build] Port 2aea8af25136

2 years ago[libc++] Make _LIBCPP_DEBUG_RANDOMIZE_RANGE a function
Nikolas Klauser [Sun, 3 Jul 2022 14:52:22 +0000 (16:52 +0200)]
[libc++] Make _LIBCPP_DEBUG_RANDOMIZE_RANGE a function

Reviewed By: ldionne, Mordante, var-const, #libc

Spies: mgorny, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128181

2 years ago[RISCV] Replace call to APInt::countTrailingZeros with uint64_t verson. NFC
Craig Topper [Sun, 3 Jul 2022 15:57:51 +0000 (08:57 -0700)]
[RISCV] Replace call to APInt::countTrailingZeros with uint64_t verson. NFC

We know the number of bits is 64 or 32 so we can use the uint64_t
version directly. This saves the APInt needing to check for the
small vs large size.

2 years ago[MLIR][Affine] Allow affine-expr on RHS in IntegerSet
Groverkss [Sun, 3 Jul 2022 15:22:35 +0000 (16:22 +0100)]
[MLIR][Affine] Allow affine-expr on RHS in IntegerSet

Currently, the parser for IntegerSet, only allows constraints like:

```
affine-constraint ::= affine-expr `>=` `0`
                    | affine-expr `==` `0`
```

This form is sometimes unreadable and painful to use when writing unittests
for Presburger library and tests in general.

This patch extends the parser to allow affine constraints with affine-expr on
the RHS:

```
affine-constraint ::= affine-expr `>=` `affine-expr`
                    | affine-expr `==` `affine-expr`
```

The internal storage and printing of IntegerSet is still in the original format.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D128915

2 years ago[AArch64] Regenerate more tests. NFC
David Green [Sun, 3 Jul 2022 14:49:16 +0000 (15:49 +0100)]
[AArch64] Regenerate more tests. NFC

Also includes some adjustments for asm.py to handle updating more cases
successfully.

2 years ago[NFC] Switch a few uses of undef to poison as placeholders for unreachble code
Nuno Lopes [Sun, 3 Jul 2022 13:33:47 +0000 (14:33 +0100)]
[NFC] Switch a few uses of undef to poison as placeholders for unreachble code

2 years ago[RISCV] Add a scavenge spill slot when use ADDI to compute scalable stack offset
luxufan [Sat, 18 Jun 2022 15:44:09 +0000 (23:44 +0800)]
[RISCV] Add a scavenge spill slot when use ADDI to compute scalable stack offset

Computing scalable offset needs up to two scrach registers. We add
scavenge spill slots according to the result of `RISCV::isRVVSpill`
and `RVVStackSize`. Since ADDI is not included in `RISCV::isRVVSpill`,
PEI doesn't add scavenge spill slots for scrach registers when using
ADDI to get scalable stack offsets.

The ADDI instruction has a destination register which can be used as
a scrach register. So one scavenge spil slot is sufficient for
computing scalable stack offsets.

Differential Revision: https://reviews.llvm.org/D128188

2 years agoRevert "Reland "[NFC] Add a missing test for for clang-repl""
Jun Zhang [Sun, 3 Jul 2022 11:40:56 +0000 (19:40 +0800)]
Revert "Reland "[NFC] Add a missing test for for clang-repl""

This reverts commit 8679cbc29fb76195544956fe233060bb7a1a6453.
See https://lab.llvm.org/buildbot/#/builders/216/builds/6799

2 years ago[LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]
Nuno Lopes [Sun, 3 Jul 2022 10:56:29 +0000 (11:56 +0100)]
[LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]

2 years agoReland "[NFC] Add a missing test for for clang-repl"
Jun Zhang [Sun, 3 Jul 2022 10:04:52 +0000 (18:04 +0800)]
Reland "[NFC] Add a missing test for for clang-repl"

This reverts 3668d1264e2d246f7e222338b8a5cab18ce1bdab
As far as we know, `__attribute__((weak))` support has been really bad
in runtimeldyld, so we just disable it in Windows at this moment. This
should fix the angry Windows buildbot.

Differential Revision: https://reviews.llvm.org/D129042

2 years ago[FPEnv] Allow CompoundStmt to keep FP options
Serge Pavlov [Fri, 1 Jul 2022 11:32:26 +0000 (18:32 +0700)]
[FPEnv] Allow CompoundStmt to keep FP options

This is a recommit of b822efc7404bf09ccfdc1ab7657475026966c3b2,
reverted in dc34d8df4c48b3a8f474360970cae8a58e6c84f0. The commit caused
fails because the test ast-print-fp-pragmas.c did not specify particular
target, and it failed on targets which do not support constrained
intrinsics. The original commit message is below.

AST does not have special nodes for pragmas. Instead a pragma modifies
some state variables of Sema, which in turn results in modified
attributes of AST nodes. This technique applies to floating point
operations as well. Every AST node that can depend on FP options keeps
current set of them.

This technique works well for options like exception behavior or fast
math options. They represent instructions to the compiler how to modify
code generation for the affected nodes. However treatment of FP control
modes has problems with this technique. Modifying FP control mode
(like rounding direction) usually requires operations on hardware, like
writing to control registers. It must be done prior to the first
operation that depends on the control mode. In particular, such
operations are required for implementation of `pragma STDC FENV_ROUND`,
compiler should set up necessary rounding direction at the beginning of
compound statement where the pragma occurs. As there is no representation
for pragmas in AST, the code generation becomes a complicated task in
this case.

To solve this issue FP options are kept inside CompoundStmt. Unlike to FP
options in expressions, these does not affect any operation on FP values,
but only inform the codegen about the FP options that act in the body of
the statement. As all pragmas that modify FP environment may occurs only
at the start of compound statement or at global level, such solution
works for all relevant pragmas. The options are kept as a difference
from the options in the enclosing compound statement or default options,
it helps codegen to set only changed control modes.

Differential Revision: https://reviews.llvm.org/D123952

2 years ago[Bazel] Make `builtin_headers_gen` as subset of CMake's `clang-resource-headers`
NAKAMURA Takumi [Sun, 3 Jul 2022 06:23:10 +0000 (15:23 +0900)]
[Bazel] Make `builtin_headers_gen` as subset of CMake's `clang-resource-headers`

At the moment, two files are not installed by CMake.

- `lib/Headers/openmp_wrappers/time.h`
- `lib/Headers/ppc_wrappers/nmmintrin.h`

`builtin_headers_gen` is available as the source of rules_pkg.
The difference of the layout of installed headers makes cache hit harder.

2 years ago[RISCV] Add more SHXADD isel patterns.
Craig Topper [Sun, 3 Jul 2022 06:11:14 +0000 (23:11 -0700)]
[RISCV] Add more SHXADD isel patterns.

This handles the code we get for

int foo(int* x, unsigned y) {
  return x[y >> 1];
}

The shift right and the shl will get DAG combined into
(shl (and X, 0xfffffffe), 1). We have custom isel to match the
shl+and, but with Zba the (add (shl X, 1), Y) part will get
matched and leave the and to be iseled by itself. This commit
adds a larger pattern that includes the and.

2 years ago[lsan] malloc_usable_size returns 0 for nullptr
Vitaly Buka [Sun, 3 Jul 2022 03:14:51 +0000 (20:14 -0700)]
[lsan] malloc_usable_size returns 0 for nullptr

2 years ago[mlir][complex] Inverse canonicalization between exp and log
lewuathe [Sun, 3 Jul 2022 00:26:41 +0000 (09:26 +0900)]
[mlir][complex] Inverse canonicalization between exp and log

We can canonicalize consecutive complex.exp and complex.log which are inverse functions each other.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D128966

2 years ago[RISCV] Match RISCVISD::ADD_LO in SelectAddrRegImm.
Craig Topper [Sat, 2 Jul 2022 16:51:00 +0000 (09:51 -0700)]
[RISCV] Match RISCVISD::ADD_LO in SelectAddrRegImm.

This allows us to fold global and constant pool addresses into
load/store during isel instead of in the post-isel peephole. I
did not copy the alignment check for ConsantPoolSDNode because it
wasn't tested.

This is a step towards being able to remove the post-isel
peephole.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D128738

2 years ago[VPlan] Move setDebugLocFromInst to VPTransformState (NFC).
Florian Hahn [Sat, 2 Jul 2022 14:18:16 +0000 (15:18 +0100)]
[VPlan] Move setDebugLocFromInst to VPTransformState (NFC).

The moved helpers are only used for codegen. It will allow moving the
remaining ::execute implementations out of LoopVectorize.cpp.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D128657

2 years ago[globalisel] Add test case for regbank selection.
Luo, Yuanke [Sat, 2 Jul 2022 08:49:02 +0000 (16:49 +0800)]
[globalisel] Add test case for regbank selection.

2 years ago[MLIR] Rename FusePadOpWithLinalgConsumer -> FusePadOpWithLinalgProducer (NFC)
lorenzo chelini [Fri, 1 Jul 2022 18:21:09 +0000 (20:21 +0200)]
[MLIR] Rename FusePadOpWithLinalgConsumer -> FusePadOpWithLinalgProducer (NFC)

Follow up after D128978, where I mistakenly rename the file. The linalg op is
fused with its producer, not the consumer.

2 years ago[RISCV] isel (shl (and X, C2), C) -> (slli (srliw X, C3), C3+C).
Craig Topper [Sat, 2 Jul 2022 07:57:35 +0000 (00:57 -0700)]
[RISCV] isel (shl (and X, C2), C) -> (slli (srliw X, C3), C3+C).

where C2 has 32 leading zeros and C3 trailing zeros.

When the shl is used by an add C is 1,2 or 3, we end up matching
(add (shl X, C), Y) first. This leaves an and with a constant that
is harder to materialize.

2 years ago[RISCV] isel (add (and X, 0xFFFFFFFE), Y) as (SH1ADD (SRLIW X, 1), Y).
Craig Topper [Sat, 2 Jul 2022 06:32:30 +0000 (23:32 -0700)]
[RISCV] isel (add (and X, 0xFFFFFFFE), Y) as (SH1ADD (SRLIW X, 1), Y).

Similar for SH2ADD and SH3ADD.

This is what we get from

int foo(int* x, unsigned y) {
  return x[y >> 1];
}

This allows us to avoid materializing 0xFFFFFFFE into a register.

2 years agoRevert "[CMake][Fuchsia] Use libunwind as the default unwinder"
Petr Hosek [Sat, 2 Jul 2022 04:51:16 +0000 (04:51 +0000)]
Revert "[CMake][Fuchsia] Use libunwind as the default unwinder"

This reverts commit 6213dba19fc0d65ab8b366b6d78c56cbd63c9d7d since
this broke Fuchsia builders.

2 years ago[clang-format][NFC] Replace an EXPECT_EQ with a verifyFormat
owenca [Sat, 2 Jul 2022 04:20:16 +0000 (21:20 -0700)]
[clang-format][NFC] Replace an EXPECT_EQ with a verifyFormat

2 years ago[llvm-objdump] Ensure offloading sections have proper alignment
Joseph Huber [Sat, 2 Jul 2022 03:24:22 +0000 (23:24 -0400)]
[llvm-objdump] Ensure offloading sections have proper alignment

Summary:
A previous patch added support for dumping offloading sections. The
tests for this feature added dummy input to the required section using
`llvm-objcopy`. This binary format has a required alignment of `8` which
was not being respected by the file copied with llvm-objcopy and would
cause failures on architectures sensitive to alignment problems or with
sanitizers. This patch adds the proper alignemnt and adds an error check
at least for the binary format so it's not completely opaque. This
should be improvbed so users actually get a helpful message.

2 years ago[RISCV] Restore "Enable shrink wrap by default"
Yeting Kuo [Fri, 1 Jul 2022 03:11:21 +0000 (11:11 +0800)]
[RISCV] Restore "Enable shrink wrap by default"

This reverts commit 7af3d4ab3d5da07256e1a7a0438e7308e14b9fd5.

RISC-V reverted the shrink wrap patch for bug 53662. Since the bug is fixed
by D123679, the commit re-enable it.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D128965

2 years ago[Attributor] Move heap2stack allocas to the entry block if possible
Johannes Doerfert [Fri, 1 Jul 2022 19:35:10 +0000 (14:35 -0500)]
[Attributor] Move heap2stack allocas to the entry block if possible

If we are certainly not in a loop we can directly emit the heap2stack
allocas in the function entry block. This will help to get rid of them
(SROA) and avoid stacksave/restore intrinsics when the function is
inlined.

2 years ago[OpenMP][NFC] Reuse check lines for Clang/OpenMP tests
Johannes Doerfert [Mon, 27 Jun 2022 22:45:17 +0000 (17:45 -0500)]
[OpenMP][NFC] Reuse check lines for Clang/OpenMP tests

I used a script to reuse existing check lines rather than creating new
ones. There are more opportunities to reduce the line count but the
"check generated functions" logic makes that somewhat tricky.

FWIW, we really should redo the update script with all these use cases
in mind...

Differential Revision: https://reviews.llvm.org/D128686

2 years ago[clang-format] Run dump_format_style.py for LK_Verilog
owenca [Sat, 2 Jul 2022 01:59:52 +0000 (18:59 -0700)]
[clang-format] Run dump_format_style.py for LK_Verilog

2 years ago[mlir][sparse] Silencing some -Wunused-function in unittests
wren romano [Fri, 1 Jul 2022 23:17:00 +0000 (16:17 -0700)]
[mlir][sparse] Silencing some -Wunused-function in unittests

This is a followup to D128058.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D129027

2 years ago[RISCV][NFC] Simplify condition of IsTU.
Yeting Kuo [Fri, 1 Jul 2022 07:25:54 +0000 (15:25 +0800)]
[RISCV][NFC] Simplify condition of IsTU.

Just simplify code.

Reviewed By: khchen

Differential Revision: https://reviews.llvm.org/D128972

2 years ago[gn build] Port d2d8b0aa4f80
LLVM GN Syncbot [Sat, 2 Jul 2022 01:13:41 +0000 (01:13 +0000)]
[gn build] Port d2d8b0aa4f80

2 years ago[gn build] Port 228c8f9cc0b2
LLVM GN Syncbot [Sat, 2 Jul 2022 01:13:40 +0000 (01:13 +0000)]
[gn build] Port 228c8f9cc0b2

2 years ago[llvm-objdump] Add support for dumping embedded offloading data
Joseph Huber [Thu, 2 Jun 2022 18:25:49 +0000 (14:25 -0400)]
[llvm-objdump] Add support for dumping embedded offloading data

In Clang/LLVM we are moving towards a new binary format to store many
embedded object files to create a fatbinary. This patch adds support for
dumping these embedded images in the `llvm-objdump` tool. This will
allow users to query information about what is stored inside the binary.
This has very similar functionality to the `cuobjdump` tool for thoe familiar
with the Nvidia utilities. The proposed use is as follows:
```
$ clang input.c -fopenmp --offload-arch=sm_70 --offload-arch=sm_52 -c
$ llvm-objdump -O input.o

input.o:        file format elf64-x86-64

OFFLOADIND IMAGE [0]:
kind            cubin
arch            sm_52
triple          nvptx64-nvidia-cuda
producer        openmp

OFFLOADIND IMAGE [1]:
kind            cubin
arch            sm_70
triple          nvptx64-nvidia-cuda
producer        openmp
```

This will be expanded further once we start embedding more information
into these offloading images. Right now we are planning on adding
flags and entries for debug level, optimization, LTO usage, target
features, among others.

This patch only supports printing these sections, later we will want to
support dumping files the user may be interested in via another flag. I
am unsure if this should go here in `llvm-objdump` or `llvm-objcopy`.

Reviewed By: MaskRay, tra, jhenderson, JonChesterfield

Differential Revision: https://reviews.llvm.org/D126904

2 years ago[ObjectYAML] Add offloading binary implementations for obj2yaml and yaml2obj
Joseph Huber [Tue, 14 Jun 2022 19:04:39 +0000 (15:04 -0400)]
[ObjectYAML] Add offloading binary implementations for obj2yaml and yaml2obj

This patchs adds the necessary code for inspecting or creating offloading
binaries using the standing `obj2yaml` and `yaml2obj` features in LLVM.

Depends on D127774

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D127776

2 years agoGenerate the capture for the field when the field is used in openmp
Jennifer Yu [Tue, 14 Jun 2022 17:11:10 +0000 (10:11 -0700)]
Generate the capture for the field when the field is used in openmp
region with implicit default inside the member function.

This is to fix assert when field is referenced in OpenMP region with
default (first|private) clause inside member function.

The problem of assert is that the capture is not generated for the field.

This patch is to generate capture when the field is used with implicit
default, use it in the code, and save the capture off to make sure it is
considered from that point and add first/private clauses.

1> Add new field ImplicitDefaultFirstprivateFDs in SharingMapTy, used to
   store generated capture fields info.
2> In function isOpenMPCaptureDecl: the caputer is generated and saved
   in ImplicitDefaultFirstprivateFDs.
3> Add new help functions:
   getImplicitFDCapExprDecl
   isImplicitDefaultFirstprivateFD
   addImplicitDefaultFirstprivateFD
4> Add addition argument in hasDSA to check default attribute for
   default(first|private).
5> The isImplicitDefaultFirstprivateFD is used in VisitDeclRefExpr to
   build the implicit clause.
6> Add new parameter "Context" for buildCaptureDecl, due to when capture
   field, the parent context is needed to be used.
7> Change in isOpenMPPrivateDecl where stop propagate the capture from
   the enclosing region for private variable.
8> In ActOnOpenMPFirstprivate/ActOnOpenMPPrivate, using captured info
   to generate first|private clause.
9> Add new function isOpenMPRebuildMemberExpr: use to determine if field
   needs to be rebuild during template instantiation.

Differential Revision: https://reviews.llvm.org/D127803

2 years ago[gn build] Port 94c7b89fe5b0
LLVM GN Syncbot [Fri, 1 Jul 2022 23:35:58 +0000 (23:35 +0000)]
[gn build] Port 94c7b89fe5b0

2 years ago[libc++][ranges] Implement `ranges::stable_sort`.
Konstantin Varlamov [Fri, 1 Jul 2022 23:34:08 +0000 (16:34 -0700)]
[libc++][ranges] Implement `ranges::stable_sort`.

Differential Revision: https://reviews.llvm.org/D127834

2 years ago[sanitizer] Update dn_expand interceptor for glibc 2.34
Vitaly Buka [Fri, 1 Jul 2022 23:22:04 +0000 (16:22 -0700)]
[sanitizer] Update dn_expand interceptor for glibc 2.34

Symbol changed with 640bbdf71c6f10ac26252ac67a22902e26657bd8

2 years agoRevert [LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]
Nuno Lopes [Fri, 1 Jul 2022 22:53:41 +0000 (23:53 +0100)]
Revert [LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]

This reverts commits 47e6f98f84ac3 and 3e701bcd2a6aee2

2 years agoattempt to fix aarch64 build bot
Nuno Lopes [Fri, 1 Jul 2022 22:43:48 +0000 (23:43 +0100)]
attempt to fix aarch64 build bot

2 years ago[LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]
Nuno Lopes [Fri, 1 Jul 2022 22:31:31 +0000 (23:31 +0100)]
[LowerMatrixMultiplication] Switch dummy values from undef to poison [NFC]

2 years ago[BOLT] Fix instrumentation problem with floating point
Maksim Panchenko [Fri, 1 Jul 2022 01:46:47 +0000 (18:46 -0700)]
[BOLT] Fix instrumentation problem with floating point

If BOLT instrumentation runtime uses XMM registers, it can interfere
with the user program causing crashes and unexpected behavior. This
happens as the instrumentation code preserves general purpose registers
only.

Build BOLT instrumentation runtime with "-mno-sse".

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D128960

2 years ago[llvm-lto2] Remove unneeded cl::init(false). NFC
Fangrui Song [Fri, 1 Jul 2022 21:35:36 +0000 (14:35 -0700)]
[llvm-lto2] Remove unneeded cl::init(false). NFC

2 years ago[Lex] Introduce `PPCallbacks::LexedFileChanged()` preprocessor callback
Argyrios Kyrtzidis [Thu, 30 Jun 2022 21:04:14 +0000 (14:04 -0700)]
[Lex] Introduce `PPCallbacks::LexedFileChanged()` preprocessor callback

This is a preprocessor callback focused on the lexed file changing, without conflating effects of line number directives and other pragmas.
A client that only cares about what files the lexer processes, like dependency generation, can use this more straightforward
callback instead of `PPCallbacks::FileChanged()`. Clients that want the pragma directive effects as well can keep using `FileChanged()`.

A use case where `PPCallbacks::LexedFileChanged()` is particularly simpler to use than `FileChanged()` is in a situation
where a client wants to keep track of lexed file changes that include changes from/to the predefines buffer, where it becomes
unnecessary complicated trying to use `FileChanged()` while filtering out the pragma directives effects callbacks.

Also take the opportunity to provide information about the prior `FileID` the `Lexer` moved from, even when entering a new file.

Differential Revision: https://reviews.llvm.org/D128947

2 years ago[bazel] Fix invalid characters
Arthur Eubanks [Fri, 1 Jul 2022 20:47:19 +0000 (13:47 -0700)]
[bazel] Fix invalid characters

2 years ago[bazel] Port 43dc3190, adding rules to generate dxil intrinsics
Arthur Eubanks [Fri, 1 Jul 2022 20:36:47 +0000 (13:36 -0700)]
[bazel] Port 43dc3190, adding rules to generate dxil intrinsics

2 years ago[InstCombine] restrict select of bit-tests to constant shift amounts
Sanjay Patel [Fri, 1 Jul 2022 20:24:34 +0000 (16:24 -0400)]
[InstCombine] restrict select of bit-tests to constant shift amounts

This transform is responsible for a long-standing miscompile
as discussed in issue #47012 (was bugzilla #47668).

There was a proposal to correct it in D88432, but that was
abandoned and there hasn't been any recent activity to fix
it AFAICT.

The original patch D45108 started with a constant-shift-only
restriction and only expanded during review, so I don't think
there's much risk of perf regression on the motivating code.

2 years ago[InstCombine] avoid 'tmp' usage in test files; NFC
Sanjay Patel [Fri, 1 Jul 2022 20:18:11 +0000 (16:18 -0400)]
[InstCombine] avoid 'tmp' usage in test files; NFC

The update script ( utils/update_test_checks.py ) warns against this.

2 years ago[mlir][sparse] Reducing computational complexity
wren romano [Fri, 1 Jul 2022 19:41:01 +0000 (12:41 -0700)]
[mlir][sparse] Reducing computational complexity

This is a followup to D128847.  The `AffineMap::getPermutedPosition` method performs a linear scan of the map, thus the previous implementation had asymptotic complexity of `O(|topSort| * |m|)`.  This change reduces that to `O(|topSort| + |m|)`.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D129011

2 years ago[flang][NFC] Add embox test with character
Valentin Clement [Fri, 1 Jul 2022 19:47:53 +0000 (21:47 +0200)]
[flang][NFC] Add embox test with character

This test is added to check for multidimensional descriptor of array
substring/derived type component array.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128990

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[SLP][NFC]Rework the test for logical and freeze, need some extra nodes,
Alexey Bataev [Fri, 1 Jul 2022 19:42:34 +0000 (12:42 -0700)]
[SLP][NFC]Rework the test for logical and freeze, need some extra nodes,
NFC.

2 years ago[pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3
Haojian Wu [Fri, 1 Jul 2022 19:23:29 +0000 (21:23 +0200)]
[pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3

2 years ago[mlir][tosa] Update TOSA transpose_conv2d to match spec
Eric Kunze [Fri, 1 Jul 2022 18:36:37 +0000 (11:36 -0700)]
[mlir][tosa] Update TOSA transpose_conv2d to match spec

The TOSA Specification doesn't have a dilation attribute for transpose_conv2d,
and the padding array is of size 4. (top,bottom,left,right).

This change updates the dialect to match the specification, and updates the lit
tests to match the dialect changes.

Differential Revision: https://reviews.llvm.org/D127332

2 years ago[SLP][NFC]Add a test for logical and operands, requiring extra
Alexey Bataev [Fri, 1 Jul 2022 18:53:11 +0000 (11:53 -0700)]
[SLP][NFC]Add a test for logical and operands, requiring extra
freezextra freeze, NFC.e.

2 years ago[UpdateTestChecks][test] Remove stray ; before/after non-RUN-non-CHECK comments
Fangrui Song [Fri, 1 Jul 2022 18:42:47 +0000 (11:42 -0700)]
[UpdateTestChecks][test] Remove stray ; before/after non-RUN-non-CHECK comments

2 years ago[gn build] Manually port 43dc3190
Arthur Eubanks [Fri, 1 Jul 2022 18:38:32 +0000 (11:38 -0700)]
[gn build] Manually port 43dc3190

2 years ago[mlir] Fix usages of `run-reproducer`.
rdzhabarov [Fri, 1 Jul 2022 18:31:20 +0000 (18:31 +0000)]
[mlir] Fix usages of `run-reproducer`.

There is no need to specify `run-reproducer` explicitly anymore.

Differential Revision: https://reviews.llvm.org/D129010

2 years agoRevert "Re-apply "Deferred Concept Instantiation Implementation"""
Erich Keane [Fri, 1 Jul 2022 18:20:16 +0000 (11:20 -0700)]
Revert "Re-apply "Deferred Concept Instantiation Implementation"""

This reverts commit befa8cf087dbb8159a4d9dc8fa4d6748d6d5049a.

Apparently this breaks some libc++ builds with an apparent assertion,
 so I'm looking into that .

2 years ago[RISCV] Considering existing offset in the alignment when folding ADDIs into load...
Craig Topper [Fri, 1 Jul 2022 17:22:43 +0000 (10:22 -0700)]
[RISCV] Considering existing offset in the alignment when folding ADDIs into load/store.

getPointerAlignment and ConstantPoolSDNode::getAlign only consider
the alignment of the object. If we already have a non-zero offset
into the offset that may have reduced the alignment.

Since the base pointer will become an LUI with the old offset, we
need to be sure the new offset fits in the alignment of the address
that will be used to create the LUI immediate.

I'm not sure it is possible to have a non-zero offset in the
GlobalAddressSDNode or ConstantPoolSDNode at this point today so this
may only be a theoretical bug.

Differential Revision: https://reviews.llvm.org/D129006

2 years ago[pseudo] Fix an out-of-bound issue in getReduceRules.
Haojian Wu [Fri, 1 Jul 2022 18:16:06 +0000 (20:16 +0200)]
[pseudo] Fix an out-of-bound issue in getReduceRules.

2 years ago[MC][RISCV] Suppress R_RISCV_{ADD,SUB}32 in .apple_names .apple_types after D127549
Fangrui Song [Fri, 1 Jul 2022 18:15:04 +0000 (11:15 -0700)]
[MC][RISCV] Suppress R_RISCV_{ADD,SUB}32 in .apple_names .apple_types after D127549

This fixes test/DebugInfo/Generic/accel-table-hash-collisions.ll and
cross-cu-inlining.ll when the default triple is riscv. llvm-dwarfdump
--apple-names does not resolve R_RISCV_{ADD,SUB}32 in .apple_names .apple_types
and having ADD/SUB will cause decoding failure `Atom[0]: Error extracting the
value`.

2 years agoRemove redundant code. [NFC]
Rong Xu [Fri, 1 Jul 2022 16:56:47 +0000 (09:56 -0700)]
Remove redundant code. [NFC]

isAssumeLikeIntrinsic() is a superset of isLifetimeStartOrEnd().

2 years ago[mlir][sparse] add more unittest cases to sparse dialect merger
Peiming Liu [Fri, 1 Jul 2022 03:10:33 +0000 (03:10 +0000)]
[mlir][sparse] add more unittest cases to sparse dialect merger

Reviewed By: aartbik, wrengr

Differential Revision: https://reviews.llvm.org/D128058

2 years ago[DirectX] add thread/group id DXIL operations.
Xiang Li [Thu, 16 Jun 2022 17:49:21 +0000 (10:49 -0700)]
[DirectX] add thread/group id DXIL operations.

Add DXIL operation for thread/group id operations.

ID  Name                      Description
93  ThreadId                  reads the thread ID
94  GroupId                   reads the group ID (SV_GroupID)
95  ThreadIdInGroup           reads the thread ID within the group (SV_GroupThreadID)
96  FlattenedThreadIdInGroup  provides a flattened index for a given thread within a given group (SV_GroupIndex)

Also add llvm intrinsic which map to these intrinsics to DXIL operation.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D127990

2 years agoTest a few more C99 DRs
Aaron Ballman [Fri, 1 Jul 2022 17:47:08 +0000 (13:47 -0400)]
Test a few more C99 DRs

This updates the status for another 8 DRs.

2 years ago[compiler-rt] Update Fuchsia sanitizer sched_yield
Petr Hosek [Fri, 1 Jul 2022 17:24:37 +0000 (17:24 +0000)]
[compiler-rt] Update Fuchsia sanitizer sched_yield

Fuchsia has split overloaded nanosleep(0) for yielding to its own
dedicated syscall, so valid zero deadlines would just return.

Patch By: gevalentino

Differential Revision: https://reviews.llvm.org/D128748

2 years ago[GISel] Don't fold convergent instruction across CFG
Quentin Colombet [Fri, 1 Jul 2022 16:27:30 +0000 (09:27 -0700)]
[GISel] Don't fold convergent instruction across CFG

Before merging two instructions together, GISel does some sanity checks
that the folding is legal. However that check was missing that the
source of the pattern may be convergent. When the destination location
is in a different basic block, the folding is invalid.

Differential Revision: https://reviews.llvm.org/D128539

2 years ago[CMake][Fuchsia] Use libunwind as the default unwinder
Petr Hosek [Sat, 28 May 2022 05:55:38 +0000 (05:55 +0000)]
[CMake][Fuchsia] Use libunwind as the default unwinder

Fuchsia already uses libunwind, but it does so implicitly via libc++.
This change makes the unwinder choice explicit.

Differential Revision: https://reviews.llvm.org/D127887

2 years ago[gn build] Port 554aea52d79e
LLVM GN Syncbot [Fri, 1 Jul 2022 17:14:07 +0000 (17:14 +0000)]
[gn build] Port 554aea52d79e

2 years ago[InstCombine] Add tests in anticipation of D128939 (NFC)
Martin Sebor [Fri, 1 Jul 2022 17:07:41 +0000 (11:07 -0600)]
[InstCombine] Add tests in anticipation of D128939 (NFC)

Precommit tests exercising the future folding of memchr and strchr calls
in equality expressions with the first function argument.

2 years ago[InstCombine] Transform strrchr to memrchr for constant strings
Martin Sebor [Fri, 1 Jul 2022 16:09:42 +0000 (10:09 -0600)]
[InstCombine] Transform strrchr to memrchr for constant strings

Add an emitter for the memrchr common extension and simplify the strrchr
call handler to use it. This enables transforming calls with the empty
string to the test C ? S : 0.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D128954

2 years ago[reland][Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.
Alexey Lapshin [Tue, 28 Jun 2022 16:52:12 +0000 (19:52 +0300)]
[reland][Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.

This review is extracted from D96035.

This patch adds possibility to keep not only DwarfStringPoolEntry, but also
pointer to it. The DwarfStringPoolEntryRef keeps reference to the string map entry.
String map keeps string data and corresponding DwarfStringPoolEntry
info. Not all string map entries may be included into the result,
and then not all string entries should have DwarfStringPoolEntry
info. Currently StringMap keeps DwarfStringPoolEntry for all entries.
It leads to extra memory usage. This patch allows to keep
DwarfStringPoolEntry info only for entries which really need it.

[reland] : make msan happy.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D126883

2 years ago[LLD][COFF] Ignore /kernel flag
Pengxuan Zheng [Tue, 21 Jun 2022 01:44:32 +0000 (18:44 -0700)]
[LLD][COFF] Ignore /kernel flag

There exists some description of the flag from Microsoft, but not sure if
there's more to it. We ignore the flag for now until we find out more about it.

https://docs.microsoft.com/en-us/cpp/build/reference/kernel-create-kernel-mode-binary?view=msvc-170

Reviewed By: thieta, hans

Differential Revision: https://reviews.llvm.org/D128238

2 years ago[MLIR][Presburger] support symbolicLexMin for IntegerRelation
Arjun P [Fri, 1 Jul 2022 16:53:13 +0000 (17:53 +0100)]
[MLIR][Presburger] support symbolicLexMin for IntegerRelation

This also changes the space of the returned lexmin for IntegerPolyhedrons;
the symbols in the poly now correspond to symbols in the result rather than dims.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D128933

2 years ago[MLIR][Presburger] Simplex: refactor (symbolic)lex to support specifying multiple...
Arjun P [Fri, 1 Jul 2022 16:46:50 +0000 (17:46 +0100)]
[MLIR][Presburger] Simplex: refactor (symbolic)lex to support specifying multiple varKinds as symbols

This is also required to support lexmin for relations.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D128931

2 years ago[libc][math] Improved ExhaustiveTest performance.
Kirill Okhotnikov [Fri, 1 Jul 2022 14:37:27 +0000 (16:37 +0200)]
[libc][math] Improved ExhaustiveTest performance.

Previous implementation splits value ranges around threads. Because of
very different performance of testing functions over different ranges,
CPU utilization were poor. Current implementation split test range
over small pieces and threads take the pieces when they finish with
previous. Therefore the CPU load is constant during testing.

Differential Revision: https://reviews.llvm.org/D128995

2 years ago[llvm-objdump] -r: print non-SHF_ALLOC relocations for non-ET_REL files
Fangrui Song [Fri, 1 Jul 2022 16:08:42 +0000 (09:08 -0700)]
[llvm-objdump] -r: print non-SHF_ALLOC relocations for non-ET_REL files

ET_EXEC and ET_DYN files may contain non-SHF_ALLOC relocation sections
(e.g. ld --emit-relocs). Match GNU objdump by dumping them.

* Remove Object/dynamic-reloc.test. Replace it with a -r RUN line in dynamic-relocs.test
* Update relocations-in-nonreloc.test to set sh_link/sh_info. GNU
  objdump seems to ignore a SHT_REL/SHT_RELA section not linking to SHT_SYMTAB.
  The test did not test what it intended to test.

Fix https://github.com/llvm/llvm-project/issues/41246

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D128959

2 years ago[OpenMP] Initial parsing and semantic support for 'parallel masked taskloop simd...
Fazlay Rabbi [Fri, 1 Jul 2022 00:08:17 +0000 (17:08 -0700)]
[OpenMP] Initial parsing and semantic support for 'parallel masked taskloop simd' construct

This patch gives basic parsing and semantic support for
"parallel masked taskloop simd" construct introduced in
OpenMP 5.1 (section 2.16.10)

Differential Revision: https://reviews.llvm.org/D128946

2 years agoRevert "[NFC] Add a missing test for for clang-repl"
Jun Zhang [Fri, 1 Jul 2022 15:55:55 +0000 (23:55 +0800)]
Revert "[NFC] Add a missing test for for clang-repl"

This reverts commit 2750985a5ccb97f4630c3443e75d78ed435d2bd0.
This has caused Windows buildbot unhappy :(

2 years ago[NFC] Add a missing test for for clang-repl
Jun Zhang [Fri, 1 Jul 2022 15:26:08 +0000 (23:26 +0800)]
[NFC] Add a missing test for for clang-repl

This adds a missing test for 0ecbedc0986bd4b7b90a60a5f31d32337160d4c4
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D128991

2 years ago[MLIR][Linalg] Update filename to reflect implementation (NFC)
lorenzo chelini [Fri, 1 Jul 2022 09:44:39 +0000 (11:44 +0200)]
[MLIR][Linalg] Update filename to reflect implementation (NFC)

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D128978