Commit Graph

463362 Commits

Author SHA1 Message Date
Joseph Huber
a621308881 [libc] Implement basic malloc and free support on the GPU
This patch adds support for the `malloc` and `free` functions. These
currently aren't implemented in-tree so we first add the interface
filies.

This patch provides the most basic support for a true `malloc` and
`free` by using the RPC interface. This is functional, but in the future
we will want to implement a more intelligent system and primarily use
the RPC interface more as a `brk()` or `sbrk()` interface only called
when absolutely necessary. We will need to design an intelligent
allocator in the future.

The semantics of these memory allocations will need to be checked. I am
somewhat iffy on the details. I've heard that HSA can allocate
asynchronously which seems to work with my tests at least. CUDA uses an
implicit synchronization scheme so we need to use an explicitly separate
stream from the one launching the kernel or the default stream. I will
need to test the NVPTX case.

I would appreciate if anyone more experienced with the implementation details
here could chime in for the HSA and CUDA cases.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D151735
2023-06-05 17:56:53 -05:00
Matt Arsenault
30bd96fa17 AMDGPU: Add baseline test for undoing mul add 1 reassociation
Add some tests for combines to undo regressions caused by
0cfc651032.
2023-06-05 18:44:17 -04:00
Matt Arsenault
a1422bf906 DAG: Reorder conditions 2023-06-05 18:44:17 -04:00
Hansang Bae
bd46706b1f [OpenMP][libomp] Allow white spaces in OMP_TARGET_OFFLOAD value
Remove heading/trailing white spaces when matching OMP_TARGET_OFFLOAD
value.

