Commit Graph

460164 Commits

Author SHA1 Message Date
Weining Lu
040a41a852 [LoongArch] Provide basic TargetTransformInfo implementation
This patch only provides basic LoongArchTTIImpl, and more hooks
will be added to provide TTI machinery for LoongArch soon.

Reviewed By: SixWeining, xen0n

Differential Revision: https://reviews.llvm.org/D147524
2023-05-06 11:38:33 +08:00
Chuanqi Xu
5b388f86aa [C++20] [Modules] Don't check input files for C++20 Modules
Close https://github.com/llvm/llvm-project/issues/62269

Currently, the compiler will emit errors when we compile C++20 modules
if the referenced files changed or got removed. This is because we reuse
the existing logic from Clang implicit modules. It is helpful for clang
implicit modules since it is implicit and we want to be sure things
don't go wrong. But it is not necessary for C++20 modules. The C++20
modules is explicit and it is build systems' responsibility to maintain
the dependencies. So the check in the compiler side may be an overkill.
2023-05-06 11:17:15 +08:00
NAKAMURA Takumi
a29a97d76b Fix a warning in D149117 [-Wunused-but-set-variable] 2023-05-06 11:30:04 +09:00
wanglei
2285bc0489 [gn] Move LoongArch target from llvm_all_experimental_targets to llvm_all_stable_targets
Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D147701
2023-05-06 10:21:19 +08:00
Manna, Soumi
babe8629d7 [NFC][Clang] Fix static analyzer tool remarks about large copies by values in Format.cpp file
Reported by Static Analyzer Tool, Coverity:

Inside "Format.cpp" file, in clang::format::internal::reformat(clang::format::FormatStyle const &, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus *)::[lambda(clang::format::Environment const &) (instance 4)]::operator ()(clang::format::Environment const &): A very large function call parameter exceeding the high threshold is passed by value.

pass_by_value: Capturing variable S of type clang::format::FormatStyle (size 808 bytes) by value, which exceeds the high threshold of 512 bytes

This patch uses original code but with an init capture that does a move instead of a copy.

Reviewed By: tahonermann, erichkeane, MyDeveloperDay, owenpan, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D149647
2023-05-05 18:55:49 -07:00
walter erquinigo
9f5ef42cbd [LLDB] Add minimal support for the new Mojo language
Modular just announced a new language called Mojo. This patch adds an entry in the language list in LLDB for minimal support (e.g. being able to create a TypeSystem for this language). We will later add debug info entries when the language matures.
2023-05-05 20:35:19 -05:00
Teresa Johnson
a28261c711 [MemProf] Create single version of helper function (NFC)
Small clean up to keep a single version of getAllocTypeAttributeString
which was duplicated locally.
2023-05-05 18:31:35 -07:00
Joseph Huber
023bfc196b [libc][docs] Fix incorrect CMake argument in GPU documentation
Summary;
This was changed a long time ago to drop the `LLVM_` prefix.

Differential Revision: https://reviews.llvm.org/D150012
2023-05-05 20:16:47 -05:00
William Huang
4357824c63 [llvm-profdata] ProfileReader cleanup - preparation for MD5 refactoring
Cleanup profile reader classes to prepare for complex refactoring as propsed in D147740 (Use MD5 as key for profile map). Change is too complicated so I am cleaning up the reader implementation first with these goals.
-  Reduce duplicated/similar logic
-  Reduce virtual functions, changing them to non-virtual
-  Reduce unnecessry checks, indirections, and dead writes.

This is patch 1/n. This patch refactors NameTable

Explaining several decisions here

1. useMD5() means whether  names of the profiles (the ProfileMap) are represented as MD5. It is NOT whether the input profile format is MD5. This function is an interface for IPO passes to decide whether to match function names or function MD5. There are two motives here:
(a) Eventually we want to use MD5 to represent all function contexts because it is much faster to use it as a key for lookup tables (prototype implementation D147740), so in compilation mode we call setProfileUseMD5() to force use MD5. While in tools mode (llvm-profdata) we want to keep the function name info if it's in the input profile.
(b) We also propose to allow multiple name tables and profile sections in ExtBinary format, and it could consist of name tables with or without using MD5, in this case MD5 prevails and other name tables are converted to MD5.

