Commit Graph

463338 Commits

Author SHA1 Message Date
Alex Langford
8a4636929f [lldb][NFCI] ConstString methods should take StringRefs by value
StringRef was made to be passed by value efficiently.

Differential Revision: https://reviews.llvm.org/D152010
2023-06-05 13:06:58 -07:00
Amir Ayupov
a478a09131 [BOLT][NFC] Drop MMap events for deleted files
Don't parse/handle mmap events with "(deleted)" filename.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D151948
2023-06-05 13:03:40 -07:00
Nick Desaulniers
db98ac0827 [Demangle] convert microsoftDemangle to take a std::string_view
This should be last of the "bottom-up conversions" of various demanglers
to accept std::string_view.  After this, D149104 may be revisited.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D152176
2023-06-05 13:00:20 -07:00
Kazu Hirata
caf0072592 [Sema] Fix a warning
This patch fixes:

  clang/lib/Sema/SemaExprCXX.cpp:5591:3: error: default label in
  switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2023-06-05 12:59:58 -07:00
David Blaikie
5e74b2e8bb llvm-dwarfdump --verify: Add support for .debug_str_offsets[.dwo]
Had a couple of issues lately causing corrupted strings due to
problematic str_offsets (overflow due to >4GB .debug_str.dwo section in
a dwp and the dwp tool silently overflowing the 32 bit offsets updated
in the .debug_str_offsets.dwo section, and then more recently two CUs in
a dwo caused the dwp tool to reapply the offset adjustment twice
corrupting str_offsets.dwo as well) - so let's check that the offsets
are valid.

This assumes no suffix merging - if anyone implements that, then this
checking should just be removed for the most part (we could still check
the offsets are within the bounds of .debug_str[.dwo], but nothing more
- any offset in the range would be valid, the offsets wouldn't have to
land at the start of a string)
2023-06-05 19:59:37 +00:00
Alex Langford
0871f22edc [lldb][NFCI] Use size_t in OptionValueProperties
In many places we're using uint32_t where we should be using size_t.
We should be consistent.

Differential Revision: https://reviews.llvm.org/D151949
2023-06-05 12:57:43 -07:00
Pierre Calixte
8625c2031c Test case improvement (Do not optimize debug locations across section boundaries/D149294)
Ensure that the expected location directives are from different sections.

Differential Revision: https://reviews.llvm.org/D150308
2023-06-05 12:55:39 -07:00
Alex Langford
0bb6f832fb [lldb][NFCI] Change return type of REPL::GetSourceFileBasename
These don't really need to be in the ConstString StringPool. I've
changed the return type to StringRef because on llvm.org and downstream
in the swift fork, this returns a constant value. We could change it to
return a std::string or something else if it needs to be able to change
between calls.

Differential Revision: https://reviews.llvm.org/D151962
2023-06-05 12:52:38 -07:00
Artem Belevich
73464e377b [NVPTX] fixed vector-compare test.
Apparently this test didn't actually test anything other that the IR compiles.
2023-06-05 12:49:12 -07:00
Peter Klausler
69c625bf64
[flang] Fix crash from bug#63099 (gfortran/regression/oldstyle_3.f90)
In InitElement() in flang/lib/Semantics/data-to-inits.cpp, don't
assume that values_.Location() can be called until after it has been
verified that values_.IsAtEnd() is not true.

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

Differential Revision: https://reviews.llvm.org/D152183
2023-06-05 12:27:50 -07:00
Artem Belevich
dc90f42ea7 Coalesce 16-bit FP types to use integer register classes.
i16/f16/bf16 will use the same .b16 registers and
i32/v2f16 and v2bf16 will share .b32 registers.

The changes are mostly mechanical, intended to remove unnecessary register
classes which tend to produce redundant register moves.

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