Differential Revision: https://reviews.llvm.org/D149890
2023-06-05 17:41:54 -05:00
Matt Arsenault
b25c001ad3 AMDGPU: Fold zext into result of v_mad_u16 on high zeroing targets
Avoids regressions in future patch.
2023-06-05 18:41:07 -04:00
Matt Arsenault
db08f9a2d5 AMDGPU: Add baseline 16-bit mad matching tests 2023-06-05 18:41:07 -04:00
Matt Arsenault
cb4b7340b0 AMDGPU: Convert test to generated checks 2023-06-05 18:41:06 -04:00
Peter Klausler
885b904a70
[flang] Pad output correctly after tabbing with ADVANCE='no' (bug#63111)
Correct the code that implements the production of spaces to bring the
furthestPositionInRecord up to a positionInRecord that was tabbed forward
by a T or TR control edit descriptor.

Fixes bug https://github.com/llvm/llvm-project/issues/63111.

Differential Revision: https://reviews.llvm.org/D152201
2023-06-05 15:35:58 -07:00
Aart Bik
62a06d8224 fix build issue on bazel
Needed to fix:
53a5c3ab4d
db7cc0348c

Reviewed By: Peiming, anlunx

Differential Revision: https://reviews.llvm.org/D152202
2023-06-05 15:33:31 -07:00
Florian Mayer
5ac240bbea [hwasan] Properly restore SP tag on exceptions
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D152036
2023-06-05 15:22:18 -07:00
Siva Chandra Reddy
2bd82c5462 [bazel][libc] Add targets for integer abs and div functions.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D152084
2023-06-05 22:15:12 +00:00
Nikolas Klauser
355f466744 [libc++][NFC] Add __element_count and use it in the constexpr C functions
This makes it less ambiguous what the parameter is meant to get.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D152040
2023-06-05 15:08:01 -07:00
Craig Topper
b64ddae8a2 [RISCV] Lower experimental_get_vector_length intrinsic to vsetvli for some cases.
This patch lowers to vsetvli when the AVL is i32 or XLenVT and
the VF is a power of 2 in the range [1, 64]. VLEN=32 is not supported
as we don't have a valid type mapping for that. VF=1 is not supported
with Zve32* only.

The element width is used to set the SEW for the vsetvli if possible.
Otherwise we use SEW=8.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D150824
2023-06-05 15:02:11 -07:00
Nick Desaulniers
86b6ac5d54 [Demangle] refactor DLangDemangle to use std::string_view
Many existing methods of the D Language Demangler take a C style string
and return an adjusted pointer to the same object as the input string is
consumed.

Make it more obvious by changing the signatures to accept
std::string_view& when the input is modified vs a copy of a
std::string_view when the input is not.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D152177
2023-06-05 14:38:07 -07:00
Fangrui Song
8d85c96e0e [lld] StringRef::{starts,ends}with => {starts,ends}_with. NFC
The latter form is now preferred to be similar to C++20 starts_with.
This replacement also removes one function call when startswith is not inlined.
2023-06-05 14:36:19 -07:00
Arthur Eubanks
fffa05a2bc Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD
LLVM_TOOL_LLD_BUILD is a relic of the pre-monorepo times. This causes us to never set COMPILER_RT_HAS_LLD.

Instead, set it from the runtimes build if lld is being built and lld is used as the compiler-rt linker.

Mark a test that requires libstdc++ as requiring Android, as other platforms may not have a libstdc++ lying around.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D144660
2023-06-05 14:35:52 -07:00
Craig Topper
4157bfb230 [RISCV] Add RISCVISD nodes for vfwadd/vfwsub.
Add a DAG combine to form these from FADD_VL/FSUB_VL and FP_EXTEND_VL.

This makes it similar to other widening ops and allows us to handle
using the same FP_EXTEND_VL for both operands.

Differential Revision: https://reviews.llvm.org/D151969
2023-06-05 14:12:47 -07:00
Craig Topper
c4224782cd [RISCV] Rename SDT_RISCVVWBinOpW_VL->SDT_RISCVVWIntBinOpW_VL. NFC
Preparation for D151969 which adds an FP version.
2023-06-05 14:12:47 -07:00
Alex Langford
59af0c3895 [lldb][NFCI] Change the way Process stores StructuredData plugins
Instead of having a map from ConstString to StructuredDataPluginSP, we
can use an llvm::StringMap. The keys themselves don't need to be
ConstStrings, so an llvm::StringMap feels most natural.

Differential Revision: https://reviews.llvm.org/D151960
2023-06-05 13:49:58 -07:00
Sami Tolvanen
5a64a826b9 [Driver] Allow -fsanitize=kcfi with -fsanitize-minimal-runtime
Having both UBSan with the minimal runtime and KCFI enabled can be
useful in low-level software. As there are no conflicts between the
flags, add KCFI to the list of compatible sanitizers.
2023-06-05 20:39:45 +00:00
Jessica Clarke
bacb14b9f3
[RISCV][test] Fix a couple of whitespace issues 2023-06-05 21:25:04 +01:00
Kazu Hirata
1117d806ca [ADT] Deprecate StringRef::{starts,ends}with_insensitive
This patch deprecates StringRef::{starts,ends}with_insensitive as
their uses have migrated to {starts,ends}_with_insensitive,
respectively.

Differential Revision: https://reviews.llvm.org/D152108
2023-06-05 13:18:07 -07:00
Kazu Hirata
857fa70e14 [Support] Remove {Bits,Float,Double}To{Bits,Float,Double}
These functions have been deprecated since:

  commit 0f52c1f86c
  Author: Kazu Hirata <kazu@google.com>
  Date:   Tue Feb 14 09:52:36 2023 -0800

Differential Revision: https://reviews.llvm.org/D152110
2023-06-05 13:18:05 -07:00
Kazu Hirata
02663a0d7f [Support] Remove PowerOf2Floor and ByteSwap_{16,32,64}
These functions have been deprecated since:

  commit b49b429fde
  Author: Kazu Hirata <kazu@google.com>
  Date:   Sun Feb 12 21:42:07 2023 -0800

Differential Revision: https://reviews.llvm.org/D152111
2023-06-05 13:18:03 -07:00
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