platform/upstream/llvm.git
2 years ago[scudo] Use nullptr instead of integer-to-pointer cast
Dominic Chen [Wed, 16 Mar 2022 20:49:29 +0000 (13:49 -0700)]
[scudo] Use nullptr instead of integer-to-pointer cast

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

2 years ago[scudo] Don't unmap other low memory pages if mapping doesn't exist
Dominic Chen [Wed, 16 Mar 2022 20:51:08 +0000 (13:51 -0700)]
[scudo] Don't unmap other low memory pages if mapping doesn't exist

Tests can register multiple allocators, but only the first will initialize since it initializes the TSDRegistrySharedT. Then, destruction of subsequent allocator may end up unmapping a nullptr PrimaryBase with non-zero PrimarySize.

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

2 years ago[scudo] Explicitly mark enum as unsigned
Dominic Chen [Wed, 16 Mar 2022 20:52:04 +0000 (13:52 -0700)]
[scudo] Explicitly mark enum as unsigned

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

2 years ago[scudo] Remove unused vector value initializer
Dominic Chen [Wed, 16 Mar 2022 20:52:31 +0000 (13:52 -0700)]
[scudo] Remove unused vector value initializer

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

2 years ago[AlwaysInliner] Check inliner errors even without assserts
Ellis Hoag [Tue, 15 Mar 2022 18:10:32 +0000 (11:10 -0700)]
[AlwaysInliner] Check inliner errors even without assserts

When we build clang without asserts we should still check the result of
`InlineFunction()` to be sure there wasn't an error. Otherwise we could
incorrectly merge attributes in the next line.

This also removes a redundent call to `getCaller()`.

Reviewed By: nikic

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

2 years ago[NFC] Disable clang/SymbolGraph test
Zixu Wang [Thu, 17 Mar 2022 17:14:19 +0000 (10:14 -0700)]
[NFC] Disable clang/SymbolGraph test

2 years ago[RISCV] Mention Zvfh extension in release notes. NFC
Craig Topper [Thu, 17 Mar 2022 17:12:09 +0000 (10:12 -0700)]
[RISCV] Mention Zvfh extension in release notes. NFC

2 years ago[PS4] Make __BIGGEST_ALIGNMENT__ 32bytes
Yuanfang Chen [Thu, 17 Mar 2022 17:12:28 +0000 (10:12 -0700)]
[PS4] Make __BIGGEST_ALIGNMENT__ 32bytes

So it matches `__STDCPP_DEFAULT_NEW_ALIGNMENT__`.

Reviewed By: probinson, aaron.ballman

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

2 years agoRevert "RegAllocGreedy: Fix last chance recolor assert in impossible case"
Matt Arsenault [Thu, 17 Mar 2022 16:46:01 +0000 (12:46 -0400)]
Revert "RegAllocGreedy: Fix last chance recolor assert in impossible case"

This reverts commit c46aab01c002b7a04135b8b7f1f52d8c9ae23a58.

This evidently blocks compiling in some cases that used to work
before. I'm also not fully convinced this is the correct place to fix
this problem.

2 years ago[clang][dataflow] Model the behavior of non-standard optional assignment
Stanislav Gatev [Wed, 16 Mar 2022 22:20:05 +0000 (22:20 +0000)]
[clang][dataflow] Model the behavior of non-standard optional assignment

Model nullopt, value, and conversion assignment operators.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D121863

2 years ago[RISCV] Add +experimental-zvfh extension to cover half types in vectors.
Craig Topper [Thu, 17 Mar 2022 16:44:43 +0000 (09:44 -0700)]
[RISCV] Add +experimental-zvfh extension to cover half types in vectors.

Currently we allow half types in vectors if the scalar Zfh extension
is enabled. This behavior is not inline with the vector spec. For f32
and f64 types, the Zve32f, Zve64f, Zve64d, and V explicitly control
the availablity of floating point types in vectors.

In order to make our compiler compliant, we either need to remove all support
for half in vectors or we need an extension to control it.

Draft spec here https://github.com/riscv/riscv-v-spec/pull/780

Reviewed By: kito-cheng

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

2 years ago[LoopSimplifyCFG] Add test case for PR54023.
Florian Hahn [Thu, 17 Mar 2022 17:01:36 +0000 (17:01 +0000)]
[LoopSimplifyCFG] Add test case for PR54023.

Test case for #54023.

2 years ago[gn build] Port 1af5fbd5c605
LLVM GN Syncbot [Thu, 17 Mar 2022 16:55:08 +0000 (16:55 +0000)]
[gn build] Port 1af5fbd5c605

