Commit Graph

433345 Commits

Author SHA1 Message Date
Jim Kitchen c8bb23547f [mlir][sparse] Custom reduce with identity
Implement the new sparse_tensor.reduce operation which
accepts a starting identity value and a code block
describing how to perform the reduction.

Reviewed by: aartbik

Differential Revision: https://reviews.llvm.org/D130573
2022-08-17 11:21:46 -05:00
Sotiris Apostolakis 848e9e454f [SelectOpti] Remove test on loop-level analysis
Remove a test that relied on the underlying instruction latency modeling.
Such dependency blocks efforts such as D79483 to improve this cost modeling.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D132029
2022-08-17 16:13:33 +00:00
Arthur Eubanks 77ce95a83b [bazel] Add --config=ci
To speedup builds/tests.
2022-08-17 09:10:47 -07:00
Mats Petersson 1e12793491 [MLIR]Add support for Arith MAX & MIN operations
There are some of this supported in various places, but the
basic conversion of single operations to LLVM was not supported.

Adding this to allow Flang to use these.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D131912
2022-08-17 17:00:53 +01:00
Mark de Wever da6ff3aecb [libc++][format] Uglyfies format buffer.
While working on D129964 I noticed some code hadn't been uglyfied, this
rectifies the issue.

Depends on D129964

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131834
2022-08-17 17:50:24 +02:00
Mark de Wever 4761a74fd8 [libc++][CI] Updates and improves the Docker image.
Since we branched LLVM install Clang 16 and remove Clang 12.

Currently our Docker installs 4 versions of Clang so our CI can use the
same image for both the main and the release branch. This wasn't done for
the other Clang tools so they always use the same version for testing
the main and the release branch. Instead install 2 versions for the
tools.

However it seems the default for Clang and its tools were the latest
released version instead of the ToT. To lessen the risk of breaking the
release CI, version 14 is installed hard-coded as a temporary solution.

Updating the main branch to use the Clang 16 compiler will be done in a
separate patch.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131324
2022-08-17 17:48:06 +02:00
Aaron Ballman 74b5dad5e9 Add N2653 to the C2x status page
This was accidentally missing from the Feb 2022 paper section.
2022-08-17 11:30:31 -04:00
David Penry 8c4aea438c [ModuloSchedule] Add interface call to accept/reject SMS schedules
This interface allows a target to reject a proposed
SMS schedule.  For Hexagon/PowerPC, all schedules
are accepted, leaving behavior unchanged.  For ARM,
schedules which exceed register pressure limits are
rejected.

Also, two RegisterPressureTracker methods now need to be public so
that register pressure can be computed by more callers.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D128941
2022-08-17 08:13:26 -07:00
Michael Buch 33833c8611 [lldb][Tests] Skip static-only tests in TestConstStaticIntegralMember.py for dsym variant
This test fails for Clang versions < 14.0 for `dsym` variants.
`dsymutil` strips debug info for classes with only static members.
Thus move the failing assertions into the XFAIL test case.

Differential Revision: https://reviews.llvm.org/D132004
2022-08-17 15:39:21 +01:00
Paul Kirth 656c5d652c [clang][llvm][NFC] Change misexpect's tolerance option to be 32-bit
In D131869 we noticed that we jump through some hoops because we parse the
tolerance option used in MisExpect.cpp into a 64-bit integer. This is
unnecessary, since the value can only be in the range [0, 100).

This patch changes the underlying type to be 32-bit from where it is
parsed in Clang through to it's use in LLVM.

Reviewed By: jloser

Differential Revision: https://reviews.llvm.org/D131935
2022-08-17 14:38:53 +00:00
Ellis Hoag 6f61594d8c [InstrProf] Add option to avoid instrumenting small functions
If a function only has a few instructions, instrumentation can significantly increase the size and performance overhead of that function. Add the `-pgo-function-size-threshold` option to select a size threshold so these small functions are not instrumented.

A similar option `-fxray-instruction-threshold=<N>` is used for XRay to reduce binary size overhead [1].

