platform/upstream/llvm.git
20 months ago[flang][runtime] Handle explicit-length character padding & truncation in Assign()
Peter Klausler [Wed, 22 Feb 2023 18:19:25 +0000 (10:19 -0800)]
[flang][runtime] Handle explicit-length character padding & truncation in Assign()

When the left-hand side of an allocatable assignment has an explicit character length,
rather than a deferred length that might imply reallocation, handle any discrepancy
in lengths via truncation or blank padding.

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

20 months ago[flang] Stricter interface compatibility checking for TBP overrides
Peter Klausler [Tue, 21 Feb 2023 00:11:04 +0000 (16:11 -0800)]
[flang] Stricter interface compatibility checking for TBP overrides

The compiler currently ignores attributes for PASS dummy arguments that
are incompatible between a type-bound procedure in an extended type and
the binding of the same name that it overrides in an ancestor type,
if any.  Strengthen this checking so that discrepancies between attributes
and intents are caught, and add some tests.

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

20 months ago[flang] Catch name conflict between generic TBP and inherited non-generic
Peter Klausler [Mon, 20 Feb 2023 20:39:53 +0000 (12:39 -0800)]
[flang] Catch name conflict between generic TBP and inherited non-generic

A generic procedure binding in an extended derived type may not have the
same name as a symbol inherited from an ancestor type unless that inherited
symbol is also a generic TBP.  Since generic names can be things like
"ASSIGNMENT(=)", name resolution doesn't use OkToAddComponent() for
generic TBPs, which would have caught this error as it does for other
symbols in derived types, so it must be special-cased.

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

20 months ago[flang] BIND(C,NAME=...) corrections
Peter Klausler [Tue, 28 Feb 2023 19:58:30 +0000 (11:58 -0800)]
[flang] BIND(C,NAME=...) corrections

The Fortran standard's various restrictions on the use of BIND(C)
often depend more on the presence or absence of an explicit NAME=
specification rather than on its value, but semantics and module
file generation aren't making distinctions between explicit NAME=
specifications that happen to match the default name and declarations
that don't have NAME=.  Tweak semantics and module file generation
to conform, and also complain when named BIND(C) attributes are
erroneously applied to entities that can't support them, like
ABSTRACT interfaces.

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

20 months ago[libc++][NFC] Reformat aligned_storage specialization macro
Louis Dionne [Thu, 2 Mar 2023 18:04:58 +0000 (13:04 -0500)]
[libc++][NFC] Reformat aligned_storage specialization macro

20 months ago[flang] Enforce prohibition against empty interoperable arrays
Peter Klausler [Sun, 19 Feb 2023 23:55:04 +0000 (15:55 -0800)]
[flang] Enforce prohibition against empty interoperable arrays

Fortran doesn't allow a BIND(C) variable or a component of a BIND(C)
type to be an array with no elements.

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

20 months ago[flang] A TBP override may not make a public binding private
Peter Klausler [Sat, 18 Feb 2023 17:32:45 +0000 (09:32 -0800)]
[flang] A TBP override may not make a public binding private

When a procedure binding in a derived type has PRIVATE accessibility,
it may not be an override of a type-bound procedure that is accessible.

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

20 months ago[flang] Disallow intrinsics and statement functions from generics
Peter Klausler [Sat, 18 Feb 2023 17:06:57 +0000 (09:06 -0800)]
[flang] Disallow intrinsics and statement functions from generics

Generic interfaces are not permitted to have intrinsic procedures or
statement functions as specific procedures.

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

20 months ago[Flang][OpenMP] Improved reduction clause TODO message
Kiran Chandramohan [Thu, 2 Mar 2023 17:35:11 +0000 (17:35 +0000)]
[Flang][OpenMP] Improved reduction clause TODO message

Provide the name of the construct and the clause info (reduction)
in the TODO mesage.

Reviewed By: DavidTruby

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

20 months ago[flang] Catch attempt to misuse an abstract procedure in a generic interface
Peter Klausler [Sat, 18 Feb 2023 01:12:14 +0000 (17:12 -0800)]
[flang] Catch attempt to misuse an abstract procedure in a generic interface

A procedure defined in an ABSTRACT INTERFACE may not appear as
a specific procedure in a generic interface.

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

20 months ago[flang] Warn about violations of an obscure requirement (15.6.4 p2)
Peter Klausler [Sat, 18 Feb 2023 00:48:25 +0000 (16:48 -0800)]
[flang] Warn about violations of an obscure requirement (15.6.4 p2)

The Fortran 2018 standard, perhaps as an attempt to prevent ambiguity
in  older compilers, requires that a statement function appear in an
explicit type declaration statement if its name is also accessible
from a host scope.  F18 processes the specification parts of inner
procedures first, so we don't need this requirement to prevent
ambiguity, and can only really check it retrospectively after name
resolution.  Emit a portability warning when appropriate.

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

20 months ago[libc++][NFC] Fix typo in documentation
Louis Dionne [Thu, 2 Mar 2023 17:42:15 +0000 (12:42 -0500)]
[libc++][NFC] Fix typo in documentation

