platform/upstream/llvm.git
17 months ago[flang] Carry over the derived type from MOLD
Valentin Clement [Wed, 8 Feb 2023 08:26:12 +0000 (09:26 +0100)]
[flang] Carry over the derived type from MOLD

Derived type from the MOLD was not carried over
to the newly allocated pointer or allocatable.
This may lead to wrong dynamic type when the pointer or allocatable
is polymorphic as shown in the example below:

```
type :: p1
  integer :: a
end type

type, extends(p1) :: p2
  integer :: b
end type

class(p1), pointer :: p(:)

allocate(p(5), MOLD=p2(1,2))
```

Reviewed By: klausler

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

17 months ago[mlir][bufferize][NFC] Merge AnalysisState and BufferizationAliasInfo
Matthias Springer [Wed, 8 Feb 2023 07:59:15 +0000 (08:59 +0100)]
[mlir][bufferize][NFC] Merge AnalysisState and BufferizationAliasInfo

There is no longer a need to keep the two separate. This is in preparation of reusing the same AnalysisState for tensor.empty elimination and One-Shot Bufferize (to address performance bottlenecks).

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

17 months ago[compiler-rt][macOS]: Disable iOS support if iOS SDK is not found
Tobias Hieta [Wed, 8 Feb 2023 07:11:34 +0000 (08:11 +0100)]
[compiler-rt][macOS]: Disable iOS support if iOS SDK is not found

If you are missing the iOS SDK on your macOS (for example you don't have
full Xcode but just CommandLineTools) then CMake currently errors
out without a helpful message. This patch disables iOS support in
compiler-rt if the iOS SDK is not found. This can be overriden by
passing -DCOMPILER_RT_ENABLE_IOS=ON.

Reviewed By: delcypher, thetruestblue

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

17 months agoRevert "[RISCV] Add performMULcombine to perform strength-reduction"
Philipp Tomsich [Wed, 8 Feb 2023 07:00:57 +0000 (08:00 +0100)]
Revert "[RISCV] Add performMULcombine to perform strength-reduction"

This reverts commit 3304d51b676ea511feca28089cb60eba3873132e.

17 months agoRevert "[RISCV] Add vendor-defined XTHeadBs (single-bit) extension"
Philipp Tomsich [Wed, 8 Feb 2023 07:00:45 +0000 (08:00 +0100)]
Revert "[RISCV] Add vendor-defined XTHeadBs (single-bit) extension"

This reverts commit 656188ddc4075eb50260607b3497589873f373d2.

17 months agoRevert "[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension"
Philipp Tomsich [Wed, 8 Feb 2023 07:00:34 +0000 (08:00 +0100)]
Revert "[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension"

This reverts commit 19a59099095b3cbc9846e5330de26fca0a44ccbe.

17 months ago[RISCV] Fix comment for Zba tests. NFC.
Philipp Tomsich [Wed, 8 Feb 2023 06:57:07 +0000 (07:57 +0100)]
[RISCV] Fix comment for Zba tests. NFC.

The comments in the Zba tests were referring to the "bitmanip base"
extension (i.e., the Zbb).  Fix it.

Reviewed By: craig.topper

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