2. MD5 handling logic is pushed up to BinaryReader base class, because this trades a non-devirtualized virtual function call with a predictable branch. ReadStringFromTable() accounts for >5% time when loading a full 1 GB profile, it should not be virtual.

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D148868
2023-05-06 00:21:03 +00:00
Mehdi Amini
c5fefbc8db Fix MLIR Linalg Python test after adopting properties in f6ac7e3c6d 2023-05-05 17:15:48 -07:00
Vitaly Buka
22aa493ad2 [test][sanitizer] Add feature for "any" GLIBC
"any" is actualy any resonably recent GLIBC.
2023-05-05 17:12:17 -07:00
Vitaly Buka
74937f2404 [test][sanitizer] Add tests for join variants 2023-05-05 17:12:17 -07:00
Mehdi Amini
f6ac7e3c6d Adopt Properties to store operations inherent Attributes in the Linalg dialect
This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148299
2023-05-05 16:58:20 -07:00
Mehdi Amini
ab2e224e19 Fix UB passing nullptr to an EmptyProperties class when building OpAdaptor
A new forwarding constructor is introduced on the adaptor to take directly
an OpaqueProperties object and do the nullptr checking and casting to avoid
the boilerplate at callsites.

Differential Revision: https://reviews.llvm.org/D150003
2023-05-05 16:50:52 -07:00
Sergei Barannikov
4c9f1584ce Add -misc-use-anonymous-namespace to .clang-tidy
This is at odds with the coding standard.
Quoting https://llvm.org/docs/CodingStandards.html#anonymous-namespaces
> Because of this, we have a simple guideline: make anonymous namespaces
> as small as possible, and only use them for class declarations.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D149664
2023-05-06 02:33:20 +03:00
Teresa Johnson
cfad2d3a3d [MemProf] Context disambiguation cloning pass [patch 4/4]
Applies ThinLTO cloning decisions made during the thin link and
recorded in the summary index to the IR during the ThinLTO backend.

Depends on D141077.

Differential Revision: https://reviews.llvm.org/D149117
2023-05-05 16:26:32 -07:00
AdityaK
8f0eee16d9 Remove unused basic_android_tree/mipsel-linux-android
Reviewers: danalbert, enh, pirama, srhines

Differential Revision: https://reviews.llvm.org/D149980
2023-05-05 15:50:22 -07:00
Fangrui Song
8afd831b45 ms inline asm: recognize case-insensitive JMP and CALL as TargetLowering::C_Address
In a `__asm` block, a symbol reference is usually a memory constraint
(indirect TargetLowering::C_Memory) [LOOP]. CALL and JUMP instructions are special
that `__asm call k` can be an address constraint, if `k` is a function.

Clang always gives us indirect TargetLowering::C_Memory and need to convert it
to direct TargetLowering::C_Address. D133914 implements this conversion, but
does not consider JMP or case-insensitive CALL. This patch implements the missing
cases, so that `__asm jmp k` (`jmp ${0:P}`) will correctly lower to `jmp _k`
instead of `jmp dword ptr [_k]`.

(`__asm call k` lowered to `call dword ptr ${0:P}` and is fixed by D149695 to
lower to `call ${0:P}` instead.)

[LOOP]: Some instructions like LOOP{,E,NE} and Jcc always use an address
constraint (`loop _k` instead of `loop dword ptr [_k]`).

After this patch and D149579, all the following cases will be correct.
```
int k(int);
int (*kptr)(int);
...
__asm call k; // correct without this patch
__asm CALL k; // correct, but needs this patch to be compatible with D149579
__asm jmp k;  // correct, but needs this patch to be compatible with D149579
__asm call kptr; // will be fixed by D149579.  "Broken case" in clang/test/CodeGen/ms-inline-asm-functions.c
__asm jmp kptr;  // will be fixed by this patch and D149579
```

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D149920
2023-05-05 15:32:32 -07:00
Alex Langford
dc91a55b2c [lldb] Fix fallout from e9eaf7b430
Minor logic mistake. This caused TestObjCClassMethod to fail.
2023-05-05 14:56:49 -07:00
Vitaly Buka
c3a46fe9c1 [test][lsan] Remove std::vector from test 2023-05-05 14:48:57 -07:00
Vitaly Buka
43de9cbec9 [test][lsan] For thread args/result leak 2023-05-05 14:48:13 -07:00
Jonas Devlieghere
81f9c4323b [lldb] Migrate to GetPropertyAtIndexAs for ArchSpec (NFC)
Use the templated GetPropertyAtIndexAs helper for ArchSpec.
2023-05-05 14:43:59 -07:00
Jonas Devlieghere
0f9c08f1b2 [lldb] Migrate to GetPropertyAtIndexAs for LanguageType (NFC)
Use the templated GetPropertyAtIndexAs helper for LanguageType.
2023-05-05 14:43:58 -07:00
Manna, Soumi
07996804a0 [NFC] ][CLANG] Fix static code analyzer concerns
Reported by Coverity:

