platform/upstream/llvm.git
18 months ago[llvm-c-test] Fix warnings
Kazu Hirata [Tue, 31 Jan 2023 20:15:04 +0000 (12:15 -0800)]
[llvm-c-test] Fix warnings

This patch fixes:

  llvm/tools/llvm-c-test/metadata.c:49:16: error: unused variable
  'tmp' [-Werror,-Wunused-variable]

  llvm-project/llvm/tools/llvm-c-test/metadata.c:70:16: error: unused
  variable 'md' [-Werror,-Wunused-variable]

  llvm/tools/llvm-c-test/metadata.c:74:16: error: unused variable
  'md2' [-Werror,-Wunused-variable]

18 months agoRevert "[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend"
Argyrios Kyrtzidis [Tue, 31 Jan 2023 20:01:32 +0000 (12:01 -0800)]
Revert "[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend"

Causes clang build failures, see https://reviews.llvm.org/D141910#4089465 for details.

This reverts commit ca446037af019d1aa01b1352a30a18df33038359.

18 months ago[clang-format] Fix use after free in FormatTokenSource test
Benjamin Kramer [Tue, 31 Jan 2023 19:59:42 +0000 (20:59 +0100)]
[clang-format] Fix use after free in FormatTokenSource test

Add a lifetime annotation to IndexedTokenSource so we get a warning for
this pattern.

18 months ago[InstCombine] reduce icmp_ne0-of-and-of-select-of-constants
Sanjay Patel [Tue, 31 Jan 2023 19:29:57 +0000 (14:29 -0500)]
[InstCombine] reduce icmp_ne0-of-and-of-select-of-constants

Follow-up to:
D142847 / 98855059674c

This handles the 'ne' variant by inverting the result.

https://alive2.llvm.org/ce/z/D229jS

18 months ago[InstCombine] add tests for icmp-ne0-of-and-of-select-of-constants; NFC
Sanjay Patel [Tue, 31 Jan 2023 19:13:00 +0000 (14:13 -0500)]
[InstCombine] add tests for icmp-ne0-of-and-of-select-of-constants; NFC

18 months ago[-Wunsafe-buffer-usage] Introduce the unsafe_buffer_usage attribute
Rashmi Mudduluru [Tue, 31 Jan 2023 19:43:34 +0000 (11:43 -0800)]
[-Wunsafe-buffer-usage] Introduce the unsafe_buffer_usage attribute

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

18 months ago[AArch64] Make nosimd imply nocrypto
David Green [Tue, 31 Jan 2023 19:17:22 +0000 (19:17 +0000)]
[AArch64] Make nosimd imply nocrypto

This adds a quick check for -neon, making it imply the same as -crypto,
which helps get some features correct in more cases.

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

18 months ago[MemProf] Make test more resilient to cpu scheduling
Teresa Johnson [Tue, 31 Jan 2023 19:01:42 +0000 (11:01 -0800)]
[MemProf] Make test more resilient to cpu scheduling

Loosen up the matching so that occasional cpu migrations don't break the
test. This showed up occasionally in internal testing.

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

18 months ago[flang] Use fir.type_desc and delay type desc address resolution
Valentin Clement [Tue, 31 Jan 2023 19:09:56 +0000 (20:09 +0100)]
[flang] Use fir.type_desc and delay type desc address resolution

Makes use of fir.type_desc in order to delay the type desc address
resolution. The lowering inserts fir.type_desc operation instead of fir.addr_of
operation pointing to the fir.global type descriptor. The fir.type_desc
operation is then lowered in code gen to an address of operation in the LLVM
dialect. At this stage, the type descriptor is generated in all cases.

Reviewed By: vdonaldson

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

18 months ago[NFC][libc++] Addresses LWG3781.
Mark de Wever [Mon, 30 Jan 2023 18:09:30 +0000 (19:09 +0100)]
[NFC][libc++] Addresses LWG3781.

  LWG3781 The exposition-only alias templates cont-key-type and
  cont-mapped-type should be removed

Libc++ never implemented these aliases.

Reviewed By: #libc, philnik, ldionne

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

18 months ago[libc++] Addresses LWG3755.
Mark de Wever [Mon, 30 Jan 2023 17:30:03 +0000 (18:30 +0100)]
[libc++] Addresses LWG3755.

  LWG3755 tuple-for-each can call user-defined operator,

Reviewed By: #libc, ldionne, philnik

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

18 months ago[libc++] Marks LWG2970 as complete.
Mark de Wever [Sun, 29 Jan 2023 14:11:56 +0000 (15:11 +0100)]
[libc++] Marks LWG2970 as complete.

  LWG2970 Return type of std::visit misspecified

Was applied in D86006 including tests.

Reviewed By: #libc, ldionne

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

18 months ago[libc++] Partly addresses LWG3798.
Mark de Wever [Sat, 21 Jan 2023 12:38:43 +0000 (13:38 +0100)]
[libc++] Partly addresses LWG3798.

  LWG3798 Rvalue reference and iterator_category

The changes are only applied to `ranges::transform_view`, the other
views haven't been implemented yet.

Reviewed By: #libc, ldionne

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

18 months ago[libc++] Addresses LWG3764.
Mark de Wever [Sat, 21 Jan 2023 12:38:41 +0000 (13:38 +0100)]
[libc++] Addresses LWG3764.

  LWG3764 reference_wrapper::operator() should propagate noexcept

As drive-by adds constexpr to the synopsis, since it has already been
implemented.

Reviewed By: #libc, ldionne

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

18 months ago[NFC][libc++][format] Uses retarget buffer.
Mark de Wever [Sun, 29 Jan 2023 12:40:58 +0000 (13:40 +0100)]
[NFC][libc++][format] Uses retarget buffer.

Lets the tuple formatter use the retarget buffer added for the range
formatter.

Reviewed By: #libc, ldionne

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

18 months ago[lldb] Fix warning about unhandled enum value `WasmExternRef` (NFC).
Jorge Gorbe Moya [Tue, 31 Jan 2023 18:25:15 +0000 (10:25 -0800)]
[lldb] Fix warning about unhandled enum value `WasmExternRef` (NFC).

