platform/upstream/llvm.git
19 months ago[LoongArch][NFC] Add tests of multiplication with immediates
Ben Shi [Sun, 2 Apr 2023 08:04:23 +0000 (16:04 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates

Reviewed By: xen0n, SixWeining

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

19 months ago[SelectionDAG] Rename Flag->Glue. NFC
Craig Topper [Mon, 3 Apr 2023 02:45:36 +0000 (19:45 -0700)]
[SelectionDAG] Rename Flag->Glue. NFC

19 months ago[Targets] Rename Flag->Glue. NFC
Craig Topper [Mon, 3 Apr 2023 02:14:31 +0000 (19:14 -0700)]
[Targets] Rename Flag->Glue. NFC

Long long ago Glue was called Flag, and it was never completely
renamed.

19 months ago[X86] Rename Flag->Glue in SelectionDAG. NFC
Craig Topper [Mon, 3 Apr 2023 02:14:22 +0000 (19:14 -0700)]
[X86] Rename Flag->Glue in SelectionDAG. NFC

Long long ago Glue was called Flag, and it was never completely
renamed.

More patches for other targets will follow.

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

19 months ago[mlir] Fix ignoring return value warning for Toy CLIs
Kai Sasaki [Sun, 2 Apr 2023 21:36:56 +0000 (06:36 +0900)]
[mlir] Fix ignoring return value warning for Toy CLIs

After [the change](https://github.com/llvm/llvm-project/commit/470f3cee3557974bb1820722bf82d86b8909199b) returning LogicalResult from applyPassManagerCLIOptions, the warning message is shown in the Toy CLIs saying it's not using the returned values. We can check the result and return non-zero value as the pass failure.

```
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch3/toyc.cpp:118:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
    applyPassManagerCLOptions(pm);
    ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[473/485] Building CXX object tools/mlir/examples/toy/Ch4/CMakeFiles/toyc-ch4.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch4/toyc.cpp:119:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
    applyPassManagerCLOptions(pm);
    ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[477/485] Building CXX object tools/mlir/examples/toy/Ch5/CMakeFiles/toyc-ch5.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch5/toyc.cpp:122:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
  applyPassManagerCLOptions(pm);
  ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[479/485] Building CXX object tools/mlir/examples/toy/Ch6/CMakeFiles/toyc-ch6.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch6/toyc.cpp:139:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
  applyPassManagerCLOptions(pm);
  ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[481/485] Building CXX object tools/mlir/examples/toy/Ch7/CMakeFiles/toyc-ch7.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch7/toyc.cpp:139:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
  applyPassManagerCLOptions(pm);
  ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
```

Reviewed By: mehdi_amini

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

19 months ago[TableGen] Rename InFlag/OutFlag->InGlue/OutGlue. NFC
Craig Topper [Sun, 2 Apr 2023 21:12:08 +0000 (14:12 -0700)]
[TableGen] Rename InFlag/OutFlag->InGlue/OutGlue. NFC

Flag was renamed to Glue a long time ago, but rename was incomplete.

19 months ago[TableGen] clang-format DAGISelMatcherOpt.cpp. NFC
Craig Topper [Sun, 2 Apr 2023 21:04:56 +0000 (14:04 -0700)]
[TableGen] clang-format DAGISelMatcherOpt.cpp. NFC

19 months ago[mlir][doc] rename MemRefDataFlowOpt -> AffineScalarReplacement
Joshua Cao [Sun, 2 Apr 2023 20:58:51 +0000 (13:58 -0700)]
[mlir][doc] rename MemRefDataFlowOpt -> AffineScalarReplacement

Renamed in https://reviews.llvm.org/D104190, but missed in docs

19 months ago[mlir] [Linalg] Limit Detensorize pass to FunctionOpInterface
Felix Schneider [Sun, 2 Apr 2023 20:24:36 +0000 (13:24 -0700)]
[mlir] [Linalg] Limit Detensorize pass to FunctionOpInterface

The linalg-detensorize Pass can only be run on FunctionOpInterface Ops and will crash when run on other ops. The TableGen definition of the pass did not enforce that.

Github issue here: https://github.com/llvm/llvm-project/issues/61845

Reviewed By: mehdi_amini

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

19 months ago[X86] truncateAVX512SetCCNoBWI - pass SDLoc argument by const-ref
Simon Pilgrim [Sun, 2 Apr 2023 19:56:54 +0000 (20:56 +0100)]
[X86] truncateAVX512SetCCNoBWI - pass SDLoc argument by const-ref

19 months ago[TableGen] Avoid creating a ScopeMatcher full of nullptrs.
Craig Topper [Sun, 2 Apr 2023 18:38:26 +0000 (11:38 -0700)]
[TableGen] Avoid creating a ScopeMatcher full of nullptrs.

The call to FactorNodes will catch it and remove it, but it's easy
to catch at creation.

Remove the now unnecessary null checks from a loop in factor nodes.

19 months ago[X86] combineX86ShufflesConstants - move hasOneUse check as late as possible. NFC.
Simon Pilgrim [Sun, 2 Apr 2023 18:16:24 +0000 (19:16 +0100)]
[X86] combineX86ShufflesConstants - move hasOneUse check as late as possible. NFC.

We only need to check hasOneUse if we're optimizing for size, so move the call at the end of the if check.

19 months ago[X86] lowerShuffleOfExtractsAsVperm - move hasOneUse checks to the end of the match...
Simon Pilgrim [Sun, 2 Apr 2023 17:29:37 +0000 (18:29 +0100)]
[X86] lowerShuffleOfExtractsAsVperm - move hasOneUse checks to the end of the match. NFCI.

Check the cheap parts of the pattern first, and make the more expensive hasOneUse() call as late as possible.

19 months ago[MCJIT] Set VMA to code address in PerfJITEventListener.
Prem Chintalapudi [Sun, 2 Apr 2023 17:29:52 +0000 (10:29 -0700)]
[MCJIT] Set VMA to code address in PerfJITEventListener.

VMA should default to CodeAddr, not 0, as specified here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jitdump-specification.txt

Reviewed By: lhames

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

19 months ago[X86] Move hasOneUse check on PCMPGT(X,-1) -> PCMPGT(0,X) inversion folds to the...
Simon Pilgrim [Sun, 2 Apr 2023 17:07:01 +0000 (18:07 +0100)]
[X86] Move hasOneUse check on PCMPGT(X,-1) -> PCMPGT(0,X) inversion folds to the end of the match. NFCI.

Check the cheap parts of the pattern first, and make the more expensive hasOneUse() call as late as possible.

19 months ago[ORC] Add a generic bootstrap key-value store to SimpleRemoteEPC.
Lang Hames [Sun, 2 Apr 2023 16:41:47 +0000 (09:41 -0700)]
[ORC] Add a generic bootstrap key-value store to SimpleRemoteEPC.

SimpleRemoteEPC already included a "bootstrap symbols map" that could be used
to communicate the addresses of symbols needed for JIT bootstrap. The new
bootstrap map can be used to communicate arbitrary bootstrap values (encoded as
SPS buffers).

The bootstrap symbols map is kept as distinct becasue bootstrap symbols are
significant, and having a known value type for them allows for better debug
logging (we know how to render the values) and tooling (e.g. utils for adding
all bootstrap symbols to a JITDylib).

19 months ago[X86] combineExtractVectorElt - call hasOneUse() as late as possible. NFCI.
Simon Pilgrim [Sun, 2 Apr 2023 16:43:16 +0000 (17:43 +0100)]
[X86] combineExtractVectorElt - call hasOneUse() as late as possible. NFCI.

MMX conversion is very unlikely, so check the value types first, and make the more expensive hasOneUse() call as late as possible.

19 months ago[clang-tidy] Fix findNextTokenSkippingComments & rangeContainsExpansionsOrDirectives
Piotr Zegar [Sun, 2 Apr 2023 15:49:27 +0000 (15:49 +0000)]
[clang-tidy] Fix findNextTokenSkippingComments & rangeContainsExpansionsOrDirectives

findNextTokenSkippingComments is actually a endless loop,
implementing it correctly.
rangeContainsExpansionsOrDirectives were skiping every second
token, if there were no whitespaces bettwen tokens.

Reviewed By: carlosgalvezp

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

19 months agoRevert D147231 "[libc] Adds string and TestLogger classes, use them in LibcTest"
Guillaume Chatelet [Sun, 2 Apr 2023 16:02:00 +0000 (16:02 +0000)]
Revert D147231 "[libc] Adds string and TestLogger classes, use them in LibcTest"

Does not build with gcc.
This reverts commit fc5ae0a7a45bdb5251f3dad3fc07047f987ca447.

19 months ago[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN
Luke Lau [Wed, 1 Mar 2023 18:25:48 +0000 (18:25 +0000)]
[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN

This enables the interleaved access pass on O1 and above, and causes
interleaving/deinterleaving shuffles of fixed length vectors with
stores/loads to be lowered into vssegN/vlsegN.

We need to be careful and make sure that we only lower vsseg/vlseg
whenever we know the fixed vector type will fit within the minimum vlen,
and that the interleaving factor is supported for the given LMUL.

Reviewed By: craig.topper

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

19 months ago[mlir][StorageUniquer] Fix build with LLVM_ENABLE_THREADS=OFF
Alexandre Ganea [Sun, 2 Apr 2023 15:38:58 +0000 (11:38 -0400)]
[mlir][StorageUniquer] Fix build with LLVM_ENABLE_THREADS=OFF

19 months ago[compiler-rt] Avoid double-prefixing aliases with __USER_LABEL_PREFIX__
Sergei Barannikov [Sun, 2 Apr 2023 15:33:27 +0000 (18:33 +0300)]
[compiler-rt] Avoid double-prefixing aliases with __USER_LABEL_PREFIX__

The prefix is added by DECLARE_SYMBOL_VISIBILITY. Calling SYMBOL_NAME
resulted in adding the prefix twice.

Reviewed By: dim

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

19 months ago[libc] Adds string and TestLogger classes, use them in LibcTest
Guillaume Chatelet [Thu, 30 Mar 2023 13:13:27 +0000 (13:13 +0000)]
[libc] Adds string and TestLogger classes, use them in LibcTest

This is an implementation of https://discourse.llvm.org/t/rfc-running-libc-unit-tests-as-integration-tests/69461.

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

19 months ago[DAG] canCreateUndefOrPoison - add ISD::INSERT_VECTOR_ELT handling
Simon Pilgrim [Sun, 2 Apr 2023 15:28:20 +0000 (16:28 +0100)]
[DAG] canCreateUndefOrPoison - add ISD::INSERT_VECTOR_ELT handling

If the inserted element index is guaranteed to be inbounds then a ISD::INSERT_VECTOR_ELT will not create poison/undef.

19 months ago[X86] Add test case showing failure to fold freeze through a ISD::INSERT_VECTOR_ELT...
Simon Pilgrim [Sun, 2 Apr 2023 15:03:14 +0000 (16:03 +0100)]
[X86] Add test case showing failure to fold freeze through a ISD::INSERT_VECTOR_ELT node

19 months ago[libc] Fix missing include for pthread tests
Guillaume Chatelet [Sun, 2 Apr 2023 15:06:15 +0000 (15:06 +0000)]
[libc] Fix missing include for pthread tests

19 months agoRevert "[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN"
Luke Lau [Sun, 2 Apr 2023 14:56:02 +0000 (15:56 +0100)]
Revert "[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN"

This reverts commit b95913e8c3a3521b85d689a358e620d89a4e83de.

19 months ago[libc] Use string_view for write_to_stderr
Guillaume Chatelet [Sat, 1 Apr 2023 11:30:34 +0000 (11:30 +0000)]
[libc] Use string_view for write_to_stderr

This patch makes use of `cpp::string_view` instead of `const char*` for `write_to_stderr`. This helps sending non null-terminated buffers such as a single character, `cpp::string_view` or `cpp::string`.
It also fizes the gpu version that had several bugs (See https://reviews.llvm.org/D145913#4236641).

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

19 months ago[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN
Luke Lau [Wed, 1 Mar 2023 18:25:48 +0000 (18:25 +0000)]
[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN

This enables the interleaved access pass on O1 and above, and causes
interleaving/deinterleaving shuffles of fixed length vectors with
stores/loads to be lowered into vssegN/vlsegN.

We need to be careful and make sure that we only lower vsseg/vlseg
whenever we know the fixed vector type will fit within the minimum vlen,
and that the interleaving factor is supported for the given LMUL.

Reviewed By: craig.topper

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

19 months ago[LoongArch] Optimize multiplication with immediates
Ben Shi [Sun, 2 Apr 2023 05:06:11 +0000 (13:06 +0800)]
[LoongArch] Optimize multiplication with immediates

Optimize multiplication with some specific immediates to
a pair of `alsl`.

Reviewed By: SixWeining, xen0n

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

19 months ago[LoongArch][NFC] Add tests of multiplication with immediates
Ben Shi [Sun, 2 Apr 2023 04:35:43 +0000 (12:35 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates

Reviewed By: xen0n, SixWeining

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

19 months ago[HIP] Supports env var HIP_PATH
Yaxun (Sam) Liu [Mon, 6 Mar 2023 15:52:47 +0000 (10:52 -0500)]
[HIP] Supports env var HIP_PATH

Currently HIP toolchain recognize env var ROCM_PATH and option --rocm-path
but only recognize --hip-path.

Some package management tools e.g. Spack relies on env var HIP_PATH to
be able to load different version of HIP dynamically.
(https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/hip/package.py#L446)
Therefore add support of env var HIP_PATH.

Reviewed by: Artem Belevich, Fangrui Song

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

19 months ago[HIP] clang should pass `-mno-amdgpu-ieee` to -cc1
Yaxun (Sam) Liu [Thu, 9 Mar 2023 20:41:54 +0000 (15:41 -0500)]
[HIP] clang should pass `-mno-amdgpu-ieee` to -cc1

Reviewed by: Artem Belevich

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

19 months ago[Loads] Support SCEVAddExpr as start for pointer AddRec.
Florian Hahn [Sun, 2 Apr 2023 11:33:43 +0000 (12:33 +0100)]
[Loads] Support SCEVAddExpr as start for pointer AddRec.

Extend handling to support `%base + offset` as start for AddRecs in
isDereferenceableAndAlignedInLoop. This is done by adjusting AccessSize
by the offset and effectively checking if the full object starting from
%base to %base + offset + access-size is dereferenceable.

Reviewed By: nikic

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

19 months agoStop modifying trailing return types.
Richard Smith [Sun, 2 Apr 2023 08:11:30 +0000 (01:11 -0700)]
Stop modifying trailing return types.

This change reverts the functional change from D144626 but retains its
test. Instead of dealing with the possibility that a trailing requires
clause might have been rewritten into some other incorrect form, just
stop rewriting it.

No functionality changes intended.

Reviewed By: erichkeane, ChuanqiXu

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

19 months ago[mlir][flang] Fix -Wunused-result after D146785 (NFC)
Jie Fu [Sun, 2 Apr 2023 08:30:33 +0000 (16:30 +0800)]
[mlir][flang] Fix -Wunused-result after D146785 (NFC)

/data/llvm-project/mlir/examples/toy/Ch4/toyc.cpp:119:5: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
    applyPassManagerCLOptions(pm);
    ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.

/data/llvm-project/flang/lib/Frontend/FrontendActions.cpp:669:3: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  mlir::applyPassManagerCLOptions(pm);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.

19 months ago[asan][test][win] Make report_after_syminitialize test less brittle
Alvin Wong [Sat, 1 Apr 2023 18:16:07 +0000 (02:16 +0800)]
[asan][test][win] Make report_after_syminitialize test less brittle

Instead of relying on one of the two commands failing on MinGW target,
just use the `%if` conditional substitution feature from lit, which is
much less brittle.

Amends 5888a47914f44ffaf102fcb7afd3500706fe753f

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

19 months ago[LoopInterchange] Add GEP with 3 indices test for pr57148
Joshua Cao [Sun, 2 Apr 2023 07:19:49 +0000 (00:19 -0700)]
[LoopInterchange] Add GEP with 3 indices test for pr57148

Motivated by https://reviews.llvm.org/D147117. Need a test with
BackedgeTakenCount=False and a 3 index GEP.

19 months ago[mlir] Catch the case using ir print without disabling multithread
Kai Sasaki [Sun, 2 Apr 2023 06:39:27 +0000 (15:39 +0900)]
[mlir] Catch the case using ir print without disabling multithread

-mlir-print-ir-module-scope option cannot be used without disabling multithread for pass manager. For the usability, we can throw a validation error in mlir-opt instead of assertion failure.

Issue: https://github.com/llvm/llvm-project/issues/61578

Reviewed By: mehdi_amini

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

19 months ago[M68k] Add support for lowering atomic fence
Min-Yih Hsu [Mon, 27 Mar 2023 17:27:27 +0000 (10:27 -0700)]
[M68k] Add support for lowering atomic fence

Ideally we want to lower ATOMIC_FENCE into `__sync_synchronize`.
However, libgcc doesn't implement that builtin as GCC simply generates an
inline assembly barrier whenever there needs to be a fence.

We use a similar way to lower ATOMIC_FENCE.

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

19 months ago[clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope"
Jon Phillips [Sun, 2 Apr 2023 02:21:41 +0000 (19:21 -0700)]
[clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope"

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

19 months ago[RISCV] Add special case for i32 uaddo X, -1 on RV64.
Craig Topper [Sun, 2 Apr 2023 01:53:19 +0000 (18:53 -0700)]
[RISCV] Add special case for i32 uaddo X, -1 on RV64.

uaddo X, -1 over flows if X is non-zero.

Matches what we do i32 uaddo X, -1 on RV32.

Fixes #61891.

19 months ago[RISCV] Add i32 uaddo X, -1 test case. NFC
Craig Topper [Sun, 2 Apr 2023 01:49:30 +0000 (18:49 -0700)]
[RISCV] Add i32 uaddo X, -1 test case. NFC

19 months ago[TableGen] Move some vectors into place instead of copying them.
Craig Topper [Sat, 1 Apr 2023 22:40:53 +0000 (15:40 -0700)]
[TableGen] Move some vectors into place instead of copying them.

19 months ago[Clang][AST] Fix __has_unique_object_representations computation for unnamed bitfields.
Roy Jacobson [Sat, 11 Mar 2023 16:39:33 +0000 (18:39 +0200)]
[Clang][AST] Fix __has_unique_object_representations computation for unnamed bitfields.

As pointed out in https://github.com/llvm/llvm-project/issues/61336, objects with
unnamed bitfields aren't be uniquely representable.

Reviewed By: shafik, Endill

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

19 months ago[flang][docs] Document module name extension
Peter Klausler [Sat, 1 Apr 2023 21:05:06 +0000 (14:05 -0700)]
[flang][docs] Document module name extension

Add an entry to the Extensions document describing how we
don't care about conflicts between module names and non-global
items.  (This is a case where it would be a nontrivial amount
of work to catch an "error" that is only a standard conformance
issue, not anything that would prevent a program from working.)

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

19 months ago[flang] Fix checks for USE-associated UDDTIO & their character argument kinds
Peter Klausler [Tue, 28 Mar 2023 20:38:44 +0000 (13:38 -0700)]
[flang] Fix checks for USE-associated UDDTIO & their character argument kinds

Call GetUltimate() before checking a user-defined derived type I/O specific
procedure so that the checks work on a USE-associated procedure.  And
require their character arguments to have the default CHARACTER kind.

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

19 months ago[X86] vector-compare-any_of.ll - add AVX1OR2 check-prefix and make AVX a common check...
Simon Pilgrim [Sat, 1 Apr 2023 20:53:03 +0000 (21:53 +0100)]
[X86] vector-compare-any_of.ll - add AVX1OR2 check-prefix and make AVX a common check-prefix

19 months ago[X86] combinePTESTCC - fold TESTC(X,~X) -> TESTC(X,-1)
Simon Pilgrim [Sat, 1 Apr 2023 19:28:25 +0000 (20:28 +0100)]
[X86] combinePTESTCC - fold TESTC(X,~X) -> TESTC(X,-1)

Partial fix for Issue #59998

19 months ago[X86] Add test showing failure to fold testc(X,~X) -> testc(X,-1)
Simon Pilgrim [Sat, 1 Apr 2023 19:19:27 +0000 (20:19 +0100)]
[X86] Add test showing failure to fold testc(X,~X) -> testc(X,-1)

19 months ago[clang-tidy] Disable misc-definitions-in-headers for declarations in anonymous namespaces
Carlos Galvez [Sat, 1 Apr 2023 15:14:22 +0000 (15:14 +0000)]
[clang-tidy] Disable misc-definitions-in-headers for declarations in anonymous namespaces

Anonymous namespaces are another way of providing internal linkage,
and the check already ignores other cases of internal linkage in
headers, via "static" or "const".

Anonymous namespaces in headers are definitely a source of pitfalls,
but it's not the responsibility of this check to cover that. Instead,
google-build-namespaces will specifically warn about this issue.

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

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

19 months ago[X86] combineSetCCMOVMSK - fold PTEST(XOR(X,Y),XOR(X,Y)) instead of PTEST(SUB(X,Y...
Simon Pilgrim [Sat, 1 Apr 2023 17:45:53 +0000 (18:45 +0100)]
[X86] combineSetCCMOVMSK - fold PTEST(XOR(X,Y),XOR(X,Y)) instead of PTEST(SUB(X,Y),SUB(X,Y))

Consistently use the PTEST(XOR(X,Y),XOR(X,Y)) pattern for all-vector comparisons

19 months ago[clang-format] Handle Verilog struct literals
sstwcw [Sat, 1 Apr 2023 17:10:06 +0000 (17:10 +0000)]
[clang-format] Handle Verilog struct literals

Previously `isVerilogIdentifier` was mistaking the apostrophe used in
struct literals as an identifier.  It is fixed.

Reviewed By: HazardyKnusperkeks, owenpan

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

19 months ago[clang-format] Handle enum in Verilog
sstwcw [Sat, 1 Apr 2023 17:08:31 +0000 (17:08 +0000)]
[clang-format] Handle enum in Verilog

Verilog has enum just like C.

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

19 months ago[asan][test] Fix tests or mark XFAIL for MinGW target
Alvin Wong [Tue, 28 Mar 2023 09:03:10 +0000 (17:03 +0800)]
[asan][test] Fix tests or mark XFAIL for MinGW target

After this change, `check-asan-dynamic` should pass on x86_64 MinGW
target, using the llvm-mingw toolchain.

The following is a list of issues fixed:

* `asan_str_test.cpp`: Exclude unintercepted functions on MinGW.
* `asan_test.cpp`: Work around regex limitation of gtest on Windows,
  which only affects MinGW target because `long double` has different
  size to `double`.
* `TestCases/Windows/report_after_syminitialize.cpp`: Added  build
  command specifically for MinGW.
* Other tests: Mark XFAIL for various reasons. Some of them need
  further investigation.

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

19 months ago[asan][test] Fix `TestCases/alloca_*` ptr-to-long cast on Windows
Alvin Wong [Thu, 30 Mar 2023 11:21:56 +0000 (19:21 +0800)]
[asan][test] Fix `TestCases/alloca_*` ptr-to-long cast on Windows

64-bit Windows uses 32-bit long so these casts fail to compile with the
error "cast from pointer to smaller type". Change to instead use
uintptr_t like other tests.

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

19 months ago[compiler-rt][asan][test] Fix lit test config on MinGW
Alvin Wong [Mon, 27 Mar 2023 14:48:17 +0000 (22:48 +0800)]
[compiler-rt][asan][test] Fix lit test config on MinGW

MinGW is GCC-like and does not support clang-cl, so clean up the lit cfg
to reflect that. Also mark all Windows test cases using clang-cl as
UNSUPPORTED for now. We should probably adapt most of these test cases
to use the GCC-like clang driver, but that will be for later.

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

19 months ago[X86] LowerVectorAllEqual - handle i64 comparisons on 32-bit targets
Simon Pilgrim [Sat, 1 Apr 2023 16:16:31 +0000 (17:16 +0100)]
[X86] LowerVectorAllEqual - handle i64 comparisons on 32-bit targets

19 months ago[llvm][TextAPI] only compare deployment version for InterfaceFile.
Cyndy Ishida [Sat, 1 Apr 2023 15:28:48 +0000 (08:28 -0700)]
[llvm][TextAPI] only compare deployment version for InterfaceFile.

19 months ago[X86] MatchVectorAllEqualTest - support for sub-128-bit vector icmp(and/or(extract...
Simon Pilgrim [Sat, 1 Apr 2023 15:37:28 +0000 (16:37 +0100)]
[X86] MatchVectorAllEqualTest - support for sub-128-bit vector icmp(and/or(extract(X,0),extract(X,1)),-1/0) reduction patterns

LowerVectorAllEqual already has full support for this

19 months ago[X86] MatchVectorAllEqualTest - add support for icmp(and(extract(X,0),extract(X,1...
Simon Pilgrim [Sat, 1 Apr 2023 15:29:54 +0000 (16:29 +0100)]
[X86] MatchVectorAllEqualTest - add support for icmp(and(extract(X,0),extract(X,1)),-1) allof reduction patterns

19 months ago[X86] Add vector-reduce-and-scalar.ll to test and(extract(v,0),extract(v,1)) style...
Simon Pilgrim [Sat, 1 Apr 2023 15:09:52 +0000 (16:09 +0100)]
[X86] Add vector-reduce-and-scalar.ll to test and(extract(v,0),extract(v,1)) style reduction patterns

19 months agoRevert "AMDGPU: Created a subclass for the return address operand in the tail call...
Aaron Ballman [Sat, 1 Apr 2023 14:49:59 +0000 (10:49 -0400)]
Revert "AMDGPU: Created a subclass for the return address operand in the tail call return instruction"

This reverts commit 7a98934fadc3581ff024a77dc696b62f1a538ad5.

This appears to have broken several bots, including:
https://lab.llvm.org/buildbot/#/builders/42/builds/9472

19 months ago[X86] MatchVectorAllEqualTest - add support for icmp(reduce_and(X),-1) allof reductio...
Simon Pilgrim [Sat, 1 Apr 2023 14:38:38 +0000 (15:38 +0100)]
[X86] MatchVectorAllEqualTest - add support for icmp(reduce_and(X),-1) allof reduction patterns

Also, improve codegen in LowerVectorAllEqual for X == -1 cases to reduce over sized vector using a AND reduction

19 months ago[X86] Add AVX1OR2 common check-prefix to vector-reduce-and-cmp.ll and vector-reduce...
Simon Pilgrim [Sat, 1 Apr 2023 14:19:56 +0000 (15:19 +0100)]
[X86] Add AVX1OR2 common check-prefix to vector-reduce-and-cmp.ll and vector-reduce-or-cmp.ll

19 months ago[clang-format] Don't format typename template parameters as expression
Emilia Dreamer [Sat, 1 Apr 2023 13:51:10 +0000 (16:51 +0300)]
[clang-format] Don't format typename template parameters as expression

bb4f6c4dca98a47054117708015bb2724256ee83 made it so that template
parameter defaults are seen akin to assignments and formatted as
expressions, however, the patch did this for all template parameters,
even for `typename` template parameters.

This patch formats `typename` and `class` template parameters as types.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

19 months ago[X86] Add AVX512F test coverage to vector-reduce-and-cmp.ll and vector-reduce-or...
Simon Pilgrim [Sat, 1 Apr 2023 13:28:41 +0000 (14:28 +0100)]
[X86] Add AVX512F test coverage to vector-reduce-and-cmp.ll and vector-reduce-or-cmp.ll

19 months ago[X86] vector-reduce-and-cmp.ll - and reductions should compare against -1 not 0 for...
Simon Pilgrim [Sat, 1 Apr 2023 12:58:14 +0000 (13:58 +0100)]
[X86] vector-reduce-and-cmp.ll - and reductions should compare against -1 not 0 for allof style comparisons

Fix tests so we actually test what was intended to complement vector-reduce-or-cmp.ll - this was a copy+paste typo from the vector-reduce-or-cmp.ll file (where we should compare against 0) - comparing reduce_and against 0 doesn't tell us much (other than no common set bits).

19 months ago[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation
Sergei Barannikov [Sat, 1 Apr 2023 11:23:55 +0000 (14:23 +0300)]
[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation

Without this all checks fail because CMake passes the flags
like this:
`... -nodefaultlibs   -D-Warray-bounds -Werror -std=c++17 ...`
Note the `-D` before the `-W`.

Reviewed By: ahatanak

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

19 months ago[PhaseOrdering] Add test case for Issue #61061
Simon Pilgrim [Sat, 1 Apr 2023 12:27:11 +0000 (13:27 +0100)]
[PhaseOrdering] Add test case for Issue #61061

19 months ago[LoongArch] Optimize multiplication with immediates
Ben Shi [Sat, 1 Apr 2023 02:42:09 +0000 (10:42 +0800)]
[LoongArch] Optimize multiplication with immediates

Optimize multiplication with some specific immediates to
a pair of `alsl`.

Reviewed By: xen0n, SixWeining

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

19 months ago[LoongArch][NFC] Add tests of multiplication with immediates (for D147305)
Ben Shi [Fri, 31 Mar 2023 04:02:28 +0000 (12:02 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates (for D147305)

Reviewed By: SixWeining

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

19 months ago[X86] Refactor MatchVectorAllZeroTest -> MatchVectorAllEqualTest
Simon Pilgrim [Sat, 1 Apr 2023 10:08:13 +0000 (11:08 +0100)]
[X86] Refactor MatchVectorAllZeroTest -> MatchVectorAllEqualTest

Refactor MatchVectorAllZeroTest to work with allof/anyof/noneof comparisons with -1 as well as 0, and use it handle icmp(bitcast(icmp_eq(X,Y)),-1) reduction patterns.

We're still missing test coverage for other other reduction types, so have kept these limited to icmp X,0 for now.

19 months ago[asan] Fix Darwin runtimes compilation
Shoaib Meenai [Sat, 1 Apr 2023 09:22:17 +0000 (02:22 -0700)]
[asan] Fix Darwin runtimes compilation

It was failing because of size_t being unknown. I was going to just pull
in stddef.h, but the callback using size_t is only used for Linux and
NetBSD, so limit its definition to those platforms as well.

19 months ago[libc++][spaceship[NFC] P1614R2 `operator<=>` moves misplaced tests to correct location
Hristo Hristov [Sun, 26 Mar 2023 09:00:18 +0000 (12:00 +0300)]
[libc++][spaceship[NFC] P1614R2 `operator<=>` moves misplaced tests to correct location

P1614R2:

- Moved misplaced tests from `libcxx/test/libcxx` to `libcxx/test/std`
- Updated status page `SpaceshipProjects.csv`: `operator<=>` implementation status

Related docs:

- https://eel.is/c++draft/
- https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html

Reviewed By: #libc, philnik

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

19 months ago[Windows SEH] Fix catch+return crash for Windows -EHa
Phoebe Wang [Sat, 1 Apr 2023 06:20:01 +0000 (14:20 +0800)]
[Windows SEH] Fix catch+return crash for Windows -EHa

This change also turns on -fasync-exceptions by default under -EHa
option due to the backend patch merged.

Reviewed By: LuoYuanke

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

19 months ago[Scalar] Use SmallPtrSet::contains (NFC)
Kazu Hirata [Sat, 1 Apr 2023 06:50:17 +0000 (23:50 -0700)]
[Scalar] Use SmallPtrSet::contains (NFC)

19 months ago[TableGen] Simplify some code. NFC
Craig Topper [Sat, 1 Apr 2023 06:35:43 +0000 (23:35 -0700)]
[TableGen] Simplify some code. NFC

This code was creating 1 entry or 0 entry std::array to pass to
to ArrayRef arguments. ArrayRef has a constructor from a single
object and we can use std::nullopt for an empty ArrayRef.

19 months ago[TableGen] Reduce code duplication. NFC
Craig Topper [Sat, 1 Apr 2023 05:54:10 +0000 (22:54 -0700)]
[TableGen] Reduce code duplication. NFC

19 months ago[BOLT][NFC] Simplify code using std::optional
Yi Kong [Fri, 31 Mar 2023 08:07:47 +0000 (16:07 +0800)]
[BOLT][NFC] Simplify code using std::optional

Use std::optional instead of tracking if it is the first profile seen.

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

19 months ago[RISCV][NFC] Simplify PatFrag mul_const_oneuse
Ben Shi [Fri, 31 Mar 2023 09:59:31 +0000 (17:59 +0800)]
[RISCV][NFC] Simplify PatFrag mul_const_oneuse

Reviewed By: craig.topper

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

19 months agoasan_memory_profile: Fix for deadlock in memory profiler code.
Sanjeet Karan Singh [Sat, 1 Apr 2023 03:36:34 +0000 (20:36 -0700)]
asan_memory_profile: Fix for deadlock in memory profiler code.

Wrapping stopTheWorld in dl_iterate_phdr acquire dl_load lock before
calling the function. Acquiring dl_load, allocator and thread registry
locks before calling stopTheWorld ensures no other threads are holding
that locks, we can safely suspend them and reenter in tracer thread.
LockStuffAndStopTheWorld's logic here is same as lsan's implementation
of this function.

Reviewed By: vitalybuka

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

19 months ago[ORC][MachO] __objc_imageinfo isn't a MachO "object platform section".
Lang Hames [Sat, 1 Apr 2023 03:31:16 +0000 (20:31 -0700)]
[ORC][MachO] __objc_imageinfo isn't a MachO "object platform section".

Commit 2666231d173 fixed a typo ("__objc_image_info" was corrected to
"__objc_imageinfo"), but this has exposed a bug where we were adding this
section to the list of platform sections to register with the ORC runtime.
The ORC runtime's MachO "object platform section" code doesn't recognize
this section (it's handled elsewhere) and errors out on it.

The solution is simply to remove __objc_imageinfo from the list of sections
to register in MachOPlatform::PlatformPlugin::registerObjectPlatformSections.

19 months ago[ORC] Prefer SectionRange::getRange convenience method.
Lang Hames [Sat, 1 Apr 2023 02:27:01 +0000 (19:27 -0700)]
[ORC] Prefer SectionRange::getRange convenience method.

19 months ago[ORC] Remove more unnecessary ExecutorAddr::getValue calls.
Lang Hames [Sat, 1 Apr 2023 01:56:20 +0000 (18:56 -0700)]
[ORC] Remove more unnecessary ExecutorAddr::getValue calls.

19 months ago[ORC] Remove redundant ExecutorAddr temporaries.
Lang Hames [Sat, 1 Apr 2023 00:51:01 +0000 (17:51 -0700)]
[ORC] Remove redundant ExecutorAddr temporaries.

Most ORC APIs work with ExecutorAddr by default since 8b1771bd9f3, so we don't
need to wrap these values in ExecutorAddr(...) calls any more.

19 months ago[FuzzMutate] introduce vector operations, select and fneg into InstInjectorStrategy
Peter Rong [Tue, 13 Dec 2022 00:33:19 +0000 (16:33 -0800)]
[FuzzMutate] introduce vector operations, select and fneg into InstInjectorStrategy

Reviewed By: arsenm

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

19 months ago[OHOS] Remove redundant IsIntegratedAssemblerDefault. NFC
Brad Smith [Sat, 1 Apr 2023 00:21:12 +0000 (20:21 -0400)]
[OHOS] Remove redundant IsIntegratedAssemblerDefault. NFC

It is already enabled.

19 months ago[clang-format] Add MinDigits suboptions to IntegerLiteralSeparator
Owen Pan [Wed, 29 Mar 2023 04:59:05 +0000 (21:59 -0700)]
[clang-format] Add MinDigits suboptions to IntegerLiteralSeparator

Closes #61209.

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

19 months ago[ORC] Simplify some ExecutorAddr uses by removing getValue and formatv.
Lang Hames [Sat, 1 Apr 2023 00:07:19 +0000 (17:07 -0700)]
[ORC] Simplify some ExecutorAddr uses by removing getValue and formatv.

19 months ago[gn] Port a52054cfa29d more
Nico Weber [Sat, 1 Apr 2023 00:10:48 +0000 (20:10 -0400)]
[gn] Port a52054cfa29d more

19 months ago[gn] Port a52054cfa29d
Nico Weber [Sat, 1 Apr 2023 00:08:26 +0000 (20:08 -0400)]
[gn] Port a52054cfa29d

19 months ago[llvm][TextAPI] compare deployment versions for equality check
Cyndy Ishida [Fri, 31 Mar 2023 23:20:40 +0000 (16:20 -0700)]
[llvm][TextAPI] compare deployment versions for equality check

19 months ago[flang] IO condition specfier control flow
V Donaldson [Fri, 31 Mar 2023 16:36:16 +0000 (09:36 -0700)]
[flang] IO condition specfier control flow

Execution of a statement such as

read(internal,*,err=666,iostat=stat) k

that terminates with an END or EOR condition must not take the ERR branch.

19 months ago[dsymutil] Disable 'auto' verification as the default
Jonas Devlieghere [Fri, 31 Mar 2023 23:27:04 +0000 (16:27 -0700)]
[dsymutil] Disable 'auto' verification as the default

Don't make 'auto' verification the default when assertions or expensive
checks are enabled while I investigate the test failures on the bots.

19 months ago[llvm-mc] Fix line_end_with_space.test
Aiden Grossman [Fri, 31 Mar 2023 23:22:15 +0000 (23:22 +0000)]
[llvm-mc] Fix line_end_with_space.test

Currently, this test doesn't test what it was originally intended to
(that lvm-mc doesn't crash when disassembling a line that ends with a
space). This patch readds the space to the input so that this
functionality is actually tested and adds a comment describing what the
test does. The space seems to have been inadvertently removed in
c8d578311473fceb50579906658b0c017ef5b193 and then never added back
in.

Reviewed By: MaskRay

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

19 months ago[clang-format] Don't misannotate left squares as lambda introducers
Owen Pan [Fri, 31 Mar 2023 03:16:52 +0000 (20:16 -0700)]
[clang-format] Don't misannotate left squares as lambda introducers

A left square can start a lambda only if it's not preceded by an
identifier other than return and co-wait/co-yield/co-return.

Fixes #54245.
Fixes #61786.

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

19 months ago[clang] Set ShowInSystemHeader for module-build and module-import remarks
Dave Lee [Thu, 8 Dec 2022 18:31:16 +0000 (10:31 -0800)]
[clang] Set ShowInSystemHeader for module-build and module-import remarks

Without this change, the use of `-Rmodule-build` and `-Rmodule-import` only
produces diagnostics for modules built or imported by non-system code.

For example, if a project source file requires the Foundation module to be
built, then `-Rmodule-build` will show a single diagnostic for Foundation, but
not in turn for any of Foundation's (direct or indirect) dependencies. This is
because the locations of those transitive module builds are initiated from
system headers, which are ignored by default. When wanting to observe module
building/importing, the system modules can represent a significant amount of
module diagnostics, and I think should be shown by default when
`-Rmodule-build` and `-Rmodule-import` are specified.

I noticed some other remarks use `ShowInSystemHeader`.

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

19 months ago[mlir][sparse] support sparse bufferization.alloc_tensor with copy argument.
Peiming Liu [Fri, 31 Mar 2023 21:17:57 +0000 (21:17 +0000)]
[mlir][sparse] support sparse bufferization.alloc_tensor with copy argument.

Reviewed By: aartbik

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

19 months ago[M68k] Add AssemblerPredicate to existing `AtLeast680x0` predicates
Min-Yih Hsu [Fri, 31 Mar 2023 21:46:39 +0000 (14:46 -0700)]
[M68k] Add AssemblerPredicate to existing `AtLeast680x0` predicates

And refactor how `AtLeast680x0` are defined. This is essentially NFC.