2 years agoRevert "Use a stable-sort when combining bases"
Sterling Augustine [Thu, 17 Mar 2022 16:53:40 +0000 (09:53 -0700)]
Revert "Use a stable-sort when combining bases"

This reverts commit 81417261a15f46284f2613118120d7d6de2bc02d.

2 years agoAttempt forward fix for Linux buildbots for D116385
David Goldman [Thu, 17 Mar 2022 16:49:08 +0000 (12:49 -0400)]
Attempt forward fix for Linux buildbots for D116385

2 years ago[flang][nfc] Move a test
Andrzej Warzynski [Thu, 17 Mar 2022 16:44:16 +0000 (16:44 +0000)]
[flang][nfc] Move a test

All option forwarding tests should be added to frontend-forwarding.f90
rather than files corresponding to various options. This patch moves
such test for `-mllvm` accordingly.

2 years ago[RISCV] Simplify scalable vector case in lowerVectorMaskExt.
Craig Topper [Thu, 17 Mar 2022 16:33:52 +0000 (09:33 -0700)]
[RISCV] Simplify scalable vector case in lowerVectorMaskExt.

Since we have SPLAT_VECTOR_PARTS these days, I don't think we need
to go through extra lengths to avoid introducing an illegal scalar type.
We can just call getConstant using the scalable vector type and let
it create either a SPLAT_VECTOR or a SPLAT_VECTOR_PARTS.

Reviewed By: frasercrmck, rogfer01

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

2 years ago[mlir][docs] Fix formatting issue in Dialects/Vector.md.
Ingo Mueller [Thu, 17 Mar 2022 16:37:11 +0000 (16:37 +0000)]
[mlir][docs] Fix formatting issue in Dialects/Vector.md.

Reviewed By: aartbik

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

2 years ago[NFC][ InstCombine] precommit test for D121585
Andrew Wei [Thu, 17 Mar 2022 16:35:47 +0000 (00:35 +0800)]
[NFC][ InstCombine] precommit test for D121585

Based on original tests from D121585.

2 years ago[BPF] Fix a bug in BPFAdjustOpt pass for icmp transformation
Yonghong Song [Thu, 17 Mar 2022 06:24:15 +0000 (23:24 -0700)]
[BPF] Fix a bug in BPFAdjustOpt pass for icmp transformation

When checking a bcc issue related to bcc tool inject.py,
I found a bug in BPFAdjustOpt pass for icmp transformation,
caused by typo's. For the following condition:
  Cond2Op != ICmpInst::ICMP_SLT && Cond1Op != ICmpInst::ICMP_SLE
it should be
  Cond2Op != ICmpInst::ICMP_SLT && Cond2Op != ICmpInst::ICMP_SLE

This patch fixed the problem and a test case is added.

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

2 years ago[mlir] Extend SimplifyTrivialLoops
Amy Zhuang [Thu, 17 Mar 2022 15:40:25 +0000 (08:40 -0700)]
[mlir] Extend SimplifyTrivialLoops

Fold away empty loops that iterate at least once and only return
values defined outside of the loop.

Reviewed By: bondhugula, dcaballe

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

2 years ago[AArch64][SVE] InstCombine llvm.aarch64.sve.sel to select
Matt Devereau [Wed, 16 Mar 2022 11:41:14 +0000 (11:41 +0000)]
[AArch64][SVE] InstCombine llvm.aarch64.sve.sel to select

InstCombine llvm.aarch64.sve.sel to select. This allows an existing instCombine
added in 20b0fa91c9ee to fire.

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

2 years ago[flang] Lower some numeric intrinsics
Valentin Clement [Thu, 17 Mar 2022 16:16:43 +0000 (17:16 +0100)]
[flang] Lower some numeric intrinsics

This patch adds lowering for the following numeric intrinsics:
- aint
- anint
- cmplx
- conjg
- dble
- dprod
- sign

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[flang] Add equivalence lowering tests
Valentin Clement [Thu, 17 Mar 2022 16:15:34 +0000 (17:15 +0100)]
[flang] Add equivalence lowering tests

This patch adds couple of lwoering tests for equivalences

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[clang] AddObjCKeyValueCompletions - use castAs<> instead of getAs<> to avoid derefer...
Simon Pilgrim [Thu, 17 Mar 2022 15:15:08 +0000 (15:15 +0000)]
[clang] AddObjCKeyValueCompletions - use castAs<> instead of getAs<> to avoid dereference of nullptr

The pointers are always dereferenced, so assert the cast is correct instead of returning nullptr

2 years ago[flang] Add more lowering tests for dummy arguments
Valentin Clement [Thu, 17 Mar 2022 16:01:46 +0000 (17:01 +0100)]
[flang] Add more lowering tests for dummy arguments