18 months ago[mlir][sparse] Extend sorting function generator to support operand beyond (lo, hi...
bixia1 [Tue, 31 Jan 2023 16:36:29 +0000 (08:36 -0800)]
[mlir][sparse] Extend sorting function generator to support operand beyond (lo, hi, xs, ys).

This is to prepare for implementing a hybrid quick sort, which switches to heap
sort when the recursive depth exceeds certain limits.

Reviewed By: aartbik

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

18 months ago[libc++] Fixes the Clang modular build.
Mark de Wever [Fri, 27 Jan 2023 07:02:09 +0000 (08:02 +0100)]
[libc++] Fixes the Clang modular build.

The patch
430b397f6715d4d2f2569716c93fcd6292ace3dc ("[libc++] Granularize <type_traits> includes in <iterator>") missed some exports in the modulemap with became apparent in the reverting commit 12cb1cb3720d.

This fixes the issue by updating the modulemap. Note that the Clang ICE is not fixed by this change.

Reviewed By: #libc, ldionne

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

18 months ago[mlir][Linalg] Add a transform.structured.lower_pack op
Nicolas Vasilache [Fri, 27 Jan 2023 16:24:14 +0000 (08:24 -0800)]
[mlir][Linalg] Add a transform.structured.lower_pack op

This revision introduces `transform.structured.lower_pack` which allows
rewriting a `tensor.pack` to `tensor.pad` + `tensor.expand_shape` + `linalg.transpose`.

The implementation is currently limited to static pack ops that do not have outer_dims permutations.

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

18 months ago[Kaleidoscope] Update code snippets in text to match full code listings
Dhruv Chawla [Tue, 31 Jan 2023 17:56:53 +0000 (23:26 +0530)]
[Kaleidoscope] Update code snippets in text to match full code listings

There were quite a few places in the tutorial where the snippets were not up to date with the full code listings given. I have updated all of the ones I could find, which mostly involves changing `.` to `->` when accessing through a `std::unique_ptr`, changing `while (1)` to `while (true)`, and other such small changes.

There are still however a few places where I am not sure what to do, such as:
- Chapter 4: `ParseTopLevelExpr()` in chapter 3 sets the ProtoTypeAST
             name to "", however it is referred to as "__anon_expr"
             in chapter 4. Would it be required to mention this change
             in chapter 4?
- Chapter 9: The code snippets refer to the top level expression as
             "main", however the full code listing refers to it as
             "__anon_expr". I think given the context of the chapter
             it makes sense to refer to it as "main", so I have
             updated the code listing to reflect that.
- Chapter 9: In chapter 9 the diff given for `HandleTopLevelExpression()`
             deletes code that is not mentioned anywhere else, so I am
             not sure what is to be done there.
- Miscellaneous: I don't think this is very important, however the
                 casing used for the first word of error messages
                 tends to vary between upper and lower case between
                 chapters and I do not know if it is worth reconciling
                 these differences.

Reviewed By: xgupta

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

18 months ago[llvm-c] add LLVMReplaceMDNodeOperandWith
Davide Bertola [Tue, 31 Jan 2023 17:02:50 +0000 (09:02 -0800)]
[llvm-c] add LLVMReplaceMDNodeOperandWith

I'm working on a tool that visits debug info and massages it using the
llvm-c API. I noticed that LLVMGetOperand special cases MDNodes so I
can get their operands, but I can't replace them. This patch adds
LLVMReplaceMDNodeOperandWith which boils down to
MDNode::replaceOperandWith.

The name was chosen for consistency with LLVMGetMDNodeOperands and
LLVMGetMDNodeNumOperands.

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

18 months ago[AST] assert(false) -> llvm_unreachable
Benjamin Kramer [Tue, 31 Jan 2023 17:55:58 +0000 (18:55 +0100)]
[AST] assert(false) -> llvm_unreachable

Has the advantage of not triggering missing return warnings even in
NDEBUG builds.

18 months ago[Clang] Do not attempt to directly link arch tools in 32-bit mode
Joseph Huber [Tue, 31 Jan 2023 17:55:05 +0000 (11:55 -0600)]
[Clang] Do not attempt to directly link arch tools in 32-bit mode

Summary:
We offer almost no support for offloading on 32-bit systems. This causes
some problems when cross-compiling for 32-bit machines as it will find
the CUDA from the host that is incompatible. Instead we force these to
always use the dynamically loaded version, which should always compile.

18 months ago[Clang] Add machinery to catch overflow in unary minus outside of a constant expressi...
Shafik Yaghmour [Tue, 31 Jan 2023 17:33:06 +0000 (09:33 -0800)]
[Clang] Add machinery to catch overflow in unary minus outside of a constant expression context

We provide several diagnostics for various undefined behaviors due to signed
integer overflow outside of a constant expression context. We were missing the
machinery to catch overflows due to unary minus.

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

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

18 months ago[llvm-ifs] Add support for --target=riscv
Alex Brachet [Tue, 31 Jan 2023 17:31:35 +0000 (17:31 +0000)]
[llvm-ifs] Add support for --target=riscv

18 months ago[MTE] Add AArch64GlobalsTagging Pass
Mitch Phillips [Tue, 31 Jan 2023 17:24:13 +0000 (09:24 -0800)]
[MTE] Add AArch64GlobalsTagging Pass

Adds an IR pass for -fsanitize=memtag-globals. This pass goes over the
tag-capable global variables, and replaces them with a tagged global
variable of the same contents. This new global variable will have its
size and alignment adjusted if neccesary so that they're both a multiple
of the tag granule size (16 bytes).

Global merge must also be suppressed for tagged globals, as each global
variable must have a unique tag. This can possibly be relaxed in future;
globals that are identical in size, alignment, and content can possibly
be merged. The major problem comes from tail- or head-merging, which if
left unchecked, could have partially-overlapping global variables with
different memory tags, leading to crashes at runtime.

Reviewed By: fmayer, eugenis

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

18 months ago[RISCV] Handle FRMArg as an optional operand instead of using InstAliases.
Craig Topper [Tue, 31 Jan 2023 17:08:13 +0000 (09:08 -0800)]
[RISCV] Handle FRMArg as an optional operand instead of using InstAliases.

Instead of having InstAliases without operand. Use the optional
operand infrastructure.

Still use the PrintAliases/NoAlias controls to determine if we
print "dyn" or not.

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

18 months ago[clang][WebAssembly] Initial support for reference type externref in clang
Paulo Matos [Mon, 9 Jan 2023 14:15:12 +0000 (15:15 +0100)]
[clang][WebAssembly] Initial support for reference type externref in clang

This patch introduces a new type __externref_t that denotes a WebAssembly opaque
reference type. It also implements builtin __builtin_wasm_ref_null_extern(),
that returns a null value of __externref_t. This lays the ground work
for further builtins and reference types.

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

18 months ago[flang] Single entry point for GET_ENVIRONMENT_VARIABLE
Leandro Lupori [Thu, 19 Jan 2023 17:45:19 +0000 (17:45 +0000)]
[flang] Single entry point for GET_ENVIRONMENT_VARIABLE

This patch refactors the runtime support for GET_ENVIRONMENT_VARIABLE
to have a single entry point instead of 2. It also updates lowering
accordingly.

This makes it easier to handle dynamically optional arguments.
See also https://reviews.llvm.org/D118777

Reviewed By: jeanPerier

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

18 months ago[SanitizerBinaryMetadata] Pretend compiler-generated loads/stores are atomic
Marco Elver [Tue, 31 Jan 2023 16:28:23 +0000 (17:28 +0100)]
[SanitizerBinaryMetadata] Pretend compiler-generated loads/stores are atomic

Profiling and GCOV generate known data-racy loads/stores. Pretend they
are atomic so that analysis using PC-keyed metadata for atomics do not
report them as data races (which would look like false positives).

Reviewed By: dvyukov

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

18 months ago[flang] Suppress a warning in D118631 [-Wunused-result]
Shao-Ce SUN [Tue, 31 Jan 2023 16:24:43 +0000 (00:24 +0800)]
[flang] Suppress a warning in D118631 [-Wunused-result]

Reviewed By: klausler

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

18 months ago[flang] More subscript triplet checking at compilation time
Peter Klausler [Mon, 30 Jan 2023 22:37:48 +0000 (14:37 -0800)]
[flang] More subscript triplet checking at compilation time

When a triplet's lower and upper bounds are the same, we can
check them without requiring a constant stride.

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

18 months ago[flang] Handle missing substring upper bound better when folding
Peter Klausler [Tue, 31 Jan 2023 00:06:09 +0000 (16:06 -0800)]
[flang] Handle missing substring upper bound better when folding

When folding a substring of a named constant or character literal,
acquire the value of a missing upper bound from the base object.

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

18 months ago[clangd] Add semantic token for angle brackets
Christian Kandeler [Wed, 20 Jul 2022 08:57:59 +0000 (10:57 +0200)]
[clangd] Add semantic token for angle brackets

This is needed for clients that would like to visualize matching
opening and closing angle brackets, which can be valuable in non-trivial
template declarations or instantiations.
It is not possible to do this with simple lexing, as the tokens
could also refer to operators.

Reviewed By: kadircet

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

18 months ago[clang-format][NFC] Bring FormatTokenSource under test.
Manuel Klimek [Tue, 31 Jan 2023 16:03:26 +0000 (16:03 +0000)]
[clang-format][NFC] Bring FormatTokenSource under test.

Add tests for FormatTokenSource and harden it against edge cases.

18 months ago[BranchRelaxation] Strengthen post condition assertions
Philip Reames [Tue, 31 Jan 2023 15:50:40 +0000 (07:50 -0800)]
[BranchRelaxation] Strengthen post condition assertions

The whole point of this pass is to rewrite branches so that branches are in bounds. We should assert that we succeeded rather than just that we kept our internal data structure in sync.

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

18 months ago[flang][driver] Add support for -embed-offload-object flag in flang
Jan Sjodin [Fri, 20 Jan 2023 19:33:22 +0000 (14:33 -0500)]
[flang][driver] Add support for -embed-offload-object flag in flang

This patch adds support for the -embed-offload-object flag to embed offloading
binaries in host code. This flag is identical to the clang flag with the same name.

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

Reviewed By: awarzynski, jhuber6

18 months ago[mlir][SubElements] Disambiguate cast<> call for MSVC
Benjamin Kramer [Tue, 31 Jan 2023 15:34:41 +0000 (16:34 +0100)]
[mlir][SubElements] Disambiguate cast<> call for MSVC

For some reason MSVC selects Attribute::cast here, and then fails to
call it because it takes no arguments. Feels like a generic lambda compiler
bug.

mlir/include\mlir/IR/StorageUniquerSupport.h(135): error C2672: 'mlir::Attribute::cast': no matching overloaded function found

18 months ago[PowerPC] Do not convert lwz to lwa if the offset is not a multiple of 4
Nemanja Ivanovic [Tue, 31 Jan 2023 15:52:13 +0000 (09:52 -0600)]
[PowerPC] Do not convert lwz to lwa if the offset is not a multiple of 4

The transform that converts this checks the alignment of the global
object being accessed. However, there was no check for the offset
within the global object which caused the compiler to produce a
DS relocation for an unaligned address.

18 months ago[RISCV] Add asserts that we don't increase codesize during pseudo expansion
Philip Reames [Tue, 31 Jan 2023 15:44:53 +0000 (07:44 -0800)]
[RISCV] Add asserts that we don't increase codesize during pseudo expansion

We currently assume that pseudo expansion doesn't increase the distance between a branch and it's label. This patch adds some asserts to catch violations of this property in pseudo expansion.

I chose to only do the assertion at the function level as we have to scan the whole function for size changes (since expansion can create multiple blocks). We could cache individual block sizes, and thus make the check cheap enough to do after every expansion, but that requires more complex code.

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

18 months ago[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer
Adrian Vogelsgesang [Tue, 31 Jan 2023 13:16:04 +0000 (05:16 -0800)]
[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer

So far, the pretty printer for `std::coroutine_handle` internally
dereferenced the contained frame pointer displayed the `promise`
as a sub-value. As noticed in https://reviews.llvm.org/D132624
by @labath, this can lead to an endless loop in lldb during printing
if the coroutine frame pointers form a cycle.

This commit breaks the cycle by exposing the `promise` as a pointer
type instead of a value type. The depth to which the `frame variable`
and the `expression` commands dereference those pointers can be
controlled using the `--ptr-depth` argument.

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

18 months ago[AArch64][SME2] Add LLVM IR intrinsics for multi-single dots
David Sherwood [Tue, 31 Jan 2023 15:18:58 +0000 (15:18 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for multi-single dots

Adds intrinsics for the following SME2 instructions:

* sdot (multi-single, 2 and 4 vectors, 32-bit and 64-bit ZA)
* udot (multi-single, 2 and 4 vectors, 32-bit and 64-bit ZA)
* usdot (multi-single, 2 and 4 vectors)
* sudot (multi-single, 2 and 4 vectors)
* fdot (multi-single, 2 and 4 vectors)
* bfdot (multi-single, 2 and 4 vectors)

NOTE: These intrinsics are still in development and are subject to future changes.

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

18 months ago[clang][CGCall] Remove header file not used. [NFCI]
Francesco Petrogalli [Tue, 31 Jan 2023 15:11:58 +0000 (16:11 +0100)]
[clang][CGCall] Remove header file not used. [NFCI]

Reviewed By: fpetrogalli

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

18 months ago[reland][NFC] Transition GlobalObject alignment from MaybeAlign to Align
Guillaume Chatelet [Tue, 31 Jan 2023 15:02:46 +0000 (15:02 +0000)]
[reland][NFC] Transition GlobalObject alignment from MaybeAlign to Align

This is a follow up on https://reviews.llvm.org/D142459#4081179.
This first patch adds an overload to `GlobalObject::setAlignment` that accepts an `Align` type.
This already handles most of the calls.

This patch also converts a few call sites to the new type when this is safe.

Here is the list of the remaining call sites:

 - [clang/lib/CodeGen/CodeGenModule.cpp:1688](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/clang/lib/CodeGen/CodeGenModule.cpp#L1688)
 - [llvm/lib/AsmParser/LLParser.cpp:1309](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L1309)
 - [llvm/lib/AsmParser/LLParser.cpp:6050](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L6050)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3871](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L3871)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4030](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L4030)
 - [llvm/lib/IR/Core.cpp:2018](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Core.cpp#L2018)
 - [llvm/lib/IR/Globals.cpp:141](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Globals.cpp#L141)
 - [llvm/lib/Linker/IRMover.cpp:660](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/IRMover.cpp#L660)
 - [llvm/lib/Linker/LinkModules.cpp:361](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L361)
 - [llvm/lib/Linker/LinkModules.cpp:362](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L362)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:782](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L782)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:840](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L840)
 - [llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1813](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L1813)
 - [llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp:27](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp#L27)

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

18 months ago[clang-format][NFC] Move IndexedTokenSource to FormatTokenSource header.
Manuel Klimek [Tue, 31 Jan 2023 15:06:20 +0000 (15:06 +0000)]
[clang-format][NFC] Move IndexedTokenSource to FormatTokenSource header.

Finish refactoring of the token sources towards a single location.

18 months ago[flang] Improve error message for move_alloc
David Truby [Mon, 30 Jan 2023 15:48:45 +0000 (15:48 +0000)]
[flang] Improve error message for move_alloc

This patch improves the error message when MOVE_ALLOC is passed the same
allocated allocatable as both the to and from arguments.

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

18 months ago[Clang] Improve error message for violations of -fmodules-decluse.
James Y Knight [Mon, 30 Jan 2023 20:05:29 +0000 (15:05 -0500)]
[Clang] Improve error message for violations of -fmodules-decluse.

Now it reports the name of the indirectly-used module which is
missing.

Reviewed By: ChuanqiXu

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

18 months ago[LiveDebugValues] Allow EntryValue with OP_deref expressions
Felipe de Azevedo Piovezan [Thu, 26 Jan 2023 17:47:03 +0000 (12:47 -0500)]
[LiveDebugValues] Allow EntryValue with OP_deref expressions

With D68945, more DBG_VALUEs were created without the indirect operand,
instead relying on OP_deref to accomplish the same effect.

At the time, however, we were not able to handle arbitrary expressions
in combination with OP_LLVM_entry_value, so D71416 prevented the use of
such operation in the presence of expressions.

As per the comment in DIExpression::isValid, "we support only entry
values of a simple register location." As such, a simple deref operation
should be supported. In fact, D80345 added support for indirect
DBG_VALUEs.

Taken the patches above into consideration, this commit relaxes the
restrictions on which expressions are allowed for entry value
candidates: the expression must be either empty or a single dereference
operator.

This patch is useful for D141381, which adds support for storing the
address of ABI-indirect parameters on the stack.

Depends on D142160

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

18 months ago[clang-format][NFC] Pull FormatTokenSource into its own header.
Manuel Klimek [Tue, 31 Jan 2023 13:55:44 +0000 (13:55 +0000)]
[clang-format][NFC] Pull FormatTokenSource into its own header.

Prepare getting FormatTokenSource under unit testing.

18 months ago[mlir] multi-argument binding for top-level transform ops
Alex Zinenko [Wed, 25 Jan 2023 16:53:25 +0000 (16:53 +0000)]
[mlir] multi-argument binding for top-level transform ops

`applyTransforms` now takes an optional mapping to be associated with
trailing block arguments of the top-level transform op, in addition to
the payload root. This allows for more advanced forms of communication
between C++ code and the transform dialect interpreter, in particular
supplying operations without having to re-match them during
interpretation.

Reviewed By: shabalin

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

18 months ago[OpenMP][FIX] Properly check assume only uses
Johannes Doerfert [Tue, 31 Jan 2023 11:33:49 +0000 (03:33 -0800)]
[OpenMP][FIX] Properly check assume only uses

We improved our simplification and this exposed a bug in the store
elimination. A load that had dead uses and assume uses was thought to be
used by assumes only. Consequently we also deleted the "dead use users".
This was a problem because a dead use just means we will not use the
load there. The user might still be needed.

Exposed by OvO, reported by @ye-luo.

18 months agoRevert D142708 "[NFC] Transition GlobalObject alignment from MaybeAlign to Align"
Guillaume Chatelet [Tue, 31 Jan 2023 14:10:25 +0000 (14:10 +0000)]
Revert D142708 "[NFC] Transition GlobalObject alignment from MaybeAlign to Align"

This is breaking the build bots. e.g.,
https://lab.llvm.org/buildbot/#/builders/121/builds/27549

This reverts commit 6717efe74da825214cb4d307ad35e5fbda353301.

18 months ago[NFC] Transition GlobalObject alignment from MaybeAlign to Align
Guillaume Chatelet [Fri, 27 Jan 2023 12:53:40 +0000 (12:53 +0000)]
[NFC] Transition GlobalObject alignment from MaybeAlign to Align

This is a follow up on https://reviews.llvm.org/D142459#4081179.
This first patch adds an overload to `GlobalObject::setAlignment` that accepts an `Align` type.
This already handles most of the calls.

This patch also converts a few call sites to the new type when this is safe.

Here is the list of the remaining call sites:

 - [clang/lib/CodeGen/CodeGenModule.cpp:1688](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/clang/lib/CodeGen/CodeGenModule.cpp#L1688)
 - [llvm/lib/AsmParser/LLParser.cpp:1309](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L1309)
 - [llvm/lib/AsmParser/LLParser.cpp:6050](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L6050)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3871](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L3871)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4030](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L4030)
 - [llvm/lib/IR/Core.cpp:2018](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Core.cpp#L2018)
 - [llvm/lib/IR/Globals.cpp:141](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Globals.cpp#L141)
 - [llvm/lib/Linker/IRMover.cpp:660](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/IRMover.cpp#L660)
 - [llvm/lib/Linker/LinkModules.cpp:361](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L361)
 - [llvm/lib/Linker/LinkModules.cpp:362](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L362)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:782](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L782)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:840](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L840)
 - [llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1813](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L1813)
 - [llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp:27](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp#L27)

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

18 months ago[MLIR] Split `generalize-tensor-pack.mlir` (NFC)
Lorenzo Chelini [Mon, 30 Jan 2023 07:06:28 +0000 (08:06 +0100)]
[MLIR] Split `generalize-tensor-pack.mlir` (NFC)

Follow a suggestion after landing https://reviews.llvm.org/D140060.
Having RUN in the middle of the file is difficult to find; split the
test into two.

Reviewed By: hanchung

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

18 months ago[GuardWidening] Choose right point for generating wide condition for branches. PR6023...
Max Kazantsev [Tue, 31 Jan 2023 11:41:25 +0000 (18:41 +0700)]
[GuardWidening] Choose right point for generating wide condition for branches. PR60234. Take 2

There was a crash because there was inconsistency between 'isAvailableAt'
and 'makeAvailableAt' queries. 'makeAvailableAt' is called on conditions
of both guards (dominating and dominated) and 'isAvailableAt' is called
only for dominated guard's condition. Before this patch, it didn't matter
because insertion point always matched the dominating guard. Now, because
they are different, this inconsistency leads to incorrect transforms which
are caught by assert.

The fix is to check 'isAvailableAt' for both conditions.

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

18 months ago[RISCV] Implement isMultiStoresCheaperThanBitsMerge hook
Alex Bradbury [Tue, 31 Jan 2023 12:46:52 +0000 (12:46 +0000)]
[RISCV] Implement isMultiStoresCheaperThanBitsMerge hook

Grabs the same logic and reasoning from the X86 implementation of the
hook. The benefit is slightly less clear for when the soft float ABI is
used (i.e. there's no transfer from an FPR to a GPR), but I've opted not
to gate it based on ABI.

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

18 months ago[flang] derived-type finalization
Valentin Clement [Tue, 31 Jan 2023 12:46:12 +0000 (13:46 +0100)]
[flang] derived-type finalization

This patch implements the derived-type finalization for
monomorphic and polymorphic derived-type.

The finalization is done through a call to the `Destroy`
runtime function so the allocatable component object are also
finalized correctly when needed. It would be possible to finalize
monomorphic derived-type with non finalizable component with a
direct call to their finalize subroutine.

7.5.6.3 point 1: LHS nonallocatable object and LHS allocatable
object finalization. Done with call to `Destroy` for monomorphic
derived-type and through `Assign` for polymorphic entities.

7.5.6.3 point 2: Done within the deallocation calls.

7.5.6.3 point 3: A function context is added to the bridge to
attach finalization that need to happen on function/subroutine
exit.

7.5.6.3 point 4: BLOCK construct not yet implemented.

7.5.6.3 point 5/6: Finalization attach to the stmtCtx in a
similar way than 9.7.3.2 point 4.

7.5.6.3 point 7: INTENT(OUT) finalization done with a
call to `Destroy` runtime function call.

This patch passes 9/10 tests in the proposed test-suite
https://github.com/llvm/llvm-test-suite/pull/13

- The case with BLOCK construct will be implemented later when
  BLOCK are implemented upstream.

- Automatic deallocation is not yet implemented. Finalization triggered
  by automatic deallocation is then not triggered.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[RISCV][test] Add tests ahead of isMultiStoresCheaperThanBitsMerge hook implementation
Alex Bradbury [Tue, 31 Jan 2023 12:40:47 +0000 (12:40 +0000)]
[RISCV][test] Add tests ahead of isMultiStoresCheaperThanBitsMerge hook implementation

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

18 months agoDAG: Remove redundant check for return alignment
Matt Arsenault [Mon, 30 Jan 2023 22:51:01 +0000 (18:51 -0400)]
DAG: Remove redundant check for return alignment

This is already what the CallBase getRetAlign does

18 months ago[AMDGPU] Use tablegen to list uniform intrinsics
Yashwant Singh [Tue, 31 Jan 2023 12:13:42 +0000 (17:43 +0530)]
[AMDGPU] Use tablegen to list uniform intrinsics

Right now we do opcode wise matching to identify uniform/non-divergent
AMDGPU intrinsics. It is duplicated at 2 places once at IR level uniformity analysis
and at MIR level. Moving them to single tablegen table for consistency and adding
and API rapper to access them.

Reviewed By: arsenm, #amdgpu

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

18 months ago[AArch64][SME2] Add multi-vector min/max intrinsics
Kerry McLaughlin [Tue, 31 Jan 2023 11:47:56 +0000 (11:47 +0000)]
[AArch64][SME2] Add multi-vector min/max intrinsics

Adds intrinsics for the following SME2 instructions:
 - smax, umax, fmax (single, 2 & 4 vector)
 - smax, umax, fmax (multi, 2 & 4 vector)
 - smin, umin, fmin (single, 2 & 4 vector)
 - smin, umin, fmin (multi, 2 & 4 vector)

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

18 months ago[LoongArch] Add baseline test for (X & Y) == Y and (X & Y) != Y
gonglingqin [Tue, 31 Jan 2023 09:47:54 +0000 (17:47 +0800)]
[LoongArch] Add baseline test for (X & Y) == Y and (X & Y) != Y

Add baseline testing for upcoming optimization patches according the
guideline https://reviews.llvm.org/rG1d6d1ecca7ec.

18 months ago[AArch64][SME2] Add SME2 outer product intrinsics
Kerry McLaughlin [Tue, 31 Jan 2023 10:50:51 +0000 (10:50 +0000)]
[AArch64][SME2] Add SME2 outer product intrinsics

Adds intrinsics for the following:
 - smopa / smops
 - umopa / umops
 - bmopa / bmops

Tests for existing SME mopa/mops intrinsics have also been updated
to use the maximum allowed ZA tile number.

 NOTE: These intrinsics are still in development and are subject
 to future changes.

Reviewed By: david-arm

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

18 months ago[3/3][Clang][RISCV] Add `__riscv_` for overloaded intrinsics
eopXD [Fri, 27 Jan 2023 09:46:11 +0000 (01:46 -0800)]
[3/3][Clang][RISCV] Add `__riscv_` for overloaded intrinsics

This commit adds prefix for the overloaded RVV intrinsics.

This is the 3rd commit of a patch-set to add __riscv_ for all RVV
intrinsics.

This follows the naming guideline under riscv-c-api-doc to add the
`__riscv_` suffix for all RVV intrinsics.

Pull Request:
riscv-non-isa/riscv-c-api-doc#31
riscv-non-isa/rvv-intrinsic-doc#189

Depends on D142644.

Reviewed By: kito-cheng

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

18 months ago[Test] Add motivating test for revert of fix of PR60234
Max Kazantsev [Tue, 31 Jan 2023 11:33:19 +0000 (18:33 +0700)]
[Test] Add motivating test for revert of fix of PR60234

18 months ago[mlir][bufferization] Fix failing lit test
Maya Amrami [Tue, 31 Jan 2023 10:56:59 +0000 (12:56 +0200)]
[mlir][bufferization] Fix failing lit test

Checks were too strict and by the time the patch was submitted,
the output of the test changed.

Reviewed By: springerm

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

18 months ago[Polly] Fix tests (NFC)
Nikita Popov [Tue, 31 Jan 2023 11:05:14 +0000 (12:05 +0100)]
[Polly] Fix tests (NFC)

Missed in 5f01a626dd0615df49773d419c75aeb33666ee83.

18 months ago[PowerPC] Improve materialization for immediates which is almost a 32 bit splat.
esmeyi [Tue, 31 Jan 2023 11:02:17 +0000 (06:02 -0500)]
[PowerPC] Improve materialization for immediates which is almost a 32 bit splat.

Summary: Some 64 bit constants can be materialized with fewer instructions than we currently use. We consider a 64 bit immediate value divided into four parts, Hi16OfHi32 (bits 48...63), Lo16OfHi32 (bits 32...47), Hi16OfLo32 (bits 16...31), Lo16OfLo32 (bits 0...15). When any three parts are equal, the immediate can be treated as "almost" a splat of a 32 bit value in a 64 bit register. For such case, we can use 3 instructions to generate the splat and use 1 instruction to modify the different part:

Reviewed By: shchenz

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

18 months ago[bazel] Add missing includes for 5212058
Goran Flegar [Tue, 31 Jan 2023 10:41:35 +0000 (11:41 +0100)]
[bazel] Add missing includes for 5212058

18 months ago[LICM] Regenerate test checks (NFC)
Nikita Popov [Tue, 31 Jan 2023 10:48:35 +0000 (11:48 +0100)]
[LICM] Regenerate test checks (NFC)

18 months ago[ConstantFold] Fix inbounds inference on mismatching source element type
Nikita Popov [Mon, 30 Jan 2023 14:30:20 +0000 (15:30 +0100)]
[ConstantFold] Fix inbounds inference on mismatching source element type

When inferring that a GEP of a global variable is inbounds because
there is no notional overindexing, we need to check that the
global value type and the GEP source element type match.

This was not necessary with typed pointers (because we would have
a bitcast in between), but is necessary with opaque pointers.

We should be able to recover some of the safe cases by performing
an offset based inbounds inference in DL-aware ConstantFolding.

18 months ago[AArch64] turn extended vecreduce bigger than v16i8 into udot/sdot
Zain Jaffal [Mon, 23 Jan 2023 10:08:33 +0000 (10:08 +0000)]
[AArch64] turn extended vecreduce bigger than v16i8 into udot/sdot

We can do this by breaking vecreduce into v16i8 vectors generating udot/sdot and concatenating them.

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

18 months ago[Clang] Fix typo in ReleaseNotes.rst
Corentin Jabot [Tue, 31 Jan 2023 10:19:30 +0000 (11:19 +0100)]
[Clang] Fix typo in ReleaseNotes.rst

18 months ago[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics
eopXD [Thu, 26 Jan 2023 17:01:41 +0000 (09:01 -0800)]
[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics

This commit adds prefix for the non-overloaded RVV intrinsics.

This is the 2nd commit of a patch-set to add __riscv_ for all RVV
intrinsics.

This follows the naming guideline under riscv-c-api-doc to add the
`__riscv_` suffix for all RVV intrinsics.

Pull Request:
riscv-non-isa/riscv-c-api-doc#31
riscv-non-isa/rvv-intrinsic-doc#189

Depends on D142085.

Reviewed By: kito-cheng

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

18 months ago[InstCombine] Add additional constexpr gep inbounds tests (NFC)
Nikita Popov [Tue, 31 Jan 2023 10:15:45 +0000 (11:15 +0100)]
[InstCombine] Add additional constexpr gep inbounds tests (NFC)

18 months ago[AArch64] Add additional tests for dotreduce to check for `v4i8` and `v24i8`
Zain Jaffal [Tue, 31 Jan 2023 09:52:34 +0000 (09:52 +0000)]
[AArch64] Add additional tests for dotreduce to check for `v4i8` and `v24i8`

Reviewed By: fhahn

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

18 months ago[Thumb2] Upgrade intrinsic upgrading code
Sergei Barannikov [Mon, 30 Jan 2023 16:07:20 +0000 (19:07 +0300)]
[Thumb2] Upgrade intrinsic upgrading code

Enabling opaque pointers has changed the mangled names of these two ARM
intrinsics:

`arm.mve.vldr.gather.offset.predicated.v2i64.p0i64.v2i64.v4i1`
`arm.mve.vstr.scatter.offset.predicated.p0i64.v2i64.v2i64.v4i1`

They are now spelled as:

`arm.mve.vldr.gather.offset.predicated.v2i64.p0.v2i64.v4i1`
`arm.mve.vstr.scatter.offset.predicated.p0.v2i64.v2i64.v4i1`

Upgrade intrinsic upgrading code to account for the change in names.

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

18 months ago[Clang] Implement Change scope of lambda trailing-return-type
Corentin Jabot [Sun, 6 Feb 2022 21:58:43 +0000 (22:58 +0100)]
[Clang] Implement Change scope of lambda trailing-return-type

This implements P2036R3 and P2579R0.
That is, explicit, int, and implicit capture become visible
at the start of the parameter head.

Reviewed By: aaron.ballman

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

18 months ago[clang][compiler-rt] Support LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on Arm Linux and BSD
David Spickett [Thu, 1 Dec 2022 14:54:17 +0000 (14:54 +0000)]
[clang][compiler-rt] Support LLVM_ENABLE_PER_TARGET_RUNTIME_DIR on Arm Linux and BSD

The orginal single folder layout produced libraries in the form:
lib/linux/<libname>-<archname>.a

That archname for Arm depended on whether you had hard or soft float.
This is sometimes shown as "arm" (soft) vs. "armhf" (hard).

If this is set in a triple we do it in the final portion, the ABI.
"gnueabi" for soft float, "gnueabihf" for hard float.

Meaning that the expected triple is:
arm-unknown-linux-gnueabihf
Not this:
armhf-unknown-linux-gnueabihf

For the per target layout I have decided to rely on the ABI portion
of the triple instead of the arch name used for the old layout
(doing that would produce the invalid triple above).

This means that building with triple:
armv8l-unknown-linux-gnueabihf
Will result in libraries in:
lib/arm-unknown-linux-gnueabihf/

And clang will now know to look for "arm" instead of "armv8l".
Meaning that we can share libraries between an armv8 and armv7 build
as we did with the previous layout. In addition to handling spelling
differences e.g. "armv8l" with an "l" on some Linux distros.

compiler-rt will autodetect that the "armhf" and/or "arm" architecture
can be built. We then replace the given triple's architecture with that.
Then if the triple's float ABI doesn't match, we change that. That new
triple is then used as the folder name.

If you select to build only the given triple, with COMPILER_RT_DEFAULT_TARGET_ONLY,
compiler-rt will not autodetect the architecture and for that I assume you
know what you're doing. In that case the library path will use the unomdified triple.

From what I can tell, this is how most large builds e.g Android and
Arm's Embedded Toolchain for llvm do things. I assume that big endian "armeb"
builds would end up doing this too.

Bare metal builds will not be using per target runtime dirs so they
remain as they were.

Depends on D139536

Reviewed By: MaskRay, phosek

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

18 months agoRevert "[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics"
eopXD [Tue, 31 Jan 2023 09:45:42 +0000 (01:45 -0800)]
Revert "[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics"

This reverts commit 2153544865a9733b06579823814c981f735e4201.
Buildbot failure https://lab.llvm.org/buildbot#builders/139/builds/35218
shows left-out test cases that were not updated.

18 months ago[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics
eopXD [Thu, 26 Jan 2023 17:01:41 +0000 (09:01 -0800)]
[2/3][Clang][RISCV] Add `__riscv_` for non-overloaded intrinsics

This commit adds prefix for the non-overloaded RVV intrinsics.

This is the 2nd commit of a patch-set to add __riscv_ for all RVV
intrinsics.

This follows the naming guideline under riscv-c-api-doc to add the
`__riscv_` suffix for all RVV intrinsics.

Pull Request:
riscv-non-isa/riscv-c-api-doc#31
riscv-non-isa/rvv-intrinsic-doc#189

Depends on D142085.

Reviewed By: kito-cheng

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

18 months ago [mlir][OneShotModuleBufferize] Add a new flag: no-analysis-func-filter
Maya Amrami [Mon, 30 Jan 2023 14:11:56 +0000 (16:11 +0200)]
 [mlir][OneShotModuleBufferize] Add a new flag: no-analysis-func-filter

OneShotModuleBufferize fails if the input IR cannot be analyzed.
One can set CopyBeforeWrite=true in order to skip analysis.
In that case, a buffer copy is inserted on every write.
This leads to many copies, also in FuncOps that could be analyzed.

This change aims to copy buffers only when it is a must.
When running OneShotModuleBufferize with CopyBeforeWrite=false,
FuncOps whose names are specified in noAnalysisFuncFilter will not be
analyzed. Ops in these FuncOps will not be analyzed as well.
They will be bufferized with CopyBeforeWrite=true,
while the other ops will be bufferized with CopyBeforeWrite=false.

Reviewed By: springerm

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

18 months ago[1/3][Clang][RISCV] Add `__riscv_` prefix for vread, vwrite, vlenb, vsetvl, and vsetvlmax
eopXD [Thu, 26 Jan 2023 16:31:56 +0000 (08:31 -0800)]
[1/3][Clang][RISCV] Add `__riscv_` prefix for vread, vwrite, vlenb, vsetvl, and vsetvlmax

This commit adds prefix for intrinsics that are defined through
`HeaderCode` under `riscv_vector.td`.

This is the 1st commit of a patch-set to add `__riscv_` for all RVV
intrinsics.

This follows the naming guideline under riscv-c-api-doc to add the
`__riscv_` suffix for all RVV intrinsics.

Pull Request:
riscv-non-isa/riscv-c-api-doc#31
riscv-non-isa/rvv-intrinsic-doc#189

Depends on D142016.

Reviewed By: kito-cheng

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

18 months ago[flang] Lower storage_size intrinsic for polymorphic entities
Valentin Clement [Tue, 31 Jan 2023 08:44:07 +0000 (09:44 +0100)]
[flang] Lower storage_size intrinsic for polymorphic entities

Lower STOARGE_SIZE intrinsic when the argument is polymoprhic
or unlimited polymorphic. STOARGE_SIZE for monomorphic entity is folded
by the frontend.

Reviewed By: vzakhari, vdonaldson

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

18 months agoRevert "[GuardWidening] Choose right point for generating wide condition for branches...
Max Kazantsev [Tue, 31 Jan 2023 08:37:02 +0000 (15:37 +0700)]
Revert "[GuardWidening] Choose right point for generating wide condition for branches. PR60234"

This reverts commit 5cb568a37a53a9b0fd8fc9c2c35870cad43623e9.

Internal testing found failures, need to investigate.

18 months ago[mlir][vector][bufferize] Fix Windows build failure introduced by D141686
Matthias Springer [Tue, 31 Jan 2023 08:33:06 +0000 (09:33 +0100)]
[mlir][vector][bufferize] Fix Windows build failure introduced by D141686

18 months ago[IR][doc] Alignment is always set in memory for load/store/alloca/cmpxchg/atomicrmw.
Guillaume Chatelet [Thu, 26 Jan 2023 14:08:20 +0000 (14:08 +0000)]
[IR][doc] Alignment is always set in memory for load/store/alloca/cmpxchg/atomicrmw.

Context https://reviews.llvm.org/D142459#4081179

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

18 months agoReland "[mlir][LLVM] Add all LLVM parameter attributes"
Christian Ulmann [Tue, 31 Jan 2023 07:54:52 +0000 (08:54 +0100)]
Reland "[mlir][LLVM] Add all LLVM parameter attributes"

This change was reverted because it introduced a linking issue due to
duplicated symbols. Making sure that the detail helper only has a static
header implementation fixes this issue.

Reviewed By: gysit

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

18 months ago[mlir][vector][bufferize] Bufferize vector.mask and vector.yield
Matthias Springer [Tue, 31 Jan 2023 07:56:03 +0000 (08:56 +0100)]
[mlir][vector][bufferize] Bufferize vector.mask and vector.yield

The masked op can currently not bufferize out-of-place. Such IR would be rejected by the One-Shot Bufferize because it would mean that a new buffer allocation is yielded from a block. Furthermore, only one operation is currently allowed inside `vector.mask`.

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

18 months ago[mlir] Adjust AttributeTest to show skip behavior.
Adrian Kuegel [Tue, 31 Jan 2023 07:08:44 +0000 (08:08 +0100)]
[mlir] Adjust AttributeTest to show skip behavior.

walk() skips identical sub-attributes. Adjust the unit test to show
this.

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

18 months ago[libc] Unify full build and default build static archive targets to just "libc".
Siva Chandra Reddy [Tue, 31 Jan 2023 07:08:49 +0000 (07:08 +0000)]
[libc] Unify full build and default build static archive targets to just "libc".

18 months ago[Fuchsia] Re-enable HWASan for globals in runtimes
Petr Hosek [Mon, 30 Jan 2023 18:54:46 +0000 (18:54 +0000)]
[Fuchsia] Re-enable HWASan for globals in runtimes

This is now supported.

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

18 months ago[runtimes][libc] Keep the libc target as "libc".
Siva Chandra Reddy [Mon, 30 Jan 2023 18:56:22 +0000 (18:56 +0000)]
[runtimes][libc] Keep the libc target as "libc".

It currently renamed to "llvmlibc" under the runtimes/boostrap build.
This prevents us from making a full libc build.

Reviewed By: phosek

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

18 months ago[mlir] Remove redundant virtual keyword. NFC
Adrian Kuegel [Tue, 31 Jan 2023 07:18:51 +0000 (08:18 +0100)]
[mlir] Remove redundant virtual keyword. NFC

Found by ClangTidyLegacy check.

18 months ago[clangd] Stop filtering lit tests based on target-triple
Kadir Cetinkaya [Tue, 31 Jan 2023 07:01:35 +0000 (08:01 +0100)]
[clangd] Stop filtering lit tests based on target-triple

We are performing this filtering due to having unix style file paths in
certain tests. Hence we're actually trying to filter based on host
platform and not the target-triple LLVM is using.

2493a7016416c90038be5c816e12a7ad07cee054 introduced filtering based on
host platform already, so we can get rid of target-triple based
filtering now.

18 months ago[mlir][SubElements] Remove the ability to override implementations
River Riddle [Tue, 31 Jan 2023 06:42:14 +0000 (22:42 -0800)]
[mlir][SubElements] Remove the ability to override implementations

It's much cleaner and simpler to drive wacky configs via the
AttrTypeSubElementHandler interface, instead of override.

18 months ago[GuardWidening] Choose right point for generating wide condition for branches. PR60234
Max Kazantsev [Tue, 31 Jan 2023 05:29:26 +0000 (12:29 +0700)]
[GuardWidening] Choose right point for generating wide condition for branches. PR60234

When guards are represented as widenable branches, there is a tricky
situation when the branch stays in loop but widenable condition doesn't.
It means that the widenable condition is loop-invariant, and some other
optimizations could have done changes using this fact.

If widening is allowed to create widened condition inside this loop,
and join the loop-invariant wc with some non-invariant facts, it can
cause miscompile. See example of this at https://github.com/llvm/llvm-project/issues/60234.

The solution is to adjust the point of generationg the wide condition,
and therefore of hoisting all related parts there. It should not be before
the branch, but before the widenable_condition call. The fact that `wc()`
and the wide condition are in the same block guarantees that they will
not violate the invariance property for any loop.

Differential Revision: https://reviews.llvm.org/D142693
Reviewed By: apilipenko

18 months ago[mlir][vector] Add folder for bitcast of integer splat constants
Quinn Dawkins [Mon, 30 Jan 2023 15:42:42 +0000 (10:42 -0500)]
[mlir][vector] Add folder for bitcast of integer splat constants

This is a similar to the existing folder for f16 to f32 added with
D96041 but instead for integer types where destination bits > source bits.

Reviewed By: ThomasRaoux

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

18 months ago[lldb] Remove unimplemented SBTraceCursor::GetExecutionContextRef
Jonas Devlieghere [Tue, 31 Jan 2023 04:27:28 +0000 (20:27 -0800)]
[lldb] Remove unimplemented SBTraceCursor::GetExecutionContextRef

Fixes TAPI verification error:

  SBTraceCursor.h:130:23: error: declaration has external linkage, but dynamic library doesn't have symbol '__ZN4lldb13SBTraceCursor22GetExecutionContextRefEv'
  SBExecutionContext &GetExecutionContextRef();
                      ^

Remove the method as it doesn't have an implementation.

18 months ago[AVR][NFC] Refactor 'AVRAsmPrinter::PrintAsmOperand'
Ben Shi [Fri, 20 Jan 2023 02:34:08 +0000 (10:34 +0800)]
[AVR][NFC] Refactor 'AVRAsmPrinter::PrintAsmOperand'

Reviewed By: Chenbing.Zheng, aykevl

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