20 months ago[libc++] Reintroduce workaround for stdint re-export on Darwin
Louis Dionne [Wed, 1 Mar 2023 19:58:03 +0000 (14:58 -0500)]
[libc++] Reintroduce workaround for stdint re-export on Darwin

This had been removed as part of 3a0f88c4c2c4. It turns out that this
did break some code, but we never noticed because it requires including
<stdint.h> (and nothing else), and then using one of the types from
that header. It also requires running with modules enabled in a Standard
no later than C++17.

After the test refactorings in D145116, this bug would be caught
by running a CI job on macOS with modules enabled in C++17 mode
(but surprisingly not with more recent standards). This patch doesn't
add such a job because it is deemed a corner case.

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

20 months ago[libc++] Use ASSERT_SAME_TYPE instead of <type_traits> in depr tests
Louis Dionne [Wed, 1 Mar 2023 21:37:12 +0000 (16:37 -0500)]
[libc++] Use ASSERT_SAME_TYPE instead of <type_traits> in depr tests

Whenever, possible, use ASSERT_SAME_TYPE instead of static_assert along
with std::is_same in the depr header tests. This prevents dragging in
multiple headers unrelated to the header being tested, which can (and
has) hidden issues.

Also, add a couple of tests to ensure that basic declarations in
<stddef.h> and <stdint.h> are available when including just those
headers, since the rest of the tests for those types require pulling
in additional dependencies.

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

20 months ago[AMDGPU] Remove outdated FIXME in comments [NFC]
ZHU Zijia [Thu, 2 Mar 2023 17:26:53 +0000 (01:26 +0800)]
[AMDGPU] Remove outdated FIXME in comments [NFC]

This case has already been handled by D106449.

20 months ago[flang] Refine procedure compatibility checking
Peter Klausler [Wed, 15 Feb 2023 01:33:57 +0000 (17:33 -0800)]
[flang] Refine procedure compatibility checking

The test for compatible function results needs to be nearly strict
equality of their types, not the usual actual/dummy type compatibility
test used in other situations.  The exceptional case is that assumed
length CHARACTER function results are compatible with explicit length
results of the same kind.  In particular, a function returning a
polymorphic pointer is not compatible with a function returning a
monomorphic pointer even of the same declared type.

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

20 months ago[flang] Fix ISHFTC argument value check
Peter Klausler [Wed, 15 Feb 2023 00:07:24 +0000 (16:07 -0800)]
[flang] Fix ISHFTC argument value check

The code that visits all pairs of constant SHIFT= and SIZE= arguments
in an array-valued call to the ISHFTC intrinsic function had a bad loop
test that affected the case where one of these arguments was scalar and
the other was not.  Fix it, and add tests.

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

20 months ago[flang] Warn about dangerous actual argument association with TARGET dummy arguments
Peter Klausler [Tue, 14 Feb 2023 22:58:34 +0000 (14:58 -0800)]
[flang] Warn about dangerous actual argument association with TARGET dummy arguments

The actual argument associated with a dummy argument with the TARGET attribute is
not required to be itself a target or pointer, or even to be a variable, but in
those cases, any pointer that is associated with the dummy argument during the
execution of the procedure is either going to be invalid afterwards because it
points to temporary storage that has since been deallocated or an optimization
time bomb because it aliases an object that isn't a target.  Add warnings for
these cases.

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

20 months ago[libc][NFC] Switch use of errno in src/unistd and src/sys to libc_errno.
Siva Chandra Reddy [Wed, 1 Mar 2023 17:41:02 +0000 (17:41 +0000)]
[libc][NFC] Switch use of errno in src/unistd and src/sys to libc_errno.

Reviewed By: lntue

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

20 months ago[mlir][SparseTensor] Fix incorrect API usage in RewritePatterns
Matthias Springer [Thu, 2 Mar 2023 16:22:06 +0000 (17:22 +0100)]
[mlir][SparseTensor] Fix incorrect API usage in RewritePatterns

Incorrect API usage was detected by D144552.

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

20 months ago[AMDGPU] Mark mbcnt as convergent
Yaxun (Sam) Liu [Wed, 1 Mar 2023 15:56:11 +0000 (10:56 -0500)]
[AMDGPU] Mark mbcnt as convergent

since it depends on CFG.

Otherwise some passes will try to merge them and cause
incorrect results.

Reviewed by: Artem Belevich

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

20 months ago[ADT] Drop append_range test that doesn't compile with EXPENSIVE_CHECKS
Jakub Kuderski [Thu, 2 Mar 2023 16:23:49 +0000 (11:23 -0500)]
[ADT] Drop append_range test that doesn't compile with EXPENSIVE_CHECKS

The issue seems to be caused by the definition of `SafeIntIterator` and
is otherwise unrelated to the implementation of `append_range`.

We have a simialr test below, so this does not meaningfully decrease the
test coverage of `append_range`.

See the discussion in: https://reviews.llvm.org/D144420#4164373

Issue: https://github.com/llvm/llvm-project/issues/61122

20 months ago[InstCombine] add tests for absolute diff; NFC
Sanjay Patel [Thu, 2 Mar 2023 14:43:23 +0000 (09:43 -0500)]
[InstCombine] add tests for absolute diff; NFC

More coverage for D145073.

