platform/upstream/llvm.git
2 years ago[LLVMContext] Respect default value of -opaque-pointers option (NFC)
Nikita Popov [Wed, 23 Mar 2022 11:57:30 +0000 (12:57 +0100)]
[LLVMContext] Respect default value of -opaque-pointers option (NFC)

If the option is edited to use true as the default, we should
respect that, rather than hardcoding false here.

2 years agoRevert "[clang] roll-forward "[clang] Mark `trivial_abi` types as "trivially relocata...
Zahira Ammarguellat [Wed, 23 Mar 2022 11:51:08 +0000 (04:51 -0700)]
Revert "[clang] roll-forward "[clang] Mark `trivial_abi` types as "trivially relocatable""."

This reverts commit 56d46b36fc231a0beb518602503035bba92043e0.

The LIT test SemaCXX/attr-trivial-abi.cpp is failing with 32bit build on
Windows. All the lines with the ifdef WIN32 are asserting but they are
not expected to. It looks like the LIT test was not tested on a 32bit
build of the compiler.

2 years ago[InstCombine] add tests for shuffle of mismatched binops; NFC
Sanjay Patel [Tue, 22 Mar 2022 20:36:16 +0000 (16:36 -0400)]
[InstCombine] add tests for shuffle of mismatched binops; NFC

2 years agoReland "[llvm][AArch64] Insert "bti j" after call to setjmp"
David Spickett [Wed, 23 Mar 2022 10:51:08 +0000 (10:51 +0000)]
Reland "[llvm][AArch64] Insert "bti j" after call to setjmp"

This reverts commit edb7ba714acba1d18a20d9f4986d2e38aee1d109.

This changes BLR_BTI to take variable_ops meaning that we can accept
a register or a label. The pattern still expects one argument so we'll
never get more than one. Then later we can check the type of the operand
to choose BL or BLR to emit.

(this is what BLR_RVMARKER does but I missed this detail of it first time around)

Also require NoSLSBLRMitigation which I missed in the first version.

2 years ago[CGOpenMPRuntime] Remove uses of deprecated Address constructor
Nikita Popov [Wed, 23 Mar 2022 11:14:39 +0000 (12:14 +0100)]
[CGOpenMPRuntime] Remove uses of deprecated Address constructor

And as these are the last remaining uses, also remove the
constructor itself.

2 years agoForgot to add a release note for WG14 N2412.
Aaron Ballman [Wed, 23 Mar 2022 11:39:53 +0000 (07:39 -0400)]
Forgot to add a release note for WG14 N2412.

This support was completed in bf7d9970ba0ac5ecfa1a469086f5789de5c94e3f

2 years ago[mlir][OpenMP] Add omp.single
Shraiysh Vaishay [Wed, 23 Mar 2022 10:11:09 +0000 (15:41 +0530)]
[mlir][OpenMP] Add omp.single

This patch adds omp.single according to Section 2.8.2 of OpenMP 5.0.

Also added tests for the same.

Reviewed By: peixin

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

Co-authored-by: Kiran Kumar T P <kirankumar.tp@amd.com>
2 years ago[OpenCL] opencl-c.h: remove arg names for vload/vstore builtins
Sven van Haastregt [Wed, 23 Mar 2022 11:12:50 +0000 (11:12 +0000)]
[OpenCL] opencl-c.h: remove arg names for vload/vstore builtins

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "data" and
"offset".

Continues the direction set out in D119560.

2 years ago[MLIR][Presburger] support IntegerRelation::convertIdKind
Arjun P [Wed, 23 Mar 2022 11:10:48 +0000 (11:10 +0000)]
[MLIR][Presburger] support IntegerRelation::convertIdKind

Reviewed By: Groverkss

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