This patch adds more lowering tests for dummy arguments
and adds lowering for a specific case.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoUse a stable-sort when combining bases
Sterling Augustine [Wed, 16 Mar 2022 23:35:40 +0000 (16:35 -0700)]
Use a stable-sort when combining bases

While experimenting with different algorithms for std::sort
I discovered that combine-vmovdrr.ll fails if this sort is not
stable.

I suspect that the test is too stringent in its check--the resultant
code looks functionally identical to me under both stable and unstable
sorting, but a generic fix is quite a bit more difficult to implement.

Thanks to scw@google.com for finding the proper fix.

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

2 years ago[flang] Add IO lowering test
Valentin Clement [Thu, 17 Mar 2022 15:59:31 +0000 (16:59 +0100)]
[flang] Add IO lowering test

This patch adds more lowering tests for IO
Test lowering of IO read SIZE control-spec (12.6.2.15)

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[AtomicExpandPass][NFC] Reformat with clang-format
Marco Elver [Thu, 17 Mar 2022 15:46:12 +0000 (16:46 +0100)]
[AtomicExpandPass][NFC] Reformat with clang-format

NFCI.

2 years ago[LTO][ELF] Require asserts for --stats-file= tests.
henry wong [Thu, 17 Mar 2022 15:53:36 +0000 (23:53 +0800)]
[LTO][ELF] Require asserts for --stats-file= tests.

https://reviews.llvm.org/D121809 causes the build bot failure, add the `REQUIRES: asserts` to fix it.

Reviewed By: tejohnson

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

2 years ago[CodeGen] Avoid pointer element type access for blocks
Nikita Popov [Thu, 17 Mar 2022 15:54:21 +0000 (16:54 +0100)]
[CodeGen] Avoid pointer element type access for blocks

Pass the block struct type down to the TargetInfo hooks.

2 years ago[LLDB] Modifying expression code in MakeLoadImageUtilityFunction to be more consistent
Shafik Yaghmour [Thu, 17 Mar 2022 15:51:32 +0000 (08:51 -0700)]
[LLDB] Modifying expression code in MakeLoadImageUtilityFunction to be more consistent

MakeLoadImageUtilityFunction() is not using extern "C" for external C functions
and it is not using eLanguageTypeC_plus_plus. So I am modifying it to be consistent.

Also see: rdar://87544782

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

2 years ago[Coroutines][NFC] Format line to 80 cols
Fraser Cormack [Thu, 17 Mar 2022 15:33:52 +0000 (15:33 +0000)]
[Coroutines][NFC] Format line to 80 cols

2 years ago[libc][NFC] Add a separate flag for capturing the '+' in fopen mode string.
Siva Chandra Reddy [Thu, 17 Mar 2022 08:39:58 +0000 (08:39 +0000)]
[libc][NFC] Add a separate flag for capturing the '+' in fopen mode string.

Having a separate flag helps in setting up proper flags when
implementing, say the Linux specialization of File.

Along the way, a signature for a function which is to be used to open
files has been added. The implementation of the function is to be
included in platform specializations.

Reviewed By: lntue

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