[1] https://www.llvm.org/docs/XRay.html

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D131816
2022-08-17 06:47:15 -07:00
Simon Pilgrim ab6a6b8e0d [CostModel][X86] Add cost kinds test coverage for integer arithmetic operators 2022-08-17 14:36:31 +01:00
Erich Keane d483730d8c Re-apply "Deferred Concept Instantiation Implementation""
This reverts commit 258c3aee54.

This should fix the libc++ issue that caused the revert, by re-designing
slightly how we determined when we should evaluate the constraints.
Additionally, many of the other components to the original patch (the
NFC parts) were committed separately to shrink the size of this patch
for review.

Differential Revision: https://reviews.llvm.org/D126907
2022-08-17 06:24:40 -07:00
Thomas Joerg 5ad7cc7f21 Fix unused variable (introduced in
c248219b09)
2022-08-17 15:18:37 +02:00
Ivan Kosarev 7a355e9027 [AMDGPU][MC][NFC] Refine SMEM store, probe and discard definitions.
Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D131968
2022-08-17 13:54:26 +01:00
Alex Bradbury ce38128194 [RISCV] Avoid redundant branch-to-branch when expanding cmpxchg
If the success value of a cmpxchg is used in a branch, the expanded
cmpxchg sequence ends up with a redundant branch-to-branch (as the
backend atomics expansion happens as late as possible, passes to
optimise such cases have already run). This patch identifies this case
and avoid it when expanding the cmpxchg.

Note that a similar optimisation is possible for a BEQ on the cmpxchg
success value. As it's hard to imagine a case where real-world code may
do that, this patch doens't handle that case.

Differential Revision: https://reviews.llvm.org/D130192
2022-08-17 13:49:15 +01:00
Dominik Adamski cc8c746f8d [NFC][Flang] Add simd collapse test case
Flang supports lowering collapse clause to MLIR for worksharing loops
and simd loops. Simd collapse clause is represented in MLIR code as a
simd-loop having a list of indices, bounds and steps where the size of the list
is equal to the collapse value.

Support for simd collapse clause was added by several patches:
https://reviews.llvm.org/D118065 -> basic support for simd-loop in MLIR.
                                    Loop collapsing is done in the same way as
                                    for worksharing loops:
                                    https://reviews.llvm.org/D105706
https://reviews.llvm.org/D125282 -> support for lowering simd clause from
                                    Fortran into MLIR
https://reviews.llvm.org/D125302 -> lowering collapse clause from Fortran to
                                    MLIR. Lowering collapse clause is done
                                    before simd-specific function is called.
https://reviews.llvm.org/D128338 -> modified the MLIR representation of
                                    collapse clause. Removed collapse keyword
                                    in OpenMP MLIR dialect. Use loop list to
                                    represent collapse clause. This loop list
                                    is created by changes from patch:
                                    https://reviews.llvm.org/D125302 and it is
                                    passed to function responsible for lowering
                                    of simd directive which was implemented in
                                    patch: https://reviews.llvm.org/D125282

Reviewed By: kiranchandramohan

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

Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
2022-08-17 07:42:22 -05:00
Haojian Wu 6a9f79e102 [pseudo] Eliminate the type-name identifier ambiguities in the grammar.
See https://reviews.llvm.org/D130626 for motivation.

Identifier in the grammar has different categories (type-name, template-name,
namespace-name), they requires semantic information to resolve. This patch is
to eliminate the "local" ambiguities in type-name, and namespace-name, which
gives us a performance boost of the parser:

  - eliminate all different type rules (class-name, enum-name, typedef-name), and
    fold them into a unified type-name, this removes the #1 type-name ambiguity, and
    gives us a big performance boost;
  - remove the namespace-alis rules, as they're hard and uninteresting;

Note that we could eliminate more and gain more performance (like fold template-name,
type-name, namespace together), but at current stage, we'd like keep all existing
categories of the identifier (as they might assist in correlated disambiguation &
keep the representation of important concepts uniform).

| file               |ambiguous nodes |  forest size     | glrParse performance |
|SemaCodeComplete.cpp|  11k -> 5.7K   | 10.4MB -> 7.9MB  | 7.1MB/s -> 9.98MB/s  |
|       AST.cpp      |  1.3k -> 0.73K | 0.99MB -> 0.77MB | 6.7MB/s -> 8.4MB/s   |