1. Inside "ASTReader.cpp" file,  in clang::ASTReader::FindExternalLexicalDecls(clang::DeclContext const *, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl *> &): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type pair.

2. Inside "ASTReader.cpp" file, in clang::ASTReader::ReadAST(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule> *): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type DenseMapPair.

3. Inside "CGOpenMPRuntimeGPU.cpp" file, in clang::CodeGen::CGOpenMPRuntimeGPU::emitGenericVarsEpilog(clang::CodeGen::CodeGenFunction &, bool): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type pair.

4. Inside "ASTWriter.cpp" file, in clang::ASTWriter::WriteHeaderSearch(clang::HeaderSearch const &): Using the auto keyword without an & causes a copy.

auto_causes_copy: Using the auto keyword without an & causes the copy of an object of type UnresolvedHeaderDirective.

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D149461
2023-05-05 14:34:36 -07:00
Benjamin Kramer
d2540186eb [bazel] Add missing dependency for b8e878da5c 2023-05-05 23:33:41 +02:00
Shoaib Meenai
0e2b4b2dba Revert "[ArgumentPromotion] Bail if any callers are minsize"
This reverts commit 8b8466fd31.

This is causing size regressions with -Oz and FullLTO. Revert while I
come up with a repro.
2023-05-05 14:26:57 -07:00
Shoaib Meenai
141be5c062 Revert "Reland [Pipeline] Don't limit ArgumentPromotion to -O3"
This reverts commit 6f29d1adf2.

https://reviews.llvm.org/D149768 is causing size regressions for -Oz
with FullLTO, and I'm reverting that one while investigating. This
commit depends on that one, so it needs to be reverted as well.
2023-05-05 14:26:57 -07:00
Alexey Bataev
5d31134e1b Add myself as a code owner of SLP vectorizer + credits, NFC. 2023-05-05 14:19:18 -07:00
Nikolas Klauser
e7e3711885 [libc++][PSTL] Make the PSTL available by default under -fexperimental-library
This removes the need for a custom libc++ build to have a basic set of PSTL algorithms.

Reviewed By: ldionne, #libc

Spies: miyuki, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D149624
2023-05-05 13:53:17 -07:00
Ethan Luis McDonough
42df495114 [flang] OpenMP allocate directive parse tree fix
Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate

After rewriting:
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate

Reviewed By: kiranchandramohan

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

Co-authored-by: Isaac Perry <isaac.perry@arm.com>
2023-05-05 15:50:49 -05:00
Ethan Luis McDonough
a6e616cdb1 Revert "[flang] OpenMP allocate directive parse tree fix"
This reverts commit 597d8563cd.
2023-05-05 15:47:00 -05:00
Teresa Johnson
04f3c5a71e Restore again "[MemProf] Context disambiguation cloning pass [patch 3/4]"
This reverts commit f09807ca9d, restoring
bfe7205975 and follow on fix
e3e6bc6995, now that the nondeterminism
has been addressed by D149924.

Differential Revision: https://reviews.llvm.org/D141077
2023-05-05 13:27:33 -07:00
Ethan Luis McDonough
597d8563cd [flang] OpenMP allocate directive parse tree fix
Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
```
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate
```

After rewriting:
```
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
```

Co-authored-by: Isaac Perry <isaac.perry@arm.com>

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D148409
2023-05-05 14:55:25 -05:00
Ethan Luis McDonough
936d40cdb5 Revert "[flang] OpenMP allocate directive parse tree fix"
This reverts commit 5faf45a3d2.
Once again arcanist stripped the co-author metadata.  I'm going to add it to the revision description and try one last time.
2023-05-05 14:50:14 -05:00
Louis Dionne
afd3478f37 [clang][ci] Upload artifacts in a tarball to reduce size and avoid symlink issues 2023-05-05 15:45:52 -04:00
Ethan Luis McDonough
5faf45a3d2 [flang] OpenMP allocate directive parse tree fix
Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
```
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate
```

After rewriting:
```
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
```

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D148409
2023-05-05 14:41:15 -05:00
Ethan Luis McDonough
c89959842f Revert "[flang] OpenMP allocate directive parse tree fix"
This reverts commit eaf7d97865.
Arcanist stripped co-author data from initial commit.
2023-05-05 14:31:01 -05:00
Philip Reames
c501aa8843 [RISCV][TTI] Model shuffle mask materialization with correct index type
We were modeling these as if the index type was always e8, but the actual
lowering uses the data type width if legal.  We also weren't accounting for
i64 on xlen32 correctly.