2 years ago[OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files
Arthur Eubanks [Thu, 10 Feb 2022 19:56:14 +0000 (11:56 -0800)]
[OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files

This allows us to not have to specify -opaque-pointers when updating
IR tests from typed pointers to opaque pointers.

We detect opaque pointers in .ll files by looking for relevant tokens,
either "ptr" or "*".

Reviewed By: #opaque-pointers, nikic

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

2 years ago[CodeGen] Avoid some pointer element type accesses
Nikita Popov [Thu, 17 Mar 2022 14:41:50 +0000 (15:41 +0100)]
[CodeGen] Avoid some pointer element type accesses

2 years ago[lldb] Skip invalid-condition.test on Windows
Jonas Devlieghere [Thu, 17 Mar 2022 15:22:55 +0000 (08:22 -0700)]
[lldb] Skip invalid-condition.test on Windows

This test is making the Windows bot unhappy. Unfortunately the output
doesn't tell me much about what exactly is wrong.

2 years ago[CodeGen] Avoid some pointer element type accesses
Nikita Popov [Thu, 17 Mar 2022 14:21:01 +0000 (15:21 +0100)]
[CodeGen] Avoid some pointer element type accesses

2 years ago[clangd] Code action for creating an ObjC initializer
David Goldman [Wed, 29 Dec 2021 21:20:29 +0000 (16:20 -0500)]
[clangd] Code action for creating an ObjC initializer

The code action creates an initializer for the selected
ivars/properties, defaulting to all if only the interface/implementation
container is selected.

We add it based on the position of the first non initializer that we
see, and default to adding it where the @end token is.

We also use the ObjC parameter form of (nullable id) instead of
(id _Nullable) if the property has the nullable attribute.

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

2 years ago[Clang] Added info about noinline/always_inline statement attributes to release notes
Dávid Bolvanský [Thu, 17 Mar 2022 15:28:37 +0000 (16:28 +0100)]
[Clang] Added info about noinline/always_inline statement attributes to release notes

Reviewed By: aaron.ballman

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

2 years ago[AArch64] Add extra insert-subvector tests. NFC
David Green [Thu, 17 Mar 2022 15:29:07 +0000 (15:29 +0000)]
[AArch64] Add extra insert-subvector tests. NFC

2 years ago[AMDGPU] Stop using getMinimalPhysRegClass in LowerFormalArguments
Jay Foad [Thu, 17 Mar 2022 12:55:33 +0000 (12:55 +0000)]
[AMDGPU] Stop using getMinimalPhysRegClass in LowerFormalArguments

NFCI. The motivation for this is avoid problems in future if we add new
classes containing only a subset of all VGPRs, or a subset of all SGPRs.
getMinimalPhysRegClass would favour these smaller classes, which is not
what we want here.

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

2 years ago[DebugInfo][InstrRef] Prefer stack locations for variables
Jeremy Morse [Thu, 17 Mar 2022 14:03:22 +0000 (14:03 +0000)]
[DebugInfo][InstrRef] Prefer stack locations for variables

This patch adjusts what location is picked for a known variable value --
preferring to leave locations on the stack, even when a value is re-loaded
into a register. The benefit is reduced location list entropy, on a
clang-3.4 build I found that .debug_loclists reduces in size by 6%, from
29Mb down to 27Mb.

Testing: a few tests need the stack slot to be written to explicitly, to
force LiveDebugValues into restoring the variable location to a register.
I've added an explicit test for the desired behaviour in
livedebugvalues_recover_clobbers.mir .

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

2 years ago[CodeGen] Avoid some pointer element type accesses
Nikita Popov [Thu, 17 Mar 2022 13:54:18 +0000 (14:54 +0100)]
[CodeGen] Avoid some pointer element type accesses

2 years ago[Instruction] Introduce getAtomicSyncScopeID()
Marco Elver [Thu, 17 Mar 2022 13:56:29 +0000 (14:56 +0100)]
[Instruction] Introduce getAtomicSyncScopeID()

An analysis may just be interested in checking if an instruction is
atomic but system scoped or single-thread scoped, like ThreadSanitizer's
isAtomic(). Unfortunately Instruction::isAtomic() can only answer the
"atomic" part of the question, but to also check scope becomes rather
verbose.

To simplify and reduce redundancy, introduce a common helper
getAtomicSyncScopeID() which returns the scope of an atomic operation.
Start using it in ThreadSanitizer.

NFCI.

Reviewed By: dvyukov

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

2 years ago[CGObjCGNU] Remove pointer element type uses
Nikita Popov [Thu, 17 Mar 2022 13:33:31 +0000 (14:33 +0100)]
[CGObjCGNU] Remove pointer element type uses

2 years ago[Flang] Lower the repeat intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 13:18:19 +0000 (13:18 +0000)]
[Flang] Lower the repeat intrinsic

The repeat intrinsic creates ncopies of a string. The lowering is to
a runtime call to a function in the flang library. The runtime allocates
the buffer to store the result string. This buffer is freed by code
added in the lowering.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower command and environment intrinsics
Valentin Clement [Thu, 17 Mar 2022 13:34:58 +0000 (14:34 +0100)]
[flang] Lower command and environment intrinsics

This patch adds lowering for command and environment
related intrinsics:
- `get_command_argument`
- `get_environment_variable`
- `command_argument_count`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Josh Mottley <Josh.Mottley@arm.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[LV] Use usesScalars in widenPHIInstruction.
Florian Hahn [Thu, 17 Mar 2022 13:16:32 +0000 (13:16 +0000)]
[LV] Use usesScalars in widenPHIInstruction.

This uses the existing VPlan helpers to check whether there are scalar
uses of a phi recipe. It remove one of the few remaining dependencies on
the cost model from VPlan code generation.

Depends on D121612.

Reviewed By: Ayal

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

2 years ago[Flang] Lower the transpose intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 13:05:16 +0000 (13:05 +0000)]
[Flang] Lower the transpose intrinsic

Tranpose intrinsic performs the transpose matrix operation for arrays
of rank 2. The intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[x86] try harder to use shift instead of test if it can save some immediate bytes
Sanjay Patel [Thu, 17 Mar 2022 13:09:42 +0000 (09:09 -0400)]
[x86] try harder to use shift instead of test if it can save some immediate bytes