17 months ago[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
Philipp Tomsich [Tue, 31 Jan 2023 19:12:45 +0000 (20:12 +0100)]
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension

The vendor-defined XTHeadBb (predating the standard Zbb extension)
extension adds some bit-manipulation extensions with somewhat similar
semantics as some of the Zbb instructions.

It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for XTHeadBb is
available from:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da

Depends on D143036

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

17 months ago[RISCV] Add vendor-defined XTHeadBs (single-bit) extension
Philipp Tomsich [Mon, 30 Jan 2023 02:23:17 +0000 (03:23 +0100)]
[RISCV] Add vendor-defined XTHeadBs (single-bit) extension

The vendor-defined XTHeadBs (predating the standard Zbs extension)
extension adds a bit-test instruction (th.tst) with similar semantics
as bexti from Zbs.  It is supported by the C9xx cores (e.g., found in
the wild in the Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for XTHeadBs is
available from:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da

Depends on D143394

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

17 months ago[RISCV] Add performMULcombine to perform strength-reduction
Philipp Tomsich [Fri, 3 Feb 2023 21:03:07 +0000 (22:03 +0100)]
[RISCV] Add performMULcombine to perform strength-reduction

The RISC-V backend thus far does not provide strength-reduction, which
causes a long (but not complete) list of 3-instruction patterns listed
to utilize the shift-and-add instruction from Zba and XTHeadBa in
strength-reduction.

This adds the logic to perform strength-reduction through the DAG
combine for ISD::MUL.  Initially, we wire this up for XTheadBa only,
until this has had some time to settle and get real-world test
exposure.

The following strength-reductions strategies are currently supported:
  - XTheadBa
    - C = (n + 1)           // th.addsl
    - C = (n + 1)k          // th.addsl, slli
    - C = (n + 1)(m + 1)    // th.addsl, th.addsl
    - C = (n + 1)(m + 1)k   // th.addsl, th.addsl, slli
    - C = ((n + 1)m + 1)    // th.addsl, th.addsl
    - C = ((n + 1)m + 1)k   // th.addslm th.addsl, slli
  - base ISA
    - C being 2 set-bits    // slli, slli, add
       (possibly slli, th.addsl)

Even though the slli+slli+add sequence would we supported without
XTheadBa, this currently is gated to avoid having to update a large
number of test cases (i.e., anything that has a multiplication with a
constant where only 2 bits are set) in this commit.

With the strength reduction now being performed in performMUL combine,
we drop the (now redundant) patterns from RISCVInstrInfoXTHead.td.

Depends on D143029

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

17 months ago[RISCV] Add vendor-defined XTHeadBa (address-generation) extension
Philipp Tomsich [Wed, 8 Feb 2023 00:08:11 +0000 (01:08 +0100)]
[RISCV] Add vendor-defined XTHeadBa (address-generation) extension

The vendor-defined XTHeadBa (predating the standard Zba extension)
extension adds an address-generation instruction (th.addsl) with
similar semantics as sh[123]add from Zba.  It is supported by the C9xx
cores (e.g., found in the wild in the Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for XTHeadBa is
available from:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da

Reviewed By: craig.topper

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

17 months agoDAGCombiner: fix -Wunused-private-field. NFC
Fangrui Song [Wed, 8 Feb 2023 06:33:56 +0000 (22:33 -0800)]
DAGCombiner: fix -Wunused-private-field. NFC

17 months ago[AMDGPU] Introduce never uniform bit field in tablegen
Yashwant Singh [Wed, 8 Feb 2023 06:11:51 +0000 (11:41 +0530)]
[AMDGPU] Introduce never uniform bit field in tablegen

IsNeverUniform can be set to 1 to mark instructions which are
inherently never-uniform/divergent. Enabling this bit in
Writelane instruction for now. To be extended to all required
instructions.

Reviewed By: arsenm, sameerds, #amdgpu

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

17 months ago[libc++] Implement LWG3657 std::hash<filesystem::path>
Louis Dionne [Tue, 7 Feb 2023 01:35:42 +0000 (17:35 -0800)]
[libc++] Implement LWG3657 std::hash<filesystem::path>

This is implemented as a DR on top of C++17.

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

17 months ago[VP][DAGCombiner] Introduce generalized pattern match for vp sdnodes.
Yeting Kuo [Tue, 17 Jan 2023 05:30:24 +0000 (13:30 +0800)]
[VP][DAGCombiner] Introduce generalized pattern match for vp sdnodes.

The patch tries to solve duplicated combine work for vp sdnodes. The idea is to
introduce MatchConext that verifies specific patterns and generate specific node
infromation. There is two MatchConext in DAGCombiner. EmptyMatcher is for
normal nodes and VPMatcher is for vp nodes.

The idea of this patch is come form Simon Moll's proposal [0]. I only fixed some
minor issues and added few new features in this patch.

[0]: https://github.com/sx-aurora-dev/llvm-project/commit/c38a14484aa2945f3b05369560b65916dd832f76

Reviewed By: craig.topper

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

17 months ago[Support] change StringMap hash function from djbHash to xxHash
Erik Desjardins [Sun, 29 Jan 2023 21:31:00 +0000 (16:31 -0500)]
[Support] change StringMap hash function from djbHash to xxHash

Depends on https://reviews.llvm.org/D142861.

Alternative to https://reviews.llvm.org/D137601.

xxHash is much faster than djbHash. This makes a simple Rust test case with a large constant string 10% faster to compile.

Previous attempts at changing this hash function (e.g. https://reviews.llvm.org/D97396) had to be reverted due to breaking tests that depended on iteration order.
No additional tests fail with this patch compared to `main` when running `check-all` with `-DLLVM_ENABLE_PROJECTS="all"` (on a Linux host), so I hope I found everything that needs to be changed.

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

17 months ago[MachineCopyPropagation] Eliminate spillage copies that might be caused by eviction...
Kai Luo [Wed, 8 Feb 2023 02:14:24 +0000 (02:14 +0000)]
[MachineCopyPropagation] Eliminate spillage copies that might be caused by eviction chain

Remove spill-reload like copy chains. For example
```
r0 = COPY r1
r1 = COPY r2
r2 = COPY r3
r3 = COPY r4
<def-use r4>
r4 = COPY r3
r3 = COPY r2
r2 = COPY r1
r1 = COPY r0
```
will be folded into
```
r0 = COPY r1
r1 = COPY r4
<def-use r4>
r4 = COPY r1
r1 = COPY r0
```

Reviewed By: qcolombet

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

17 months ago[Clang] Disable building tools for 32-bit hosts as well
Joseph Huber [Wed, 8 Feb 2023 03:18:09 +0000 (21:18 -0600)]
[Clang] Disable building tools for 32-bit hosts as well

Summary:
Offloading is not supported on 32-bit applications. We already disable
this for 32-bit cross-compiling but we also need to disable it for
32-bit native machines as well.

17 months ago[mlir][vector] Support 0-D vector when eliding single element reduction
Kai Sasaki [Wed, 8 Feb 2023 02:51:08 +0000 (11:51 +0900)]
[mlir][vector] Support 0-D vector when eliding single element reduction

ElideSingleElementReduction causes assertion failure when we give 0-D vector. It's possible to fold the case by using vector.extractelement op instead. It's originally reported in https://github.com/llvm/llvm-project/issues/60193.

Reviewed By: dcaballe

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

17 months agoRevert "[llvm-profdata] Add option to cap profile output size"
William Huang [Wed, 8 Feb 2023 02:29:12 +0000 (02:29 +0000)]
Revert "[llvm-profdata] Add option to cap profile output size"

This reverts commit 48f163b889a8f373474c7d198c43e27779f38692.

17 months ago[llvm-profdata] Add option to cap profile output size
William Huang [Wed, 18 Jan 2023 01:10:47 +0000 (01:10 +0000)]
[llvm-profdata] Add option to cap profile output size

D139603 (add option to llvm-profdata to reduce output profile size) contains test cases that are not cross-platform. Moving those tests to unit test and making sure the feature is callable from llvm library

Reviewed By: snehasish

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

17 months ago[mlir][IRNumbering] Fix the dialect comparator to be strict
River Riddle [Wed, 8 Feb 2023 01:37:00 +0000 (17:37 -0800)]
[mlir][IRNumbering] Fix the dialect comparator to be strict

Check if rhs is the dialect to be ordered first, ensuring that
we don't inadvertantly order something before it by
falling back to pure number comparison.

This only shows up depending on the implementation of
stable_sort. This was hit in a build of MSVC that was
checking for strict ordering.

17 months ago[AArch64] Fix missing comment on D138888, NFC
zhongyunde [Wed, 8 Feb 2023 01:58:20 +0000 (09:58 +0800)]
[AArch64] Fix missing comment on D138888, NFC

Reviewed By: paulwalker-arm

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

17 months ago[flang] Enable LoongArch for x86CompatibleBehavior in floating point flag
Weining Lu [Wed, 8 Feb 2023 01:07:34 +0000 (09:07 +0800)]
[flang] Enable LoongArch for x86CompatibleBehavior in floating point flag

Similar to D138503 for RISC-V which fix the flang-OldUnit test failure:

```
.../llvm-project/flang/unittests/Evaluate/real.cpp:504: FAIL:
FlagsToBits(prod.flags) == 0x18, not 0x10
0 0x800001 * 0xbf7ffffe
```

With this patch applied, `check-flang` all pass.

Reviewed By: vzakhari

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

17 months ago[flang] Add LoongArch64 support to lib/Optimizer/CodeGen/Target.cpp
Weining Lu [Wed, 8 Feb 2023 01:07:01 +0000 (09:07 +0800)]
[flang] Add LoongArch64 support to lib/Optimizer/CodeGen/Target.cpp

Add LoongArch64 linux target specifics to Target.cpp which is similar to
RISCV-64 in D136547.

For LoongArch, a complex floating-point number, or a structure
containing just one complex floating-point number, is passed as though
it were a structure containing two floating-point reals.

Reviewed By: vzakhari

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

17 months ago[RISCV][CodeGen] Account for LMUL from VS2 for Vector Reduction Instructions
Monk Chiang [Thu, 12 Jan 2023 04:59:40 +0000 (20:59 -0800)]
[RISCV][CodeGen] Account for LMUL from VS2 for Vector Reduction Instructions

The Reduction instruction destination register LMUL is 1. But the source
register(vs2) has different LMUL(MF8 to M8). It's beneficial to know how
many registers are working on reduction instructions.
This patch creates separate SchedWrite for each relevant LMUL that from VS2.

Reviewed By: michaelmaitland

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

17 months ago[RISCV] Allow mismatched SmallDataLimit and use Min for conflicting values
Fangrui Song [Wed, 8 Feb 2023 01:13:21 +0000 (17:13 -0800)]
[RISCV] Allow mismatched SmallDataLimit and use Min for conflicting values

Fix an issue about module linking with LTO.

When compiling with PIE, the small data limitation needs to be consistent with that in PIC, otherwise there will be linking errors due to conflicting values.

bar.c
```
int bar() { return 1; }
```

foo.c
```
int foo() { return 1; }
```

```
clang --target=riscv64-unknown-linux-gnu -flto -c foo.c -o foo.o -fPIE
clang --target=riscv64-unknown-linux-gnu -flto -c bar.c -o bar.o -fPIC

clang --target=riscv64-unknown-linux-gnu -flto foo.o bar.o -flto -nostdlib -v -fuse-ld=lld
```

```
ld.lld: error: linking module flags 'SmallDataLimit': IDs have conflicting values in 'bar.o' and 'ld-temp.o'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```

Use Min instead of Error for conflicting SmallDataLimit.

Authored by: @joshua-arch1
Signed-off-by: xiaojing.zhang <xiaojing.zhang@xcalibyte.com>
Signed-off-by: jianxin.lai <jianxin.lai@xcalibyte.com>
Reviewed By: MaskRay

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

17 months agoRevert "[-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas"
Ziqing Luo [Wed, 8 Feb 2023 01:05:24 +0000 (17:05 -0800)]
Revert "[-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas"

This reverts commit aef05b5dc5c566bcaa15b66c989ccb8d2841ac71.
It causes a buildbot failure: https://lab.llvm.org/buildbot/#/builders/216/builds/16879/steps/6/logs/stdio

17 months ago[libc++] Implement P1328R1 constexpr std::type_info::operator==
Louis Dionne [Tue, 7 Feb 2023 01:08:19 +0000 (17:08 -0800)]
[libc++] Implement P1328R1 constexpr std::type_info::operator==

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

17 months ago[DAGCombine] Allow scalable type dead store elimination.
Dinar Temirbulatov [Wed, 8 Feb 2023 00:57:26 +0000 (00:57 +0000)]
[DAGCombine] Allow scalable type dead store elimination.

Add support to allow removing a dead store for scalable types. Avoid to remove
scalable type store in favor of fixed type store, since scalable type size is
unknown at the compile time.

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

17 months ago[-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas
Ziqing Luo [Wed, 8 Feb 2023 00:45:44 +0000 (16:45 -0800)]
[-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

Add a pair of clang pragmas:
- `#pragma clang unsafe_buffer_usage begin` and
- `#pragma clang unsafe_buffer_usage end`,
which specify the start and end of an (unsafe buffer checking) opt-out
region, respectively.

Behaviors of opt-out regions conform to the following rules:

- No nested nor overlapped opt-out regions are allowed. One cannot
  start an opt-out region with `... unsafe_buffer_usage begin` but never
  close it with `... unsafe_buffer_usage end`. Mis-use of the pragmas
  will be warned.
- Warnings raised from unsafe buffer operations inside such an opt-out
  region will always be suppressed. This behavior CANNOT be changed by
  `clang diagnostic` pragmas or command-line flags.
- Warnings raised from unsafe operations outside of such opt-out
  regions may be reported on declarations inside opt-out
  regions. These warnings are NOT suppressed.
- An un-suppressed unsafe operation warning may be attached with
  notes. These notes are NOT suppressed as well regardless of whether
  they are in opt-out regions.

The implementation maintains a separate sequence of location pairs
representing opt-out regions in `Preprocessor`.  The `UnsafeBufferUsage`
analyzer reads the region sequence to check if an unsafe operation is
in an opt-out region. If it is, discard the warning raised from the
operation immediately.

Reviewed by: NoQ

Differential revision: https://reviews.llvm.org/D140179

17 months ago[libc++][NFC] Use _LIBCPP_HIDE_FROM_ABI everywhere in pair
Louis Dionne [Wed, 8 Feb 2023 00:52:28 +0000 (16:52 -0800)]
[libc++][NFC] Use _LIBCPP_HIDE_FROM_ABI everywhere in pair

17 months ago[gn build] Port 692da6245d71
LLVM GN Syncbot [Wed, 8 Feb 2023 00:16:16 +0000 (00:16 +0000)]
[gn build] Port 692da6245d71

17 months ago[-Wunsafe-buffer-usage] Filter out conflicting fix-its
Ziqing Luo [Wed, 8 Feb 2023 00:04:09 +0000 (16:04 -0800)]
[-Wunsafe-buffer-usage] Filter out conflicting fix-its

Two fix-its conflict if they have overlapping source ranges. We shall
not emit conflicting fix-its.  This patch checks conflicts in fix-its
generated for one variable (including variable declaration fix-its and
variable usage fix-its). If there is any, we do NOT emit any fix-it
for that variable.

Reviewed by: NoQ

Differential revision: https://reviews.llvm.org/D141338

17 months agoOnly run the weird new try-to-read-too-much test on Darwin
Jason Molenda [Wed, 8 Feb 2023 00:04:14 +0000 (16:04 -0800)]
Only run the weird new try-to-read-too-much test on Darwin

I'm still getting linux CI bot failures for this test.  It's not
critical, and it depends on a failure mode that is true on Darwin
but I was always gambling that it might fail in the same way on
other systems.

17 months agoFix TestProcessAPI.py to only allocate sys.maxsize buffer
Jason Molenda [Tue, 7 Feb 2023 23:25:51 +0000 (15:25 -0800)]
Fix TestProcessAPI.py to only allocate sys.maxsize buffer

I hardcoded nearly a UINT64_MAX number in this test case,
and python is not able to convert it to a long on some
platforms.  Use sys.maxsize instead; this also would have
failed if the testsuite was run on a 32-bit system.

17 months ago[emacs] Add llvm-mir-mode
Justin Bogner [Tue, 7 Feb 2023 23:54:49 +0000 (15:54 -0800)]
[emacs] Add llvm-mir-mode

Adds an emacs mode for .mir files. For the most part this just
consists of keyword rules for various MIR constructs and then
appending the llvm-mode keywords to that. This doesn't currently
attempt to do anything to be aware of the YAML structure or
differentiate between machine IR and embedded LLVM IR.

17 months agoAdd `set(CMAKE_CXX_STANDARD 17)` to MLIR CMakeLists.txt
Mehdi Amini [Tue, 7 Feb 2023 23:54:27 +0000 (15:54 -0800)]
Add `set(CMAKE_CXX_STANDARD 17)` to MLIR CMakeLists.txt

This is only useful when building the project in a "standalone" way: that is by
invoking cmake pointing at mlir/ to build against an already built LLVM.

Fixes #60574

17 months ago[mlir][memref] fix typo in documentation (NFC)
Peiming Liu [Tue, 7 Feb 2023 23:49:29 +0000 (23:49 +0000)]
[mlir][memref] fix typo in documentation (NFC)

Reviewed By: aartbik

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

17 months ago[bazel] Fix libc
Fangrui Song [Tue, 7 Feb 2023 23:51:06 +0000 (15:51 -0800)]
[bazel] Fix libc

17 months ago[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations
Ziqing Luo [Tue, 7 Feb 2023 23:38:21 +0000 (15:38 -0800)]
[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations

Use clang fix-its to transform declarations of local variables, which
are used for buffer access , to be of std::span type.

We placed a few limitations to keep the solution simple:
- it only transforms local variable declarations (no parameter declaration);
- it only considers single level pointers, i.e., pointers of type T * regardless of whether T is again a pointer;
- it only transforms to std::span types (no std::array, or std::span::iterator, or ...);
    - it can only transform a VarDecl that belongs to a DeclStmt whose has a single child.

One of the purposes of keeping this patch simple enough is to first
evaluate if fix-it is an appropriate approach to do the
transformation.

This commit was reverted by 622be09c815266632e204eaf1c7a35f050220459
for a compilation warning and now it is fixed.

Reviewed by: NoQ, jkorous

Differential revision: https://reviews.llvm.org/D139737

17 months ago[Sanitizers] Fix read buffer overrun in scanning loader commands
Mariusz Borsa [Tue, 7 Feb 2023 22:19:54 +0000 (14:19 -0800)]
[Sanitizers] Fix read buffer overrun in scanning loader commands

The fix only affects Darwin, but to write the test I had to modify
the MemoryMappingLayout class which is used by all OSes,
to allow for mocking of image header (this change should be NFC). Hence no [Darwin] in the subject
so I can get more eyes on it.

While looking for a memory gap to put the shadow area into, the sanitizer code
scans through the loaded images, and for each image it scans through its
loader command to determine the occupied memory ranges.

While doing so, if the 'segment load' (kLCSegment) loader comand is encountered, the command scanning function
returns success (true), but does not decrement the command list iterator counter.
The result is that the function is called again and again, with the iterator counter
now being too high. The command scanner keeps updating the loader command pointer,
by using the command size field.

If the loop counter is too high, the command pointer
lands into unintended area ( beyond
+sizeof(mac_header64)+header->sizeofcmds ),
and result depends on the random content found there.

The random content interpreted as loader command might contain a large integer value in the
cmdsize field - this value is added to the current loader command pointer,
which might now point to an inaccessible memory address. It can occasionally result
in a crash if it happens to run beyond the mapped memory segment.

Note that when the area after the loader command list
contains zeros or small integers only, the loop will end normally and the problem
will go unnoticed. So it happened until now since having a some big value
after the header area, falling into command size field is a pretty rare situation.

The fix makes sure that the iterator counter gets updated when the segment load (kLCSegment)
loader command is found too, and in the same code location so the updates will always go together.

Undo the changes in the sanitizer_procmaps_mac.cpp to see the test failing.

rdar://101161047
rdar://102819707

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

17 months ago[Clang][CMake] Set up distribution target for Clang-BOLT
Amir Ayupov [Tue, 7 Feb 2023 23:05:34 +0000 (15:05 -0800)]
[Clang][CMake] Set up distribution target for Clang-BOLT

Provide a way to install usable BOLT-optimized Clang
(clang + resource headers) using
`ninja clang-bolt install-distribution` with BOLT.cmake cache file
or `ninja stage2-clang-bolt stage2-install-distribution`
with BOLT-PGO.cmake cache file.

Reviewed By: phosek

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

17 months ago[mlir][gpu] Add support for integer types in gpu.subgroup_mma ops
Quinn Dawkins [Mon, 6 Feb 2023 04:53:38 +0000 (23:53 -0500)]
[mlir][gpu] Add support for integer types in gpu.subgroup_mma ops

The signedness is carried by `!gpu.mma_matrix` types to most closely
match the Cooperative Matrix specification which determines signedness
with the type (and sometimes the operation).

See: https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/NV/SPV_NV_cooperative_matrix.html

To handle the lowering from vector to gpu, ops such as arith.extsi are
pattern matched next to `vector.transfer_read` and `vector.contract` to
determine the signedness of the matrix type.

Enables s8 and u8 WMMA types in NVVM for the GPUToNVVM conversion.

Reviewed By: ThomasRaoux

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

17 months agoRevert "[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations"
Ziqing Luo [Tue, 7 Feb 2023 22:47:43 +0000 (14:47 -0800)]
Revert "[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations"

This reverts commit a29e67614c3b7018287e5f68c57bba7618aa880e.

17 months ago[mlir] Relax version requirement for PyYAML in mlir
Stella Stamenova [Tue, 7 Feb 2023 22:24:55 +0000 (14:24 -0800)]
[mlir] Relax version requirement for PyYAML in mlir

Some Ubuntu 20.04 images come with PyYAML 5.3.1 pre-installed through distutils. This makes pip very angry. See https://github.com/yaml/pyyaml/issues/349.

Since older versions of PyYAML should work for mlir, relax the version requirement to ease developer setup.

Reviewed By: stellaraccident

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

17 months ago[NVPTX] Lower extraction of upper half of i32/i64 as partial move.
Artem Belevich [Tue, 7 Feb 2023 00:32:22 +0000 (16:32 -0800)]
[NVPTX] Lower extraction of upper half of i32/i64 as partial move.

This produces better SASS than right-shift + truncate and is fairly common for
CUDA code that operates on __half2 values represented as opaque integer.

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

17 months agoCheck if null buffer handed to SBProcess::ReadMemory
Jason Molenda [Tue, 7 Feb 2023 21:54:41 +0000 (13:54 -0800)]
Check if null buffer handed to SBProcess::ReadMemory

Add a check for a null destination buffer in SBProcess::ReadMemory,
and return an error if that happens.  If a Python SB API script
tries to allocate a huge amount of memory, the malloc done by the
intermediate layers will fail and will hand a null pointer to
ReadMemory.  lldb will eventually crash trying to write in to that
buffer.

Also add a test that tries to allocate an impossibly large amount
of memory, and hopefully should result in a failed malloc and hitting
this error codepath.

Differential Revision: https://reviews.llvm.org/D143012
rdar://104846609

17 months ago[VPlan] Mark load VPWidenMemoryInstruction as not having side-effects.
Florian Hahn [Tue, 7 Feb 2023 22:02:50 +0000 (22:02 +0000)]
[VPlan] Mark load VPWidenMemoryInstruction as not having side-effects.

Also add an assert using the underlying instruction to catch any
potential violations.

17 months ago[bazel] Make libc:__support_common depend on :libc_root
Fangrui Song [Tue, 7 Feb 2023 21:59:22 +0000 (13:59 -0800)]
[bazel] Make libc:__support_common depend on :libc_root

17 months ago[FuncSpec] Prevent assertion failure when no store value is found
Jonathon Penix [Tue, 7 Feb 2023 03:05:09 +0000 (19:05 -0800)]
[FuncSpec] Prevent assertion failure when no store value is found

If the only user of the Alloca argument provided to getPromotableAlloca()
is the same as the Call argument, StoreValue is never set and results
in an assertion failure that isa<> was used on a nullptr when passed into
getCandidateConstant().

This was originally seen when trying to build SPEC 2006 416.gamess using
flang with lto enabled.

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

17 months ago[LV] Remove unused load from RISCV test (NFC).
Florian Hahn [Tue, 7 Feb 2023 21:55:43 +0000 (21:55 +0000)]
[LV] Remove unused load from RISCV test (NFC).

The test contained a unused load that appears unrelated to the test
(store of vector of i1). Remove it to avoid test changes in follow-up
change which will lead to dead loads being removed.

17 months agoRemove textual headers from module map
Adrian Prantl [Tue, 7 Feb 2023 21:24:47 +0000 (13:24 -0800)]
Remove textual headers from module map

since headers were moved into the lib/ directory.

17 months ago[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations
Ziqing Luo [Tue, 7 Feb 2023 21:14:09 +0000 (13:14 -0800)]
[-Wunsafe-buffer-usage] Generate fix-it for local variable declarations

Use clang fix-its to transform declarations of local variables, which are used for buffer access , to be of std::span type.

We placed a few limitations to keep the solution simple:
- it only transforms local variable declarations (no parameter declaration);
- it only considers single level pointers, i.e., pointers of type T * regardless of whether T is again a pointer;
- it only transforms to std::span types (no std::array, or std::span::iterator, or ...);
- it can only transform a VarDecl that belongs to a DeclStmt whose has a single child.

One of the purposes of keeping this patch simple enough is to first
evaluate if fix-it is an appropriate approach to do the
transformation.

Reviewed by: NoQ, jkorous

Differential revision: https://reviews.llvm.org/D139737

17 months ago[RPOFunctionAttrs] Use LazyCallGraph instead of CallGraph
Samuel [Tue, 7 Feb 2023 18:05:36 +0000 (10:05 -0800)]
[RPOFunctionAttrs] Use LazyCallGraph instead of CallGraph

There are a few more uses of CallGraph that should be replaced with LazyCallGraph

Also delete legacy version of RPOFunctionAttrs since it is deprecated and LazyCallGraph is not available under the legacy pass manager.

Reviewed By: aeubanks

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

17 months ago[BOLT] Search section based on relocation symbol
yavtuk [Tue, 7 Feb 2023 20:23:44 +0000 (23:23 +0300)]
[BOLT] Search section based on relocation symbol

We need to search referenced section based on relocations symbol section
to properly match end section symbols. For example on some binaries we
can observe that init_array_end/fini_array_end might be "placed" in to
the gap and since no section could be found for address the relocation
would be skipped resulting in wrong ADRP imm after emitting new text
resulting in binary sigsegv.

Credits for the test to Vladislav Khmelevskii aka yota9.

17 months ago[bazel] Fix llvm/unittests after TargetParser change
Fangrui Song [Tue, 7 Feb 2023 21:06:23 +0000 (13:06 -0800)]
[bazel] Fix llvm/unittests after TargetParser change

17 months ago[bazel] Fix dependencies after TargetParser change
Fangrui Song [Tue, 7 Feb 2023 21:01:38 +0000 (13:01 -0800)]
[bazel] Fix dependencies after TargetParser change

17 months ago[Clang] Refactor "Designators" into a unified implementation [NFC]
Bill Wendling [Tue, 7 Feb 2023 18:01:44 +0000 (10:01 -0800)]
[Clang] Refactor "Designators" into a unified implementation [NFC]

The interfaces for designators (i.e. C99 designated initializers) was
done in two slightly different ways. This was rather wasteful as the
differences could be combined into one.

Reviewed By: rsmith

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

17 months ago[libc] Fix sanitizer
Guillaume Chatelet [Tue, 7 Feb 2023 20:56:12 +0000 (20:56 +0000)]
[libc] Fix sanitizer

17 months agoReland [LegacyPM] Remove some legacy passes
Arthur Eubanks [Tue, 20 Dec 2022 21:36:20 +0000 (13:36 -0800)]
Reland [LegacyPM] Remove some legacy passes

These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

Namely
* Internalize
* StripSymbols
* StripNonDebugSymbols
* StripDeadDebugInfo
* StripDeadPrototypes
* VectorCombine
* WarnMissedTransformations

Fixed previously failing ocaml tests (one of them seems to already be failing?)

17 months ago[libc][NFC] Rename macros
Guillaume Chatelet [Tue, 7 Feb 2023 20:41:30 +0000 (20:41 +0000)]
[libc][NFC] Rename macros

17 months ago[libc][NFC] Move code to sanitizer.h + more consistent naming
Guillaume Chatelet [Tue, 7 Feb 2023 15:23:40 +0000 (15:23 +0000)]
[libc][NFC] Move code to sanitizer.h + more consistent naming

17 months ago[AArch64][GlobalISel] Legalize wide s8/s16 vectors G_ADD/G_MUL/G_OR/...
Vladislav Dzhidzhoev [Tue, 7 Feb 2023 16:48:58 +0000 (17:48 +0100)]
[AArch64][GlobalISel] Legalize wide s8/s16 vectors G_ADD/G_MUL/G_OR/...

Clamp the max number of elements of s8/s16 vectors when legalizing G_ADD,
G_SUB, G_MUL, G_AND, G_OR, G_XOR, in order to support some wide vectors.

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

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

17 months agoAdd codegen for llvm log2/log10 elementwise builtins
Joshua Batista [Tue, 7 Feb 2023 19:26:08 +0000 (11:26 -0800)]
Add codegen for llvm log2/log10 elementwise builtins

Add codegen for llvm log2 / log10 elementwise builtin
The log2/log10 elementwise builtin is necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered when these functions are given inputs of incompatible types.
The new builtins are restricted to floating point types only.

Reviewed By: fhahn

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

17 months ago[BOLT][TEST] Fix is-strip test for NFC testing
Amir Ayupov [Tue, 7 Feb 2023 20:16:45 +0000 (12:16 -0800)]
[BOLT][TEST] Fix is-strip test for NFC testing

17 months ago[mlir][LLVMIR] Add lowering support for vp.muladd intrinsic
Diego Caballero [Tue, 7 Feb 2023 20:08:46 +0000 (20:08 +0000)]
[mlir][LLVMIR] Add lowering support for vp.muladd intrinsic

Reviewed By: gysit

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

17 months ago[OpenMP 5.2] Deprecate 'destroy' clause without argument for 'depobj' construct
Fazlay Rabbi [Tue, 7 Feb 2023 19:52:48 +0000 (11:52 -0800)]
[OpenMP 5.2] Deprecate 'destroy' clause without argument for 'depobj' construct

Deprecate and diagnose uses of the 'destroy' clauses without an argument
in 'omp depobj' directives.

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

17 months ago[mlir][Vector] Add lowering support for 1-D masked multi-reductions
Diego Caballero [Tue, 7 Feb 2023 19:25:19 +0000 (19:25 +0000)]
[mlir][Vector] Add lowering support for 1-D masked multi-reductions

1-D multi-reductions follow a different lowering path (they are
converted to 2-D multi-reductions) so masked variants need to be
supported explicitly.

Reviewed By: nicolasvasilache

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

17 months ago[flang] Add AMDGPU target in flang
Jan Sjodin [Wed, 1 Feb 2023 20:09:59 +0000 (15:09 -0500)]
[flang] Add AMDGPU target in flang

This is the first patch of several that will enable generating code for AMD
GPUs. It adds the AMDGPU target so it can be used with the --target and -mcpu
options.

Reviewed By: kiranchandramohan

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

17 months ago[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.
Siva Chandra Reddy [Mon, 6 Feb 2023 07:07:23 +0000 (07:07 +0000)]
[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.

This part of the effort to make all test related pieces into the `test`
directory. This helps is excluding test related pieces in a straight
forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move
the MPFR wrapper and testutils into the 'test' directory.

17 months ago[Serialization] Add support for (de)serializing #pragma pack
Dustin Howett [Tue, 7 Feb 2023 19:02:59 +0000 (11:02 -0800)]
[Serialization] Add support for (de)serializing #pragma pack

Serialization of tokens is required when PCH is used with late parsed
templates, including annotation tokens used for pragmas.

This patch implements the serialization for annot_pragma_pack.

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

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

17 months ago[CodeGen] Kill off a few more direct uses of EVT::getEVTString [nfc]
Philip Reames [Tue, 7 Feb 2023 19:22:13 +0000 (11:22 -0800)]
[CodeGen] Kill off a few more direct uses of EVT::getEVTString [nfc]

17 months ago[lit] don't skip test times when executions are instantaneous
Ashay Rane [Tue, 7 Feb 2023 19:27:23 +0000 (11:27 -0800)]
[lit] don't skip test times when executions are instantaneous

If a test executes quickly or if the timing resolution is too coarse,
the running time associated with a test could be zero. This happens
often for the //llvm/utils/lit/tests/reorder.py test on Windows, which
causes the test to fail non-deterministically.

This patch modifies the existing check, so that instead of skipping
zeros, lit now skips if the timing is None (presumably due to an error
in measurement). Recurring executions of the reorder.py test on Windows
seem to indicate that the test no longer exhibits occasional failure.

Reviewed By: stella.stamenova

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

17 months ago[AArch64] Recurse further into performUADDVCombine
David Green [Tue, 7 Feb 2023 19:14:06 +0000 (19:14 +0000)]
[AArch64] Recurse further into performUADDVCombine

This adjusts the performUADDVCombine to recurse further into adds from
reductions, which can help produce more UADDLP when the order of lanes is
unimportant. It also prevents some regressions from subsequent patches.

17 months ago[CodeGen] Add standard print/debug utilities to MVT
Philip Reames [Tue, 7 Feb 2023 18:41:18 +0000 (10:41 -0800)]
[CodeGen] Add standard print/debug utilities to MVT

Doing so makes it easier to do printf style debugging in idiomatic manner. I followed the code structure of Value with only the definition of dump being #ifdef out in non-debug builds. Not sure if this is the "right" option; we don't seem to have any single consistent scheme on how dump is handled.

Note: This is a follow up to D143454 which did the same for EVT.

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

17 months ago[llvm][IfConversion] update successor list when merging INLINEASM_BR
Nick Desaulniers [Tue, 7 Feb 2023 18:22:24 +0000 (10:22 -0800)]
[llvm][IfConversion] update successor list when merging INLINEASM_BR

If this successor list is not correct, then branch-folding may
incorrectly think that the indirect target is dead and remove it. This
results in a dangling reference to the removed block as an operand to
the INLINEASM_BR, which later will get AsmPrinted into code that doesn't
assemble.

This was made more obvious by, but is not a regression of
https://reviews.llvm.org/D130316.

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

Reviewed By: efriedma, void

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

17 months agoprecommit test for pr60346
Nick Desaulniers [Tue, 7 Feb 2023 18:19:12 +0000 (10:19 -0800)]
precommit test for pr60346

Link: https://github.com/llvm/llvm-project/issues/60346
Reviewed By: efriedma, void

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

17 months ago[NFC][Clang] Regenerate test output for SVE ACLE tests.
Paul Walker [Tue, 7 Feb 2023 18:17:51 +0000 (18:17 +0000)]
[NFC][Clang] Regenerate test output for SVE ACLE tests.

Just a rerun of update_cc_test_checks.py to capture some changes to
variable names after their reliance on instcombine was removed.

17 months ago[X86] combineX86ShufflesRecursively - peek through insert_subvector(undef, x, 0)...
Simon Pilgrim [Tue, 7 Feb 2023 18:24:50 +0000 (18:24 +0000)]
[X86] combineX86ShufflesRecursively - peek through insert_subvector(undef, x, 0) vector widening nodes

If the node is inert then just peek through it and canonicalize the shuffle mask to ensure any referenced upper elements are set to undef.

17 months agoRevert "[LegacyPM] Remove some legacy passes"
Arthur Eubanks [Tue, 7 Feb 2023 18:17:24 +0000 (10:17 -0800)]
Revert "[LegacyPM] Remove some legacy passes"

This reverts commit a4b4f62beb0bf40123181e5f5bdf32ef54f87166.

Ocaml bindings tests failing.

17 months ago[mlir][Linalg] NFC - Extract inferGemmDims - Amend forgotten changes
Nicolas Vasilache [Tue, 7 Feb 2023 18:16:46 +0000 (10:16 -0800)]
[mlir][Linalg] NFC - Extract inferGemmDims - Amend forgotten changes

17 months ago[mlir][Linalg] NFC - Extract inferGemmDims
Nicolas Vasilache [Tue, 7 Feb 2023 17:58:02 +0000 (09:58 -0800)]
[mlir][Linalg] NFC - Extract inferGemmDims

17 months ago[LegacyPM] Remove some legacy passes
Arthur Eubanks [Tue, 20 Dec 2022 21:36:20 +0000 (13:36 -0800)]
[LegacyPM] Remove some legacy passes

These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

Namely
* Internalize
* StripSymbols
* StripNonDebugSymbols
* StripDeadDebugInfo
* StripDeadPrototypes
* VectorCombine
* WarnMissedTransformations

17 months ago[CostModel][X86] Update LV UTC_ARGS regexp filter to match ptr instead of i8* etc.
Simon Pilgrim [Tue, 7 Feb 2023 17:46:34 +0000 (17:46 +0000)]
[CostModel][X86] Update LV UTC_ARGS regexp filter to match ptr instead of i8* etc.

17 months ago[libc] Add startup code implementation for GPU targets
Joseph Huber [Thu, 2 Feb 2023 21:05:54 +0000 (15:05 -0600)]
[libc] Add startup code implementation for GPU targets

This patch introduces startup code for executing `main` on a device
compiled for the GPU. We will primarily use this to run standalone
integration tests on the GPU. The actual execution of this routine will
need to be provided by a `loader` utility to bootstrap execution on the
GPU.

Reviewed By: sivachandra

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

17 months ago[clang] NFC: Remove GCC 5.1 workaround in FileEntry
Jan Svoboda [Mon, 6 Feb 2023 19:39:40 +0000 (11:39 -0800)]
[clang] NFC: Remove GCC 5.1 workaround in FileEntry

We no longer support GCC 5.1 (D122976), so let's remove the workaround in FileEntry.

Reviewed By: benlangmuir

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

17 months ago[clang][deps] Fix race condition
Jan Svoboda [Mon, 6 Feb 2023 19:36:51 +0000 (11:36 -0800)]
[clang][deps] Fix race condition

D140176 introduced new `FullDeps` API that's not thread-safe, breaking the class invariant. This was causing race condition when `clang-scan-deps` was run with multiple threads.

Reviewed By: steven_wu, akyrtzi

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

17 months ago[Hexagon] Add release note for LLVM 16
Krzysztof Parzyszek [Tue, 7 Feb 2023 17:24:06 +0000 (09:24 -0800)]
[Hexagon] Add release note for LLVM 16

17 months ago[X86] combineX86ShuffleChainWithExtract - refactor to remove need to widen all vectors
Simon Pilgrim [Tue, 7 Feb 2023 13:03:16 +0000 (13:03 +0000)]
[X86] combineX86ShuffleChainWithExtract - refactor to remove need to widen all vectors

combineX86ShuffleChain no longer needs the candidate shuffle inputs to all have been widened to root size, but combineX86ShuffleChainWithExtract still assumes that they have.

This refactor peeks through all inputs' extract_subvector nodes to find the widest legal vector type and widens the shuffle mask accordingly - it no longer bails if any of the inputs can't be widened to the new width.

combineX86ShuffleChainWithExtract now follows a similar process to combineX86ShufflesRecursively, so I think we should eventually be able to get rid of it and just let combineX86ShufflesRecursively handle widening the shuffle width as well.

Another step toward removing subvector widening for Issue #45319

17 months ago[ARM][AArch64][RISCV] Add tests for various double reductions. NFC
David Green [Tue, 7 Feb 2023 16:39:20 +0000 (16:39 +0000)]
[ARM][AArch64][RISCV] Add tests for various double reductions. NFC

17 months ago[CodeGen] Add standard print/debug utilities to EVT
Philip Reames [Tue, 7 Feb 2023 16:02:43 +0000 (08:02 -0800)]
[CodeGen] Add standard print/debug utilities to EVT

Doing so makes it easier to do printf style debugging in idiomatic manner. I followed the code structure of Value with only the definition of dump being #ifdef out in non-debug builds. Not sure if this is the "right" option; we don't seem to have any single consistent scheme on how dump is handled.

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

17 months ago[libc] Cleanup the CMake infrastructure to add startup objects.
Siva Chandra Reddy [Tue, 7 Feb 2023 06:46:09 +0000 (06:46 +0000)]
[libc] Cleanup the CMake infrastructure to add startup objects.

Instead of using a custom target to copy the startup object file to a
file with the desired name, a normal object library with a special
property is used.

Follow up patches will do more cleanup wrt how the startup objects are
used in integration tests.

Reviewed By: jhuber6

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

17 months ago[llvm] Add tests for upcoming fixes to pointer/index type confusion.
Krzysztof Drewniak [Mon, 6 Feb 2023 21:45:44 +0000 (21:45 +0000)]
[llvm] Add tests for upcoming fixes to pointer/index type confusion.

Various parts of the codebase are using getIntPtrType() and its
relatives when getting the type of the offset argument to GEP. Most
such code has been updated to use the pointer index type field from
the data layout, but there is code that still assumes these two types
are the same in certain optimizaiton passes.

This commit adds regression tests to capture the old behavior.

Reviewed By: #amdgpu, arsenm

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

17 months ago[mlir][doc] Remove outdated section about a deprecated `OpBuilder` use
Markus Böck [Tue, 7 Feb 2023 16:04:28 +0000 (17:04 +0100)]
[mlir][doc] Remove outdated section about a deprecated `OpBuilder` use

This syntax has been removed two years ago in https://github.com/llvm/llvm-project/commit/2f5569f6f67a30f7774f7c2d2f3d726752a862ae yet the doc still had a section marking them as deprecated

17 months ago[Flang] [Semantics] More descript warning message for same named external statements...
Paul Scoropan [Mon, 6 Feb 2023 19:09:10 +0000 (19:09 +0000)]
[Flang] [Semantics] More descript warning message for same named external statements and interfaces

For issue: https://github.com/llvm/llvm-project/issues/56605. Previous error messages are not descriptive of problem. Issuing warnings instead that do not halt compilation but offer better description of problem.

Reviewed By: klausler

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

17 months ago[OpenMP][libomp] Remove false positive for memory sanitizer
Jonathan Peyton [Mon, 6 Feb 2023 19:32:35 +0000 (13:32 -0600)]
[OpenMP][libomp] Remove false positive for memory sanitizer

The memory sanitizer intercepts the memcpy() call but not the direct
assignment of last byte to 0. This leads the sanitizer to believe the
last byte of a string based on the kmp_str_buf_t type is uninitialized.
Hence, the eventual strlen() inside __kmp_env_dump() leads to an
use-of-uninitialized-value warning.

Using strncat() instead gives the sanitizer the information it needs.

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

Fixes #60501

17 months ago[WebAssembly][test][NFC] Add coverage of non-void funcref calls
Alex Bradbury [Tue, 7 Feb 2023 15:56:10 +0000 (15:56 +0000)]
[WebAssembly][test][NFC] Add coverage of non-void funcref calls

This is trickier to handle in some other representations of funcrefs
that are being explored, so it makes sense to ensure we have some
coverage of this requirement.

17 months ago[HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated
Kirill Stoimenov [Tue, 7 Feb 2023 00:02:17 +0000 (00:02 +0000)]
[HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated

After D143438 there is no point in this check as the size will never 0. Also this keeps it consistent with ASAN where there is not size check in LsanMetadata::allocated.

Reviewed By: MaskRay, vitalybuka

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

17 months ago[mlir][ods] add mechanism for deprecating an `OpBuilder` in ODS
Markus Böck [Thu, 2 Feb 2023 15:35:02 +0000 (16:35 +0100)]
[mlir][ods] add mechanism for deprecating an `OpBuilder` in ODS

This allows discouraging the use of specific build methods of an op by having TableGen generate C++ code, instructing the C++ compiler to warn on use of the `build` method.
The implementation uses the C++14 `[[deprecated(...)]]`` for this purpose. I considered using `LLVM_DEPRECATED`, but thought requiring a fix-it was not necassery, nor would the syntax in ODS have been very nice.

My motivation for this change is that in the future I'd like to deprecate the use `build` methods in the LLVM Dialect, not using explicit pointer types for ops such as `llvm.load` or `llvm.alloca`, which makes the code not future proof for opaque pointers. In-tree has to be clean first before I could commit such a change of course, but I thought the initial infrastructure change could already be submitted.

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