2 years agoReapply [CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()
Nikita Popov [Fri, 18 Mar 2022 12:06:42 +0000 (13:06 +0100)]
Reapply [CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()

This requires some adjustment in caller code, because there was
a confusion regarding the meaning of the PtrTy argument: This
argument is the type of the pointer being loaded, not the addresses
being loaded from.

Reapply after fixing the specified pointer type for one call in
47eb4f7dcd845878b16a53dadd765195b9c24b6e, where the used type is
important for determining alignment.

2 years ago[CodeGen][OpenMP] Add alignment to test (NFC)
Nikita Popov [Wed, 23 Mar 2022 10:59:15 +0000 (11:59 +0100)]
[CodeGen][OpenMP] Add alignment to test (NFC)

Check which alignments are generated for loads/stores.

2 years ago[MLIR][Presburger] add Simplex:addDivisionVariable
Arjun P [Tue, 22 Mar 2022 13:21:20 +0000 (13:21 +0000)]
[MLIR][Presburger] add Simplex:addDivisionVariable

This is a convenience function for adding new divisions to the Simplex given the numerator and denominator.

This will be needed for symbolic integer lexmin support.

Reviewed By: Groverkss

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

2 years ago[CGOpenMPRuntime] Specify correct type in EmitLoadOfPointerLValue()
Nikita Popov [Wed, 23 Mar 2022 10:35:32 +0000 (11:35 +0100)]
[CGOpenMPRuntime] Specify correct type in EmitLoadOfPointerLValue()

Perform a bitcast first, so we can specify the correct pointer type
inf EmitLoadOfPointerLValue(), rather than using a dummy void pointer.

2 years agoRevert "[llvm][AArch64] Insert "bti j" after call to setjmp"
David Spickett [Wed, 23 Mar 2022 10:43:20 +0000 (10:43 +0000)]
Revert "[llvm][AArch64] Insert "bti j" after call to setjmp"

This reverts commit eb5ecbbcbb6ce38e29237ab5d17156fcb2e96e74
due to failures on buildbots with expensive checks enabled.

2 years ago[CGOpenMPRuntime] Reuse getDepobjElements() (NFC)
Nikita Popov [Wed, 23 Mar 2022 10:21:46 +0000 (11:21 +0100)]
[CGOpenMPRuntime] Reuse getDepobjElements() (NFC)

There were two more places repeating this code, reuse the helper.
This requires moving the static functions into the class.

2 years agoCleanup includes: Transforms/Instrumentation & Transforms/Vectorize
serge-sans-paille [Mon, 21 Mar 2022 20:52:21 +0000 (21:52 +0100)]
Cleanup includes: Transforms/Instrumentation & Transforms/Vectorize

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D122181

2 years ago[bazel] Make extract_api compatible with bazel
Benjamin Kramer [Wed, 23 Mar 2022 10:00:35 +0000 (11:00 +0100)]
[bazel] Make extract_api compatible with bazel

2 years agoFix link to Rationale document from doc on tuple.
Ingo Müller [Wed, 23 Mar 2022 09:53:22 +0000 (09:53 +0000)]
Fix link to Rationale document from doc on tuple.

This also replaces the absolute link to the same document with a
relative one in the same file.

Reviewed By: rriddle

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

2 years ago[llvm][AArch64] Insert "bti j" after call to setjmp
David Spickett [Mon, 14 Mar 2022 10:24:45 +0000 (10:24 +0000)]
[llvm][AArch64] Insert "bti j" after call to setjmp

Some implementations of setjmp will end with a br instead of a ret.
This means that the next instruction after a call to setjmp must be
a "bti j" (j for jump) to make this work when branch target identification
is enabled.

The BTI extension was added in armv8.5-a but the bti instruction is in the
hint space. This means we can emit it for any architecture version as long
as branch target enforcement flags are passed.

The starting point for the hint number is 32 then call adds 2, jump adds 4.
Hence "hint #36" for a "bti j" (and "hint #34" for the "bti c" you see
at the start of functions).

The existing Arm command line option -mno-bti-at-return-twice has been
applied to AArch64 as well.

Support is added to SelectionDAG Isel and GlobalIsel. FastIsel will
defer to SelectionDAG.

Based on the change done for M profile Arm in https://reviews.llvm.org/D112427

Fixes #48888

Reviewed By: danielkiss

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

2 years ago[CodeGen][OpenMP] Add alignment to test (NFC)
Nikita Popov [Wed, 23 Mar 2022 09:28:04 +0000 (10:28 +0100)]
[CodeGen][OpenMP] Add alignment to test (NFC)

Check which alignments are generated for loads and stores.

2 years agoRevert "[CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()"
Nikita Popov [Wed, 23 Mar 2022 09:22:14 +0000 (10:22 +0100)]
Revert "[CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()"

This reverts commit 767ec883e37510a247ea5695921876ef67cf5b3f.

This results in a some incorrect alignments which are not covered
by existing tests.

2 years ago[NFC] Remove trailing whitespaces in clang/Driver/Options.td
Tobias Hieta [Wed, 23 Mar 2022 09:21:04 +0000 (10:21 +0100)]
[NFC] Remove trailing whitespaces in clang/Driver/Options.td

2 years ago[WebAssembly] Fix error location for parsed symbol/label operands
Alex Bradbury [Wed, 23 Mar 2022 08:53:05 +0000 (08:53 +0000)]
[WebAssembly] Fix error location for parsed symbol/label operands

The previous code didn't take account for the fact that parseExpression
my lex additional tokens - because of this, it's necessary to record the
location of the current token ahead of the call. This patch additionally
makes use of the fact parseExpression will set its End parameter to the
end of the expression.

Although this fix could be added independently of D122127, I've opted to
make it a child patch in order to ensure the change has some test
coverage.

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

2 years ago[WebAssembly] Use location of operand for operand-based type check errors
Alex Bradbury [Wed, 23 Mar 2022 08:51:15 +0000 (08:51 +0000)]
[WebAssembly] Use location of operand for operand-based type check errors

This addresses a series of FIXMEs introduced in D122020.

A follow-up patch (D122128) addresses the bug that is exposed by this
change (an issue with source location information when lexing
identifiers).

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

2 years ago[clang] Update BUILD.bazel after 89f6b26f1beb2c1344f5cfeb34e405128544c76b.
Alexander Belyaev [Wed, 23 Mar 2022 08:46:40 +0000 (09:46 +0100)]
[clang] Update BUILD.bazel after 89f6b26f1beb2c1344f5cfeb34e405128544c76b.

2 years ago[flang][NFC] Fix lowering tests indent
Valentin Clement [Tue, 22 Mar 2022 19:48:06 +0000 (12:48 -0700)]
[flang][NFC] Fix lowering tests indent

Remove 2 spaces indent that was introduced by mistake
when upstreaming these files.

2 years ago[AMDGPU][LLD] Adding support for ABI version 5 option
Jacob Lambert [Mon, 21 Mar 2022 20:54:08 +0000 (13:54 -0700)]
[AMDGPU][LLD] Adding support for ABI version 5 option

Code object version 5 will use the same EFlags as version 4, so we only need to add an additional case

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

2 years ago[lldb/docs] Fixed minor ugly links
Alisamar Husain [Wed, 23 Mar 2022 07:30:18 +0000 (13:00 +0530)]
[lldb/docs] Fixed minor ugly links

2 years agoRevert "[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutRegInfo"
Craig Topper [Wed, 23 Mar 2022 06:41:23 +0000 (23:41 -0700)]
Revert "[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutRegInfo"

This reverts commit 1a9b55b63a6e18a4692eeb795697cb61ca1b002f.

Causing build bot failures

2 years agoRevert "Driver: Don't warn on -mbranch-protection when linking"
Tom Stellard [Wed, 23 Mar 2022 06:35:30 +0000 (23:35 -0700)]
Revert "Driver: Don't warn on -mbranch-protection when linking"

This reverts commit 98fd3b359866f474ab1c097c22fb5c3be356b996.

This patch broke multiple bots.

2 years ago[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutRegInfo
Craig Topper [Wed, 23 Mar 2022 06:07:29 +0000 (23:07 -0700)]
[SelectionDAG] Don't create entries in ValueMap in ComputePHILiveOutRegInfo

Instead of using operator[], use DenseMap::find to prevent default
constructing an entry if it isn't already in the map.

2 years agoDriver: Don't warn on -mbranch-protection when linking
Tom Stellard [Wed, 23 Mar 2022 06:17:39 +0000 (23:17 -0700)]
Driver: Don't warn on -mbranch-protection when linking

The -mbranch-protection definition in Options.td was not given a Group,
so this was causing clang to emit a -Wunused-command-line-argument
warning when this flag was passed to the linker driver.  This was a
problem, because some build systems, like cmake, automatically pass the
C flags to the linker.  Therefore, any program that was compiled with
-Werror and -mbranch-protection would fail to link with the error:

argument unused during compilation: '-mbranch-protection=standard' [-Werror,-Wunused-command-line-argument]

Reviewed By: vhscampos

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

2 years ago[flang] Flush and master constructs
Shraiysh Vaishay [Wed, 23 Mar 2022 04:33:11 +0000 (10:03 +0530)]
[flang] Flush and master constructs

This patch adds tests for flush and master constructs

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: kiranchandramohan

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

Co-authored By: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>

2 years ago[mlir][OpenMP] Added assembly format for omp.wsloop and remove parseClauses
Shraiysh Vaishay [Wed, 23 Mar 2022 04:07:55 +0000 (09:37 +0530)]
[mlir][OpenMP] Added assembly format for omp.wsloop and remove parseClauses

This patch
 - adds assembly format for `omp.wsloop` operation
 - removes the `parseClauses` clauses as it is not required anymore

This is expected to be the final patch in a series of patches for replacing
parsers for clauses with `oilist`.

Reviewed By: Mogball

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

2 years ago[Inline-asm] Add diagnosts for unsupported inline assembly arguments
Phoebe Wang [Wed, 23 Mar 2022 03:24:54 +0000 (11:24 +0800)]
[Inline-asm] Add diagnosts for unsupported inline assembly arguments

GCC supports power-of-2 size structures for the arguments. Clang supports fewer than GCC. But Clang always crashes for the unsupported cases.

This patch adds sema checks to do the diagnosts to solve these crashes.

Reviewed By: jyu2

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

2 years ago[mlir][NFC] Remove redundant let assignment.
jacquesguan [Tue, 22 Mar 2022 12:04:56 +0000 (20:04 +0800)]
[mlir][NFC] Remove redundant let assignment.

We already have bit hasFolder = 0 in the defination of the class Op, so no need to have another let assignment here.

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

2 years ago[mlir][Arith] Make integer max/min commutative.
jacquesguan [Tue, 22 Mar 2022 13:00:33 +0000 (21:00 +0800)]
[mlir][Arith] Make integer max/min commutative.

Make MaxSI, MaxUI, MinSI and MinUI commutative, so they will be canonicalized to have its constants appear as the second operand. And the constant folder will match more cases.

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

2 years ago[Bundle][Codegen] Ignore bundle for meta-instruction
Shengchen Kan [Wed, 23 Mar 2022 02:14:02 +0000 (10:14 +0800)]
[Bundle][Codegen] Ignore bundle for meta-instruction

The purpose is to keep the default behavior as before.
Noticed by comments in D121600.

Reviewed By: bjope

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

2 years ago[NFC][llvm][StringMap]Extract createTable and getHashTable functions and add the...
wangyihan [Tue, 22 Mar 2022 12:34:16 +0000 (20:34 +0800)]
[NFC][llvm][StringMap]Extract createTable and getHashTable functions and add the inline attribute to the getMinBucketToReserveForEntries function.

1. Extract createTable and getHashTable functions.
2. Add the inline attribute to the getMinBucketToReserveForEntries function.
3. Remove unnecessary local variable HTSize.

Statements in the following order appear in  llvm::StringMapImpl::init and llvm::StringMapImpl::RehashTable, so I extracted this code into a function. getHashTable is for the same reason, it appears in  llvm::StringMapImpl::FindKey,  llvm::StringMapImpl::LookupBucketFor and llvm::StringMapImpl::RehashTable.

```
auto **Table = static_cast<StringMapEntryBase **>(safe_calloc(
      NewNumBuckets + 1, sizeof(StringMapEntryBase **) + sizeof(unsigned)));

  // Allocate one extra bucket, set it to look filled so the iterators stop at
  // end.
  Table[NewNumBuckets] = (StringMapEntryBase *)2;
```

```
unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);
```

Reviewed By: skan, sepavloff

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

2 years ago[AVR] Generate 'rcall' instead of 'call' on avr2 and avr25
Ben Shi [Sun, 13 Mar 2022 06:35:49 +0000 (06:35 +0000)]
[AVR] Generate 'rcall' instead of 'call' on avr2 and avr25

The 'call' (long call) instruction is available on avr3 and above,
and devices in avr2 and avr25 should use the 'rcall' (short call)
instruction for function calls.

Reviewed By: aykevl, dylanmckay

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

2 years ago[AVR] Add more devices
Ben Shi [Thu, 10 Mar 2022 09:01:07 +0000 (09:01 +0000)]
[AVR] Add more devices

Synchronize AVR device lists with gcc-avr-5.4.0 and avr-libc-2.0.0.

Reviewed By: dylanmckay, aykevl

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

2 years ago[AVR] Fix incorrect calling convention for varargs functions
Ben Shi [Fri, 4 Mar 2022 14:42:41 +0000 (14:42 +0000)]
[AVR] Fix incorrect calling convention for varargs functions

An i8 argument should only cost 1 byte on the stack. This is
compatible with avr-gcc.

There are also more test cases (of calling convention) are added.

Reviewed By: aykevl, dylanmckay

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

2 years ago[AMDGPU] [NFC]: Organize the code around reserving registers.
hsmahesha [Wed, 23 Mar 2022 01:45:52 +0000 (07:15 +0530)]
[AMDGPU] [NFC]: Organize the code around reserving registers.

First, add code to reserve all required special purpose registers,
followed by code to reserve SGPRs, followed by code to reserve
VGPRs/AGPRs.

This patch is prepared as a pre-requisite to fix an issue related to
GFX90A hardware.

Reviewed By: arsenm

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

2 years ago[NFC][Clang][OpaquePtr] Remove calls to Address::deprecated in
Akira Hatanaka [Wed, 23 Mar 2022 01:39:16 +0000 (18:39 -0700)]
[NFC][Clang][OpaquePtr] Remove calls to Address::deprecated in
TargetInfo.cpp

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

2 years agoRevert "[InstCombine] try to narrow shifted bswap-of-zext"
Nathan Chancellor [Wed, 23 Mar 2022 00:32:33 +0000 (17:32 -0700)]
Revert "[InstCombine] try to narrow shifted bswap-of-zext"

This reverts commit 9e9bda2e8f5b88715bad767a4b7740df32b040d2.

This causes a backend error when building the Linux kernel for arm64.
See https://reviews.llvm.org/D122166 for a simplified reproducer.

2 years agoRecommit "[SLP] Fix lookahead operand reordering for splat loads." attempt 2, fixed...
Vasileios Porpodas [Tue, 22 Mar 2022 22:21:20 +0000 (15:21 -0700)]
Recommit "[SLP] Fix lookahead operand reordering for splat loads." attempt 2, fixed assertion crash.

Original review: https://reviews.llvm.org/D121354

This reverts commit f7d7d2a08d16356c57f6d2d36bc2fc0589a55df9.

2 years ago[clang-tidy] Fix false positives in `misc-redundant-expression` check
Fabian Wolff [Tue, 22 Mar 2022 23:28:18 +0000 (00:28 +0100)]
[clang-tidy] Fix false positives in `misc-redundant-expression` check

Reviewed By: aaron.ballman

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

2 years ago[gn build] Manually port 89f6b26
Arthur Eubanks [Tue, 22 Mar 2022 23:26:44 +0000 (16:26 -0700)]
[gn build] Manually port 89f6b26

2 years ago[lld-macho][nfc] Don't mix file sizes with addresses
Jez Ng [Fri, 10 Sep 2021 21:00:43 +0000 (17:00 -0400)]
[lld-macho][nfc] Don't mix file sizes with addresses

Update DataInCode's calculation of `endAddr` to use `getSize()` instead
of `getFileSize()` -- while in practice they're the same for
non-zerofill sections (which code sections are), we still should treat
address sizes / offsets as distinct from file sizes / offsets.

2 years agoReland "[memprof] Store callsite metadata with memprof records."
Snehasish Kumar [Tue, 22 Mar 2022 21:40:02 +0000 (14:40 -0700)]
Reland "[memprof] Store callsite metadata with memprof records."

This reverts commit f4b794427e8037a4e952cacdfe7201e961f31a6f.

Reland with underlying msan issue fixed in D122260.

2 years ago[memprof] Initialize MemInfoBlock data.
Snehasish Kumar [Tue, 22 Mar 2022 20:56:30 +0000 (13:56 -0700)]
[memprof] Initialize MemInfoBlock data.

This patch updates the existing default no-arg constructor for
MemInfoBlock to explicitly initialize all members. Also add missing
DataTypeId initialization to the other constructor. These issues were
exposed by msan on patch D121179. With this patch D121179 builds cleanly
on msan.

Reviewed By: tejohnson

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

2 years ago[X86] Fold MMX_MOVD64from64rr + store to MMX_MOVQ64mr instead of MMX_MOVD64from64mr.
Craig Topper [Tue, 22 Mar 2022 21:19:50 +0000 (14:19 -0700)]
[X86] Fold MMX_MOVD64from64rr + store to MMX_MOVQ64mr instead of MMX_MOVD64from64mr.

MMX_MOVD64from64rr moves an MMX register to a 64-bit GPR.

MMX_MOVD64from64mr is the memory version of moving a MMX register to a
64-bit GPR. It requires the REX.W bit to be set. There are no isel
patterns that use this instruction.

MMX_MOVQ64mr is the MMX register store instruction. It doesn't
require a REX.W prefix. This makes it one byte shorter to encode
than MMX_MOVD64from64mr in many cases.

Both store instructions output the same mnemonic string. The assembler
would choose MMX_MOVQ64mr if it was to parse the output. Which is
another reason using it is the correct thing to do.

Reviewed By: RKSimon

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

2 years ago[NFC][clang][extract-api] Use proper name string for Objective-C language
Zixu Wang [Tue, 22 Mar 2022 21:11:45 +0000 (14:11 -0700)]
[NFC][clang][extract-api] Use proper name string for Objective-C language

Change the Symbol Graph serializer for ExtractAPI to use `objective-c`
for the language name string for Objective-C, to align with clang
frontend standards.

2 years ago[SelectionDAG] Add printing support for the Align value of AssertAlign nodes.
Craig Topper [Tue, 22 Mar 2022 20:51:22 +0000 (13:51 -0700)]
[SelectionDAG] Add printing support for the Align value of AssertAlign nodes.

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

2 years ago[mlir][sparse] Distinguishing "shape" from "sizes" in variable names
wren romano [Sat, 19 Mar 2022 02:31:03 +0000 (19:31 -0700)]
[mlir][sparse] Distinguishing "shape" from "sizes" in variable names

I'm using "shape" to mean the compile-time object, where zeros indicate sizes which are compile-time dynamic; and using "sizes" to mean the run-time object, where zeros indicate a dimension with no coordinates (hence resulting in trivial storage).  Because their semantics differ on zeros, it's important to keep them distinguished.  Although we do not define separate C++ types to capture the distinction, we can at least use variable names to do so.

This is (tangential) work towards fixing: https://github.com/llvm/llvm-project/issues/51652

Depends On D122057

Reviewed By: aartbik

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

2 years ago[OpenMP] Initial parsing/sema for the 'omp parallel loop' construct
Mike Rice [Tue, 22 Mar 2022 17:55:21 +0000 (10:55 -0700)]
[OpenMP] Initial parsing/sema for the 'omp parallel loop' construct

  Adds basic parsing/sema/serialization support for the
  #pragma omp parallel loop directive.

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

2 years ago[AMDGPU] Allow v_accvgpr_write to use SGPR on gfx90a
Stanislav Mekhanoshin [Tue, 22 Mar 2022 19:08:29 +0000 (12:08 -0700)]
[AMDGPU] Allow v_accvgpr_write to use SGPR on gfx90a

This is undocumented, but it should work.

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

2 years ago[instcombine] Fold away memset/memmove from otherwise unused alloca
Philip Reames [Tue, 22 Mar 2022 20:30:59 +0000 (13:30 -0700)]
[instcombine] Fold away memset/memmove from otherwise unused alloca

The motivation for this is that while both memcpyopt and dse will catch this case, both are limited by MSSA's walk back threshold when finding clobbers.  As such, if you have a memcpy of an otherwise dead alloca placed towards the end of a long basic block with lots of other memory instructions, it would be missed.  This is a bit undesirable for such an "obviously" useless bit of code.

As noted in comments, we should probably generalize instcombine's escape analysis peephole (see visitAllocInst) to allow read xor write.  Doing that would subsume this code in a more general way, but is also a more involved change.  For the moment, I went with the easiest fix.

2 years ago[libc++][NFC] Slight improvement to __availability documentation
Louis Dionne [Tue, 22 Mar 2022 20:48:30 +0000 (16:48 -0400)]
[libc++][NFC] Slight improvement to __availability documentation

2 years ago[mlir][sparse] Adding Action::kSparseToSparse for @newSparseTensor
wren romano [Sat, 19 Mar 2022 02:20:33 +0000 (19:20 -0700)]
[mlir][sparse] Adding Action::kSparseToSparse for @newSparseTensor

This is work towards: https://github.com/llvm/llvm-project/issues/51652

This differential doesn't yet make use of the new kSparseToSparse, just introduces it.  The differential that finally makes use of them is D122061, which is the final differential in the chain that fixes bug 51652.

Depends On D122054

Reviewed By: aartbik

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

2 years ago[flang][NFC] Add forall lowering tests
Valentin Clement [Tue, 22 Mar 2022 20:32:57 +0000 (21:32 +0100)]
[flang][NFC] Add forall lowering tests

This patch adds some lowering tests for the `forall` construct.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoRevert "Recommit "[SLP] Fix lookahead operand reordering for splat loads.""
Arthur Eubanks [Tue, 22 Mar 2022 20:27:04 +0000 (13:27 -0700)]
Revert "Recommit "[SLP] Fix lookahead operand reordering for splat loads.""

This reverts commit 79613185d305013de743cdbd6690e4d77c8af27e.

Causes crashes, see comments in https://reviews.llvm.org/D121973.

2 years ago[InstCombine] reorder code, fix formatting; NFC
Sanjay Patel [Tue, 22 Mar 2022 20:02:09 +0000 (16:02 -0400)]
[InstCombine] reorder code, fix formatting; NFC

The affected code can be updated to solve #54364,
so make some cosmetic diffs before real changes.

2 years ago[clang][extract-api] Refactor ExtractAPI and improve docs
Zixu Wang [Mon, 21 Mar 2022 07:53:28 +0000 (00:53 -0700)]
[clang][extract-api] Refactor ExtractAPI and improve docs

- The name SymbolGraph is inappropriate and confusing for the new library
  for clang-extract-api. Refactor and rename things to make it clear that
  ExtractAPI is the core functionality and SymbolGraph is one serializer
  for the API information.
- Add documentation comments to ExtractAPI classes and methods to improve
  readability and clearness of the ExtractAPI work.

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

2 years ago[test,instcombine] Precommit test for upcoming transform
Philip Reames [Tue, 22 Mar 2022 20:16:17 +0000 (13:16 -0700)]
[test,instcombine] Precommit test for upcoming transform

2 years ago[mlir][sparse] Introducing options for the SparseTensorConversion pass
wren romano [Sat, 19 Mar 2022 02:10:40 +0000 (19:10 -0700)]
[mlir][sparse] Introducing options for the SparseTensorConversion pass

This is work towards: https://github.com/llvm/llvm-project/issues/51652

This differential sets up the options and threads them through everywhere, but doesn't actually use them yet.  The differential that finally makes use of them is D122061, which is the final differential in the chain that fixes bug 51652.

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Moving lexOrder from SparseTensorCOO to Element
wren romano [Tue, 22 Mar 2022 00:39:15 +0000 (17:39 -0700)]
[mlir][sparse] Moving lexOrder from SparseTensorCOO to Element

This is the more logical place for the function to live.  If/when we factor out a separate class for just the `Coordinates` themselves, then the definition should be moved to `Coordinates::lexOrder` (and `Element::lexOrder` would become a thin wrapper delegating to that function).

This is (tangentially) work towards fixing: https://github.com/llvm/llvm-project/issues/51652

Reviewed By: aartbik

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

2 years ago[flang][NFC] Add pointer dummy arguments tests
Valentin Clement [Tue, 22 Mar 2022 19:56:25 +0000 (20:56 +0100)]
[flang][NFC] Add pointer dummy arguments tests

This patch adds test for calls with POINTER dummy arguments on the caller side.

It also fixes some formatting error that was introduced when upstreaming
the other pointer tests.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[AMDGPU] Update mfma test to run gfx940 checks. NFC.
Stanislav Mekhanoshin [Tue, 22 Mar 2022 19:42:31 +0000 (12:42 -0700)]
[AMDGPU] Update mfma test to run gfx940 checks. NFC.

2 years ago[BOLT] Avoid pointless loop rotation
spupyrev [Thu, 17 Mar 2022 16:51:07 +0000 (09:51 -0700)]
[BOLT] Avoid pointless loop rotation

It seems the earlier implementation does not follow the description
in LoopRotationPass.h: It rotates loops even if they are already laid out
correctly. The diff adjusts the behaviour.

Given that the impact of LoopInversionPass is minor, this change won't
yield significant perf differences. Tested on clang-10: there seems to be a
0.1%-0.3% cpu win and a small reduction of branch misses.

**Before:**
BOLT-INFO: 120 Functions were reordered by LoopInversionPass

**After:**
BOLT-INFO: 79 Functions were reordered by LoopInversionPass

Reviewed By: yota9

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

2 years ago[test] Autogen a test for ease of update
Philip Reames [Tue, 22 Mar 2022 19:38:20 +0000 (12:38 -0700)]
[test] Autogen a test for ease of update

2 years ago[cmake] Demote fatal error to a warning when we don't know the Apple SDK in use
Louis Dionne [Tue, 22 Mar 2022 19:35:30 +0000 (15:35 -0400)]
[cmake] Demote fatal error to a warning when we don't know the Apple SDK in use

Sometimes, we could be building for a platform where we don't link
compiler-rt, so being able to figure out the right compiler-rt suffix
isn't necessary, but we shouldn't fail the build.

2 years ago[libc++][NFC] Use struct instead of class for ranges::end
Louis Dionne [Tue, 22 Mar 2022 19:34:48 +0000 (15:34 -0400)]
[libc++][NFC] Use struct instead of class for ranges::end

This is consistent with what we do elsewhere.

2 years agollvm-dwarfdump: Including calling convention attribute in pretty printed type names
David Blaikie [Mon, 21 Mar 2022 19:37:39 +0000 (19:37 +0000)]
llvm-dwarfdump: Including calling convention attribute in pretty printed type names

2 years agoDebugInfo: Simplify const/volatile printing for function types
David Blaikie [Thu, 17 Mar 2022 22:59:18 +0000 (22:59 +0000)]
DebugInfo: Simplify const/volatile printing for function types

2 years ago[Clang][NFC] Add braces to help readability
Corentin Jabot [Tue, 22 Mar 2022 19:05:17 +0000 (20:05 +0100)]
[Clang][NFC] Add braces to help readability

In CheckConstexprFunctionStmt, as discussed in
D111400.

2 years agoRevert "Add UTF32 to/from UTF8 conversion functions"
Aaron Ballman [Tue, 22 Mar 2022 18:59:57 +0000 (14:59 -0400)]
Revert "Add UTF32 to/from UTF8 conversion functions"

This reverts commit c3460689288abc98c91d8d6bffa74be9eb16c74d.

It broke at least one of the builders:
https://lab.llvm.org/buildbot#builders/100/builds/13947

2 years ago[Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr
Corentin Jabot [Tue, 5 Oct 2021 21:33:31 +0000 (23:33 +0200)]
[Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr

Allow goto, labelled statements as well as `static`, `thread_local`, and
non-literal variables in `constexpr` functions.

As specified. for all of the above (except labelled statements) constant
evaluation of the construct still fails.

For `constexpr` bodies, the proposal is implemented with diagnostics as
a language extension in older language modes. For determination of
whether a lambda body satisfies the requirements for a constexpr
function, the proposal is implemented only in C++2b mode to retain the
semantics of older modes for programs conforming to them.

Reviewed By: aaron.ballman, hubert.reinterpretcast, erichkeane

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

2 years ago[flang] Initial UTF-8 support in runtime I/O
Peter Klausler [Wed, 16 Mar 2022 19:32:03 +0000 (12:32 -0700)]
[flang] Initial UTF-8 support in runtime I/O

Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8').  This encoding applies to default
CHARACTER values that are not 7-bit ASCII as well as to
the wide CHARACTER kinds 2 and 4.  Basic testing is in place
via direct calls to the runtime I/O APIs, but serious checkout
awaits lowering support of the wide CHARACTER kinds.

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

2 years ago[flang] Fix crash: ENTRY with generic interface of the same name
Peter Klausler [Wed, 16 Mar 2022 17:16:45 +0000 (10:16 -0700)]
[flang] Fix crash: ENTRY with generic interface of the same name

Name resolution was crashing while processing the ENTRY statement
due to a lack of special-case code necessary to handle the indirection
needed when the generic has the same name as the ENTRY.

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

2 years ago[mlir][ods] Add Deprecate helper
Jacques Pienaar [Tue, 22 Mar 2022 18:08:36 +0000 (11:08 -0700)]
[mlir][ods] Add Deprecate helper

Add method to tag classes/defs as deprecated. Previously deprecations
were only verbally communicated and folks didn't have an active warning
while building about impending removal. Add mechanism to tag defs as
deprecated to allow warning users.

This doesn't change any policy, it just moves deprecation warnings from
comments to something more user visible.

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

2 years ago[lldb] Set the TERM environment variable for the API tests
Jonas Devlieghere [Tue, 22 Mar 2022 02:18:29 +0000 (19:18 -0700)]
[lldb] Set the TERM environment variable for the API tests

Avoid "TERM environment variable not set" by either propagating the TERM
environment variable or defaulting to vt100. All of our CI is already
doing this explicitly through the --env dotest arg, but it's easy to
forget when setting up a new job. I don't see any downside in making it
the default.

2 years ago[MLIR][Presburger] Fix a comment in the unittests
Cynthia Shen [Tue, 22 Mar 2022 15:54:25 +0000 (15:54 +0000)]
[MLIR][Presburger] Fix a comment in the unittests

Reviewed By: arjunp

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

2 years agoAdd UTF32 to/from UTF8 conversion functions
Marcus Johnson [Tue, 22 Mar 2022 17:41:43 +0000 (13:41 -0400)]
Add UTF32 to/from UTF8 conversion functions

This is anticipated to be used in new format specifier checking code.

2 years ago[ARM] select_xform.ll - re-add and fix missing CHECK prefixes
Simon Pilgrim [Tue, 22 Mar 2022 17:34:48 +0000 (17:34 +0000)]
[ARM] select_xform.ll - re-add and fix missing CHECK prefixes

We were still checking test results with the CHECK prefix but they had bit-rotted since whenever it'd been removed from the --check-prefixes list

2 years ago[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsi...
Craig Topper [Tue, 22 Mar 2022 17:16:53 +0000 (10:16 -0700)]
[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsics on RV32.

On RV32, we need to type legalize i64 scalar arguments to intrinsics.
We usually do this by splatting the value into a vector separately.
If the scalar happens to be sign extended, we can continue using a .vx
intrinsic.

We already special cased sign extended constants, this extends it
to any sign extended value.

I've only added tests for one case of vadd. Most intrinsics go
through the same check.

Reviewed By: khchen

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

2 years agoAllow -Wno-gnu to silence GNU extensions related to pointer arithmetic
Aaron Ballman [Tue, 22 Mar 2022 17:14:16 +0000 (13:14 -0400)]
Allow -Wno-gnu to silence GNU extensions related to pointer arithmetic

These diagnostics were added to a diagnostic group, but that diagnostic
group was not under -Wgnu. I've now split them into their own
diagnostic group that is added both to the original group (so user's
currently opting in or out of these should not see a change) and under
the -Wgnu group so that -Wno-gnu can be used to disable all GNU
extension diagnostics. This fixes Issue 54444.

2 years ago[TableGen][RISCV] Add InstAliases with zero_reg to cover unmasked vnot.v, vncvt.x...
Craig Topper [Tue, 22 Mar 2022 16:53:39 +0000 (09:53 -0700)]
[TableGen][RISCV] Add InstAliases with zero_reg to cover unmasked vnot.v, vncvt.x.x.w, vneg.v, etc.

The mask being NoRegister prevented the existing aliases from matching
since NoRegister isn't in the VMV0 register class.

To workaround this I've added new aliases that look for zero_reg.
I had to motify tablegen to generate matching code for zero_reg.
And as a consequence, I had to change the EmitPriority for an ARM
alias that used zero_reg that started printing.

Reviewed By: frasercrmck

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

2 years ago[RISCV][NFC] Refine and refactor RISCVVEmitter and riscv_vector.td.
Zakk Chen [Mon, 28 Feb 2022 09:07:13 +0000 (01:07 -0800)]
[RISCV][NFC] Refine and refactor RISCVVEmitter and riscv_vector.td.

1. Rename nomask as unmasked to keep with the terminology in the spec.
2. Merge UnMaskpolicy and Maskedpolicy arguments into one in RVVBuiltin class.
3. Rename HasAutoDef as HasBuiltinAlias.
4. Move header definition code into one class.

Reviewed By: rogfer01

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

2 years ago[VP] Preserve address space of pointer for strided load/store intrinsics.
Craig Topper [Tue, 22 Mar 2022 16:41:40 +0000 (09:41 -0700)]
[VP] Preserve address space of pointer for strided load/store intrinsics.

This adds LLVMAnyPointerToElt to use instead of LLVMPointerToElt.
This allows us to preserve the address space as part of the type
overload for the intrinsic, but still require the vector element
type to match the pointer type.

Reviewed By: nikic

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

2 years ago[demangler] Add support for C++20 modules
Nathan Sidwell [Wed, 26 Jan 2022 15:22:04 +0000 (07:22 -0800)]
[demangler] Add support for C++20 modules

Add support for module name demangling.  We have two new demangler
nodes -- ModuleName and ModuleEntity. The former represents a module
name in a hierarchical fashion. The latter is the combination of a
(name) node and a module name. Because module names and entity
identities use the same substitution encoding, we have to adjust the
flow of how substitutions are handled, and examine the substituted
node to know how to deal with it.

Reviewed By: dblaikie

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

2 years ago[clang][NFC] Refactor logic for picking standard library on Apple
Louis Dionne [Tue, 22 Mar 2022 14:58:24 +0000 (10:58 -0400)]
[clang][NFC] Refactor logic for picking standard library on Apple

Flip the logic around: always default to libc++ except on older platforms,
instead of defaulting to libstdc++ except on newer platforms. Since roughly
all supported platforms use libc++ now, it makes more sense to make that
the default, and allows the removal of some downstream diff.

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

2 years ago[IR] Allow matching pointer to vector with opaque pointers.
Hendrik Greving [Tue, 22 Mar 2022 02:20:53 +0000 (19:20 -0700)]
[IR] Allow matching pointer to vector with opaque pointers.

Allows for skipping the pointer to vector type if opaque pointers
are enabled and the matching pointer is a vector pointer when
matching an intrinsic signature in the verifier.

No test added since lacking a target using intrinsic with pointer
to vector arguments.

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

2 years ago[WebAssembly][NFC] Delete type checking logic for removed ref.null instruction
Alex Bradbury [Tue, 22 Mar 2022 16:24:05 +0000 (16:24 +0000)]
[WebAssembly][NFC] Delete type checking logic for removed ref.null instruction

D114979 changed the textual formal of ref.null - dropping ref.null in
favour of ref.null_extern and ref.null_func. Therefore, the type checker
no longer needs logic to handle "ref.null".

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

2 years ago [WebAssembly] Add tests for the Asm type checker
Alex Bradbury [Tue, 22 Mar 2022 15:50:56 +0000 (15:50 +0000)]
 [WebAssembly] Add tests for the Asm type checker

While looking at bugs like PR54022, I noted that there is no real test
coverage for the asm type checker. This patch starts to address that,
adding a series of tests for the errors messages produced, as well as
some FIXMEs as an XFAIL test for some current issues.

It's not intended to be an exhaustive test, but does have test cases for
each of the instructions that the type checker has specific handling
for.

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

2 years ago[simple] fix some the documentation
Walter Erquinigo [Tue, 22 Mar 2022 16:08:47 +0000 (09:08 -0700)]
[simple] fix some the documentation

Some links were not rendered correctly in the intel pt documentation and
some spacing was fixed in some command objects.

2 years ago[CGOpenMPRuntime] Remove some uses of deprecated Adddress ctor
Nikita Popov [Tue, 22 Mar 2022 15:19:00 +0000 (16:19 +0100)]
[CGOpenMPRuntime] Remove some uses of deprecated Adddress ctor

2 years ago[flang][NFC] Remove unused variable
Valentin Clement [Tue, 22 Mar 2022 15:11:42 +0000 (16:11 +0100)]
[flang][NFC] Remove unused variable

Fix for buildbot failure shown after fe252f8ed6369acdb13d4e290d3b9dfe2ec4eb8e

2 years ago[Flang] Lower the sqrt intrinsics
Kiran Chandramohan [Tue, 22 Mar 2022 14:13:52 +0000 (14:13 +0000)]
[Flang] Lower the sqrt intrinsics

The intrinsic computes the square root for real and complex numbers. By
default they are lowered to runtime calls to libpgmath. With the llvm
option, it can be lowered to llvm intrinsics (not all types .eg. complex
are supported for llvm 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: schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[RISCV] Add policy operand for masked compare and vmsbf/vmsif/vmsof IR
Zakk Chen [Thu, 17 Mar 2022 03:17:06 +0000 (20:17 -0700)]
[RISCV] Add policy operand for masked compare and vmsbf/vmsif/vmsof IR
intrinsics.

Those operations are updated under a tail agnostic policy, but they
could have mask agnostic or undisturbed.

Reviewed By: rogfer01

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