Differential Revision: https://reviews.llvm.org/D130747
2022-08-17 14:30:53 +02:00
Aaron Ballman d7e06d5675 Update the status of some more C99 features
This also adds some test coverage to demonstrate we implement what was
standardized.
2022-08-17 08:11:56 -04:00
Serge Pavlov 956f8c0e10 [Driver] Override default location of config files
If directory for config files was specified in project configuration
using parameters CLANG_CONFIG_FILE_SYSTEM_DIR or CLANG_CONFIG_FILE_USER_DIR,
it was not overriden by command-line option `--config-system-dir=` or
`--config-user-dir=` that specified empty path.

This change corrects the behavior. It fixes the issue
https://github.com/llvm/llvm-project/issues/56836 ([clang] [test]
test/Driver/config-file-errs.c fails if CLANG_CONFIG_FILE_SYSTEM_DIR is
specified).
2022-08-17 18:52:53 +07:00
Simon Pilgrim 7dd8e3dc0d [CostModel][X86] intrinsic-cost-kinds.ll - add fcopysign costs tests 2022-08-17 12:39:24 +01:00
Mats Petersson 726786083f [flang]Avoid asking for operands when there are none
Fix one encountered (issue #57072) and two potential scenarios where the
code would ask for an operand that isn't there.

Add test for the encountered case.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D131671
2022-08-17 12:31:42 +01:00
David Spickett 8375c3124d [LLVM][IndvarSimplify] Move test that requires X86
This is failing on our bots that only build Arm/AArch64.

https://lab.llvm.org/buildbot/#/builders/171/builds/19033/steps/5/logs/FAIL__LLVM__pr57187_ll
2022-08-17 11:14:08 +00:00
OverMighty 232953f996 [AArch64] Add pattern for SQDML*Lv1i32_indexed
There was no pattern to fold into these instructions. This patch adds
the pattern obtained from the following ACLE intrinsics so that they
generate sqdmlal/sqdmlsl instructions instead of separate sqdmull and
sqadd/sqsub instructions:
 - vqdmlalh_s16, vqdmlslh_s16
 - vqdmlalh_lane_s16, vqdmlalh_laneq_s16, vqdmlslh_lane_s16,
   vqdmlslh_laneq_s16 (when the lane index is 0)

It also modifies the result of the existing pattern for the latter, when
the lane index is not 0, to use the v1i32_indexed instructions instead
of the v4i16_indexed ones.

Fixes #49997.

Differential Revision: https://reviews.llvm.org/D131700
2022-08-17 12:00:47 +01:00
Rainer Orth d9993484ee [Sparc] Don't use SunStyleELFSectionSwitchSyntax
As discussed in D85414 <https://reviews.llvm.org/D85414>, two tests
currently `FAIL` on Sparc since that backend uses the Sun assembler syntax
for the `.section` directive, controlled by
`SunStyleELFSectionSwitchSyntax`.

Instead of adapting the affected tests, this patch changes that default.
The internal assembler still accepts both forms as input, only the output
syntax is affected.

Current support for the Sun syntax is cursory at best: the built-in
assembler cannot even assemble some of the directives emitted by GCC, and
the set supported by the Solaris assembler is even larger: SPARC Assembly
Language Reference Manual, 3.4 Pseudo-Op Attributes
<https://docs.oracle.com/cd/E37838_01/html/E61063/gmabi.html#scrolltoc>.

A few Sparc test cases need to be adjusted. At the same time, the patch
fixes the failures from D85414 <https://reviews.llvm.org/D85414>.

Tested on `sparcv9-sun-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D85415
2022-08-17 12:59:29 +02:00
Simon Pilgrim 1d522a39f7 [TTI] Remove getInstructionThroughput cost helper.
Pulled out of D79483 - we can just as easily use getUserCost directly
2022-08-17 11:41:47 +01:00
Simon Pilgrim 594c5b1a42 [SLP] Update TODO comment about shuffle mask decoding
This is handled in ShuffleVectorInst/getShuffleCost - getInstructionThroughput is (slowly) being removed.
2022-08-17 11:41:46 +01:00
Zain Jaffal f61f99a105
[instcombine] Optimise for zero initialisation of product given fast flags are enabled
Currently, clang ignores the 0 initialisation in finite math
For example:

```
double f_prod = 0;
double arr[1000];
for (size_t i = 0; i < 1000; i++) {
  f_prod *= arr[i];
 }
```
Clang will ignore that `f_prod` is set to zero and it will generate assembly to iterate over the loop.

Reviewed By: fhahn, spatel

Differential Revision: https://reviews.llvm.org/D131672
2022-08-17 11:12:15 +01:00
Rainer Orth bcb2740f41 [flang] Add Solaris/x86 support to Optimizer/CodeGen/Target.cpp
When testing LLVM 15.0.0 rc1 on Solaris, I found that 50+ flang tests
`FAIL`ed with

  error:
/vol/llvm/src/llvm-project/local/flang/lib/Optimizer/CodeGen/Target.cpp:310:
not yet implemented: target not implemented

This patch fixes that for Solaris/x86, where the fix is trivial (just
handling it like the other x86 OSes).

Tested on `amd64-pc-solaris2.11`; only a single failure remains now.

Differential Revision: https://reviews.llvm.org/D131054
2022-08-17 11:54:38 +02:00
Dominik Adamski 19bd4789b9 [NFC][OpenMP] Update simd loop collapse support description
Simdloop collapse clause is supported in the same way
as colllapse clause for worksharing loops.

Reviewed By: kiranchandramohan

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

Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
2022-08-17 03:57:22 -05:00
Andre Vieira 49223e0a2d [TypePromotion] Don't promote PHI + ZExt if wider than RegisterBitWidth
Differential Revision: https://reviews.llvm.org/D131966
2022-08-17 09:54:15 +01:00
David Spickett fe4a58214f [LLDB][ARM] Remove expected failure from AnonTypedef test
Thanks to ff9efe240c this test
is now passing.

https://lab.llvm.org/buildbot/#/builders/17/builds/26270
2022-08-17 08:52:58 +00:00
Graham Hunter 70d35443dc [LAA] Handle forked pointers with add/sub instructions
Handle cases where a forked pointer has an add or sub instruction
before reaching a select.

Reviewed By: fhahn
Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D130278
2022-08-17 09:51:13 +01:00
Max Kazantsev 53544c67db [Test] Add miscompiled test for PR57187
Details at https://github.com/llvm/llvm-project/issues/57187
2022-08-17 15:46:30 +07:00
Thomas Joerg 42b2facbe2 Revert "DynamicMemRefType: iteration and access by indices"
This reverts commit b8ecf32f81.

This commit introduces undefined behavior according to UBSan:
UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset third_party/llvm/llvm-project/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h:377:5
2022-08-17 10:35:00 +02:00
Yuanfang Chen b296aed8ae [clang] fix a typo in da6187f566 2022-08-17 01:27:12 -07:00
Denis Fatkulin 8837ef4d37
[clang] Apply FixIts to members declared via `using` in derived classes
FixIt don't switch to arrow in derrived members with `using`

Example code:
```
struct Bar {
  void foo();
};
struct Baz {
  using Bar::foo;
};
void test(Baz* ptr) {
  ptr.^
}

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D131088
2022-08-17 10:09:48 +02:00
Furkan Usta 4dd71b3cb9
[clang] Give priority to Class context while parsing declarations
Fixes https://github.com/clangd/clangd/issues/290.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D130363
2022-08-17 10:06:39 +02:00
Michael Buch 88d3c1db45 [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF
When resolving symbols during IR execution, lldb makes a last effort attempt
to resolve external symbols from object files by approximate name matching.
It currently uses `CPlusPlusNameParser` to parse the demangled function name
and arguments for the unresolved symbol and its candidates. However, this
hand-rolled C++ parser doesn’t support ABI tags which, depending on the demangler,
get demangled into `[abi:tag]`. This lack of parsing support causes lldb to never
consider a candidate mangled function name that has ABI tags.

The issue reproduces by calling an ABI-tagged template function from the
expression evaluator. This is particularly problematic with the recent
addition of ABI tags to numerous libcxx APIs.

The issue stems from the fact that `clang::CodeGen` emits function
function calls using the mangled name inferred from the `FunctionDecl`
LLDB constructs from DWARF. Debug info often lacks information for
us to construct a perfect FunctionDecl resulting in subtle mangled
name inaccuracies.

This patch side-steps the problem of inaccurate `FunctionDecl`s by
attaching an `asm()` label to each `FunctionDecl` LLDB creates from DWARF.
`clang::CodeGen` consults this label to get the mangled name as one of
the first courses of action when emitting a function call.

LLDB already does this for C++ member functions as of
[675767a591](https://reviews.llvm.org/D40283)

**Testing**

* Added API tests

Differential Revision: https://reviews.llvm.org/D131974
2022-08-17 09:02:43 +01:00
Siva Chandra Reddy eb0715e3c7 [libc][NFC] Make IntegerToString simpler to use at call-sites.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D131943
2022-08-17 07:57:06 +00:00
Kadir Cetinkaya 83411bf06f
[clangd] Support for standard type hierarchy
This is mostly a mechanical change to adapt standard type hierarchy
support proposed in LSP 3.17 on top of clangd's existing extension support.

This does mainly two things:
- Incorporate symbolids for all the parents inside resolution parameters, so
  that they can be retrieved from index later on. This is a new code path, as
  extension always resolved them eagerly.
- Propogate parent information when resolving children, so that at least one
  branch of parents is always preserved. This is to address a shortcoming in the
  extension.

This doesn't drop support for the extension, but it's deprecated from now on and
will be deleted in upcoming releases. Currently we use the same struct
internally but don't serialize extra fields.

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

Differential Revision: https://reviews.llvm.org/D131385
2022-08-17 09:29:15 +02:00
Carlos Alberto Enciso 177cbb1c9b [CMake] Explicit bootstrap options override any passthrough ones.
The https://reviews.llvm.org/D53014 added CMAKE_BUILD_TYPE to
the list of BOOTSTRAP_DEFAULT_PASSTHROUGH variables.

The downside is that both stage-1 and stage-2 configurations
are the same. So it is not possible to build different stage
configurations.

This patch allow explicit bootstrap options to override any
passthrough ones.

For instance, the following settings would build:
  stage-1 (Release) and stage-2(Debug)

-DCMAKE_BUILD_TYPE=Release -DBOOTSTRAP_CMAKE_BUILD_TYPE=Debug

Reviewed By: @beanz

Differential Revision: https://reviews.llvm.org/D131755
2022-08-17 08:16:10 +01:00
Fangrui Song 4c244b2833 [ELF] Fix .plt.got comments. NFC 2022-08-16 23:29:01 -07:00
Pavel Kosov ff9efe240c [LLDB][JIT] Set processor for ARM architecture
Patch sets ARM cpu, before compiling JIT code. This enables FastISel for armv6 and higher CPUs and allows using hardware FPU

~~~

OS Laboratory. Huawei RRI. Saint-Petersburg

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D131783
2022-08-17 09:10:21 +03:00
Daniel Bertalan 1b67ce79e3 [lld-macho] Honor weak and thread-local flags for TAPI symbols
Differential Revision: https://reviews.llvm.org/D131995
2022-08-17 07:03:24 +02:00
Craig Topper d27c147aaa [RISCV] Allow lowerSELECT to fold integer setcc with FP select.
We'd pick it up in DAG combine later even if we didn't handle it here.
No test changes because we get it in DAG combine anyway.
2022-08-16 21:28:54 -07:00
Craig Topper 39707c1a9a [RISCV] Add test coverage for (select (icmp X, Y), float, float). NFC
We fold integer setcc into SELECT_CC during DAG combine even if
the SELECT_CC has FP result type, but we had no test coverage.
2022-08-16 21:28:26 -07:00
David Blaikie 9fc65658f5 fold assert-only variable into assert to address non-assert -Wunused-variable 2022-08-17 04:10:59 +00:00
Vitaly Buka 16fecdfa70 Revert "[AArch64] Add `foldCSELOfCSEl` DAG combine"
Breaks ubsan on buildbot, details in D125504

This reverts commit 6f9423ef06.
2022-08-16 20:29:37 -07:00
owenca 2185f64771 [clang-format] Handle comments between access specifier and colon
Fixes #56740.

Differential Revision: https://reviews.llvm.org/D131940
2022-08-16 20:18:21 -07:00