platform/upstream/llvm.git
16 months agoRevert "[RISCV] Add separate lookup tables for fli.h and fli.d."
Craig Topper [Mon, 13 Mar 2023 05:02:23 +0000 (22:02 -0700)]
Revert "[RISCV] Add separate lookup tables for fli.h and fli.d."

This reverts commit ebc11b68412cdcf2a0e6e2c50df262cfd9b8f481.

I made a mistake in the f16 table. Will fix and recommit.

16 months agoRevert "[RISCV] Remove unused function declaration. NFC"
Craig Topper [Mon, 13 Mar 2023 05:01:41 +0000 (22:01 -0700)]
Revert "[RISCV] Remove unused function declaration. NFC"

This reverts commit 5589c3cf752383fa42eaacc13fb985653ae528b6.

I need to revert an earlier patch to fix a mistake.

16 months ago[RISCV] Remove unused function declaration. NFC
Craig Topper [Mon, 13 Mar 2023 04:23:39 +0000 (21:23 -0700)]
[RISCV] Remove unused function declaration. NFC

16 months ago[test][asan] Fix test on MacOS 12+
Vitaly Buka [Fri, 10 Mar 2023 17:45:37 +0000 (09:45 -0800)]
[test][asan] Fix test on MacOS 12+

Reviewed By: rsundahl

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

16 months agoReland rGf35a09daebd0a90daa536432e62a2476f708150d and rG63854f91d3ee1056796a5ef277536...
Chen Zheng [Fri, 9 Dec 2022 05:27:14 +0000 (00:27 -0500)]
Reland rGf35a09daebd0a90daa536432e62a2476f708150d and rG63854f91d3ee1056796a5ef27753648396cac6ec

[DAGCombiner] handle more store value forwarding

When lowering calls on target like PPC, some stack loads
will be generated for by value parameters. Node CALLSEQ_START
prevents such loads from being combined.

Suggested by @RolandF, this patch removes the unnecessary
loads for the byval parameter by extending ForwardStoreValueToDirectLoad

Reviewed By: nemanjai, RolandF

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

16 months ago[SPARC] Attempt to fix bug introduced by D142458
Vitaly Buka [Mon, 13 Mar 2023 01:22:41 +0000 (18:22 -0700)]
[SPARC]  Attempt to fix bug introduced by D142458

Reported https://lab.llvm.org/buildbot/#/builders/5/builds/32113

16 months ago[SelectionDAG] Deprecate isNullValue and isAllOnesValue
Kazu Hirata [Mon, 13 Mar 2023 01:25:07 +0000 (18:25 -0700)]
[SelectionDAG] Deprecate isNullValue and isAllOnesValue

This patch deprecates them as there are no known uses of these
functions in the project.

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

16 months ago[SelectionDAG] Fix mismatched truncate when combine BUILD_VECTOR with EXTRACT_SUBVECTOR
Jun Ma [Fri, 10 Mar 2023 01:00:15 +0000 (09:00 +0800)]
[SelectionDAG] Fix mismatched truncate when combine BUILD_VECTOR with EXTRACT_SUBVECTOR

Just use correct type for truncation. Fixes PR59625

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

