platform/upstream/llvm.git
2 years ago[test] Remove unnecessary -verify-machineinstrs=0
Arthur Eubanks [Wed, 20 Jul 2022 17:55:03 +0000 (10:55 -0700)]
[test] Remove unnecessary -verify-machineinstrs=0

Issue #38784 seems to be fixed and removing these doesn't cause any issues.

2 years ago[AMDGPU] NFC. Assert that mask is full with VOPC DPP
Joe Nash [Tue, 19 Jul 2022 16:49:15 +0000 (12:49 -0400)]
[AMDGPU] NFC. Assert that mask is full with VOPC DPP

VOPC DPP should not be formed when the row_mask and bank_mask are not
0xf (full) because the resulting VOP DPP would have different semantics
than the MOV DPP followed by VOP. Existing checks in GCNDPPCombine cover
this case but for different reasons, so assert the property for
future-proofing.

Reviewed By: nhaehnle

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

2 years ago[libc++][format] Updates the status page.
Mark de Wever [Wed, 20 Jul 2022 17:26:28 +0000 (19:26 +0200)]
[libc++][format] Updates the status page.

2 years ago[RISCV][test] Add tests for atomic compare exchange + branch on result
Alex Bradbury [Wed, 20 Jul 2022 16:49:33 +0000 (17:49 +0100)]
[RISCV][test] Add tests for atomic compare exchange + branch on result

Due to the late expansion of the compare exchange sequences, there's
scope for improving codegen by folding the branches into the cmpxchg
loop (avoiding a branch-to-branch).

2 years ago[gn build] Port 857a78c04dee
LLVM GN Syncbot [Wed, 20 Jul 2022 16:42:40 +0000 (16:42 +0000)]
[gn build] Port 857a78c04dee

2 years ago[IPO] Restore a call to has_value (NFC)
Kazu Hirata [Wed, 20 Jul 2022 16:40:18 +0000 (09:40 -0700)]
[IPO] Restore a call to has_value (NFC)

This patch restores a call to has_value to make it clear that we are
checking the presence of an optional value, not the underlying value.

This patch partially reverts d08f34b592ff06ccb1f36da88ec09aa926427a4d.

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

2 years ago[libc++] Implements Unicode grapheme clustering
Mark de Wever [Sat, 28 May 2022 13:30:10 +0000 (15:30 +0200)]
[libc++] Implements Unicode grapheme clustering

This implements the Grapheme clustering as required by
P1868R2 width: clarifying units of width and precision in std::format

This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper.

Reviewed By: ldionne, #libc

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

2 years ago [flang][nfc] Test folding of bit-population count intrinsics
Tarun Prabhu [Wed, 20 Jul 2022 16:27:22 +0000 (11:27 -0500)]
[flang][nfc] Test folding of bit-population count intrinsics

Test compile-time folding of the leadz, trailz, popcnt and poppar Fortran 2008 intrinsics.

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

2 years agofix bug for useless malloc elimination in CodeGenPrepare
Ruobing Han [Tue, 19 Jul 2022 21:39:14 +0000 (21:39 +0000)]
fix bug for useless malloc elimination in CodeGenPrepare

Put AllocationFn check before I->willReturn can allow CodeGenPrepare to remove useless malloc instruction

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

2 years ago[libc++][doc] Updates the release notes.
Mark de Wever [Mon, 18 Jul 2022 18:32:39 +0000 (20:32 +0200)]
[libc++][doc] Updates the release notes.

This is a preparation for the upcoming LLVM 16 release.

Reviewed By: ldionne, #libc

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

2 years ago[RISCV][test] Add tests showing signext behaviour of cmpxchg
Alex Bradbury [Wed, 20 Jul 2022 16:08:30 +0000 (17:08 +0100)]
[RISCV][test] Add tests showing signext behaviour of cmpxchg

2 years agoUse llvm::is_contained (NFC)
Kazu Hirata [Wed, 20 Jul 2022 16:09:19 +0000 (09:09 -0700)]
Use llvm::is_contained (NFC)

2 years ago[flang] Use value instead of getValue (NFC)
Kazu Hirata [Wed, 20 Jul 2022 15:56:23 +0000 (08:56 -0700)]
[flang] Use value instead of getValue (NFC)

Flang C++ Style Guide tells us to use x.value() when no presence test
is obviously protecting the reference.  Since assert can be disabled,
I don't count it as "protection" here.

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

2 years ago[LV] Autogen a test for ease of update
Philip Reames [Wed, 20 Jul 2022 15:14:45 +0000 (08:14 -0700)]
[LV] Autogen a test for ease of update

2 years agoRevert "[Libomptarget] Make libomptarget an LLVM library"
Joseph Huber [Wed, 20 Jul 2022 14:18:23 +0000 (10:18 -0400)]
Revert "[Libomptarget] Make libomptarget an LLVM library"

This reverts commit 643dfd97d52e7b0c0dfbe7fd6046de9d43b3daa6.

This patch still makes the AMDGPU buildbots unhappy. Reverting for now
until the AMD folks figure it out.

2 years ago[Libomptarget] Fix LTO command line in test
Joseph Huber [Wed, 20 Jul 2022 14:17:35 +0000 (10:17 -0400)]
[Libomptarget] Fix LTO command line in test

Summary:
The test passed -offload-lto instead of -foffload-lto.