20 months agoMake clang/test/C/C2x/n2934.c compatible with targets that do not support thread_loca...
Fanbo Meng [Thu, 2 Mar 2023 14:28:37 +0000 (09:28 -0500)]
Make clang/test/C/C2x/n2934.c compatible with targets that do not support thread_local storage.

Add an optional error check to test case for it to pass on targets that do not support thread_local storage.

Reviewed By: aaron.ballman, abhina.sreeskantharajan

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

20 months ago[GlobalOpt] Drop bitcast handling in global to alloca fold
Nikita Popov [Thu, 2 Mar 2023 16:10:42 +0000 (17:10 +0100)]
[GlobalOpt] Drop bitcast handling in global to alloca fold

Pointer bitcasts no longer occur with opaque pointers -- and in
this case not handling them allows us to drop the code for
promoting constant expressions to instructions as well.

20 months ago[Sanitizers] Disable armv7* sanitizers slice for ios
usama hameed [Thu, 2 Mar 2023 16:04:45 +0000 (21:04 +0500)]
[Sanitizers] Disable armv7* sanitizers slice for ios

rdar://104059106

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

20 months ago[GlobalOpt] Regenerate test checks (NFC)
Nikita Popov [Thu, 2 Mar 2023 16:06:08 +0000 (17:06 +0100)]
[GlobalOpt] Regenerate test checks (NFC)

And drop the unnecessary main function.

20 months ago[ASAN] Use TypeSize in InterestingMemoryOperand [mostly NFC]
Philip Reames [Thu, 2 Mar 2023 15:44:00 +0000 (07:44 -0800)]
[ASAN] Use TypeSize in InterestingMemoryOperand [mostly NFC]

This is a mechanical prep change for scalable vector support.  All it does is move the point of TypeSize to unsigned (i.e. the unsafe cast) closer to point of use.

20 months ago[DAGCombiner] Replace LegalOperations check in visitSIGN_EXTEND with LegalTypes.
Craig Topper [Thu, 2 Mar 2023 15:44:00 +0000 (07:44 -0800)]
[DAGCombiner] Replace LegalOperations check in visitSIGN_EXTEND with LegalTypes.

This is guarding a check for isTypeLegal so it should check is
LegalTypes.

Fixes PR61111.

Reviewed By: RKSimon

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

20 months ago[clang][ExtractAPI] Handle platform specific unavailability correctly
Ankur [Thu, 2 Mar 2023 14:33:56 +0000 (14:33 +0000)]
[clang][ExtractAPI] Handle platform specific unavailability correctly

