454344 Commits

Author SHA1 Message Date
Vitaly Buka
ea4cbbbfa4 [SPARC] Attempt to fix bug introduced by D142458
Reported https://lab.llvm.org/buildbot/#/builders/5/builds/32113
2023-03-12 18:32:24 -07:00
Kazu Hirata
f271e5d9d4 [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
2023-03-12 18:25:07 -07:00
Jun Ma
00eef4f7c3 [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
2023-03-13 08:59:52 +08:00
Mike Crowe
57b78faa9e [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
2023-03-12 21:42:53 +00:00
LLVM GN Syncbot
4483e77b31 [gn build] Port 43562287a816 2023-03-12 21:25:33 +00:00
Mehdi Amini
fa51c1753a 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
2023-03-12 22:20:50 +01:00
Nikolas Klauser
43562287a8 [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
2023-03-12 22:19:41 +01:00
Piotr Zegar
55f8a287e9 [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
2023-03-12 20:01:36 +00:00
Piotr Zegar
d5fd6a376a [clang-tidy] Fix rename_check.py
Fix checks renaming after directory structure
of clang-tidy has changed.
2023-03-12 19:51:40 +00:00
Michal Paszkowski
147ff1b494 [SPIR-V] Fix llvm deprecated warnings
Fixes warnings related to getAllOnesValue and isNullValue being
deprecated.

Differential Revision: https://reviews.llvm.org/D145709
2023-03-12 20:33:42 +01:00
Valentin Clement
fa77f57956
[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
2023-03-12 20:24:24 +01:00
Kazu Hirata
7946e67cf3 [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.
2023-03-12 12:00:14 -07:00
Craig Topper
ebc11b6841 [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.
2023-03-12 11:28:49 -07:00
Craig Topper
858451c50b [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.
2023-03-12 11:28:49 -07:00
Alex Lorenz
c8e2dd8c6f [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.
2023-03-12 10:58:33 -07:00
LLVM GN Syncbot
daf0b27128 [gn build] Port c491c9170239 2023-03-12 17:27:38 +00:00
Chris Cotter
c491c91702 [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
2023-03-12 16:58:08 +00:00
Craig Topper
40582493f0 [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.
2023-03-12 09:52:49 -07:00
Alex Bradbury
989f3f080e [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
2023-03-12 16:11:12 +00:00
Simon Pilgrim
9041682d2c [DAG] Remove redundant isZExtFree(SDValue,VT) overrides. NFC.
These implementations both match the TargetLoweringBase.isZExtFree implementation
2023-03-12 15:56:04 +00:00
Nicolas Vasilache
8afe6f7bd5 [mlir] NFC - Add some more static value utils
Differential Revision: https://reviews.llvm.org/D145875
2023-03-12 08:25:52 -07:00
Simon Pilgrim
82dc04befd [DAG] visitZERO_EXTEND - pull out the repeated SDLoc(N) variables 2023-03-12 15:18:46 +00:00
Simon Pilgrim
4d7da0e711 [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.
2023-03-12 15:01:33 +00:00
Simon Pilgrim
f759275c1c [AMDGPU] Regenerate sdwa-peephole.ll 2023-03-12 13:50:25 +00:00
Jon Chesterfield
d3dda422bf [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
2023-03-12 13:47:48 +00:00
Mike Crowe
c4918cbf3b [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
2023-03-12 13:32:45 +00:00
Mike Crowe
0a93abd976 [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
2023-03-12 13:32:29 +00:00
Mike Crowe
f9dc14cf1f [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
2023-03-12 13:32:05 +00:00
Simon Pilgrim
b53ea2b9c5 [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
2023-03-12 13:25:23 +00:00
Simon Pilgrim
84547ec401 [X86] and-shift.ll - add gnux32 test coverage to ensure the X32 ABI correctly narrows the i64 shifts 2023-03-12 13:11:21 +00:00
Paul Walker
1597e5e693 [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
2023-03-12 11:32:00 +00:00
Paul Walker
2f887c9a76 [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
2023-03-12 10:39:24 +00:00
Dmitry Vyukov
4989779d7a 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
2023-03-12 11:21:33 +01:00
Simon Pilgrim
47208f8d34 [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
2023-03-12 09:49:11 +00:00
Christian Ulmann
6628767e47 [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
2023-03-12 10:31:29 +01:00
Brad Smith
eee590ca4b Revert "[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible"
This reverts commit 6590a372fa3f4582c04b4b179f90a3c728e75025.
2023-03-12 04:20:25 -04:00
Michael Francis
7488dd25e1 Revert "[Clang][AIX][p] Manually Claim -p in front end"
This reverts commit 59848b9ebae6a92a4342b1e8aa32feaf5c9c4b51, as it
causes some failures in AIX-related Lit tests.
2023-03-12 08:14:33 +00:00
Michael Francis
59848b9eba [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
2023-03-12 07:33:21 +00:00
Siva Chandra Reddy
5d69233453 [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.
2023-03-12 07:08:58 +00:00
Igor Zhukov
24416d22bb 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.
2023-03-12 13:27:23 +07:00
Koakuma
6590a372fa [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
2023-03-11 17:47:53 -05:00
Koakuma
24e300190a [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
2023-03-11 17:42:09 -05:00
Sanjay Patel
ef6f23535d 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
2023-03-11 17:28:56 -05:00
Vitaly Buka
8a386b2250 [sanitizer] Fix text in error message 2023-03-11 13:40:42 -08:00
Sanjay Patel
43ae4b62b2 [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
2023-03-11 14:20:30 -05:00
Simon Pilgrim
772aa05452 [X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA 2023-03-11 18:43:49 +00:00
Yaxun (Sam) Liu
43c90f905a [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
2023-03-11 13:33:17 -05:00
Mike Crowe
988355808e [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
2023-03-11 17:46:56 +00:00
Piotr Zegar
f1e2469edc [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
2023-03-11 17:36:21 +00:00
Ahmed Harmouche
9b8d9447f8 [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
2023-03-11 09:18:11 -08:00