We favor 'and' and 'test' in earlier phases of optimization,
and that's usually the better option, but we can save a few
instruction bytes by converting a mask constant to a shift here.

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

2 years ago[pseudo] Tweak some docs, NFC
Haojian Wu [Wed, 16 Mar 2022 15:45:24 +0000 (16:45 +0100)]
[pseudo] Tweak some docs, NFC

Consitently use the "nonterminal", "pseudoparser" terms.

2 years ago[clangd] Re-enable clang-tidy's nolint blocks
Haojian Wu [Thu, 17 Mar 2022 12:48:47 +0000 (13:48 +0100)]
[clangd] Re-enable clang-tidy's nolint blocks

The previous inefficient implementation is polished.

Reviewed By: kadircet

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

2 years ago[pseudo] Split greatergreater token.
Haojian Wu [Thu, 17 Mar 2022 12:42:31 +0000 (13:42 +0100)]
[pseudo] Split greatergreater token.

For a >> token (a right shift operator, or a nested template?), the clang
lexer always returns a single greatergreater token, as a result,
the grammar-based GLR parser never try to parse the nested template
case.

We derive a token stream by always splitting the >> token, so that the
GLR parser is able to pursue both options during parsing (usually 1
path fails).

Reviewed By: sammccall

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

2 years ago[Flang] Lower the trim intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 12:33:53 +0000 (12:33 +0000)]
[Flang] Lower the trim intrinsic

The trim intrinsic removes trailing blank spaces from a string. The
intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[Flang] Lower Matmul intrinsic
Kiran Chandramohan [Thu, 17 Mar 2022 12:30:05 +0000 (12:30 +0000)]
[Flang] Lower Matmul intrinsic

The Matmul intrinsic performs matrix multiplication on rank 2 arrays.
The intrinsic is lowered to a runtime call.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[Sema] add warning for tautological FP compare with literal
Sanjay Patel [Thu, 17 Mar 2022 11:40:03 +0000 (07:40 -0400)]
[Sema] add warning for tautological FP compare with literal

If we are equality comparing an FP literal with a value cast from a type
where the literal can't be represented, that's known true or false and
probably a programmer error.

Fixes issue #54222.
https://github.com/llvm/llvm-project/issues/54222

Note - I added the optimizer change with:
9397bdc67eb2
...and as discussed in the post-commit comments, that transform might be
too dangerous without this warning in place, so it was reverted to allow
this change first.

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

2 years ago[flang] Lower misc intrinsics
Valentin Clement [Thu, 17 Mar 2022 12:20:13 +0000 (13:20 +0100)]
[flang] Lower misc intrinsics

This patch adds lowering for couple of intrinsics:
- `btest`
- `ceiling`
- `nearest`
- `scale`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: AlexisPerry <aperry@lanl.gov>
2 years ago[flang] Lower present intrinsic
Valentin Clement [Thu, 17 Mar 2022 12:18:53 +0000 (13:18 +0100)]
[flang] Lower present intrinsic

This patch adds lowering for the `present` intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower exit intrinsic
Valentin Clement [Thu, 17 Mar 2022 12:16:53 +0000 (13:16 +0100)]
[flang] Lower exit intrinsic

This patch adds lowering for the `exit`
intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Josh Mottley <Josh.Mottley@arm.com>
2 years ago[flang][lowering] Add support for lowering of the `index` intrinsics
Andrzej Warzynski [Wed, 16 Mar 2022 18:27:12 +0000 (18:27 +0000)]
[flang][lowering] Add support for lowering of the `index` intrinsics

This patch adds support for lowering of the `index` intrinsics from
Fortran to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[VPlan] VPInterleaveRecipe only requires the first lane of the address.
Florian Hahn [Thu, 17 Mar 2022 11:56:43 +0000 (11:56 +0000)]
[VPlan] VPInterleaveRecipe only requires the first lane of the address.

VPInterleaveRecipe only uses the first lane of the address. Add
onlyFirstLaneUsed implementation. This is needed for a follow-up patch.

Reviewed By: Ayal

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

2 years ago[flang][nfc] Update comment in test
Andrzej Warzynski [Thu, 17 Mar 2022 11:54:02 +0000 (11:54 +0000)]
[flang][nfc] Update comment in test

2 years ago[AMDGPU][MC] A fix for commit 5977dfb
Dmitry Preobrazhensky [Thu, 17 Mar 2022 11:40:01 +0000 (14:40 +0300)]
[AMDGPU][MC] A fix for commit 5977dfb

The commit code https://github.com/llvm/llvm-project/commit/5977dfba64099e224cba12f580b6867e7a3d149a
failed to compile with GCC5. This patch addresses the issue.
For a related discussion, see https://reviews.llvm.org/D121696