This Patch gives ExtractAPI the ability to emit correct availability information for symbols marked as unavailable on a specific platform ( PR#60954 )

Reviewed By: dang

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

20 months ago[mlir][NVGPU] Fix incorrect API usage in RewritePatterns
Matthias Springer [Thu, 2 Mar 2023 15:12:42 +0000 (16:12 +0100)]
[mlir][NVGPU] Fix incorrect API usage in RewritePatterns

Incorrect API usage was detected by D144552.

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

20 months ago[mlir][linalg] Fix incorrect API usage in RewritePatterns
Matthias Springer [Thu, 2 Mar 2023 14:43:59 +0000 (15:43 +0100)]
[mlir][linalg] Fix incorrect API usage in RewritePatterns

Incorrect API usage was detected by D144552.

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

20 months agoCall MarkVirtualMembersReferenced on an actual class definition
Stephan Bergmann [Wed, 1 Mar 2023 22:29:45 +0000 (23:29 +0100)]
Call MarkVirtualMembersReferenced on an actual class definition

...rather than on potentially just a declaration.

Without the fix, the newly added clang/test/SemaCXX/warn-undefined-internal.cpp
failed with

> error: 'warning' diagnostics expected but not seen:
>   File /home/sbergman/github.com/llvm/llvm-project/clang/test/SemaCXX/warn-undefined-internal.cpp Line 12 (directive at /home/sbergman/github.com/llvm/llvm-project/clang/test/SemaCXX/warn-undefined-internal.cpp:13): function 'test2()::S::f' has internal linkage but is not defined
> error: 'note' diagnostics expected but not seen:
>   File /home/sbergman/github.com/llvm/llvm-project/clang/test/SemaCXX/warn-undefined-internal.cpp Line 14 (directive at /home/sbergman/github.com/llvm/llvm-project/clang/test/SemaCXX/warn-undefined-internal.cpp:15): used here

(I ran into this when two LibreOffice Clang plugins produced false positive
warnings, as they relied on Decl::isReferenced() returning true for such virtual
member functions of local classes.)

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

20 months agoRevert "[Sanitizers] Error out for -static-libsan on darwin"
usama hameed [Thu, 2 Mar 2023 14:48:38 +0000 (19:48 +0500)]
Revert "[Sanitizers] Error out for -static-libsan on darwin"

This reverts commit 4e7d40e0928cfe448ba947d2a67895fccaa3535f.

20 months agoRevert "Revert "[SCEV] Add SCEVType to represent `vscale`.""
Paul Walker [Thu, 2 Mar 2023 12:23:52 +0000 (12:23 +0000)]
Revert "Revert "[SCEV] Add SCEVType to represent `vscale`.""

Relanding after fixing Polly related build error.

This reverts commit 7b26dcae9eaf8cdcba7fef032fd83d060dffd4b4.

20 months agoChange ClangTidy unit tests to run in C++20 mode instead of C++11.
Utkarsh Saxena [Thu, 2 Mar 2023 12:04:07 +0000 (13:04 +0100)]
Change ClangTidy unit tests to run in C++20 mode instead of C++11.

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

20 months ago[mlir][vector] Fix incorrect API usage in RewritePatterns
Matthias Springer [Thu, 2 Mar 2023 11:51:35 +0000 (12:51 +0100)]
[mlir][vector] Fix incorrect API usage in RewritePatterns

Incorrect API usage was detected by D144552.

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

20 months ago[gn build] Port 97dcbea63e11
LLVM GN Syncbot [Thu, 2 Mar 2023 12:51:00 +0000 (12:51 +0000)]
[gn build] Port 97dcbea63e11

20 months ago[LogicCombine 1/?] Implement a general way to simplify logical operations.
chenglin.bi [Thu, 2 Mar 2023 12:45:54 +0000 (20:45 +0800)]
[LogicCombine 1/?] Implement a general way to simplify logical operations.

This patch involves boolean ring to simplify logical operations. We can treat `&` as ring multiplication and `^` as ring addition.
So we need to canonicalize all other operations to `*` `+`. Like:
```
a & b -> a * b
a ^ b -> a + b
~a -> a + 1
a | b -> a * b + a + b
c ? a : b -> c * a + (c + 1) * b
```
In the code, we use a mask set to represent an expression. Every value that is not comes from logical operations could be a bit in the mask.
The mask itself is a multiplication chain. The mask set is an addiction chain.
We can calculate two expressions based on boolean algebras.

For now, the initial patch only enabled on and/or/xor,  Later we can enhance the code step by step.

Reference: https://en.wikipedia.org/wiki/Boolean_ring

Reviewed By: spatel

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

20 months ago[MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.
Clement Courbet [Thu, 2 Mar 2023 12:34:43 +0000 (13:34 +0100)]
[MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.

20 months ago[AArch64] NFC: Add missing CHECK lines for sme-aarch64-svcount.ll test
Sander de Smalen [Thu, 2 Mar 2023 12:20:53 +0000 (12:20 +0000)]
[AArch64] NFC: Add missing CHECK lines for sme-aarch64-svcount.ll test

20 months ago[clangd] Use the normalized file path to do the filtering.
Haojian Wu [Thu, 2 Mar 2023 12:31:04 +0000 (13:31 +0100)]
[clangd] Use the normalized file path to do the filtering.

This is an oversight, where we normalized the path, but we didn't use it
in the filtering.

20 months agoAMDGPU: Add more flat scratch load and store tests for 8 and 16-bit types
Petar Avramovic [Wed, 1 Mar 2023 18:00:04 +0000 (19:00 +0100)]
AMDGPU: Add more flat scratch load and store tests for 8 and 16-bit types

Add tests for more complicated scratch load and store patterns.
Includes:
- sign and zero extending loads of i8 and i16 to i32 into 32-bit register
- D16 instructions that affect only high or low 16 bits of 32-bit register
 - D16 sign and zero extending loads of i8 to i16 into high or low 16 bits
   of 32-bit register
 - D16 loads of i16 to high or low 16 bits of 32-bit register
 - D16 stores of i8 and i16 from high 16 bits of 32-bit register

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

20 months ago[AArch64][SME2] Add CodeGen support for target("aarch64.svcount").
Sander de Smalen [Thu, 2 Mar 2023 11:46:10 +0000 (11:46 +0000)]
[AArch64][SME2] Add CodeGen support for target("aarch64.svcount").

This patch adds AArch64 CodeGen support such that the type can be passed
and returned to/from functions, and also adds support to use this type in
load/store operations and PHI nodes.

Reviewed By: paulwalker-arm

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

20 months ago[C++20][ClangTidy] Update the ClangTidy tests to also test in C++20 mode
Utkarsh Saxena [Tue, 21 Feb 2023 14:24:11 +0000 (15:24 +0100)]
[C++20][ClangTidy] Update the ClangTidy tests to also test in C++20 mode

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

20 months ago[mlir][llvm] Use interfaces in the translation to LLVMIR.
Tobias Gysi [Thu, 2 Mar 2023 11:55:57 +0000 (12:55 +0100)]
[mlir][llvm] Use interfaces in the translation to LLVMIR.

The revision consistently uses the AliasAnalysisOp and AccessGroupOp
interfaces in the translation from MLIR to LLVMIR. It thus drops the
last string based lookups of alias scope and access group attributes.

Depends on D144851

Reviewed By: Dinistro

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

20 months agoRevert "[SCEV] Add SCEVType to represent `vscale`."
Paul Walker [Thu, 2 Mar 2023 11:59:50 +0000 (11:59 +0000)]
Revert "[SCEV] Add SCEVType to represent `vscale`."

This reverts commit 7912f5cc92f65ad0d3c705f3683a0b69dbedcc57.

20 months ago[SCEV] Add SCEVType to represent `vscale`.
Paul Walker [Mon, 27 Feb 2023 14:49:32 +0000 (14:49 +0000)]
[SCEV] Add SCEVType to represent `vscale`.

This is part of an effort to remove ConstantExpr based
representations of `vscale` so that its LangRef definiton can
be relaxed to accommodate a less strict definition of constant.

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

20 months ago[Support] Implement findModulesAndOffsets on Apple 64-bit platforms
Luís Marques [Thu, 2 Mar 2023 10:39:56 +0000 (10:39 +0000)]
[Support] Implement findModulesAndOffsets on Apple 64-bit platforms

To have line number information in stack traces (per stack frame) it's
necessary to implement findModulesAndOffsets.

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

20 months ago[GlobalOpt] Use more specific type (NFC)
Nikita Popov [Thu, 2 Mar 2023 10:45:27 +0000 (11:45 +0100)]
[GlobalOpt] Use more specific type (NFC)

SRA always works on GlobalVariables.

20 months ago[llvm-exegesis] Include more specific header (NFC)
Nikita Popov [Thu, 2 Mar 2023 10:23:42 +0000 (11:23 +0100)]
[llvm-exegesis] Include more specific header (NFC)

20 months agoRevert "[clang][Interp] Implement C++ Range-for loops"
Timm Bäder [Thu, 2 Mar 2023 09:23:48 +0000 (10:23 +0100)]
Revert "[clang][Interp] Implement C++ Range-for loops"

This reverts commit bce8b3c1830434c10b8a30380db522d7c6a8658d.

This commit breaks memory-sanitizer builds:
https://lab.llvm.org/buildbot/#/builders/5/builds/31899

20 months ago[bazel] Add missing dep for llvm-c-test
Haojian Wu [Thu, 2 Mar 2023 10:01:54 +0000 (11:01 +0100)]
[bazel] Add missing dep for llvm-c-test

20 months ago[bazel] Port for f7ca01333214f934c580c162afdee933e7430b6c
Haojian Wu [Thu, 2 Mar 2023 09:38:41 +0000 (10:38 +0100)]
[bazel] Port for f7ca01333214f934c580c162afdee933e7430b6c

20 months ago[mlir][nfc] Clean-up ConvertToDestinationStyle.cpp.
Alexander Belyaev [Thu, 2 Mar 2023 09:26:31 +0000 (10:26 +0100)]
[mlir][nfc] Clean-up ConvertToDestinationStyle.cpp.

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

20 months ago[DebugInfo] Remove `dbg.addr` from IR
J. Ryan Stinnett [Sat, 25 Feb 2023 22:44:04 +0000 (22:44 +0000)]
[DebugInfo] Remove `dbg.addr` from IR

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from CodeGen
J. Ryan Stinnett [Sat, 25 Feb 2023 22:17:28 +0000 (22:17 +0000)]
[DebugInfo] Remove `dbg.addr` from CodeGen

As part of this work, removing `SDDbgValue::clearIsEmitted` originally added for
`dbg.addr` in 045c67769d7fe577fc38cccb6fb40fd814437447 was attempted, but it
appears some tests for `DBG_INSTR_REF` now depend on that behaviour as well, so
it was kept and comments were updated instead.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from Analysis
J. Ryan Stinnett [Sat, 25 Feb 2023 21:29:44 +0000 (21:29 +0000)]
[DebugInfo] Remove `dbg.addr` from Analysis

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from llvm-reduce
J. Ryan Stinnett [Sat, 25 Feb 2023 21:04:49 +0000 (21:04 +0000)]
[DebugInfo] Remove `dbg.addr` from llvm-reduce

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from Transforms
J. Ryan Stinnett [Sat, 25 Feb 2023 20:59:04 +0000 (20:59 +0000)]
[DebugInfo] Remove `dbg.addr` from Transforms

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from MLIR
J. Ryan Stinnett [Sat, 18 Feb 2023 22:59:35 +0000 (22:59 +0000)]
[DebugInfo] Remove `dbg.addr` from MLIR

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Remove `dbg.addr` from Coroutines
J. Ryan Stinnett [Sat, 18 Feb 2023 22:48:03 +0000 (22:48 +0000)]
[DebugInfo] Remove `dbg.addr` from Coroutines

This removes `dbg.addr` support from the Coroutines transform. This effectively
reverts the `dbg.addr`-only portions of 19279ffc77b8d224c447d4eb0ee0c727ab64babf
and 0b647fc5299156bf83c46aa539d6c9c39647bb36.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo][NFC] Remove `FuncArgumentDbgValueKind::Addr` from SelectionDAG
J. Ryan Stinnett [Sat, 18 Feb 2023 22:16:42 +0000 (22:16 +0000)]
[DebugInfo][NFC] Remove `FuncArgumentDbgValueKind::Addr` from SelectionDAG

This removes the unused `FuncArgumentDbgValueKind::Addr` value originally added
by e24f5348798605a799c63ff09169d177d262cd37. The intent was to signal the
original intrinsic that marked a function argument, but the `Addr` part was
never used.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo] Upgrade `dbg.addr` to `dbg.value`
J. Ryan Stinnett [Sun, 29 Jan 2023 00:59:33 +0000 (00:59 +0000)]
[DebugInfo] Upgrade `dbg.addr` to `dbg.value`

As part of removing `dbg.addr`, this upgrades any calls to `dbg.value` with
`DW_OP_deref` prepended onto the value expression.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[DebugInfo][Docs] Remove `dbg.addr` from docs
J. Ryan Stinnett [Sat, 18 Feb 2023 23:13:44 +0000 (23:13 +0000)]
[DebugInfo][Docs] Remove `dbg.addr` from docs

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

20 months ago[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces to intrinsics.
Tobias Gysi [Thu, 2 Mar 2023 09:12:43 +0000 (10:12 +0100)]
[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces to intrinsics.

This revision updates the memcpy, memove, and memset intrinsics to
implement the AliasAnalysis and AccessGroup interfaces. The changes
will enable the import and export of alias scope, tbaa, and
access group metadata attached to these intrinsics. It also
renames the requiresAliasScope flag to requiresAliasAnalysis since
the intrinsics also support tbaa and not only access scope metadata.

The revision still maintains the string based attribute lookup
in the translation from MLIR to LLVMIR. Using the interfaces
instead of the string based lookup is left to a followup revision.

Depends on D144851

Reviewed By: Dinistro

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

20 months ago[mlir][linalg] Vectorize tensor.extract using contiguous loads
Andrzej Warzynski [Wed, 1 Mar 2023 15:44:01 +0000 (15:44 +0000)]
[mlir][linalg] Vectorize tensor.extract using contiguous loads

This patch implements vectorization of tensor.extract for n-D tensor (n
>= 2) using contiguous load operations, i.e. `vector.transfer_read`. This
is a follow-up of https://reviews.llvm.org/D137660 in which gather loads
were used, i.e. `vector.gather`.

It is always safe to use gather load operations when the underlying
memory pattern is contiguous, but not vice-verse. At the moment, the
following conditions have to be met for contiguous loads to be
generated:
  1. The _output tensor_ must be a 1-D vector with the trailing dim > 1,
     e.g. `tensor<1x1x4xi32`,
  2. The trailing dim in the _input tensor_ must be > 1, e.g.
     `tensor<1x1x4i32>` would be fine, but not `tensor<1x4x1xi32>`.
If these conditions are not satisfied, gather loads are generated
instead.

Condition 1 guarantees that the iteration space of the corresponding
`linalg.generic` Op is relatively simple. That makes analysing the
indices for `tensor.extract` rather straightforward.

Condition 2 is mostly there to avoid weird vectorisation patterns
resulting in vectors like: `vector<1x1x1xi32>`. In practice, tensors
like `tensor<1x4x1xi32>` should be collapsed to `tensor<1x4xi32>` before
vectorisation, but that's beyond the scope of this patch.

If needed, both conditions can be relaxed. I've not been able to find a
good motivating example for these, hence skipping. For reference,
`tosa.resize` (lowered to Linalg) was the driving example used here.

As a bonus, the test from "vectorization-unsupported.mlir" is moved to
"vectorization.mlir" with proper CHECK lines added.

NOTE: This relands 89b144ece330b363713bec369d2d89dc85f715f5 (added extra
test, refined comments and variable names).

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

Co-authored-by: Diego Caballero <diegocaballero@google.com>
20 months ago[Coverage] Fix an issue: a statement after calling 'assert()' function is wrongly
Ying Yi [Fri, 17 Feb 2023 11:42:20 +0000 (11:42 +0000)]
[Coverage] Fix an issue: a statement after calling 'assert()' function is wrongly
marked as 'not executed'.

In the current coverage mapping implementation, we terminate the current region
and start a zero region when we hit a nonreturn function. However, for logical OR,
the second operand is not executed if the first operand evaluates to true. If the
nonreturn function is called in the right side of logical OR and the left side of
logical OR is TRUE, we should not start a zero `GapRegionCounter`. This will also
apply to `VisitAbstractConditionalOperator`.

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

Reviewed By: zequanwu

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

20 months ago[GlobalOpt] Extend CleanupPointerRootUsers to handle CE users.
Florian Hahn [Thu, 2 Mar 2023 09:12:23 +0000 (10:12 +0100)]
[GlobalOpt] Extend CleanupPointerRootUsers to handle CE users.

Extend CleanupPointerRootUsers to iterate over a worklist, add users of
constant expressions to the worklist to enable additional cleanups.

Reviewed By: nikic

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

20 months ago[mlir][Transform] Fix transform::SequenceOp builder
Nicolas Vasilache [Thu, 2 Mar 2023 09:06:18 +0000 (01:06 -0800)]
[mlir][Transform] Fix transform::SequenceOp builder

Previously, the wrond type would be used and would not matche the number of locations triggering
an assertion failures in `createBlock`.

20 months ago[clang][Interp] Handle record initialization via CastExpr
Timm Bäder [Sat, 31 Dec 2022 17:26:15 +0000 (18:26 +0100)]
[clang][Interp] Handle record initialization via CastExpr

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

20 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, rupprecht, shafik

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

20 months ago[UTC] Include return type/attributes under --version 2
Nikita Popov [Tue, 24 Jan 2023 14:32:31 +0000 (15:32 +0100)]
[UTC] Include return type/attributes under --version 2

If --function-signature is used with --version 2, then also include
the return type/attributes in the check lines. This is the
implementation of D133943 rebased on the --version mechanism from
D142473.

This doesn't bump the default version yet, because I'd like to do
that together with D140212 (which enables --function-signature by
default), as these changes seem closely related. For now this
functionality can be accessed by explicitly passing --version 2
to UTC.

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

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

20 months ago[llvm-c] Remove bindings for creating legacy passes
Nikita Popov [Tue, 28 Feb 2023 15:38:45 +0000 (16:38 +0100)]
[llvm-c] Remove bindings for creating legacy passes

Legacy passes are only supported for codegen, and I don't believe
it's possible to write backends using the C API, so we should drop
all of those. Reduces the number of places that need to be modified
when removing legacy passes.

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

20 months agoRecommit "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to...
Noah Goldstein [Thu, 2 Mar 2023 08:34:41 +0000 (02:34 -0600)]
Recommit "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to shuffles." (2nd Try)

Move the opcode checks to after we have already verified we found a
valid shift instruction (`0 < ShiftAmt`) in `matchUnaryPermuteShuffle`
and `lowerShuffleAsShift`.

Reviewed By: pengfei, RKSimon

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

20 months ago[clang][Interp] Add ArrayElemPtr{,Pop} opcode
Timm Bäder [Sat, 31 Dec 2022 16:06:52 +0000 (17:06 +0100)]
[clang][Interp] Add ArrayElemPtr{,Pop} opcode

We usually access array elements in the same pattern, which uses
narrow(). Add an extra opcode for this. This saves us quite some
instructions and makes the bytecode easier to read.

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

20 months agoRevert "[SelectionDAG] Transitively copy NodeExtraInfo on RAUW"
Marco Elver [Thu, 2 Mar 2023 08:24:25 +0000 (09:24 +0100)]
Revert "[SelectionDAG] Transitively copy NodeExtraInfo on RAUW"

This reverts commit 7f635b90e7bdf1378fd9a65fc62b99e8e07d4aaf.

The current implementation causes pathological slowdowns in certain
cases: https://github.com/llvm/llvm-project/issues/61108

20 months ago[clang][Interp] Only check constructors for global variables
Timm Bäder [Wed, 28 Dec 2022 10:43:26 +0000 (11:43 +0100)]
[clang][Interp] Only check constructors for global variables

Local variables may be partially initialized.

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

20 months ago[clang][Interp] Implement C++ Range-for loops
Timm Bäder [Sat, 31 Dec 2022 15:14:33 +0000 (16:14 +0100)]
[clang][Interp] Implement C++ Range-for loops

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

20 months ago[mlir][Linalg] NFC - Improve debug messages for padding
Nicolas Vasilache [Thu, 2 Mar 2023 07:54:21 +0000 (23:54 -0800)]
[mlir][Linalg] NFC - Improve debug messages for padding

20 months ago[LLDB] XFAIL TestRunLocker.py for windows
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:51:30 +0000 (11:51 +0400)]
[LLDB] XFAIL TestRunLocker.py for windows

TestRunLocker.py is failing on windows x64 and AArch64 buildbots.
Buildbot log suggests that test needs some minor modification for
windows which I will do later.

https://lab.llvm.org/buildbot/#/builders/83/builds/29680
https://lab.llvm.org/buildbot/#/builders/219/builds/942

20 months ago[flang] Use the newly introduced AliasAnalysisOpInterface.
Tobias Gysi [Thu, 2 Mar 2023 07:32:30 +0000 (08:32 +0100)]
[flang] Use the newly introduced AliasAnalysisOpInterface.

This revision uses the AliasAnalysisOpInterface introduced in
https://reviews.llvm.org/D144851 to set the tbaa attributes
of load and store ops. With the attribute it is also possible to
set the attribute on atomics as well as on memcopy and
memove intrinsics as soon as https://reviews.llvm.org/D144965
lands.

Reviewed By: vzakhari

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

20 months agoRevert "[LLDB] XFAIL TestRunLocker.py on Windows"
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:22:08 +0000 (11:22 +0400)]
Revert "[LLDB] XFAIL TestRunLocker.py on Windows"

This reverts commit 9d28e00e741cb19684111656803434aceef4c2a0.

20 months ago[clang][Interp] Handle defined functions without a body
Timm Bäder [Fri, 30 Dec 2022 10:50:48 +0000 (11:50 +0100)]
[clang][Interp] Handle defined functions without a body

This happens when explicitly defaulting a constructor, for example.

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

20 months ago[llvm][GenericUniformity] Prevent assert while calculating temporal divergence
Yashwant Singh [Thu, 2 Mar 2023 07:08:52 +0000 (12:38 +0530)]
[llvm][GenericUniformity] Prevent assert while calculating temporal divergence

analyzeTemporalDivergence() was missing the check for always-uniform before
evaluating weather an instruction depends on a value defined in the cycle.
Fix for #60638
https://github.com/llvm/llvm-project/issues/60638

Reviewed By: sameerds, foad, #amdgpu

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

20 months ago[LLDB] XFAIL TestRunLocker.py on Windows
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:05:11 +0000 (11:05 +0400)]
[LLDB] XFAIL TestRunLocker.py on Windows