Noticed via inspection while working on the shuffle/buildvec lowering.  Note
that this costing is also wrong in a more major way - we don't actually use
a constant pool load in many cases.  But that's a separate issue.
2023-05-05 12:26:21 -07:00
Fangrui Song
65493fd57a [MC] Simplify flushPendingLabels. NFC 2023-05-05 12:12:45 -07:00
Valentin Clement
d9d06d11ca [flang][openacc] Lower host and device clauses to data operand ops
Update OpenACC update construct lowering to create
the data operand operations for host and device clauses.

Depends on D149909

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149910
2023-05-05 12:02:06 -07:00
Valentin Clement
437bc5640f [mlir][openacc] Switch host/device clauses to data operand operations
Introduce acc.update_host and acc.update_device as data
operands operation to be used by the acc.update op.

Reviewed By: razvanlupusoru, jeanPerier

Differential Revision: https://reviews.llvm.org/D149909
2023-05-05 12:01:27 -07:00
Manna, Soumi
6e0c441748 [NFC][CLANG] Fix nullptr dereference found by Coverity static analysis tool
Reported by Coverity:

  In clang::ASTContext::hasUniqueObjectRepresentations(clang::QualType, bool): Return value of function which returns null is dereferenced without checking.

  (Ty->isMemberPointerType()) {
      	//returned_null: getAs returns nullptr.
      	//var_assigned: Assigning: MPT = nullptr return value from getAs.
      const auto *MPT = Ty->getAs<MemberPointerType>();

     //dereference: Dereferencing a pointer that might be nullptr MPT when calling getMemberPointerInfo. (The virtual call resolves to
     <unnamed>::ItaniumCXXABI::getMemberPointerInfo.)
      return !ABI->getMemberPointerInfo(MPT).HasPadding;
    }

ABIs assume the parameter passed to `getMemberPointerInfo` is non-null.
This patch checks type by doing a `if (const auto *MPT = Ty->getAs<MemberPointerType>())` instead.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D149922
2023-05-05 11:57:33 -07:00
Ethan Luis McDonough
eaf7d97865 [flang] OpenMP allocate directive parse tree fix
Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
```
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate
```

After rewriting:
```
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
```

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D148409
2023-05-05 13:53:11 -05:00
Joseph Huber
71d2b65e36 [libc] Make the RPC interfaces move only
This patch uses the changed interface in D149972 to make these classes
move-only. The `Port` class could be further refined to be
construct-only in a future patch, but for now this makes it more
difficult to misuse the interface.

Depends on D149972

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D149974
2023-05-05 13:45:23 -05:00
Joseph Huber
b8e878da5c [libc] Rework 'cpp:optional' to support move construction
This patch replaces the existing `cpp::optional` type with a newer
version that has more features. This class is heavily inspired by the
old `llvm::Optional` class. Currently the limitations of this class is
that we only handle types with trivial constructors or operators.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149972
2023-05-05 13:45:22 -05:00
Hanhan Wang
8eed9f38ca [mlir][linalg] Add support for folding pack(fill) into fill.
Reviewed By: qedawkins

Differential Revision: https://reviews.llvm.org/D149801
2023-05-05 11:42:06 -07:00
Simon Pilgrim
c7fce3f98b [DAG] Rename computeOverflowKind -> computeOverflowForUnsignedAdd. NFC.
Matches the naming convention for the equivalent ValueTracking helpers - further SelectionDAG computeOverflowFor*() helpers will be added soon.
2023-05-05 19:38:54 +01:00
Simon Pilgrim
051918c71e [DAG] expandIntMINMAX - add umax(x,1) --> sub(x,cmpeq(x,0)) fold
Move the fold from X86 to generic expansion

(We also have several existing expansions that are missing freezes on repeated operands - I've added a TODO for now).
2023-05-05 19:27:52 +01:00
Alex Langford
e9eaf7b430 Re-land "[lldb] Expose a const iterator for SymbolContextList"
Re-lands 04aa943be8 with modifications
to fix tests.
I originally reverted this because it caused a test to fail on Linux.
The problem was that I inverted a condition on accident.
2023-05-05 11:19:21 -07:00
Craig Topper
9c377c53da [RISCV] Copy lack-of-signed-truncation-check.ll and signed-truncation-check.ll from AArch6/X86. NFC
This is a more exhaustive set of tests for the same issue D149814
is trying to solve.
2023-05-05 11:15:39 -07:00