2 years ago[clang-tidy][run-clang-tidy.py] Add --config-file=<string> option
Shreyas Atre [Thu, 17 Mar 2022 11:29:26 +0000 (07:29 -0400)]
[clang-tidy][run-clang-tidy.py] Add --config-file=<string> option

Link to the GitHub Issue: https://github.com/llvm/llvm-project/issues/53745

Added config_path variable within the python script which makes the
required call to the clang-tidy binary with --config-file option.
If the config_path is None then config will be used. No error is raised
if both are given but silently chooses config_path over config

2 years ago[clang-tidy] Don't check decltype return types in `readability-const-return-type`
Evgeny Shulgin [Thu, 10 Feb 2022 19:59:24 +0000 (22:59 +0300)]
[clang-tidy] Don't check decltype return types in `readability-const-return-type`

The checker removes `const`s that are superfluos and badly affect
readability. `decltype(auto)`/`decltype(expr)` are often const-qualified, but
have no effect on readability and usually can't stop being const-qualified
without significant code change.

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

Reviewed By: aaron.ballman

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

2 years ago[SLP] Avoid unnecessary getIncomingValueForBlock() call (NFC)
Nikita Popov [Thu, 17 Mar 2022 11:22:16 +0000 (12:22 +0100)]
[SLP] Avoid unnecessary getIncomingValueForBlock() call (NFC)

This code just wants to check all incoming values, we don't care
care what the incoming block is here.

2 years agoRevert "[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64"
David Spickett [Thu, 17 Mar 2022 09:36:55 +0000 (09:36 +0000)]
Revert "[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64"

This reverts commit 406d418c0c831287b41c83150369fd8485c3d700.

Our regular bots are now using clang-13. The previous set will remain
online for a while to check reviews that haven't rebased to include
this change yet.

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