16 months ago[clang-tidy] Support std::format and std::print in readability-redundant-string-cstr
Mike Crowe [Sun, 12 Mar 2023 21:42:52 +0000 (21:42 +0000)]
[clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

std::format (C++20) and std::print (C++23) are perfectly happy to accept
std::string arguments. Converting them to C-style strings by calling
c_str() is unnecessary and may cause extra walking of the string to
determine its length.

Depends on D144216

Reviewed By: carlosgalvezp, PiotrZSL

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

16 months ago[gn build] Port 43562287a816
LLVM GN Syncbot [Sun, 12 Mar 2023 21:25:33 +0000 (21:25 +0000)]
[gn build] Port 43562287a816

16 months agoIntroduce mlir::tracing::ExecutionContext
Mehdi Amini [Mon, 23 Jan 2023 01:14:10 +0000 (01:14 +0000)]
Introduce mlir::tracing::ExecutionContext

This component acts as an action handler that can be registered in the
MLIRContext. It is the main orchestration of the infrastructure, and implements
support for clients to hook there and snoop on or control the execution.
This is the basis to build tracing as well as a "gdb-like" control of the
compilation flow.

The ExecutionContext acts as a handler in the MLIRContext for executing an
Action. When an action is dispatched, it'll query its set of Breakpoints
managers for a breakpoint matching this action. If a breakpoint is hit, it
passes the action and the breakpoint information to a callback. The callback
is responsible for controlling the execution of the action through an enum
value it returns. Optionally, observers can be registered to be notified
before and after the callback is executed.

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

16 months ago[libc++] Granularize <exception>
Nikolas Klauser [Wed, 1 Mar 2023 19:13:55 +0000 (20:13 +0100)]
[libc++] Granularize <exception>

This patch also updates the moved code to the new style (i.e. formatted, replaced marcos and typedefs)

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits

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

16 months ago[clang-tidy][NFC] Update docs/clang-tidy/checks/list.rst
Piotr Zegar [Sun, 12 Mar 2023 20:01:36 +0000 (20:01 +0000)]
[clang-tidy][NFC] Update docs/clang-tidy/checks/list.rst
Mark fixes to Yes for cppcoreguidelines-avoid-capture-default-when-capturing-this
check, as it provides fixes

16 months ago[clang-tidy] Fix rename_check.py
Piotr Zegar [Sun, 12 Mar 2023 19:51:03 +0000 (19:51 +0000)]
[clang-tidy] Fix rename_check.py

Fix checks renaming after directory structure
of clang-tidy has changed.

16 months ago[SPIR-V] Fix llvm deprecated warnings
Michal Paszkowski [Sun, 12 Mar 2023 19:33:42 +0000 (20:33 +0100)]
[SPIR-V] Fix llvm deprecated warnings

Fixes warnings related to getAllOnesValue and isNullValue being
deprecated.

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

16 months ago[flang] Simpify parent component handling
Valentin Clement [Sun, 12 Mar 2023 19:23:58 +0000 (20:23 +0100)]
[flang] Simpify parent component handling

This patch simplify the parent component handling when it's the last ref.

The first field is not necessary when the target box type is set correctly.

Reviewed By: PeteSteinfeld

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

16 months ago[InstCombine] Precommit tests
Kazu Hirata [Sun, 12 Mar 2023 19:00:14 +0000 (12:00 -0700)]
[InstCombine] Precommit tests

This patch precommits tests for:

https://github.com/llvm/llvm-project/issues/60802
https://github.com/llvm/llvm-project/issues/61183

which are about std::bit_ceil and std::bit_floor, respectively.

16 months ago[RISCV] Add separate lookup tables for fli.h and fli.d.
Craig Topper [Sun, 12 Mar 2023 18:19:21 +0000 (11:19 -0700)]
[RISCV] Add separate lookup tables for fli.h and fli.d.

Use separate lookup tables instead of trying to reuse the fli.s
table.

We were missing the 2 denormal cases for fli.h. We also had an issue
where fli.d was only checking 8 bits of the 11 bit exponent.

16 months ago[RISCV] Add test cases for fli.h and fli.d CodeGen bugs. NFC
Craig Topper [Sun, 12 Mar 2023 18:14:20 +0000 (11:14 -0700)]
[RISCV] Add test cases for fli.h and fli.d CodeGen bugs. NFC

We fail to use fli.h for the 2 denormal values.
We use fli.d for some values where the value is larger than a float
can represent due to truncating the exponent to 8 bits without checking
if it fits in 8 bits.

16 months ago[clang][darwin] An OS version preprocessor define is added for any darwin OS
Alex Lorenz [Sun, 12 Mar 2023 17:52:12 +0000 (10:52 -0700)]
[clang][darwin] An OS version preprocessor define is added for any darwin OS

This change generalizes the OS version macro for all darwin OSes. The OS-specific OS version macros are still defined to preserve compatibility.

16 months ago[gn build] Port c491c9170239
LLVM GN Syncbot [Sun, 12 Mar 2023 17:27:38 +0000 (17:27 +0000)]
[gn build] Port c491c9170239

16 months ago[clang-tidy] Implement CppCoreGuideline F.18
Chris Cotter [Sun, 12 Mar 2023 16:55:47 +0000 (16:55 +0000)]
[clang-tidy] Implement CppCoreGuideline F.18

Warn when an rvalue reference function paramter is never moved
from within the function body.

Reviewed By: carlosgalvezp

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

16 months ago[RISCV] Add overrides of isLoadFromStackSlot/isStoreFromStackSlot signatures that...
Craig Topper [Sun, 12 Mar 2023 16:45:46 +0000 (09:45 -0700)]
[RISCV] Add overrides of isLoadFromStackSlot/isStoreFromStackSlot signatures that don't have MemBytes.

D145471 added overrides of the other signature to return MemBytes,
but shouldn't have removed these overrides.

These signatures will now call the MemBytes signature and ignore
the MemBytes. This matches X86.

16 months ago[RISCV][NFCI] Use common MCELFStreamer code for attribute emission
Alex Bradbury [Sun, 12 Mar 2023 16:11:12 +0000 (16:11 +0000)]
[RISCV][NFCI] Use common MCELFStreamer code for attribute emission

D102894 introduced common code for the emission of ELF attributes. Our
implementation in RISC-V predates this, and basically copies the Arm
logic at the time. This patch removes that duplication and uses the
shared logic instead.

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

16 months ago[DAG] Remove redundant isZExtFree(SDValue,VT) overrides. NFC.
Simon Pilgrim [Sun, 12 Mar 2023 15:55:58 +0000 (15:55 +0000)]
[DAG] Remove redundant isZExtFree(SDValue,VT) overrides. NFC.

These implementations both match the TargetLoweringBase.isZExtFree implementation

16 months ago[mlir] NFC - Add some more static value utils
Nicolas Vasilache [Fri, 10 Mar 2023 13:35:44 +0000 (05:35 -0800)]
[mlir] NFC - Add some more static value utils

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

16 months ago[DAG] visitZERO_EXTEND - pull out the repeated SDLoc(N) variables
Simon Pilgrim [Sun, 12 Mar 2023 15:18:46 +0000 (15:18 +0000)]
[DAG] visitZERO_EXTEND - pull out the repeated SDLoc(N) variables

16 months ago[DAG] Cleanup the (zext (shl (zext x), cst)) -> (shl (zext x), cst) fold. NFC.
Simon Pilgrim [Sun, 12 Mar 2023 15:00:11 +0000 (15:00 +0000)]
[DAG] Cleanup the (zext (shl (zext x), cst)) -> (shl (zext x), cst) fold. NFC.

Preliminary cleanup before adding some additional legality and value tracking handling.

16 months ago[AMDGPU] Regenerate sdwa-peephole.ll
Simon Pilgrim [Sun, 12 Mar 2023 13:50:20 +0000 (13:50 +0000)]
[AMDGPU] Regenerate sdwa-peephole.ll

16 months ago[amdgpu][nfc] Replace ad hoc LDS frame recalculation with absolute_symbol MD
Jon Chesterfield [Sun, 12 Mar 2023 13:47:40 +0000 (13:47 +0000)]
[amdgpu][nfc] Replace ad hoc LDS frame recalculation with absolute_symbol MD

Post ISel, LDS variables are absolute values. Representing them as
such is simpler than the frame recalculation currently used to build assembler
tables from their addresses.

This is a precursor to lowering dynamic/external LDS accesses from non-kernel
functions.

Reviewed By: arsenm

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

16 months ago[clang-tidy] Provide default template arguments in <string>
Mike Crowe [Sun, 12 Mar 2023 13:32:45 +0000 (13:32 +0000)]
[clang-tidy] Provide default template arguments in <string>

Simplify the use of the basic_string and basic_string_view types by
providing default template arguments.

Depends on D145311

Reviewed By: PiotrZSL

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

16 months ago[clang-tidy] Make readability-container-size-empty check using <string> header
Mike Crowe [Sun, 12 Mar 2023 13:32:29 +0000 (13:32 +0000)]
[clang-tidy] Make readability-container-size-empty check using <string> header

Improve the generic <string> header by adding the size() method so that
it can be used to replace the custom implementation in the
readability-container-size-empty check.

This requires fixing an incorrect comparison of a std::wstring with a
char string literal.

Unfortunately, removing the custom basic_string implementation means
fixing the line numbers for many of the checks.

Depends on D145312

Reviewed By: PiotrZSL

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

16 months ago[clang-tidy] Make readability-string-compare check use <string> header
Mike Crowe [Sun, 12 Mar 2023 13:28:33 +0000 (13:28 +0000)]
[clang-tidy] Make readability-string-compare check use <string> header

Improve the generic <string> header by adding another constructor,
std::basic_string::empty and operator!= overload set so that it can be
used to replace the custom implementation in the
readability-string-compare check.

Depends on D145311

Reviewed By: PiotrZSL

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

16 months ago[DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profit...
Simon Pilgrim [Sun, 12 Mar 2023 13:25:23 +0000 (13:25 +0000)]
[DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profitable.

Try to more aggressively narrow masks of extended values.

This is mainly for cases where the mask is trying to zero out any_extended upper bits, assuming we can zext/trunc the values for free.

This catches a few actual missed folds, as well as helps canonicalize a number of other cases which were being caught in isel etc.

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

16 months ago[X86] and-shift.ll - add gnux32 test coverage to ensure the X32 ABI correctly narrows...
Simon Pilgrim [Sun, 12 Mar 2023 13:11:21 +0000 (13:11 +0000)]
[X86] and-shift.ll - add gnux32 test coverage to ensure the X32 ABI correctly narrows the i64 shifts

16 months ago[SVE][Builtins] Lower X forms of fp binop/mla arithmetic builtins to dedicated intrinsics
Paul Walker [Fri, 10 Feb 2023 16:22:25 +0000 (16:22 +0000)]
[SVE][Builtins] Lower X forms of fp binop/mla arithmetic builtins to dedicated intrinsics

This patch changes the lowering for the following fp builtins to
emit calls to the new aarch64.sve.###.u intrinsics.
  svabd_x, svabd_n_x
  svadd_x, svadd_n_x
  svdiv_x, svdiv_n_x
  svdivr_x, svdivr_n_x
  svmad_x, svmad_n_x
  svmax_x, svmax_n_x
  svmaxnm_x, svmaxnm_n_x
  svmin_x, svmin_n_x
  svminnm_x, svminnm_n_x
  svmla_x, svmla_n_x
  svmls_x, svmls_n_x
  svmsb_x, svmsb_n_x
  svmul_x, svmul_n_x
  svmulx_x, svmulx_n_x
  svnmad_x, svnmad_n_x
  svnmla_x, svnmla_n_x
  svnmls_x, svnmls_n_x
  svnmsb_X, svnmsb_n_x
  svsub_x, svsub_n_x
  svsubr_x, svsubr_n_x

Depends on D143765.

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

16 months ago[InstCombine] Extend SVEVectorFuseMulAddSub to support newly added "undef" intrinsics.
Paul Walker [Mon, 20 Feb 2023 17:52:54 +0000 (17:52 +0000)]
[InstCombine] Extend SVEVectorFuseMulAddSub to support newly added "undef" intrinsics.

D143767 will change the intrinsics used to lower floating-point
svadd_x, svmul_x and svsub_x builtins. This will result in the
combines added as part of D140200 to no longer fire in all cases.
This patch extends the existing combines for contraction to cover
fadd_u, fmul_u and fsub_u intrinsics.

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

16 months agoasan: fix crash on odd stack size
Dmitry Vyukov [Fri, 10 Mar 2023 16:36:14 +0000 (17:36 +0100)]
asan: fix crash on odd stack size

The test currently crashes as:

AddressSanitizer: CHECK failed: asan_poisoning.cpp:38 "((AddrIsAlignedByGranularity(addr))) != (0)"

Main stack address/size don't have to be aligned on asan shadow granularity.
Align stack bottom.

Reviewed By: melver, vitalybuka

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

16 months ago[X86] matchAddressRecursively - support zext(and(shl(x,c1)),c2) -> shl(zext(and(x...
Simon Pilgrim [Sun, 12 Mar 2023 09:48:40 +0000 (09:48 +0000)]
[X86] matchAddressRecursively - support zext(and(shl(x,c1)),c2) -> shl(zext(and(x, c2 >> c1),c1)

This came about while investigating ways to handle D145468 in a more generic manner, which involves trying harder to fold and(zext(x),c) -> zext(and(x,c))

Alive2: https://alive2.llvm.org/ce/z/7fXtDt (generic fold)

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

16 months ago[mlir][llvm] Add visibility attribute
Christian Ulmann [Fri, 10 Mar 2023 15:35:04 +0000 (16:35 +0100)]
[mlir][llvm] Add visibility attribute

This commit introduces the LLVM's visibility attribute and adds it to
both globals and functions.

Furthermore, this commit ensures that "thread_local" is printed in the
correct place and adds a test for that.

Reviewed By: gysit

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

16 months agoRevert "[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible"
Brad Smith [Sun, 12 Mar 2023 07:58:21 +0000 (03:58 -0400)]
Revert "[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible"

This reverts commit 6590a372fa3f4582c04b4b179f90a3c728e75025.

16 months agoRevert "[Clang][AIX][p] Manually Claim -p in front end"
Michael Francis [Sun, 12 Mar 2023 08:11:44 +0000 (08:11 +0000)]
Revert "[Clang][AIX][p] Manually Claim -p in front end"

This reverts commit 59848b9ebae6a92a4342b1e8aa32feaf5c9c4b51, as it
causes some failures in AIX-related Lit tests.

16 months ago[Clang][AIX][p] Manually Claim -p in front end
Michael Francis [Wed, 1 Mar 2023 00:56:06 +0000 (00:56 +0000)]
[Clang][AIX][p] Manually Claim -p in front end

The current implementation of `-p` does not claim the argument once it
is passed. Since it pushes `-pg` directly, it is only ever referred to
again when linking. As a result, when compiling with `-S`, the compiler
warns that `-p` goes unused even though that is not the case.

With this patch, if both `-p` and `-pg` are passed, the argument that is
passed second will take precedence. `-p` will still throw an error on
unsupported platforms, regardless of precedence.

This revision includes a test case, which has been placed in
`clang/test/Driver/zos-profiling-error.c`. As a result,
`zos-profiling-error.c` has been renamed to `ibm-profiling.c`. This
revision also passes `clang/test/Driver/aix-ld.c`.

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

16 months ago[libc][NFC] Reduce the number of threads created in cnd_test to 1000 form 10000.
Siva Chandra Reddy [Sun, 12 Mar 2023 06:37:37 +0000 (06:37 +0000)]
[libc][NFC] Reduce the number of threads created in cnd_test to 1000 form 10000.

The high number of 10000 threads was choking bot builders running on boards with
very small memory.

16 months agoRevert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
Igor Zhukov [Sun, 12 Mar 2023 06:27:23 +0000 (13:27 +0700)]
Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"

libc++ clang-cl tests failed after that commit

Look at https://buildkite.com/llvm-project/libcxx-ci/builds/20490

Reviewed By: #libc

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

This reverts commit b00aaab730ae8bd7f8a44e1808e668e20c2c9282.

16 months ago[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible
Koakuma [Sat, 11 Mar 2023 22:47:53 +0000 (17:47 -0500)]
[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible

On 64-bit target, when doing i64 BR_CC where one of the comparison operands is a
constant zero, try to fold the compare and BPcc into a BPr instruction.

For all integers, EQ and NE comparison are available, additionally for signed
integers, GT, GE, LT, and LE is also available.

Reviewed By: arsenm

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

16 months ago[SPARC] Implement hooks for conditional branch relaxation
Koakuma [Sat, 11 Mar 2023 22:39:25 +0000 (17:39 -0500)]
[SPARC] Implement hooks for conditional branch relaxation

Integrate the BranchRelaxation pass to help with relaxing out-of-range
conditional branches.

This is mostly of concern for SPARCv9, which uses conditional branches with
much smaller range than its v8 counterparts.
(Some large autogenerated code, such as the ones generated by TableGen, already
hits this limitation when building in Release)

Reviewed By: arsenm

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

16 months agoRevert "[InstCombine] use loop info when running the pass after loop vectorization"
Sanjay Patel [Sat, 11 Mar 2023 22:25:12 +0000 (17:25 -0500)]
Revert "[InstCombine] use loop info when running the pass after loop vectorization"

This reverts commit 43ae4b62b2671cf73e691c0b53324cd39405cd51.

This was intended to be practically NFC in terms of the overall
opt pipeline, but there is experimental data showing that code
changes occurred here:
https://llvm-compile-time-tracker.com/compare.php?from=772aa05452f8ff90a47168e6801cda2acb5a1873&to=43ae4b62b2671cf73e691c0b53324cd39405cd51&stat=size-text

16 months ago[sanitizer] Fix text in error message
Vitaly Buka [Sat, 11 Mar 2023 21:40:42 +0000 (13:40 -0800)]
[sanitizer] Fix text in error message

16 months ago[InstCombine] use loop info when running the pass after loop vectorization
Sanjay Patel [Sat, 11 Mar 2023 19:17:50 +0000 (14:17 -0500)]
[InstCombine] use loop info when running the pass after loop vectorization

This is the follow-up to D144199 and suggestion from D144045.
We make use of loop info explicit via InstCombine pass parameter
rather than semi-arbitrary via caching.

The only InstCombine transform that uses LoopInfo currently is a
GEP fold in visitGEPOfGEP(), so that shows up as a failure in the
dedicated test for the fold as well as several LoopVectorizer tests
that run extra passes.

I don't see any pass manager regression tests that actually check
for pass options, but this is intended to be NFC for the pass
pipeline behavior - we only try to use loop info where it would
have been used before via caching .

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

16 months ago[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA
Simon Pilgrim [Sat, 11 Mar 2023 18:43:44 +0000 (18:43 +0000)]
[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA

16 months ago[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`
Yaxun (Sam) Liu [Mon, 6 Mar 2023 16:45:11 +0000 (11:45 -0500)]
[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`

HIP runtime is the language runtime of HIP. When users need
to specify rpath, they usually need to specify rpath for
both compiler-rt and HIP runtime. It seems redundant
to have separate options. Therefore make --offload-add-rpath
an alias to -frtlib-add-rpath.

Reviewed by: Fangrui Song, Artem Belevich

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

16 months ago[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header
Mike Crowe [Sat, 11 Mar 2023 17:46:56 +0000 (17:46 +0000)]
[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header

Remove duplication in abseil-redundant-strcat-calls check tests,
by using dummy <string> header file string.

Depends on D145310

Reviewed By: PiotrZSL

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

16 months ago[clang-tidy] Fix false-positive in cppcoreguidelines-slicing
Piotr Zegar [Sat, 11 Mar 2023 17:36:20 +0000 (17:36 +0000)]
[clang-tidy] Fix false-positive in cppcoreguidelines-slicing

When warning would be emitted in constructor for virtual base class
initialization.

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

Reviewed By: carlosgalvezp

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

16 months ago[mlir][core] Fix inline pass default pipeline dump
Ahmed Harmouche [Sat, 11 Mar 2023 17:07:42 +0000 (09:07 -0800)]
[mlir][core] Fix inline pass default pipeline dump

The inliner pass performs canonicalization when created programtically, run with `mlir-opt` with default options, or when explicitly specified. However, when running the pipeline resulting from a `-dump-pass-pipeline` on a default inline pass, the canonicalization is not performed as part of the inlining. This is because the default value for the `default-pipeline` option of the inline pass is an empty string, and this is selected during the dumping. When `InlinerPass::initializeOptions` detects the empty string, it sets the `defaultPipeline` to `nullptr`, which was previously set to canonicalize in the `InlinerPass` constructor, thus the canonicalization is not performed.

The added test checks if the inline pass performs canonicalization by default, and that the dumped `default-pipeline` is set to `canonicalize`.

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

Reviewed By: rriddle

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

16 months ago[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB
Stephen Neuendorffer [Sat, 11 Mar 2023 05:52:26 +0000 (21:52 -0800)]
[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB

This library is linked into libc-hdrgen, which is compiled with
DISABLE_LLVM_LINK_LLVM_DYLIB.  This option avoids linking with
libLLVM.so when LLVM_LINK_LLVM_DYLIB is specified.  Unfortunately,
this can cause wierd linkage errors where symbols are defined
multiple times, with one definition coming from static linkage
and another definition coming from libLLVM.so.  This is usually
apparent as a link error with options defined multiple times.

This patch adds DISABLE_LLVM_LINK_LLVM_DYLIB to this library, to
get consistent linkage of libc-hdrgen.

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

16 months ago[Flang] Allow compile *.f03, *.f08 file
Shao-Ce SUN [Sat, 11 Mar 2023 16:17:30 +0000 (00:17 +0800)]
[Flang] Allow compile *.f03, *.f08 file

Fix issue [#61260](https://github.com/llvm/llvm-project/issues/61260)

Reviewed By: awarzynski

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

16 months ago[Clang][Doc] Fix inconsistent links in release notes
Roy Jacobson [Sat, 11 Mar 2023 16:39:33 +0000 (18:39 +0200)]
[Clang][Doc] Fix inconsistent links in release notes

16 months ago[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations
Simon Pilgrim [Sat, 11 Mar 2023 16:37:41 +0000 (16:37 +0000)]
[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations

Allows us to handle shift amounts that exceed the original bitwidth

16 months agoRevert "[Flang] Allow compile *.f03, *.f08 file"
Shao-Ce SUN [Sat, 11 Mar 2023 16:06:09 +0000 (00:06 +0800)]
Revert "[Flang] Allow compile *.f03, *.f08 file"

The test will fail in the MSVC environment.

This reverts commit 171794de533b400edb47f0e6df4375a7ae052fc8.

16 months ago[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy
Nikolas Klauser [Wed, 8 Feb 2023 19:09:12 +0000 (20:09 +0100)]
[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy

Don't forward to `min_element` for small types that are trivially copyable, and instead use a naive loop that keeps track of the smallest element (as opposed to an iterator to the smallest element). This allows the compiler to vectorize the loop in some cases.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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

16 months ago[Flang] Allow compile *.f03, *.f08 file
Shao-Ce SUN [Sat, 11 Mar 2023 15:16:32 +0000 (23:16 +0800)]
[Flang] Allow compile *.f03, *.f08 file

Fix issue [#61260](https://github.com/llvm/llvm-project/issues/61260)

Reviewed By: awarzynski

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

16 months ago[DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation
Simon Pilgrim [Sat, 11 Mar 2023 14:25:42 +0000 (14:25 +0000)]
[DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation

16 months ago[clang-tidy] Make readability-container-data-pointer use <string> header
Mike Crowe [Sat, 11 Mar 2023 13:46:21 +0000 (13:46 +0000)]
[clang-tidy] Make readability-container-data-pointer use <string> header

This requires operator[] to be added to the std::basic_string
implementation.

Depends on D144216

Reviewed By: carlosgalvezp

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

16 months ago[Flang][OpenMP] NFC: Fix a few format issues
Kiran Chandramohan [Sat, 11 Mar 2023 10:36:55 +0000 (10:36 +0000)]
[Flang][OpenMP] NFC: Fix a few format issues

Change a few variable/class names to be in line with guidelines.

16 months ago[VPlan] Simplify code in createReplicateRegion (NFC).
Florian Hahn [Sat, 11 Mar 2023 10:46:38 +0000 (11:46 +0100)]
[VPlan] Simplify code in createReplicateRegion (NFC).

Simplify the code as suggested in D143865.

16 months ago[lld-macho] Don't include zero-size private label symbols in map file
Jez Ng [Sat, 11 Mar 2023 03:31:13 +0000 (22:31 -0500)]
[lld-macho] Don't include zero-size private label symbols in map file

This is also what ld64 does. This will make it easier to compare their
respective map files.

Reviewed By: #lld-macho, thevinster

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

16 months ago[lld-macho] Print archive names in linker map
Jez Ng [Sat, 11 Mar 2023 03:29:14 +0000 (22:29 -0500)]
[lld-macho] Print archive names in linker map

If a symbol is pulled in from an archive, we should include the archive
name in the map file output. This is what ld64 does.

Note that we aren't using `toString(InputFile*)` here because it
includes the install name for dylibs in its output, and ld64's map file
does not contain those.

Reviewed By: #lld-macho, smeenai

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

16 months ago[lld-macho] Coalesce local symbol aliases along with their aliased weak def
Jez Ng [Sat, 11 Mar 2023 03:28:36 +0000 (22:28 -0500)]
[lld-macho] Coalesce local symbol aliases along with their aliased weak def

This supersedes {D139069}. In some ways we are now closer to ld64's
behavior: we previously only did this coalescing for private-label
symbols, but now we do it for all locals, just like ld64. However, we no
longer generate weak binds when a local alias to a weak symbol is
referenced. This is merely for implementation simplicity; it's not clear
to me that any real-world programs depend on us emulating this behavior.

The problem with the previous approach is that we ended up with
duplicate references to the same symbol instance in our InputFiles,
which translated into duplicate symbols in our output. While we could
work around that problem by performing a dedup step before emitting the
symbol table, it seems cleaner to not generate duplicate references in
the first place.

Numbers for chromium_framework on my 16 Core Intel Mac Pro:

             base           diff           difference (95% CI)
  sys_time   2.243 ± 0.093  2.231 ± 0.066  [  -2.5% ..   +1.4%]
  user_time  6.529 ± 0.087  6.080 ± 0.050  [  -7.5% ..   -6.3%]
  wall_time  6.928 ± 0.175  6.474 ± 0.112  [  -7.7% ..   -5.4%]
  samples    26             31

Yep, that's a massive win... because it turns out that {D140606} and
{D139069} caused a regression (of about the same size.) I just didn't
think to measure them back then. I'm guessing all the extra symbols we
have been emitting did not help perf at all...

Reviewed By: lgrey

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

16 months agoRevert "[hwasan] Provide aliases for c allocation functions for Fuchsia"
Vitaly Buka [Sat, 11 Mar 2023 05:17:46 +0000 (21:17 -0800)]
Revert "[hwasan] Provide aliases for c allocation functions for Fuchsia"

Breaks build bots, details in D145718.

This reverts commit 7de775159660538449652ca442c34fd91feecef6.

16 months ago[sanitizer] Add diagnostics for munmap failure
Vitaly Buka [Sat, 11 Mar 2023 05:01:09 +0000 (21:01 -0800)]
[sanitizer] Add diagnostics for munmap failure

We are seeing CHECK is triggered there, but it's unclear why.

16 months ago[test] Add some interesting cases to MC/RISCV/riscv64-64b-pcrel.s
Fangrui Song [Sat, 11 Mar 2023 05:10:40 +0000 (21:10 -0800)]
[test] Add some interesting cases to MC/RISCV/riscv64-64b-pcrel.s

16 months ago[mlir][sparse] Improve quick sort by using a loop to sort the bigger partition.
bixia1 [Wed, 8 Mar 2023 14:56:19 +0000 (06:56 -0800)]
[mlir][sparse] Improve quick sort by using a loop to sort the bigger partition.

Reviewed By: aartbik

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

16 months ago[RISCV] Adjust how -1.0 is handled in RISCVLoadFPImm. NFC
Craig Topper [Sat, 11 Mar 2023 04:26:00 +0000 (20:26 -0800)]
[RISCV] Adjust how -1.0 is handled in RISCVLoadFPImm. NFC

Instead of hardcoding the -1.0 exponent and mantissa separately from the
table, reuse the table entry for 1.0.

When searching the table we can change index 16 to index 0 if the sign
is negative. Or when indexing we can change index 0 to index 16 and remember
that we need to flip the sign.

I'm going to make another patch that has a f16 and f64 table and
this makes the code for those more similar.

16 months agoclang/cmake: Use installed gtest libraries for stand-alone builds
Tom Stellard [Sat, 11 Mar 2023 02:00:06 +0000 (18:00 -0800)]
clang/cmake: Use installed gtest libraries for stand-alone builds

(re-commit of cb38df4c4d3aee53107219a68749dc94fe70ff68 with the correct commit message)

Reviewed By: phosek, kwk

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

16 months agoRevert "Add install targets for gtest"
Tom Stellard [Sat, 11 Mar 2023 03:59:15 +0000 (19:59 -0800)]
Revert "Add install targets for gtest"

This reverts commit cb38df4c4d3aee53107219a68749dc94fe70ff68.

I accidentally committed this with the wrong commit message.

16 months agoAdd install targets for gtest
Tom Stellard [Sat, 11 Mar 2023 01:22:14 +0000 (17:22 -0800)]
Add install targets for gtest

Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

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

16 months ago[X86] Add unwind for base pointer test case.
Luo, Yuanke [Sat, 11 Mar 2023 03:36:02 +0000 (11:36 +0800)]
[X86] Add unwind for base pointer test case.

16 months ago[polly][test] Fix after 7c3c98144
Arthur Eubanks [Sat, 11 Mar 2023 03:28:59 +0000 (19:28 -0800)]
[polly][test] Fix after 7c3c98144

16 months ago[RISCV] Remove one bit of mantissa in RISCVLoadFPImm related code.
Craig Topper [Sat, 11 Mar 2023 03:14:44 +0000 (19:14 -0800)]
[RISCV] Remove one bit of mantissa in RISCVLoadFPImm related code.

We only need 2 bits of mantissa. The third bit was always 0.

16 months ago[X86] Add regcall CC test case for base pointer register.
Luo, Yuanke [Sat, 11 Mar 2023 02:55:12 +0000 (10:55 +0800)]
[X86] Add regcall CC test case for base pointer register.

16 months ago[lld] Pass random.randint stop parameter as int.
Jacek Caban [Sat, 11 Mar 2023 02:54:14 +0000 (21:54 -0500)]
[lld] Pass random.randint stop parameter as int.

It's required by Python 3.12, from https://docs.python.org/3.12/library/random.html "Changed in version 3.12: Automatic conversion of non-integer types is no longer supported."

Reviewed By: #lld-macho, int3

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

16 months ago[NVPTX] Sync generation of parameter names in a function signature with the function...
Pavel Kopyl [Mon, 20 Feb 2023 15:31:58 +0000 (16:31 +0100)]
[NVPTX] Sync generation of parameter names in a function signature with the function body.

This fixes parameter names mismatch in anonymous functions.

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

16 months ago[NFC] fix typo `funciton` -> `function`
Yuanfang Chen [Sat, 11 Mar 2023 02:03:26 +0000 (18:03 -0800)]
[NFC] fix typo `funciton` -> `function`

credits to @jmagee

16 months agoAdd install targets for gtest
Tom Stellard [Sat, 11 Mar 2023 01:22:14 +0000 (17:22 -0800)]
Add install targets for gtest

Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

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

16 months ago[Passes] Remove some legacy passes
Arthur Eubanks [Wed, 8 Mar 2023 23:07:17 +0000 (15:07 -0800)]
[Passes] Remove some legacy passes

DFAJumpThreading
JumpThreading
LibCallsShrink
LoopVectorize
SLPVectorizer
DeadStoreElimination
AggressiveDCE
CorrelatedValuePropagation
IndVarSimplify

These are part of the optimization pipeline, of which the legacy version is deprecated and being removed.

16 months ago[lldb][NFC] Use UnixSignal::CreateForHost in Process
Alex Langford [Sat, 11 Mar 2023 00:56:52 +0000 (16:56 -0800)]
[lldb][NFC] Use UnixSignal::CreateForHost in Process

These do the same thing but we have a specific function for it.

16 months ago[hwasan] Provide aliases for c allocation functions for Fuchsia
Leonard Chan [Sat, 11 Mar 2023 00:31:04 +0000 (00:31 +0000)]
[hwasan] Provide aliases for c allocation functions for Fuchsia

"Interceptors" in this file aren't like the traditional interceptors
used by other sanitizers like asan. They're simply aliases to the
equivalent __sanitizer_* functions.

This also removes the WRAP(FN) declaration since it just creates
declarations for __interceptor_* functions but they seem to be unused.

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

16 months ago[ASAN] Support memory checks on scalable vector typed masked load and store
Philip Reames [Sat, 11 Mar 2023 00:05:22 +0000 (16:05 -0800)]
[ASAN] Support memory checks on scalable vector typed masked load and store

This takes the approach of using the loop based formation for scalable vectors only. We could potentially use the loop form for fixed vectors only, but we'd loose the unroll and specialize on constant vector logic which is already present. I don't have a strong opinion on whether the existing logic is worthwhile, I kept it mostly to minimize test churn.

Worth noting is that there is a better lowering available. The plain vector lowering appears to check only the first and last byte. By analogy, we should be able to check only the first active and last active byte in the masked op. This is a more invasive change to asan, and I decided simply supporting scalable vectors at all was a better starting place.

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

16 months ago[HWASAN][LSAN] Exclude crash-recovery-modules.m from HWASAN tests
Kirill Stoimenov [Fri, 10 Mar 2023 21:03:43 +0000 (21:03 +0000)]
[HWASAN][LSAN] Exclude crash-recovery-modules.m from HWASAN tests

This is a reland of a single file from D145727, which was reverted in 25ba9dcf1807. This test is using exact line number in the checks so if anything is rearranged the test fails. Moving hwasan on the same line fixes that issue.

Reviewed By: vitalybuka

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

16 months ago[llvm-tblgen] Support conditional definitions using !casts clauses
Philip Reames [Fri, 10 Mar 2023 23:49:27 +0000 (15:49 -0800)]
[llvm-tblgen] Support conditional definitions using !casts clauses

This is a follow on to D145108. This started as simply fixing the crash on an error case reported against that change, but I think this also ends up fixing the original reported issue (https://github.com/llvm/llvm-project/issues/49830) as well. More accurately, D145108 fixed the case where the cast resolves to an existing record, and this change fixes the case where the named record doesn't exist.

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

16 months ago[NFC] [CMake] Add misssing dependencies
Chris Bieneman [Fri, 10 Mar 2023 23:13:00 +0000 (17:13 -0600)]
[NFC] [CMake] Add misssing dependencies

I missed adding these in my last cleanup change :(

16 months ago[mlir][sparse] support dynamic sparse tensor slices.
Peiming Liu [Tue, 10 Jan 2023 22:35:49 +0000 (22:35 +0000)]
[mlir][sparse] support dynamic sparse tensor slices.

Reviewed By: aartbik

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

16 months ago[libc] Fix common compile options not getting passed to GPU object
Joseph Huber [Fri, 10 Mar 2023 22:53:43 +0000 (16:53 -0600)]
[libc] Fix common compile options not getting passed to GPU object

Summary:
This variable was named incorrectly. We weren't getting needed flags
passed to object library builds.

16 months agoImplements MLIR Bytecode versioning capability
Matteo Franciolini [Tue, 14 Feb 2023 16:45:08 +0000 (08:45 -0800)]
Implements MLIR Bytecode versioning capability

A dialect can opt-in to handle versioning through the
`BytecodeDialectInterface`. Few hooks are exposed to the dialect to allow
managing a version encoded into the bytecode file. The version is loaded
lazily and allows to retrieve the version information while parsing the input
IR, and gives an opportunity to each dialect for which a version is present
to perform IR upgrades post-parsing through the `upgradeFromVersion` method.
Custom Attribute and Type encodings can also be upgraded according to the
dialect version using readAttribute and readType methods.

There is no restriction on what kind of information a dialect is allowed to
encode to model its versioning. Currently, versioning is supported only for
bytecode formats.

Reviewed By: rriddle, mehdi_amini

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

16 months agoRevert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"
ManuelJBrito [Fri, 10 Mar 2023 22:23:28 +0000 (22:23 +0000)]
Revert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"

This reverts commit 1a4d0eb866be909fe16da5ebffe4122aa0693d8c.

16 months ago[cmake] Quote args when generating /libpath option specifying runtime dir for link...
Matthew Voss [Fri, 10 Mar 2023 22:11:37 +0000 (14:11 -0800)]
[cmake] Quote args when generating /libpath option specifying runtime dir for link/lld-link

When the runtime dir path includes whitespace (ex. when it's installed
under "Program Files" on Windows), the lack of quotes causes the linker
to interpret the path as one or more arguments. None of these path
fragments exist, so the link fails.

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

16 months ago[flang] Add missing dependencies for flang/lib/Optimizer/Dialect
Peter Steinfeld [Fri, 10 Mar 2023 21:03:52 +0000 (13:03 -0800)]
[flang] Add missing dependencies for flang/lib/Optimizer/Dialect

Patch D145640 wasn't building for me because .cpp files in
flang/lib/Optimizer/Dialect depend on the files generated in
.../build/include/llfm/IR.  But the .cpp file compilations were being
done before the needed include files were generated.

This patch fixes that by adding dependencies on "intrinsics_gen" to the
CMake files in two directories.

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

16 months agoRevert "[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted"
Arthur Eubanks [Fri, 10 Mar 2023 21:22:17 +0000 (13:22 -0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted"

This reverts commit 818e554e251c1e07f133aeed9fe0473502ebfdae.

Causes miscompiles, see comments on D141188.

16 months ago[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.
Alexey Bataev [Mon, 20 Feb 2023 21:26:11 +0000 (13:26 -0800)]
[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.

Previously only the very first gather/buildvector node might be probed for reshuffling of other nodes.
But the compiler may do the same for other gather/buildvector nodes too, just need to check the
dependency and postpone the emission of the dependent nodes, if the origin nodes were not emitted yet.

Part of D110978

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