20 months ago[x86] Precommit a test
Kazu Hirata [Thu, 2 Mar 2023 07:03:39 +0000 (23:03 -0800)]
[x86] Precommit a test

This patch precommits a test for:

https://github.com/llvm/llvm-project/issues/60802

20 months ago[clang][Interp] Implement remaining MaterializeTemporaryExpr bits
Timm Bäder [Mon, 26 Dec 2022 08:18:56 +0000 (09:18 +0100)]
[clang][Interp] Implement remaining MaterializeTemporaryExpr bits

As well as support for CompoundLiteralExprs.

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

20 months agoELF: Respect MEMORY command when specified without a SECTIONS command.
Peter Collingbourne [Thu, 2 Mar 2023 00:54:24 +0000 (16:54 -0800)]
ELF: Respect MEMORY command when specified without a SECTIONS command.

We were previously ignoring the MEMORY command unless SECTIONS was also
specified. Fix it.

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

20 months ago[llvm-lib] 'llvm-lib' currently cannot generate an import library from a Windows
Vadim Paretsky (Intel Americas Inc) [Thu, 2 Mar 2023 04:32:35 +0000 (20:32 -0800)]
[llvm-lib] 'llvm-lib' currently cannot generate an import library from a Windows
.def file, functionality supported by 'lib'. This incompatibility is
breaking clang based Windows openmp builds. This revision adds
basic support for this feature to llvm-lib by cloning the corresponding
code from 'dlltool'.

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