2 years agoredo UNSUPPORT test on 64-bit AIX too
Jake Egan [Wed, 20 Jul 2022 14:17:35 +0000 (10:17 -0400)]
redo UNSUPPORT test on 64-bit AIX too

The test failure affects both bitmodes.

2 years ago[LV] Autogen several tests for ease of update in upcoming change
Philip Reames [Wed, 20 Jul 2022 14:17:44 +0000 (07:17 -0700)]
[LV] Autogen several tests for ease of update in upcoming change

2 years agoUNSUPPORT test on 64-bit AIX too
Jake Egan [Wed, 20 Jul 2022 14:03:20 +0000 (10:03 -0400)]
UNSUPPORT test on 64-bit AIX too

The test failure affects both bitmodes.

2 years ago[LLD] [COFF] Improve the error message for too many exported symbols
Martin Storsjö [Mon, 18 Jul 2022 06:27:11 +0000 (09:27 +0300)]
[LLD] [COFF] Improve the error message for too many exported symbols

Print the actual number of symbols that would have been exported
too, which helps assessing the situation.

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

2 years ago[TableGen] Add a location for a class definition that was forward-declared
Roman Rusyaev [Wed, 20 Jul 2022 13:25:02 +0000 (15:25 +0200)]
[TableGen] Add a location for a class definition that was forward-declared

This change improves ctags generation for tablegen files.

For the following example
```
class A;

class A {
  int a;
}
```
Previously, tags were generated only for a forward declaration of class 'A'.

This patch allows generating tags for the forward declarations
and further definition of class 'A'.

Reviewed By: barannikov88

Original patch by: rusyaev-roman (Roman Rusyaev)
Some adjustments by: nhaehnle (Nicolai Hähnle)

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

2 years ago[Libomptarget] Make libomptarget an LLVM library
Joseph Huber [Fri, 15 Jul 2022 16:10:18 +0000 (12:10 -0400)]
[Libomptarget] Make libomptarget an LLVM library

This patch makes libomptarget depend on LLVM libraries to be built. The
reason for this is because we already have an implicit dependency on
LLVM headers for ELF identification and extraction as well as an
optional dependenly on the LLVMSupport library for time tracing
information. Furthermore, there are changes in the future that require
using more LLVM libraries, and will heavily simplify some future code as
well as open up the large amount of useful LLVM libraries to
libomptarget.