2 years ago[X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments...
Simon Pilgrim [Thu, 17 Mar 2022 10:42:29 +0000 (10:42 +0000)]
[X86] Use the unaligned vector typedefs for the lddqu intrinsics pointer arguments (PR20670)

Extension to 4390c721cba09597037578100948bbc83cc41b16 - similar to the vanilla load/store intrinsics, _mm_lddqu_si128/_mm256_lddqu_si256 should take an unaligned pointer, but were using the aligned m128i/m256i types which can cause alignment warnings.

The existing sse3-builtins.c and avx-builtins.c tests in llvm-project\clang\test\CodeGen\X86 should cover this.

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

2 years ago[mlir][bazel] make .pyi files available to Bazel
Alex Zinenko [Wed, 16 Mar 2022 14:59:59 +0000 (15:59 +0100)]
[mlir][bazel] make .pyi files available to Bazel

These files are necessary for various type checking and autocompletion
tooling to work.

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

2 years ago[flang] handle allocatable components when creating array temps
Jean Perier [Thu, 17 Mar 2022 09:55:56 +0000 (10:55 +0100)]
[flang] handle allocatable components when creating array temps

When creating an array temporary in the array copy pass, care must be
taken with allocatable components. The element components needs to be
given a clean unallocated status before being used in the assignments.
This is because assignment of allocatable components makes deep copy,
and may cause deallocation of the previous value if it was allocated.
Hence the previous allocation status cannot be let undefined.

On top of that, when cleaning-up the temp, all allocatable components
that may have been allocated must be deallocated.

This patch implements this by centralizing the code making and cleaning
array temps in ArrayValueCopy.cpp, and by calling Initialize and Destroy
runtime entry points when they are allocatable components.

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

2 years ago[Bazel] Update Bazel build to add symbol_graph.
Adrian Kuegel [Thu, 17 Mar 2022 07:49:27 +0000 (08:49 +0100)]
[Bazel] Update Bazel build to add symbol_graph.

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

2 years ago[Clang][VE] Add vector mask intrinsics to clang
Kazushi (Jam) Marukawa [Wed, 16 Mar 2022 15:20:38 +0000 (00:20 +0900)]
[Clang][VE] Add vector mask intrinsics to clang

Add vector mask intrinsics instructions to clang.

Reviewed By: simoll

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

2 years ago[LegacyPassManager] Move structural hashing into Pass classes. NFC.
Jay Foad [Fri, 18 Feb 2022 10:53:32 +0000 (10:53 +0000)]
[LegacyPassManager] Move structural hashing into Pass classes. NFC.

Move structural hashing into virtual methods on Pass. This will
allow MachineFunctionPass to override the method to add hashing of
the MachineFunction.

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

2 years ago[AArch64] Combine ISD::AND into AArch64ISD::ANDS
David Green [Thu, 17 Mar 2022 09:44:11 +0000 (09:44 +0000)]
[AArch64] Combine ISD::AND into AArch64ISD::ANDS

If we already have a AArch64ISD::ANDS node with identical operands, we
can merge any ISD::AND into it, reducing the instruction count by
calculating the value and the flags in a single operation. This code is
taken from the X86 backend, and could also handle AArch64ISD::ADDS and
AArch64ISD::SUBS, but I couldn't find any test cases where it came up.

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

2 years ago[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Thu, 17 Mar 2022 09:24:59 +0000 (10:24 +0100)]
[mlir][Bazel] Add missing dependency.

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

2 years ago[mlir][Bazel] Adapt BUILD.bazel for move of lsp-server support files.
Adrian Kuegel [Thu, 17 Mar 2022 08:52:56 +0000 (09:52 +0100)]
[mlir][Bazel] Adapt BUILD.bazel for move of lsp-server support files.

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

2 years agoReapply [InstCombine] Support switch in phi to cond fold
Nikita Popov [Wed, 2 Mar 2022 09:54:57 +0000 (10:54 +0100)]
Reapply [InstCombine] Support switch in phi to cond fold

Reapply with an explicit check for multi-edges, as the expected
behavior of multi-edge dominance is unclear (D120811).

-----

For conditional branches, we know the value is i1 0 or i1 1 along
the outgoing edges. For switches we can apply exactly the same
optimization, just with the known values determined by the switch
cases.

2 years ago[pseudo] Fix some naming-style violations.
Haojian Wu [Thu, 17 Mar 2022 08:08:25 +0000 (09:08 +0100)]
[pseudo] Fix some naming-style violations.

2 years ago[clang-format][docs] Regenerate ClangFormatStyleOptions.rst
Krystian Kuzniarek [Thu, 17 Mar 2022 08:43:37 +0000 (09:43 +0100)]
[clang-format][docs] Regenerate ClangFormatStyleOptions.rst

Misalignment of clang/docs/ClangFormatStyleOptions.rst and
clang/include/clang/Format/Format.h was introduced in c24b3db45.

Regenerated with:
python clang/docs/tools/dump_format_style.py

Reviewed By: sstwcw, curdeius, HazardyKnusperkeks

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

2 years ago[mlir][Bazel] Also fix mlir/unittests/BUILD.bazel.
Adrian Kuegel [Thu, 17 Mar 2022 08:40:47 +0000 (09:40 +0100)]
[mlir][Bazel] Also fix mlir/unittests/BUILD.bazel.

2 years ago[clang-format] Correctly recognize binary operators in template arguments with parent...
Marek Kurdej [Wed, 16 Mar 2022 20:50:26 +0000 (21:50 +0100)]
[clang-format] Correctly recognize binary operators in template arguments with parenthesized literals.

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

Before, code like `foo<b & 1>` was formatted correctly but `foo<b & (1)>` wasn't.
This patch fixes this inconsistency.

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years agoReland "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"
Yi Kong [Wed, 16 Mar 2022 06:06:23 +0000 (14:06 +0800)]
Reland "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"

This reverts commit ba59476515cf4598dd25bcfacfbca11b4f4da3d4.

2 years ago[clang-format] Reformat. NFC.
Marek Kurdej [Thu, 17 Mar 2022 08:01:37 +0000 (09:01 +0100)]
[clang-format] Reformat. NFC.

2 years ago[mlir][Bazel] Adapt to move of FuncOp.
Adrian Kuegel [Thu, 17 Mar 2022 08:24:53 +0000 (09:24 +0100)]
[mlir][Bazel] Adapt to move of FuncOp.

2 years ago[mlir] Make header standalone (NFC)
Adrian Kuegel [Thu, 17 Mar 2022 08:20:18 +0000 (09:20 +0100)]
[mlir] Make header standalone (NFC)

2 years ago[RISCV] Add patterns for vnsrl.wi and vnsra.wi instructions
Lian Wang [Wed, 16 Mar 2022 08:42:19 +0000 (08:42 +0000)]
[RISCV] Add patterns for vnsrl.wi and vnsra.wi instructions

Reviewed By: craig.topper

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

2 years ago[mlir][NFC] Move the LSP agnostic files to a new lsp-server directory
River Riddle [Fri, 11 Mar 2022 07:17:24 +0000 (23:17 -0800)]
[mlir][NFC] Move the LSP agnostic files to a new lsp-server directory

This allows for sharing the implementation of key components across multiple
MLIR language servers. These will be used in a followup to help implement
a PDLL language server.

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

2 years ago[PDLL] Add proper expansive documentation for PDLL
River Riddle [Tue, 15 Feb 2022 23:43:00 +0000 (15:43 -0800)]
[PDLL] Add proper expansive documentation for PDLL

This commit adds detailed documentation for PDLL, its language design, and
captures a bit of the rationale. This document captures everything in-tree at present,
and is intended to be an all encompassing manual for interacting with and understanding
PDLL.

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

2 years ago[flang] Lower array related intrinsics
Valentin Clement [Thu, 17 Mar 2022 06:17:10 +0000 (07:17 +0100)]
[flang] Lower array related intrinsics

This patch adds lowering for somw array related intrinsics:
- `reshape`
- `spread`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[lldb] Migrate runtime instrumentation plugins to ReportWarning
Jonas Devlieghere [Thu, 17 Mar 2022 06:09:59 +0000 (23:09 -0700)]
[lldb] Migrate runtime instrumentation plugins to ReportWarning

2 years ago[flang] Lower character related intrinsics
Valentin Clement [Thu, 17 Mar 2022 06:13:40 +0000 (07:13 +0100)]
[flang] Lower character related intrinsics

This patch adds lowering for some character related
intrinsics:
- `scan`
- `verify`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[lldb] Remove commented-out code in CommandObjectExpression (NFC)
Jonas Devlieghere [Thu, 17 Mar 2022 06:02:24 +0000 (23:02 -0700)]
[lldb] Remove commented-out code in CommandObjectExpression (NFC)

2 years ago[lldb] Migrate condition evaluation failure to ReportError
Jonas Devlieghere [Thu, 17 Mar 2022 05:38:39 +0000 (22:38 -0700)]
[lldb] Migrate condition evaluation failure to ReportError

Migrate to using ReportError to report a failure to evaluate a
watchpoint condition. I had already done so for the parallel code for
breakpoints.

In the process, I noticed that I accidentally regressed the error
reporting for breakpoint conditions by dropping the call to
GetDescription. This patch rectifies that and adds a test.

Because the call to GetDescription expects a Stream*, I also switches
from using a raw_string_ostream to a StreamString for both breakpoints
and watchpoints.

2 years ago[mlir] Refactor DialectRegistry delayed interface support into a general DialectExten...
River Riddle [Tue, 22 Feb 2022 22:49:12 +0000 (14:49 -0800)]
[mlir] Refactor DialectRegistry delayed interface support into a general DialectExtension mechanism

The current dialect registry allows for attaching delayed interfaces, that are added to attrs/dialects/ops/etc.
when the owning dialect gets loaded. This is clunky for quite a few reasons, e.g. each interface type has a
separate tracking structure, and is also quite limiting. This commit refactors this delayed mutation of
dialect constructs into a more general DialectExtension mechanism. This mechanism is essentially a registration
callback that is invoked when a set of dialects have been loaded. This allows for attaching interfaces directly
on the loaded constructs, and also allows for loading new dependent dialects. The latter of which is
extremely useful as it will now enable dependent dialects to only apply in the contexts in which they
are necessary. For example, a dialect dependency can now be conditional on if a user actually needs the
interface that relies on it.

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

2 years ago[lldb] Fix flakiness in command-disassemble-process.yaml (2/2)
Jonas Devlieghere [Thu, 17 Mar 2022 05:09:59 +0000 (22:09 -0700)]
[lldb] Fix flakiness in command-disassemble-process.yaml (2/2)

I split up the test so we could stop redirecting stderr to stdout but I
forgot to include that part in the previous commit.

2 years ago[mlir][vscode] Don't inject inside strings
Jacques Pienaar [Thu, 17 Mar 2022 04:57:04 +0000 (21:57 -0700)]
[mlir][vscode] Don't inject inside strings

Avoids matching R"mlir( while already inside a string.

2 years ago[AMDGPU] Select buffer_atomic_cmpswap* in tblgen
Abinav Puthan Purayil [Tue, 15 Mar 2022 18:14:03 +0000 (23:44 +0530)]
[AMDGPU] Select buffer_atomic_cmpswap* in tblgen

This change replaces the manual selection of buffer_atomic_cmpswap*
instructions in SelectionDAG and GlobalISel with a tblgen based
selection in BUFInstructions.td. This allows us to select the return and
no-return variants in tblgen.

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

2 years ago[lldb] Fix flakyness in command-disassemble-process.yaml
Jonas Devlieghere [Thu, 17 Mar 2022 04:27:54 +0000 (21:27 -0700)]
[lldb] Fix flakyness in command-disassemble-process.yaml

2 years ago[lldb] Fix flakyness in Minidump/no-process-id.yaml
Jonas Devlieghere [Thu, 17 Mar 2022 04:21:11 +0000 (21:21 -0700)]
[lldb] Fix flakyness in Minidump/no-process-id.yaml