20 months agoRevert D143786 "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable...
Fangrui Song [Thu, 2 Mar 2023 03:08:55 +0000 (19:08 -0800)]
Revert D143786 "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to shuffles."

This reverts commit a98ee27416916c3f8af4cd229e0a633423d6d9a3.
It caused MemorySanitizer use-of-uninitialized-value in matchUnaryPermuteShuffle.

20 months ago[libcxx][NFC] Added a note about the P2520R0
Shivam kunwar [Thu, 2 Mar 2023 02:28:15 +0000 (07:58 +0530)]
[libcxx][NFC] Added a note about the P2520R0

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

20 months ago[libc++] [FreeBSD] correct 64-bit test
Ed Maste [Wed, 1 Mar 2023 23:39:29 +0000 (18:39 -0500)]
[libc++] [FreeBSD] correct 64-bit test

Using __SIZEOF_LONG__ == 8 rather than __LP64__ is needed so we use umtx
on CHERI.  I accidentally landed an older diff.

Fixes: 17ecbb3ea6ff0ae716dd524c0e2bf75a4815c95b

20 months ago[memprof] Avoid meaningless pod copy
Wu, Yingcong [Thu, 2 Mar 2023 01:36:37 +0000 (01:36 +0000)]
[memprof] Avoid meaningless pod copy