v2f16 regtype conversion to i32
2023-06-05 12:21:52 -07:00
Nathan Chancellor
deecf89a13
[Clang] Add release note for 877210faa4
Reviewed By: erichkeane, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D152186
2023-06-05 12:14:51 -07:00
Mehdi Amini
53a5c3ab4d Fix MLIR build with Shared lib enabled
db7cc0348c added OpenMP support to the execution engine but didn't
add the explicit CMake dependency.
2023-06-05 12:10:24 -07:00
Rafael Ubal Tena
db7cc0348c Activate OpenMP translation in MLIR execution engine CAPI.
We've observed that the MLIR Jit Engine fails when the `omp` dialect is used due to a failure to register OpenMP-related translations. This small patch addresses this issue.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D151577
2023-06-05 11:56:50 -07:00
Dmitriy Filchenko
94407e1bba [scudo] Change configuration for Trusty, use mmap()
Trusty runs in memory constrained environments, with many apps
having only one page (4KB) of heap memory available. However, we
still want to mmap() multiples of PAGE_SIZE at a time.

Additionally, switch Scudo from using sbrk() to mmap().

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D151968
2023-06-05 18:28:10 +00:00
Aaron Ballman
540b934ff9 Fix LLVM sphinx build
Addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/35886
2023-06-05 14:14:23 -04:00
Ramkumar Ramachandra
10f8be19e7 tree-sitter-mlir: add a more complete grammar
Contribute a grammar, along with associated tests, from the upstream
project maintained at https://github.com/artagnon/tree-sitter-mlir. The
new grammar includes several fixes, and successfully parses 60-80% of
MLIR tests in the Arith, Math, ControlFlow, SCF, Tensor, Affine, and
Linalg dialects.

Differential Revision: https://reviews.llvm.org/D144408
2023-06-05 19:11:06 +01:00
Charalampos Mitrodimas
91be60b347 Respect "-fdiagnostics-absolute-paths" on emit include location
This commit fixes "TextDiagnostic::emitIncludeLocation" when compiling
with "-fdiagnostics-absolute-paths" flag enabled by emitting the absolute
path of the included file.

Fixes #63026

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D151833
2023-06-05 18:07:18 +00:00
Christopher Di Bella
798c5ba770 [clang][NFC] refactors value type traits so we can have more than bools
Since all the type traits up until now have had Boolean vaules, we've
always been able to assume that the expressions are `bool`. This is
about to change (D151952 introduces a trait that returns `size_t`), so
we need to restructure the code so it doesn't become unwieldy.

This is achieved by giving traits a designated "return" type.

Differential Revision: https://reviews.llvm.org/D152034
2023-06-05 18:07:18 +00:00
Shao-Ce SUN
68f55d78e3 [Flang] Map ieee_fma intrinsic to llvm.fma
Map `ieee_fma` intrinsic to LLVM IR as `llvm.fma`.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D151872
2023-06-06 02:01:36 +08:00
Fangrui Song
65ceb42d63 Replace deprecated startswith_insensitive with starts_with_insensitive 2023-06-05 11:01:27 -07:00
Noah Goldstein
73ce343125 [InstCombine] Add transform (icmp pred (shl {nsw and/or nuw} X, Y), C) -> (icmp pred X, C)
Three new transforms:
    1) `(icmp pred (shl nsw nuw X, Y), C)` [if `C <= 0`] -> `(icmp pred X, C)`
        - ugt: https://alive2.llvm.org/ce/z/K_57J_
        - sgt: https://alive2.llvm.org/ce/z/BL8u_a
        - sge: https://alive2.llvm.org/ce/z/yZZVYz
        - uge: https://alive2.llvm.org/ce/z/R4jwwJ
        - ule: https://alive2.llvm.org/ce/z/-gbmth
        - sle: https://alive2.llvm.org/ce/z/ycZVsh
        - slt: https://alive2.llvm.org/ce/z/4MzHYm
        - sle: https://alive2.llvm.org/ce/z/fgNfex
        - ult: https://alive2.llvm.org/ce/z/cXfvH5
        - eq : https://alive2.llvm.org/ce/z/sZh_Ti
        - ne : https://alive2.llvm.org/ce/z/UrqSWA

    2) `(icmp eq/ne (shl {nsw|nuw} X, Y), 0)` -> `(icmp eq/ne X, 0)`
        - eq+nsw: https://alive2.llvm.org/ce/z/aSJN6D
        - eq+nuw: https://alive2.llvm.org/ce/z/r2_-br
        - ne+nuw: https://alive2.llvm.org/ce/z/RkETtu
        - ne+nsw: https://alive2.llvm.org/ce/z/8iSfW3

    3) `(icmp slt (shl nsw X, Y), 0/1)` -> `(icmp pred X, 0/1)`
       `(icmp sgt (shl nsw X, Y), 0/-1)` -> `(icmp pred X, 0/-1)`
        - slt: https://alive2.llvm.org/ce/z/eZYRan
        - sgt: https://alive2.llvm.org/ce/z/QQeP26

    Transform 3) is really sle/slt/sge/sgt with 0, but sle/sge
    canonicalize to slt/sgt respectively so its implemented as such.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D145341