This will make "standalone" builds of `libomptarget' more difficult for
vendors wishing to ship their own. This will require a sufficiently new
version of LLVM to be installed on the system that should be picked up
by the existing handling for the implicit headers.

The things this patch changes are as follows:
  - `libomptarget.so` links against LLVMSupport and LLVMObject
  - `libomptarget.so` is a symbolic link to `libomptarget.so.15`
  - If using a shared library build, user applications will depend on LLVM
    libraries as well
  - We can now use LLVM resources in Libomptarget.

Note that this patch only changes this to apply to libomptarget itself,
not the plugins. Additional patches will be necessary for that.

Reviewed By: JonChesterfield

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

2 years ago[mlir][bufferize][doc] Fix documentation of return type of `to_memref`.
Ingo Müller [Wed, 20 Jul 2022 12:04:09 +0000 (12:04 +0000)]
[mlir][bufferize][doc] Fix documentation of return type of `to_memref`.

This is my very first contact with this dialect, so I am not very
confident with this commit, but it seems like the op returns a memref,
not a tensor, so that's what comment about the result type should say.

[mlir][bufferization][doc] Improve typesetting of inline code. Fix Typo.

Reviewed By: pifon2a

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

2 years ago[clang] Small adjustments for -fexperimental-library
Louis Dionne [Wed, 20 Jul 2022 13:10:40 +0000 (09:10 -0400)]
[clang] Small adjustments for -fexperimental-library

Move -lc++experimental before -lc++abi (that was forgotten in the
original patch), and mark a test as UNSUPPORTED on AIX. I contacted
the owners of the AIX bot that failed because I was unable to reproduce
the issue locally.

2 years ago[AMDGPU] Change RUN lines to not depend on code sinking. NFC.
Jay Foad [Wed, 20 Jul 2022 12:40:06 +0000 (13:40 +0100)]
[AMDGPU] Change RUN lines to not depend on code sinking. NFC.

Change a couple of RUN lines to not depend on the presence or position
of the IR code sinking pass in the codegen pipeline, since it does not
belong in there anyway.

2 years ago[LV] Fix miscompile due to srem/sdiv speculation safety condition
Philip Reames [Tue, 19 Jul 2022 18:42:55 +0000 (11:42 -0700)]
[LV] Fix miscompile due to srem/sdiv speculation safety condition

An srem or sdiv has two cases which can cause undefined behavior, not just one. The existing code did not account for this, and as a result, we miscompiled when we encountered e.g. a srem i64 %v, -1 in a conditional block.

Instead of hand rolling the logic, just use the utility function which exists exactly for this purpose.

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

2 years agoUpdate the Windows packaging script.
Carlos Alberto Enciso [Wed, 20 Jul 2022 12:22:10 +0000 (13:22 +0100)]
Update the Windows packaging script.

As discussed on:
  https://discourse.llvm.org/t/build-llvm-release-bat-script-options/63146/6

Giving:
  call :function if errorlevel 1 exit /b 1

Due to a missing new line, the error code returned by the function
is taking as another argument.

Changed to use standard '||' to exit if the errorlevel greater than zero.

  call :function || exit /b 1

Reviewed By: hans

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

2 years agoInliner: don't mark call sites as 'nounwind' if that would be redundant
Nicolai Hähnle [Fri, 15 Jul 2022 13:27:26 +0000 (15:27 +0200)]
Inliner: don't mark call sites as 'nounwind' if that would be redundant

When F calls G calls H, G is nounwind, and G is inlined into F, then the
inlined call-site to H should be effectively nounwind so as not to lose
information during inlining.

If H itself is nounwind (which often happens when H is an intrinsic), we
no longer mark the callsite explicitly as nounwind. Previously, there
were cases where the inlined call-site of H differs from a pre-existing
call-site of H in F *only* in the explicitly added nounwind attribute,
thus preventing common subexpression elimination.

v2:
- just check CI->doesNotThrow

v3 (resubmit after revert at 344378808778c61d5599f4e0ac783ef7e6f8ed05):
- update Clang tests

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

2 years ago[SCEV][NFC][CT] Do not waste time proving contextual facts for unreached loops and...
Max Kazantsev [Wed, 20 Jul 2022 12:01:43 +0000 (19:01 +0700)]
[SCEV][NFC][CT] Do not waste time proving contextual facts for unreached loops and blocks

In fact, in unreached code we can say that every fact is true. So do not waste time trying to
do something smarter.

Formally it's not an NFC because it may change query results in unreached code, but they
won't have any impact on execution.

Hypothetical CT boost expected but not measured in practice.

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

2 years agoUpdate some more tests with update_cc_test_checks.py
Nicolai Hähnle [Tue, 19 Jul 2022 06:58:31 +0000 (08:58 +0200)]
Update some more tests with update_cc_test_checks.py

2 years ago[flang][driver] Fix opt-level option parsing
Andrzej Warzynski [Tue, 19 Jul 2022 17:48:31 +0000 (17:48 +0000)]
[flang][driver] Fix opt-level option parsing

This update makes sure that `flang-new -O2 -O0` will run at `-O0` rather
than `-O2`.

This bug was identified and originally fixed by Vyacheslav Zakharin in
https://reviews.llvm.org/D130035. I've extracted the fix into a separate
patch.

co-authored by: Vyacheslav Zakharin <vyacheslav.p.zakharin@intel.com>

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

2 years ago[XCOFF] write the aux header when the visibility is specified in XCOFF32.
esmeyi [Wed, 20 Jul 2022 11:09:34 +0000 (07:09 -0400)]
[XCOFF] write the aux header when the visibility is specified in XCOFF32.

The n_type field in the symbol table entry has two interpretations in XCOFF32, and a single interpretation in XCOFF64.
The new interpretation is used in XCOFF32 if the value of the o_vstamp field in the auxiliary header is 2.
In XCOFF64 and the new XCOFF32 interpretation, the n_type field is used for the symbol type and visibility.
The patch writes the aux header with an o_vstamp field value of 2 when the visibility is specified in XCOFF32 to make the new XCOFF32 interpretation used.

Reviewed By: DiggerLin, jhenderson

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

2 years ago[DAG] getNode - don't bother creating ADDO(X,0) or SUBO(X,0) nodes.
Simon Pilgrim [Wed, 20 Jul 2022 11:04:23 +0000 (12:04 +0100)]
[DAG] getNode - don't bother creating ADDO(X,0) or SUBO(X,0) nodes.

Similar to what we already do in getNode for basic ADD/SUB nodes, return the X operand directly, but here we know that there will be no/zero overflow as well.

As noted on D127115 - this path is being exercised by llvm/test/CodeGen/ARM/dsp-mlal.ll, although I haven't been able to get any codegen without a topological worklist.

2 years ago[ARM] Fix Thumb2 compare being emitted ExpandCMP_SWAP
David Green [Wed, 20 Jul 2022 11:04:22 +0000 (12:04 +0100)]
[ARM] Fix Thumb2 compare being emitted ExpandCMP_SWAP

Given a patch like D129506, using instructions not valid for the current
target feature set becomes an error. This fixes an issue in
ARMExpandPseudo::ExpandCMP_SWAP where Thumb2 compares were used in
Thumb1Only code, such as thumbv8m.baseline targets.

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

2 years ago[X86] shuffle-blend.ll - add avx512f-only test coverage
Simon Pilgrim [Wed, 20 Jul 2022 10:36:07 +0000 (11:36 +0100)]
[X86] shuffle-blend.ll - add avx512f-only test coverage

2 years ago[DAG] getNode - assert that ADDO/SUBO nodes have the correct ops + types
Simon Pilgrim [Wed, 20 Jul 2022 10:23:48 +0000 (11:23 +0100)]
[DAG] getNode - assert that ADDO/SUBO nodes have the correct ops + types

2 years ago[X86] shuffle-blend.ll - add 32-bit test coverage
Simon Pilgrim [Wed, 20 Jul 2022 10:22:08 +0000 (11:22 +0100)]
[X86] shuffle-blend.ll - add 32-bit test coverage

Noticed while reviewing D129537

2 years ago[VPlan] Initial def-use verification.
Florian Hahn [Wed, 20 Jul 2022 10:06:32 +0000 (11:06 +0100)]
[VPlan] Initial def-use verification.

This patch introduces some initial def-use verification. This catches
cases like the one fixed by D129436.

Reviewed By: Ayal

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

2 years ago[DAG] PromoteIntRes_BUILD_VECTOR - extend constant boolean vectors according to targe...
Simon Pilgrim [Wed, 20 Jul 2022 09:48:11 +0000 (10:48 +0100)]
[DAG] PromoteIntRes_BUILD_VECTOR - extend constant boolean vectors according to target BooleanContents

PromoteIntRes_BUILD_VECTOR currently always ANY_EXTENDs build vector operands, but if this is a constant boolean vector we're losing the useful ability to keep the vector matching the BooleanContents mode used by the target.

This patch extends constant boolean vectors according to target BooleanContents, allowing a number of additional all-bits folds (notable XOR -> NOT conversions) to occur.

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

2 years ago[bazel] Also add -lrt to OrcTargetProcess for 1b1f1c778695442c2683813ec7d4b557bb279e26
Benjamin Kramer [Wed, 20 Jul 2022 09:28:26 +0000 (11:28 +0200)]
[bazel] Also add -lrt to OrcTargetProcess for 1b1f1c778695442c2683813ec7d4b557bb279e26

2 years ago[libc++] Implement P1423R3 (char8_t backward compatibility remediation)
Nikolas Klauser [Tue, 19 Jul 2022 00:03:10 +0000 (02:03 +0200)]
[libc++] Implement P1423R3 (char8_t backward compatibility remediation)

Reviewed By: Mordante, #libc

Spies: h-vetinari, libcxx-commits, arichardson

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

2 years ago[libc++] Add clang-tidy for the tests
Nikolas Klauser [Mon, 18 Jul 2022 00:01:02 +0000 (02:01 +0200)]
[libc++] Add clang-tidy for the tests

Reviewed By: Mordante, huixie90, #libc

Spies: aheejin, libcxx-commits

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

2 years ago[bazel] Add -lrt on non-darwin/non-windows for 1b1f1c778695442c2683813ec7d4b557bb279e26
Benjamin Kramer [Wed, 20 Jul 2022 09:21:53 +0000 (11:21 +0200)]
[bazel] Add -lrt on non-darwin/non-windows for 1b1f1c778695442c2683813ec7d4b557bb279e26

For shm_open in orc jit.

2 years agoupdate-test-checks: safely handle tests with #if's
Nicolai Hähnle [Tue, 19 Jul 2022 07:43:58 +0000 (09:43 +0200)]
update-test-checks: safely handle tests with #if's

There is at least one Clang test (clang/test/CodeGen/arm_acle.c) which
has functions guarded by #if's that cause those functions to be compiled
only for a subset of RUN lines.

This results in a case where one RUN line has a body for the function
and another doesn't. Treat this case as a conflict for any prefixes that
the two RUN lines have in common.

This change exposed a bug where functions with '$' in the name weren't
properly recognized in ARM assembly (despite there being a test case
that was supposed to catch the problem!). This bug is fixed as well.

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

2 years ago[InstCombine] add more tests for xor_of_icmps. nfc
Chenbing Zheng [Wed, 20 Jul 2022 09:00:34 +0000 (17:00 +0800)]
[InstCombine] add more tests for xor_of_icmps. nfc

2 years agoRevert "Don't treat readnone call in presplit coroutine as not access memory"
Chuanqi Xu [Wed, 20 Jul 2022 09:00:58 +0000 (17:00 +0800)]
Revert "Don't treat readnone call in presplit coroutine as not access memory"

This reverts commit 57224ff4a6833dca1f17568cc9cf77f9579030ae. This
commit may trigger crashes on some workloads. Revert it for clearness.

2 years agoReland "[AArch64] Add a tablegen pattern for UZP2."
Alexandros Lamprineas [Mon, 18 Jul 2022 07:07:59 +0000 (08:07 +0100)]
Reland "[AArch64] Add a tablegen pattern for UZP2."

Converts concat_vectors((trunc (lshr)), (trunc (lshr))) to UZP2
when the shift amount is half the width of the vector element.

Prioritize the ADDHN(2), SUBHN(2) patterns over UZP2.
Fixes https://github.com/llvm/llvm-project/issues/52919

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

2 years ago[mlir:LSP][NFC] Make the LSPServer class private
River Riddle [Wed, 20 Jul 2022 03:39:09 +0000 (20:39 -0700)]
[mlir:LSP][NFC] Make the LSPServer class private

There is no benefit to making it public, and the code is much
cleaner and easier to follow when inlined. This also matches
the pattern within the PDLL lsp server.

2 years ago[LoopVectorize][AArch64] Add TTI hook preferPredicatedReductionSelect
David Sherwood [Thu, 14 Jul 2022 10:45:41 +0000 (11:45 +0100)]
[LoopVectorize][AArch64] Add TTI hook preferPredicatedReductionSelect

By default if SVE is enabled we want the select instruction used for
reductions to be inside the loop, rather than outside. This makes it
possible for the backend to fold the select into the operation to
produce a single predicated add, fadd, etc.

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

2 years ago[VP] Legalize the stride operand for EXPERIMENTAL_VP_STRIDED SDNodes
Lorenzo Albano [Wed, 20 Jul 2022 08:20:55 +0000 (10:20 +0200)]
[VP] Legalize the stride operand for EXPERIMENTAL_VP_STRIDED SDNodes

Add promotion and expansion of integer operands for
experimental_vp_strided SelectionDAG nodes; the expansion is actually
just a truncation of the stride operand.

Reviewed By: simoll

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

2 years ago[mlir] Fix macOS tests
Anush Elangovan [Wed, 20 Jul 2022 08:18:23 +0000 (10:18 +0200)]
[mlir] Fix macOS tests

Fix shared library names on macOS for execution_engine.py test.

Reviewed By: stellaraccident

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

2 years ago[InstCombine] add tests for icmp-shr. nfc
Chenbing Zheng [Wed, 20 Jul 2022 07:44:31 +0000 (15:44 +0800)]
[InstCombine] add tests for icmp-shr. nfc

2 years ago[sanitizer] Port sanitizer_common to LoongArch
Xi Ruoyao [Wed, 20 Jul 2022 07:58:40 +0000 (00:58 -0700)]
[sanitizer] Port sanitizer_common to LoongArch

Initial libsanitizer support for LoongArch. It survived all GCC UBSan tests.

Major changes:

1. LoongArch port of Linux kernel only supports `statx` for `stat` and its families.  So we need to add `statx_to_stat` and use it for `stat`-like libcalls.  The logic is "borrowed" from Glibc.
2. `sanitizer_syscall_linux_loongarch64.inc` is mostly duplicated from RISC-V port, as the syscall interface is almost same.

Reviewed By: SixWeining, MaskRay, XiaodongLoong, vitalybuka

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

2 years ago[X86] Add test case for shuffle.
Luo, Yuanke [Wed, 20 Jul 2022 07:49:08 +0000 (15:49 +0800)]
[X86] Add test case for shuffle.

The test case focus on shuffle which can be transformed to select or
blend.

2 years ago[llvm] Use llvm::any_of and llvm::none_of (NFC)
Kazu Hirata [Wed, 20 Jul 2022 07:36:19 +0000 (00:36 -0700)]
[llvm] Use llvm::any_of and llvm::none_of (NFC)

2 years ago[mlir][Math] Add constant folder for Log1pOp.
jacquesguan [Mon, 18 Jul 2022 02:36:12 +0000 (10:36 +0800)]
[mlir][Math] Add constant folder for Log1pOp.

This patch adds constant folder for Log1pOp which only supports single and double precision floating-point.

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

2 years ago[LegacyPM] Remove InstrOrderFileLegacyPass
Fangrui Song [Wed, 20 Jul 2022 06:58:51 +0000 (23:58 -0700)]
[LegacyPM] Remove InstrOrderFileLegacyPass

Following recent changes removing non-core features of the legacy
PM/optimization pipeline.

2 years agoUpdate the Windows packaging script.
Carlos Alberto Enciso [Wed, 20 Jul 2022 06:15:13 +0000 (07:15 +0100)]
Update the Windows packaging script.

As discussed on:
https://discourse.llvm.org/t/build-llvm-release-bat-script-options/63146/6

- In stage1 use the following binaries from stage0:
  lld-link, llvm-lib and llvm-windres

Reviewed By: hans

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

2 years ago[mlir][TilingInterface] Add support for interchange to tiling patterns that use the...
Mahesh Ravishankar [Sun, 17 Jul 2022 06:03:14 +0000 (06:03 +0000)]
[mlir][TilingInterface] Add support for interchange to tiling patterns that use the `TilingInterface`.

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

2 years ago[flang] Use value instead of getValue (NFC)
Kazu Hirata [Wed, 20 Jul 2022 04:49:14 +0000 (21:49 -0700)]
[flang] Use value instead of getValue (NFC)

Flang C++ Style Guide tells us to use x.value() when no presence test
is obviously protecting the reference.

2 years agoRevert "[libasan] Remove 4Mb stack limit for swapcontext unpoisoning"
Vitaly Buka [Wed, 20 Jul 2022 04:17:06 +0000 (21:17 -0700)]
Revert "[libasan] Remove 4Mb stack limit for swapcontext unpoisoning"

This patches exposed existing incorectness of swapcontext imlementation.
swapcontext does not set oucp->uc_stack. Unpoisoning works if ucp is
from makecontext, but may try to use garbage pointers if it's from
previos swapcontext or from getcontext. Existing limit reduces
probability of garbage pointers are used.

I restore behavour which we had for years, and will look to improve
swapcontext support.

This reverts commit d0751c9725aab1dad3d86481e13a4628356e7422.

2 years ago[X86][test] Use Min behavior for "cf-protection-{branch,return}" tests
Fangrui Song [Wed, 20 Jul 2022 04:25:55 +0000 (21:25 -0700)]
[X86][test] Use Min behavior for "cf-protection-{branch,return}" tests

The behavior does not match that much. Min is the new Clang codegen behavior
since D130065.

2 years ago[X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags
Fangrui Song [Wed, 20 Jul 2022 04:20:01 +0000 (21:20 -0700)]
[X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags

These features require that all object files are compiled with the support. When
the feature is disabled for an object file, the merge behavior should treat the
file having a value of 0 (see D129911).

Reviewed By: xiangzhangllvm

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

2 years agoMark test experimental-library-flag.cpp as XFAIL on PS4 and PS5 to get the bot green...
Douglas Yung [Wed, 20 Jul 2022 04:16:37 +0000 (21:16 -0700)]
Mark test experimental-library-flag.cpp as XFAIL on PS4 and PS5 to get the bot green until the author can investigate.

Should fix https://lab.llvm.org/buildbot/#/builders/139/builds/25208

Test was originally introduced in D121141.

2 years agoUse value instead of getValue (NFC)
Kazu Hirata [Wed, 20 Jul 2022 04:18:26 +0000 (21:18 -0700)]
Use value instead of getValue (NFC)

2 years ago[X86] Make sure load size is not larger than stack slot
Haohai Wen [Wed, 20 Jul 2022 04:14:42 +0000 (12:14 +0800)]
[X86] Make sure load size is not larger than stack slot

Reviewed By: LuoYuanke

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

2 years ago[libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.
Konstantin Varlamov [Wed, 20 Jul 2022 03:40:12 +0000 (20:40 -0700)]
[libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.

Also simplify the `robust` test files for non-boolean predicates and
omitting `std::invoke`.

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

2 years ago[AArch64] Use SUBXrx64 for dynamic stack to refer to sp
chenglin.bi [Wed, 20 Jul 2022 03:06:16 +0000 (11:06 +0800)]
[AArch64] Use SUBXrx64 for dynamic stack to refer to sp

When we lower dynamic stack, we need to substract pattern `x15 << 4`  from sp.
Subtract instruction with arith shifted register(SUBXrs) can't refer to sp. So for now we need two extra mov like:

```
mov x0, sp
sub x0, x0, x15, lsl #4
mov sp, x0
```
If we want to refer to sp in subtract instruction like this:
```
sub sp, sp, x15, lsl #4
```
We must use arith extended register version(SUBXrx).
So in this patch when we find sub have sp operand on src0, try to select to SubXrx64.

Reviewed By: efriedma

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

2 years ago[gn build] Port 5dd19ada571b
LLVM GN Syncbot [Wed, 20 Jul 2022 03:15:57 +0000 (03:15 +0000)]
[gn build] Port 5dd19ada571b

2 years agoUse has_value instead of hasValue (NFC)
Kazu Hirata [Wed, 20 Jul 2022 03:15:44 +0000 (20:15 -0700)]
Use has_value instead of hasValue (NFC)

2 years ago[libc++][ranges] Implement `ranges::partial_sort`.
varconst [Wed, 20 Jul 2022 03:10:02 +0000 (20:10 -0700)]
[libc++][ranges] Implement `ranges::partial_sort`.

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

2 years ago[mlir] Address compiler warning
Jacques Pienaar [Wed, 20 Jul 2022 03:03:03 +0000 (20:03 -0700)]
[mlir] Address compiler warning

2 years ago[CodeGen] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Wed, 20 Jul 2022 02:50:43 +0000 (19:50 -0700)]
[CodeGen] Use value_or instead of getValueOr (NFC)

2 years agoDon't treat readnone call in presplit coroutine as not access memory
Chuanqi Xu [Wed, 20 Jul 2022 02:37:23 +0000 (10:37 +0800)]
Don't treat readnone call in presplit coroutine as not access memory

To solve the readnone problems in coroutines. See
https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015
for details.

According to the discussion, we decide to fix the problem by inserting
isPresplitCoroutine() checks in different passes instead of
wrapping/unwrapping readnone attributes in CoroEarly/CoroCleanup passes.
In this direction, we might not be able to cover every case at first.
Let's take a "find and fix" strategy.

Reviewed By: nikic, nhaehnle, jyknight

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

2 years ago[lld-macho] Simplify archive loading logic
Jez Ng [Wed, 20 Jul 2022 01:54:58 +0000 (21:54 -0400)]
[lld-macho] Simplify archive loading logic

This is a follow-on to {D129556}. I've refactored the code such that
`addFile()` no longer needs to take an extra parameter. Additionally,
the "do we force-load or not" policy logic is now fully contained within
addFile, instead of being split between `addFile` and
`parseLCLinkerOptions`. This also allows us to move the `ForceLoad` (now
`LoadType`) enum out of the header file.

Additionally, we can now correctly report loads induced by
`LC_LINKER_OPTION` in our `-why_load` output.

I've also added another test to check that CLI library non-force-loads
take precedence over `LC_LINKER_OPTION` + `-force_load_swift_libs`. (The
existing logic is correct, just untested.)

Reviewed By: #lld-macho, thakis

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

2 years ago[llvm-driver] Generate symlinks instead of executables for tools
Alex Brachet [Wed, 20 Jul 2022 01:42:56 +0000 (01:42 +0000)]
[llvm-driver] Generate symlinks instead of executables for tools

When LLVM_TOOL_LLVM_DRIVER_BUILD is On, create symlinks
to llvm instead of creating the executables. Currently
this only works for install and not
install-distribution, the work for the later will be
split up into a second patch.

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

2 years ago[x86] use zero-extending load of a byte outside of loops too (2nd try)
Sanjay Patel [Wed, 20 Jul 2022 01:25:41 +0000 (21:25 -0400)]
[x86] use zero-extending load of a byte outside of loops too (2nd try)

The first attempt missed changing test files for tools
(update_llc_test_checks.py).

Original commit message:

This implements the main suggested change from issue #56498.
Using the shorter (non-extending) instruction with only
-Oz ("minsize") rather than -Os ("optsize") is left as a
possible follow-up.

As noted in the bug report, the zero-extending load may have
shorter latency/better throughput across a wide range of x86
micro-arches, and it avoids a potential false dependency.
The cost is an extra instruction byte.

This could cause perf ups and downs from secondary effects,
but I don't think it is possible to account for those in
advance, and that will likely also depend on exact micro-arch.
This does bring LLVM x86 codegen more in line with existing
gcc codegen, so if problems are exposed they are more likely
to occur for both compilers.

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

2 years ago[lld-macho] Read in new addrsig format
Jez Ng [Wed, 20 Jul 2022 01:22:27 +0000 (21:22 -0400)]
[lld-macho] Read in new addrsig format

The new format uses symbol relocations, as described in {D127637}.

Reviewed By: #lld-macho, alx32

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

2 years ago[MC][MachO] Change addrsig format + ensure its size is properly set
Jez Ng [Wed, 20 Jul 2022 01:22:23 +0000 (21:22 -0400)]
[MC][MachO] Change addrsig format + ensure its size is properly set

There were two problems with the previous setup:

1. We weren't setting its size, which caused problems when `__llvm_addrsig`
   wasn't the last section. In particular, `__debug_line` (if created) is
   generated and placed after `__llvm_addrsig`, and would result in an
   invalid object file w/ overlapping sections being emitted.

2. The symbol indices could be invalidated if e.g. `llvm-strip` ran on
   the object file. See discussion [here][1].

To fix both these issues, we use symbol relocations instead of encoding
symbol indices directly in the section contents. The section itself
doesn't contain any data. That sidesteps the layout problem in addition
to solving the second issue.

The corresponding LLD change to read in this new format: {D128938}.
It will fix the icf-safe.ll test failure on this diff.

[1]: https://discourse.llvm.org/t/problems-with-mach-o-address-significance-table-generation/63392/

Reviewed By: #lld-macho, alx32

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

2 years ago[libc++][ranges] Fix broken CI.
Konstantin Varlamov [Wed, 20 Jul 2022 01:14:44 +0000 (18:14 -0700)]
[libc++][ranges] Fix broken CI.

2 years ago[libc++][ranges] fix `std::search_n` incorrect `static_assert`
Hui Xie [Wed, 20 Jul 2022 00:24:23 +0000 (17:24 -0700)]
[libc++][ranges] fix `std::search_n` incorrect `static_assert`

[libc++][ranges] fix `std::search_n` incorrect `static_assert`
see more detail in https://reviews.llvm.org/D124079?#3661721

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

2 years ago[ORC] Fix serialization / deserialization of default-constructed StringRef.
Lang Hames [Wed, 20 Jul 2022 00:19:58 +0000 (17:19 -0700)]
[ORC] Fix serialization / deserialization of default-constructed StringRef.

Avoids accessing the data field on zero-length strings. This is the StringRef
counterpart to the ArrayRef<char> fix in 67220c2ad72e3.

rdar://97285294

2 years ago[libc++][ranges][NFC] Test that range algorithms support iterators requiring `iter_move`.
Konstantin Varlamov [Wed, 20 Jul 2022 00:20:56 +0000 (17:20 -0700)]
[libc++][ranges][NFC] Test that range algorithms support iterators requiring `iter_move`.

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

2 years ago[libc++] Define ostream nullptr inserter for >= C++17 only
Joe Loser [Fri, 3 Jun 2022 23:05:23 +0000 (17:05 -0600)]
[libc++] Define ostream nullptr inserter for >= C++17 only

The `ostream` `nullptr` inserter implemented in 3c125fe is missing a C++ version
guard. Normally, `libc++` takes the stance of backporting LWG issues to older
standards modes as was done in 3c125fe. However, backporting to older standards
modes breaks existing code in popular libraries such as `Boost.Test` and
`Google Test` who define their own overload for `nullptr_t`.

Instead, only apply this `operator<<` overload in C++17 or later.

Fixes https://github.com/llvm/llvm-project/issues/55861.

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

2 years agoArgument name support for function pointer signature hints
Qwinci [Wed, 20 Jul 2022 00:02:24 +0000 (20:02 -0400)]
Argument name support for function pointer signature hints

Fixes https://github.com/clangd/clangd/issues/1068

Reviewed By: nridge

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

2 years ago[mlir][NFC] Split out various tests from IR/invalid.mlir
River Riddle [Tue, 19 Jul 2022 20:21:36 +0000 (13:21 -0700)]
[mlir][NFC] Split out various tests from IR/invalid.mlir

This file contains a huge number of tests that should really be in
different dialect/files. It is monolothic because of the legacy
surrounding the old standard dialect, affine operations, etc. Splitting
this up makes the tests much more maintainable given that they are now
group with other similar tests.

2 years ago[ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.
Volodymyr Sapsai [Mon, 27 Jun 2022 23:53:36 +0000 (16:53 -0700)]
[ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.

Specifically, making the following changes:
* Turn lambdas calculating ODR hashes into static functions.
* Move `ODRCXXRecordDifference` where it is used.
* Rename some variables and move some lines of code.
* Replace `auto` with explicit type when the deduced type is not mentioned.
* Add `const` for unmodified objects, so we can pass them to more functions.

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

2 years ago[Attributor] Teach checkForAllUses to follow returns into callers
Johannes Doerfert [Sat, 9 Jul 2022 18:52:49 +0000 (13:52 -0500)]
[Attributor] Teach checkForAllUses to follow returns into callers

If we can determine all call sites we can follow a use in a return
instruction into the caller. AAPointerInfo utilizes this feature.

2 years ago[Attributor][NFC] Improve debug messages
Johannes Doerfert [Sat, 9 Jul 2022 00:54:04 +0000 (19:54 -0500)]
[Attributor][NFC] Improve debug messages

2 years ago[bolt] std::atomic_uint64_t to std::atomic<uint64_t>
Sriraman Tallam [Tue, 19 Jul 2022 23:09:11 +0000 (16:09 -0700)]
[bolt] std::atomic_uint64_t to std::atomic<uint64_t>

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

2 years agoBazel BUILD file for BOLT.
Sriraman Tallam [Fri, 15 Jul 2022 22:08:08 +0000 (15:08 -0700)]
Bazel BUILD file for BOLT.

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

2 years ago[mlir] Fixed ordering of pass statistics.
Slava Zakharin [Tue, 19 Jul 2022 20:26:35 +0000 (13:26 -0700)]
[mlir] Fixed ordering of pass statistics.

The change makes sure the plain C string statistics names
are properly ordered.

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

2 years ago[gn build] Port 1b1f1c778695
LLVM GN Syncbot [Tue, 19 Jul 2022 22:44:22 +0000 (22:44 +0000)]
[gn build] Port 1b1f1c778695

2 years ago[libc] Add a method `find_last_of` to StringView.
Siva Chandra Reddy [Tue, 19 Jul 2022 19:19:52 +0000 (19:19 +0000)]
[libc] Add a method `find_last_of` to StringView.

Reviewed By: jeffbailey

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

2 years ago[LLDB][NativePDB] Add MSInheritanceAttr when creating pointer type that is a pointer...
Zequan Wu [Tue, 19 Jul 2022 19:58:56 +0000 (12:58 -0700)]
[LLDB][NativePDB] Add MSInheritanceAttr when creating pointer type that is a pointer to member.

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

2 years agoRe-re-apply 5acd47169884, Add a shared-memory based orc::MemoryMapper...
Anubhab Ghosh [Tue, 19 Jul 2022 22:28:55 +0000 (15:28 -0700)]
Re-re-apply 5acd47169884, Add a shared-memory based orc::MemoryMapper...

...with more fixes.

The original patch was reverted in 3e9cc543f22 due to bot failures caused by
a missing dependence on librt. That issue was fixed in 32d8d23cd0, but that
commit also broke sanitizer bots due to a bug in SimplePackedSerialization:
empty ArrayRef<char>s triggered a zero-byte memcpy from a null source. The
ArrayRef<char> serialization issue was fixed in 67220c2ad7, and this patch has
also been updated with a new custom SharedMemorySegFinalizeRequest message that
should avoid serializing empty ArrayRefs in the first place.

https://reviews.llvm.org/D128544

2 years agoRevert "[Local] Allow creating callbr with duplicate successors"
Nick Desaulniers [Tue, 19 Jul 2022 21:59:07 +0000 (14:59 -0700)]
Revert "[Local] Allow creating callbr with duplicate successors"

This reverts commit 08860f525a2363ccd697ebb3ff59769e37b1be21.

Crashes during PPC64LE linux kernel builds as reported by @nathanchance.
https://reviews.llvm.org/D129997#3663632

2 years ago[JITLink] Hook up prebuilt cache in DWARFRecordSectionSplitter::processBlock.
Lang Hames [Tue, 19 Jul 2022 22:00:32 +0000 (15:00 -0700)]
[JITLink] Hook up prebuilt cache in DWARFRecordSectionSplitter::processBlock.

DWARFRecordSectionSplitter pre-builds a splitBlock cache, but wasn't passing it
to the call to splitBlock. This was an oversight in the original patch.

2 years ago[lld-macho] Fix loading same libraries from both LC_LINKER_OPTION and command line
Kaining Zhong [Tue, 19 Jul 2022 21:43:30 +0000 (17:43 -0400)]
[lld-macho] Fix loading same libraries from both LC_LINKER_OPTION and command line

This fixes https://github.com/llvm/llvm-project/issues/56059 and
https://github.com/llvm/llvm-project/issues/56440. This is inspired by
tapthaker's patch (https://reviews.llvm.org/D127941), and has reused his
test cases. This patch adds an bool "isCommandLineLoad" to indicate
where archives are from. If lld tries to load the same library loaded
previously by LC_LINKER_OPTION from CLI, it will use this
isCommandLineLoad to determine if it should be affected by -all_load &
-ObjC flags. This also prevents -force_load from affecting archives
loaded previously from CLI without such flag, whereas tapthaker's patch
will fail such test case (introduced by
https://reviews.llvm.org/D128025).

Reviewed By: int3, #lld-macho

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

2 years ago[mlir] Flip LinAlg dialect to _Both
Jacques Pienaar [Tue, 19 Jul 2022 21:42:57 +0000 (14:42 -0700)]
[mlir] Flip LinAlg dialect to _Both

This one required more changes than ideal due to overlapping generated name
with different return types. Changed getIndexingMaps to getIndexingMapsArray to
move it out of the way/highlight that it returns (more expensively) a
SmallVector and uses the prefixed name for the Attribute.

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