The pointer `Buffer` is not changed, so there is no need to use reference, and the `Pod` here should use reference to avoid meaningless copy.

Reviewed By: snehasish

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

20 months ago[WebAssembly] Skip implied bitmask operation in LowerShift
Jun Ma [Thu, 23 Feb 2023 07:45:48 +0000 (15:45 +0800)]
[WebAssembly] Skip implied bitmask operation in LowerShift

This patch skips redundant explicit masks of the shift count since
it is implied inside wasm shift instruction.

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

20 months agoRevert "[MergeICmps] Adapt to non-eq comparisons, retry"
Zhongyunde [Thu, 2 Mar 2023 01:07:44 +0000 (09:07 +0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons, retry"

This reverts commit 74ad19c25d7217d8f580a21d12fd4c784a1a0094.

test unittests/ProfileData/ProfileDataTests fails when built with
optimisations level -O1 with clang including this patch.

20 months ago[SPIR-V] Remove redundant check and fix typos
Michal Paszkowski [Wed, 1 Mar 2023 23:51:18 +0000 (00:51 +0100)]
[SPIR-V] Remove redundant check and fix typos

20 months ago[ExecutionEngine] Silence warnings about sprintf use in interpreter.
Lang Hames [Wed, 1 Mar 2023 23:34:23 +0000 (15:34 -0800)]
[ExecutionEngine] Silence warnings about sprintf use in interpreter.

We should review memory safety in the interpreter
(https://github.com/llvm/llvm-project/issues/58086), but for now just silence
the warnings to reduce noise.

rdar://100555195

20 months ago[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.
Lang Hames [Wed, 22 Feb 2023 05:22:28 +0000 (21:22 -0800)]
[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.

We can get the triple from the ExecutionSession, so clients shouldn't have to
provide it.

20 months ago[libc] add basic Intel MacOS configuration
Michael Jones [Wed, 1 Mar 2023 19:35:40 +0000 (11:35 -0800)]
[libc] add basic Intel MacOS configuration

The config is based on the ARM MacOS config, but with fenv and math
functions disabled.

This should unblock this bug: https://github.com/llvm/llvm-project/issues/60910

Reviewed By: sivachandra

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