2023-06-05 13:01:03 -05:00
Noah Goldstein
e8e8528085 [InstCombine] Add tests for tranforming (icmp pred (shl {nsw and/or nuw} X, Y), C); NFC
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D145340
2023-06-05 13:01:03 -05:00
Florian Mayer
b14f95b988 [sanitizer] add new symbolizer symbol 2023-06-05 10:58:19 -07:00
Peiming Liu
7d9677a9bd [mlir][sparse] Make getNumTensors() consistent between LoopEmitter and Merger.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D152178
2023-06-05 17:56:08 +00:00
Nathan Chancellor
877210faa4
[Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute
A variable declared with __attribute__((cleanup)) cannot be unused, as
its address is passed to the clean up function. Do not emit
-Wunused-variable for variables declared with the cleanup attribute,
which matches GCC's behavior: https://godbolt.org/z/dz5YfTsan

Reviewed By: erichkeane, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D152180
2023-06-05 10:54:47 -07:00
Philip Reames
9959cdb66a [IRBUilder] Introduce getAllOnesMask [nfc]
Simplify D99750 by factoring out a utility which we already have multiple instances of in tree.
2023-06-05 10:54:07 -07:00
Alan Hu
ced7e4f53b Remove vestiges of removed OCaml modules
Several OCaml modules using the old PassManager API were removed in
https://reviews.llvm.org/D144751, but the META file still needed to be
updated to remove them. This diff also removes an unused macro definition
related to the module removals.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D152114
2023-06-05 13:27:42 -04:00
Florian Mayer
9fa938d687 Revert "Properly restore SP tag on exceptions"
This reverts commit 6a2e0cb418.
2023-06-05 10:26:33 -07:00
Krzysztof Drewniak
23098bd454 [AMDGPU] Add intrinsic for converting global pointers to resources
Define the function @llvm.amdgcn.make.buffer.rsrc, which take a 64-bit
pointer, the 16-bit stride/swizzling constant that replace the high 16
bits of an address in a buffer resource, the 32-bit extent/number of
elements, and the 32-bit flags (the latter two being the 3rd and 4th
wards of the resource), and combines them into a ptr addrspace(8).

This intrinsic is lowered during the early phases of the backend.

This intrinsic is needed so that alias analysis can correctly infer
that a certain buffer resource points to the same memory as some
global pointer. Previous methods of constructing buffer resources,
which relied on ptrtoint, would not allow for such an inference.

Depends on D148184

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D148957
2023-06-05 17:07:59 +00:00
Krzysztof Drewniak
ab37937812 [AMDGPU] Use resource base for buffer instruction MachineMemOperands
1. Remove the existing code that would encode the constant offsets (if
there were any) on buffer intrinsic operations onto their
`MachineMemOperand`s. As far as I can tell, this use of `offset` has
no substantial impact on the generated code, especially since the same
reasoning is performed by areMemAccessesTriviallyDisjoint().

2. When a buffer resource intrinsic takes a pointer argument as the
base resource/descriptor, place that memory argument in the value
field of the MachineMemOperand attached to that intrinsic.

This is more conservative than what would be produced by more typical
LLVM code using GEP, as the Value (for alias analysis purposes)
corresponding to accessing buffer[0] and buffer[1] is the same.
However, the target-specific analysis of disjoint offsets covers a lot
of the simple usecases.

Despite this limitation, the new buffer intrinsics, combined with
LLVM's existing pointer annotations, allow for non-trivial
optimizations, as seen in the new tests, where marking two buffer
descriptors "noalias" allows merging together loads and stores in a
"load from A, modify loaded value, store to B" sequence, which would
not be possible previously.

Depends on D147547

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D148184
2023-06-05 17:06:57 +00:00
Nikolas Klauser
d965960fcf Revert "[libc++] Optimize for_each for segmented iterators"
This reverts commit b1dc43aa3a.
2023-06-05 10:00:02 -07:00
Krzysztof Drewniak
faa2c678aa [AMDGPU] Add buffer intrinsics that take resources as pointers
In order to enable the LLVM frontend to better analyze buffer
operations (and to potentially enable more precise analyses on the
backend), define versions of the raw and structured buffer intrinsics
that use `ptr addrspace(8)` instead of `<4 x i32>` to represent their
rsrc arguments.

The new intrinsics are named by replacing `buffer.` with `buffer.ptr`.

One advantage to these intrinsic definitions is that, instead of
specifying that a buffer load/store will read/write some memory, we
can indicate that the memory read or written will be based on the
pointer argument. This means that, for example, a read from a
`noalias` buffer can be pulled out of a loop that is modifying a
distinct buffer.

In the future, we will define custom PseudoSourceValues that will
allow us to package up the (buffer, index, offset) triples that buffer
intrinsics contain and allow for more precise backend analysis.

This work also enables creating address space 7, which represents
manipulation of raw buffers using native LLVM load and store
instructions.

Where tests simply used a buffer intrinsic while testing some other
code path (such as the tests for VGPR spills), they have been updated
to use the new intrinsic form. Tests that are "about" buffer
intrinsics (for instance, those that ensure that they codegen as
expected) have been duplicated, either within existing files or into
new ones.

Depends on D145441

Reviewed By: arsenm, #amdgpu

Differential Revision: https://reviews.llvm.org/D147547
2023-06-05 16:59:07 +00:00
Nick Desaulniers
936dcc89da [Demangle] convert is*Encoding to use std::string_view
This was originally a part of D149104 which was backed out. This change
is uncontroversial though, so split it out and reland it.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D152042
2023-06-05 09:33:49 -07:00
Kiran Chandramohan
52ca6ad755 [Flang][PFT] Skip continue insertion for OpenMP Loops
Unstructured regions presents some issues for OpenMP code generation.
While there are no branches out of the OpenMP region, there can be
branches inside. This required the availability of an artificial
target at the end of an OpenMP region. This was implemented by
insertion an artifical `continue` and marking it as a target for
a branch.
(https://github.com/flang-compiler/f18-llvm-project/pull/1178)

The artificial target is not required for OpenMP loops. Since the
DO loop end can itself be a target of a branch. Moreover, insertion
of the continue between the end of the loop and the end of the
OpenMP loop construct presents problems since the OpenMP MLIR
loop construct models both the loop and the construct. This can
cause the terminator of the OpenMP loop construct to be missed.
This patch solves the issue by skipping the insertion of the
continue.

Note: This issue is only hit if the `end openmp loop` directive
is missed.

This patch fixes the issues in:
-> https://github.com/llvm/llvm-project/issues/58378
-> https://github.com/flang-compiler/f18-llvm-project/issues/1426

Fixes #58378

Reviewed By: vdonaldson

Differential Revision: https://reviews.llvm.org/D151700
2023-06-05 16:31:09 +00:00
Craig Topper
7a2b12b05b [RISCV] Switch vwsll.v* instructions to use the VSHT_IV_V_X_I class instead of VALU_IV_V_X_I.
This allows us to remove the uimm5 argument and changes the
scheduler class from ALU to Shift.

Ultimately we need a WShift scheduler class, but we need to scrub
all of the crypto instructions for scheduler classes so I'll leave
that for future work.

Reviewed By: 4vtomat, ego

Differential Revision: https://reviews.llvm.org/D152030
2023-06-05 09:24:50 -07:00
Michael Liao
e7c9481b70 [TableGen] Fix indentation. NFC 2023-06-05 12:22:00 -04:00
Stefan Pintilie
658f23fc46 [LLD] Emit DT_PPC64_OPT into the dynamic section
As per section 4.2.2 of the PowerPC ELFv2 ABI, this value tells the dynamic linker which optimizations it is allowed to do.
Specifically, the higher order bit of the two tells the dynamic linker that there may be multiple TOC pointers in the binary.

When we resolve any NOTOC relocations during linking, we need to set this value because we may be calling
TOC functions from NOTOC functions when the NOTOC function already clobbered the TOC pointer.

In practice, this ensures that the PLT resolver always resolves the call to the GEP (global entry point) of
the TOC function (which will set up the TOC for the TOC function).

Original patch by nemanjai

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D150631
2023-06-05 12:18:29 -04:00
Sam McCall
3f9f146371 [clangd] Move completion signatures and labelDetails
(When clients support it, otherwise keep the existing rendering).

In VSCode this makes the signature darker.

Differential Revision: https://reviews.llvm.org/D151253
2023-06-05 18:05:18 +02:00
Kiran Chandramohan
ca81808cc3 [Flang][OpenMP] Refactor to properly fix privatisation of loop bounds
The OpenMP loop Operations have the bounds attached to them. If the
loop bounds are privatised then the privatisation has to happen
before the loop operation is created. To do this the privatisation
is split into two steps. The first step performs cloning and
firstprivate handling, the second step performs lastprivate handling.

This also reverts the changes in the temporary fix (D127137).

Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1143880545
Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1119997442

Fixes #60872

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D151504
2023-06-05 16:04:24 +00:00
SR_team
4cb5e436ae [clangd] Show size, offset and padding for bit fields on hover
Examle:
```
struct test {
	char a;
	char b : 3;
	char c : 5;
	int d;
	int e : 27;
};
```

{F27617774}
{F27617776}
{F27617777}
{F27617780}

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D151128
2023-06-05 17:52:34 +02:00
Mark de Wever
17b0d90e20 [libunwind] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: #libunwind, mstorsjo

Differential Revision: https://reviews.llvm.org/D152100
2023-06-05 17:42:37 +02:00
Tom Eccles
76c3c5bca0 [flang] [stack-arrays] fix unused variable warning 2023-06-05 15:36:02 +00:00
Aaron Ballman
985f5afcd7 Silence C++17 extension warnings; NFC
Amends 12728e1449
Addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/216/builds/22308
2023-06-05 11:35:03 -04:00
Amaury Séchet
7988725f65 [NFC][DAG] Move isTruncateOf so that it can be used in foldBinOpIntoSelect. 2023-06-05 15:33:59 +00:00
Aaron Ballman
edd7c13dc3 Silence C++17 extension diagnostics in test; NFC
Amends 12728e1449
Found by:
https://lab.llvm.org/buildbot/#/builders/139/builds/42135
2023-06-05 11:32:50 -04:00
Nikita Popov
79115aebb7 [LoopUnroll] Add test for SCEV invalidation issue (NFC)
Test for the issue reported at https://reviews.llvm.org/D149331#4387931.
2023-06-05 17:28:32 +02:00
Nikita Popov
3c9cf023db Revert "[LCSSA] Don't invalidate SCEV"
This reverts commit 5cbb9f7a58.

Causes verifier error reported at
https://reviews.llvm.org/D149331#4387931.
2023-06-05 17:28:32 +02:00
Harsh Menon
26fee2b3cb [mlir] [linalg] Update documentation for fuse_into_containing_op
This patch updates the docs for fuse_into_containing_op. It
updates the returned values to include the new_containing_op
and adds a brief description of the new_containing_op.

updates the docs with new changes in the
op regarding the return of the new_containing_op as well
as a brief description o

Differential Revision: https://reviews.llvm.org/D152044
2023-06-05 08:24:32 -07:00
Viktoriia Bakalova
cd5fcea6d4 [clangd] Revert to older include spelling approach. 2023-06-05 15:18:28 +00:00