platform/upstream/llvm.git
2 years ago[NFC] Add unittest for Decl::isInExportDeclContext
Chuanqi Xu [Wed, 23 Feb 2022 08:22:55 +0000 (16:22 +0800)]
[NFC] Add unittest for Decl::isInExportDeclContext

2 years ago[clang][dataflow] Add support for global storage values
Stanislav Gatev [Fri, 18 Feb 2022 18:51:42 +0000 (18:51 +0000)]
[clang][dataflow] Add support for global storage values

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120149

2 years ago[gn build] Port a2fab82f33bb
LLVM GN Syncbot [Wed, 23 Feb 2022 08:21:48 +0000 (08:21 +0000)]
[gn build] Port a2fab82f33bb

2 years ago[pseudo] Implement LRTable.
Haojian Wu [Fri, 11 Feb 2022 13:09:15 +0000 (14:09 +0100)]
[pseudo] Implement LRTable.

This patch introduces a dense implementation of the LR parsing table, which is
used by LR parsers.

We build a SLR(1) parsing table from the LR(0) graph.

Statistics of the LR parsing table on the C++ spec grammar:
  - number of states: 1449
  - number of actions: 83069
  - size of the table (bytes): 334928

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

2 years ago[RISCV] Add more test for GORCI aliaes in Zbp extension
Lian Wang [Wed, 23 Feb 2022 08:01:51 +0000 (08:01 +0000)]
[RISCV] Add more test for GORCI aliaes in Zbp extension

Supplement tests for some aliaes of gorci.

RV32:
add orc4.h/orc2.h in rv32zbp.ll
add orc.h/orc16/orc8/orc4/orc2/orc in rv32zbp-intrinsic.ll

RV64:
add orc4.h/orc2.h in rv64zbp.ll
add orc.h/orc32/orc16/orc8/orc4/orc2/orc/orc16.w/orc8.w/
    orc4.w/orc2.w/orc.w in rv64zbp-intrinsic.ll

Reviewed By: craig.topper

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

2 years ago[flang] Lower real constant
Valentin Clement [Wed, 23 Feb 2022 07:27:10 +0000 (08:27 +0100)]
[flang] Lower real constant

This patch handles lowering of real constant.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[RISCV] Supplement more tests for GREVI aliaes in Zbp extension
Lian Wang [Wed, 23 Feb 2022 06:14:58 +0000 (06:14 +0000)]
[RISCV] Supplement more tests for GREVI aliaes in Zbp extension

Supplement tests for some aliaes of grevi.

RV32:
add rev4.h/rev2.h in rv32zbp.ll
add rev/rev2/rev4/rev8/rev16 in rv32zbp-intrinsic.ll

RV64:
add rev4.h/rev2.h in rv64zbp.ll
add rev.h/rev/rev2/rev4/rev8/rev16/rev32/rev.w/rev2.w/
    rev4.w/rev8.w/rev16.w in rv64zbp-intrinsic.ll

Reviewed By: craig.topper

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

2 years ago[SampleProfile] Handle the case when the option `MaxNumPromotions` is zero.
minglotus-6 [Tue, 22 Feb 2022 03:17:06 +0000 (19:17 -0800)]
[SampleProfile] Handle the case when the option `MaxNumPromotions` is zero.

In places where `MaxNumPromotions` is used to allocated an array, bail out early to prevent allocating an array of length 0.

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

2 years ago[ELF][test] Fix CU address_size in some gdb-index tests
Fangrui Song [Wed, 23 Feb 2022 05:42:15 +0000 (21:42 -0800)]
[ELF][test] Fix CU address_size in some gdb-index tests

Revert 251640ab575634256de6d6fde5c5359fe21efe91 which fixed the wrong thing.

While here, add `2>&1 | count 0` to assert no warning from lib/DebugInfo/DWARF.

2 years ago[ProfileData] Remove unused and racy FunctionSamples::Format after D51643
Fangrui Song [Wed, 23 Feb 2022 04:29:08 +0000 (20:29 -0800)]
[ProfileData] Remove unused and racy FunctionSamples::Format after D51643

The write may be racy if ThinLTO creates multiple `InProcessThinBackend` instances.

2 years ago[compiler-rt][builtins] build the macOS compiler-rt built-ins with Mac Catalyst support
Alex Lorenz [Mon, 14 Feb 2022 22:20:28 +0000 (14:20 -0800)]
[compiler-rt][builtins] build the macOS compiler-rt built-ins with Mac Catalyst support

This patch extends compiler-rt's cmake config to build macOS builtins with both macOS and Mac Catalyst support.
This is done by telling the compiler to emit macho files with two build version load commands.

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

2 years ago[ELF][test] Terminate .debug_info with a null entry to fix warnings
Fangrui Song [Wed, 23 Feb 2022 03:20:55 +0000 (19:20 -0800)]
[ELF][test] Terminate .debug_info with a null entry to fix warnings

2 years ago[clang] Remove Address::deprecated() calls in CodeGenFunction.cpp
Arthur Eubanks [Wed, 23 Feb 2022 02:28:32 +0000 (18:28 -0800)]
[clang] Remove Address::deprecated() calls in CodeGenFunction.cpp

2 years ago[OpenMP] Remove static allocator in linker wrapper
Joseph Huber [Wed, 23 Feb 2022 02:21:33 +0000 (21:21 -0500)]
[OpenMP] Remove static allocator in linker wrapper

Summary:
We don't need this static allocator to survive the entire file, the
strings stored have a defined lifetime.

2 years ago[OpenMP] Unrecognized objects should not be considered failure
Joseph Huber [Wed, 23 Feb 2022 02:13:03 +0000 (21:13 -0500)]
[OpenMP] Unrecognized objects should not be considered failure

Summary:
This patch removes the error we recieve when attempting to extract
offloading sections. We shouldn't consider this a failure because
extracting bitcode isn't necessarily required.

2 years agoRemove redundant word word in AsmParser DIFlag parsing
David Blaikie [Wed, 23 Feb 2022 01:49:38 +0000 (17:49 -0800)]
Remove redundant word word in AsmParser DIFlag parsing

2 years ago[instcombine] Avoid binops for comparison consistency tests
Philip Reames [Wed, 23 Feb 2022 01:25:06 +0000 (17:25 -0800)]
[instcombine] Avoid binops for comparison consistency tests

It turns out that instcombine is smarter than I am, and several of these ended up folded for the wrong reasons.

2 years agoRevert "Revert "[AArch64][GlobalISel] Optimize conjunctions of compares to conditiona...
Amara Emerson [Wed, 23 Feb 2022 00:33:18 +0000 (16:33 -0800)]
Revert "Revert "[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares.""

This reverts commit 55c181a6c786cfbfa8b7aabe0a8ba721a65b1445.

The original commit I made was an old patch, mea culpa. Committing the right
implementation with test case for the reported crash.

2 years ago[clang] Remove Address::deprecated() calls in CGVTables.cpp
Arthur Eubanks [Wed, 23 Feb 2022 00:54:09 +0000 (16:54 -0800)]
[clang] Remove Address::deprecated() calls in CGVTables.cpp

2 years ago[Docs] Add self to credits
Alina Sbirlea [Wed, 23 Feb 2022 00:43:33 +0000 (16:43 -0800)]
[Docs] Add self to credits

2 years ago[Docs]Add office hours.
Alina Sbirlea [Wed, 23 Feb 2022 00:38:57 +0000 (16:38 -0800)]
[Docs]Add office hours.

2 years ago[NFC] Add a bit more coverage for an upcoming patch
Philip Reames [Wed, 23 Feb 2022 00:36:08 +0000 (16:36 -0800)]
[NFC] Add a bit more coverage for an upcoming patch

2 years ago[sancov] Refactor getPreviousInstructionPc
Fangrui Song [Wed, 23 Feb 2022 00:30:02 +0000 (16:30 -0800)]
[sancov] Refactor getPreviousInstructionPc

Note: on some architectures lik AArch64, the PC does not match
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp:`__sanitizer_cov_trace_pc_guard`

2 years ago[AMDGPU] Pre-commit load/store combine tests. NFC.
Stanislav Mekhanoshin [Wed, 23 Feb 2022 00:20:09 +0000 (16:20 -0800)]
[AMDGPU] Pre-commit load/store combine tests. NFC.

2 years ago[libFuzzer] Refactor GetNextInstructionPc/GetPreviousInstructionPc
Fangrui Song [Wed, 23 Feb 2022 00:25:57 +0000 (16:25 -0800)]
[libFuzzer] Refactor GetNextInstructionPc/GetPreviousInstructionPc

Port the change to compiler-rt/lib/fuzzer/FuzzerTracePC.cpp .
Update RISCV to use PC-2: this is coarse (C extension may be disabled) but
sufficient for pure symbolization purpose.

The commit is separate from D120362 so that bisecting/reverting is easier.

2 years ago[mlir][sparse] refactor sparse compiler pipeline to single place
Aart Bik [Tue, 22 Feb 2022 20:21:07 +0000 (12:21 -0800)]
[mlir][sparse] refactor sparse compiler pipeline to single place

Reviewed By: bixia

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

2 years ago[instcombine] Add coverage for consistent use of unescaped malloc case
Philip Reames [Wed, 23 Feb 2022 00:18:39 +0000 (16:18 -0800)]
[instcombine] Add coverage for consistent use of unescaped malloc case

2 years ago[sanitizer] Refactor GetNextInstructionPc/GetPreviousInstructionPc
Fangrui Song [Wed, 23 Feb 2022 00:20:40 +0000 (16:20 -0800)]
[sanitizer] Refactor GetNextInstructionPc/GetPreviousInstructionPc

x86 uses offset 1 while most RISC architectures use offset 4.
Check x86 first to prevent changes for new RISC architectures.

Reviewed By: #sanitizers, vitalybuka

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

2 years ago[clang] Remove an Address::deprecated() call in CGClass.cpp
Arthur Eubanks [Wed, 23 Feb 2022 00:19:06 +0000 (16:19 -0800)]
[clang] Remove an Address::deprecated() call in CGClass.cpp

2 years ago[NFC] Remove dead code (try 2)
Arthur Eubanks [Wed, 23 Feb 2022 00:11:49 +0000 (16:11 -0800)]
[NFC] Remove dead code (try 2)

This is causing
../../llvm/include/llvm/Object/MachO.h:379:13: warning: private field 'Kind' is not used [-Wunused-private-field]
  FixupKind Kind;

Previous attempt in a23f7c0cb6b42a06bc9707fdf46ce2a90080f61f.

2 years ago[WebAssembly] Fixed AsmPrinter not emitting .functype for intrinsics
Wouter van Oortmerssen [Tue, 22 Feb 2022 23:45:49 +0000 (15:45 -0800)]
[WebAssembly] Fixed AsmPrinter not emitting .functype for intrinsics

Intrinsics like `memset` were not emitted as `.functype` because
WebAssemblyAsmPrinter::emitExternalDecls explicitly skips symbols
that are isIntrinsic. Removing that check doesn't work, since the symbol
from the module refers to a 4-argument `llvm.memset.p0i8.i32` rather
than the 3-argument `memset` symbol referenced in the call.
Our `WebAssemblyMCLowerPrePass` however does collect the
`memset` symbol, so the current solution is as simple as emitting
`.functype` for those.

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

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

2 years ago[instcombine] Autogen a test for ease of update
Philip Reames [Wed, 23 Feb 2022 00:02:27 +0000 (16:02 -0800)]
[instcombine] Autogen a test for ease of update

2 years ago[instcombine] Extend test coverage for a tricky bit of reasoning about unescaped...
Philip Reames [Wed, 23 Feb 2022 00:01:39 +0000 (16:01 -0800)]
[instcombine] Extend test coverage for a tricky bit of reasoning about unescaped mallocs

2 years ago[instcombine] Add test coverage for a tricky bit of reasoning about unescaped mallocs
Philip Reames [Tue, 22 Feb 2022 23:52:10 +0000 (15:52 -0800)]
[instcombine] Add test coverage for a tricky bit of reasoning about unescaped mallocs

2 years agoSet std::numeric_limits<>::tinyness_before to true for floating point types on ARM...
Owen Anderson [Tue, 28 Dec 2021 19:44:49 +0000 (11:44 -0800)]
Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Section E1.3.5 in the ARMv8 Architecture Reference Manual specifies:
  Underflow. The bit is set to 1 if the absolute value of the result
  of an operation, produced before rounding, is less than the minimum
  positive normalized number for the destination precision, and the
  rounded result is inexact.

Reviewed By: #libc, majnemer, EricWF

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

2 years agoEncode address offsets of basic blocks relative to the end of the previous basic...
Rahman Lavaee [Tue, 22 Feb 2022 22:39:08 +0000 (14:39 -0800)]
Encode address offsets of basic blocks relative to the end of the previous basic blocks.

Conceptually, the new encoding emits the offsets and sizes as label differences between each two consecutive basic block begin and end label. When decoding, the offsets must be aggregated along with basic block sizes to calculate the final relative-to-function offsets of basic blocks.

This encoding uses smaller values compared to the existing one (offsets relative to function symbol).
Smaller values tend to occupy fewer bytes in ULEB128 encoding. As a result, we get about 25% reduction
in the size of the bb-address-map section (reduction from about 9MB to 7MB).

Reviewed By: tmsriram, jhenderson

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

2 years ago[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors
David Green [Tue, 22 Feb 2022 23:37:22 +0000 (23:37 +0000)]
[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors

We have a combine for converting mul(dup(ext(..)), ...) into
mul(ext(dup(..)), ..), for allowing more uses of smull and umull
instructions. Currently it looks for vector insert and shuffle vectors
to detect the element that we can convert to a vector extend. Not all
cases will have a shufflevector/insert element though.

This started by extending the recognition to buildvectors (with elements
that may be individually extended). The new method seems to cover all
the cases that the old method captured though, as the shuffle will
eventually be lowered to buildvectors, so the old method has been
removed to keep the code a little simpler. The new code detects legal
build_vector(ext(a), ext(b), ..), converting them to ext(build_vector(a,
b, ..)) providing all the extends/types match up.

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

2 years ago[lld] Require C++14 in LLD standalone build
Jez Ng [Tue, 22 Feb 2022 23:14:47 +0000 (18:14 -0500)]
[lld] Require C++14 in LLD standalone build

This is what the Clang standalone build does too. And setting this
seems to be required to get the standalone build to work on my Mac.

Reviewed By: #lld-macho, MaskRay, Ericson2314, smeenai

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

2 years ago[VFS] Use generic_category for errors generated from the VFS
Ben Barham [Tue, 22 Feb 2022 05:13:38 +0000 (21:13 -0800)]
[VFS] Use generic_category for errors generated from the VFS

Errors are generally checked in clients by comparing to the portable
error condition in `std::errc`, which will have the `generic_category`
(eg. `std::errc::no_such_file_or_directory`). While in practice these
are usually equivalent for the standard errno's, they are not in *all*
implementations. One such example is CentOS 7.

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

2 years ago[gn build] bump fmsc-version to 1926
Nico Weber [Tue, 22 Feb 2022 22:47:26 +0000 (17:47 -0500)]
[gn build] bump fmsc-version to 1926

This is needed to pick up the workaround in fb1aa286c1
when building with a modern MSVC (like LLVM now requires).

2 years ago[SLP] Fix assert from non-constant index in insertelement
Brendon Cahoon [Mon, 21 Feb 2022 00:18:26 +0000 (18:18 -0600)]
[SLP] Fix assert from non-constant index in insertelement

A call to getInsertIndex() in getTreeCost() is returning None,
which causes an assert because a non-constant index value for
insertelement was not expected. This case occurs when the
insertelement index value is defined with a PHI.

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

2 years ago[SLP][NFC]Add a test for bottom to top reordering.
Alexey Bataev [Tue, 22 Feb 2022 21:46:02 +0000 (13:46 -0800)]
[SLP][NFC]Add a test for bottom to top reordering.

2 years ago[polly] Remove trailing whitespace from tests. NFC.
Michael Kruse [Tue, 22 Feb 2022 21:37:50 +0000 (15:37 -0600)]
[polly] Remove trailing whitespace from tests. NFC.

2 years agoFold Tensor.extract_slice into a constant splat.
Okwan Kwon [Fri, 18 Feb 2022 18:07:36 +0000 (18:07 +0000)]
Fold Tensor.extract_slice into a constant splat.

Fold arith.extract_slice into arith.constant when the source is a constant
splat and the result type is statically shaped.

2 years ago[BOLT][DWARF] Remove patchLowHigh unused function.
Alexander Yermolovich [Tue, 22 Feb 2022 21:26:38 +0000 (13:26 -0800)]
[BOLT][DWARF] Remove patchLowHigh unused function.

Cleanup after removing caching mechanims for ranges/abbrevs.

Reviewed By: rafauler, yota9

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

2 years agofix comment typo to cycle bots
Nico Weber [Tue, 22 Feb 2022 21:25:51 +0000 (16:25 -0500)]
fix comment typo to cycle bots

2 years ago[clang-format] Don't break semi after requires clause ...
Björn Schäpers [Mon, 21 Feb 2022 21:03:55 +0000 (22:03 +0100)]
[clang-format] Don't break semi after requires clause ...

..regardless of the chosen style.

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

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

2 years ago[clang-format][NFC] Simplify if in ContinuationIndenter::addTokenOCL
Björn Schäpers [Sun, 2 Jan 2022 20:53:02 +0000 (21:53 +0100)]
[clang-format][NFC] Simplify if in ContinuationIndenter::addTokenOCL

Setting a boolean within an if and only using it in the very next if is
a bit confusing. Merge it into one if.

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

2 years agoRevert "Remove dead code."
Reid Kleckner [Tue, 22 Feb 2022 20:56:45 +0000 (12:56 -0800)]
Revert "Remove dead code."

This reverts commit a23f7c0cb6b42a06bc9707fdf46ce2a90080f61f.

Breaks the build.

2 years agoDisable test on big endian machines. Yaml2obj has problems there.
Adrian Prantl [Tue, 22 Feb 2022 20:47:39 +0000 (12:47 -0800)]
Disable test on big endian machines. Yaml2obj has problems there.

2 years agoRemove dead code.
Adrian Prantl [Tue, 22 Feb 2022 20:47:29 +0000 (12:47 -0800)]
Remove dead code.

2 years ago[Transforms] Enhance CorrelatedValuePropagation to handle both values of select
Dmitry Vassiliev [Tue, 22 Feb 2022 20:11:20 +0000 (00:11 +0400)]
[Transforms] Enhance CorrelatedValuePropagation to handle both values of select

The "Correlated Value Propagation" pass was missing a case when handling select instructions. It was only handling the "false" constant value, while in NVPTX the select may have the condition (and thus the branches) inverted, for example:
```
loop:
%phi = phi i32* [ %sel, %loop ], [ %x, %entry ]
%f = tail call i32* @f(i32* %phi)
%cmp1 = icmp ne i32* %f, %y
%sel = select i1 %cmp1, i32* %f, i32* null
%cmp2 = icmp eq i32* %sel, null
br i1 %cmp2, label %return, label %loop
```
But the select condition can be inverted:
```
%cmp1 = icmp eq i32* %f, %y
%sel = select i1 %cmp1, i32* null, i32* %f
```
The fix is to enhance "Correlated Value Propagation" to handle both branches of the select instruction.

Reviewed By: nikic, lebedev.ri

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

2 years ago[Transforms] Pre-commit test cases for CorrelatedValuePropagation to handle both...
Dmitry Vassiliev [Tue, 22 Feb 2022 20:10:05 +0000 (00:10 +0400)]
[Transforms] Pre-commit test cases for CorrelatedValuePropagation to handle both values of select
This is a pre-commit of test cases relevant for D119643.
CorrelatedValuePropagation should handle inverted select condition, but it does not yet.

2 years ago[SystemZ/z/OS] Add va intrinsics for XPLINK
Kai Nacke [Tue, 22 Feb 2022 18:54:16 +0000 (13:54 -0500)]
[SystemZ/z/OS] Add va intrinsics for XPLINK

Add support for va intrinsics for the XPLINK ABI.
Only the extended vararg variant, which uses a pointer to next
argument, is supported. The standard variant will build on this.

Reviewed By: uweigand

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

2 years ago[libc++][AIX] Add AIX error message as expected output
Zarko Todorovski [Tue, 22 Feb 2022 19:34:10 +0000 (14:34 -0500)]
[libc++][AIX] Add AIX error message as expected output

AIX's libc generates "Error -1 occurred" instead of the "Unknown Error"
expected by these test cases. Add this as expected output for AIX only.

Reviewed By: daltenty, #powerpc, #libc, zibi, Quuxplusone

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

2 years ago[sanitizer_common] Use GetStaticTlsBoundary on Solaris 11.4
Rainer Orth [Tue, 22 Feb 2022 19:18:22 +0000 (20:18 +0100)]
[sanitizer_common] Use GetStaticTlsBoundary on Solaris 11.4

This is a restricted alternative to D91605
<https://reviews.llvm.org/D91605> which only works on Solaris 11.4 SRU 10+,
but would break the build on Solaris 11.3 and Illumos which lack
`dlpi_tls_modid`.

Apart from that, the patch is trivial.  One caveat is that the
`sanitizer_common` and `asan` tests need to be linked explicitly with `ld
-z relax=transtls` on Solaris/amd64 since the archives with calls to
`__tls_get_addr` are linked in directly.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

2 years ago[Driver] Support Solaris/amd64 GetTls
Rainer Orth [Tue, 22 Feb 2022 19:14:33 +0000 (20:14 +0100)]
[Driver] Support Solaris/amd64 GetTls

This is the driver part of D91605 <https://reviews.llvm.org/D91605>, a
workaround to allow direct calls to `__tls_get_addr` on Solaris/amd64.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

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

2 years agoAdd support for chained fixup load commands to MachOObjectFile
Adrian Prantl [Thu, 11 Nov 2021 00:25:26 +0000 (16:25 -0800)]
Add support for chained fixup load commands to MachOObjectFile

This is part of a series of patches to upstream support for Mach-O chained fixups.

This patch adds support for parsing the chained fixup load command and
parsing the chained fixups header. It also puts into place the
abstract interface that will be used to iterate over the fixups.

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

2 years agoAdd a (nonfunctional) -dyld_info flag to llvm-objdump.
Adrian Prantl [Wed, 10 Nov 2021 00:00:29 +0000 (16:00 -0800)]
Add a (nonfunctional) -dyld_info flag to llvm-objdump.

Darwin otool implements this flag as a one-stop solution for
displaying bind and rebase info. As I am working on upstreaming
chained fixup support this command will be useful to write testcases.

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

2 years agoReland "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"
Reid Kleckner [Tue, 22 Feb 2022 18:48:25 +0000 (10:48 -0800)]
Reland "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"

This reverts commit 9865c3f28aa812364584b55629eef9b52bb1230e.

Looks like our commits raced and Jeff fixed the build issue.

2 years ago[mlir][pdl] NFC fix missing include
Mogball [Tue, 22 Feb 2022 18:47:07 +0000 (18:47 +0000)]
[mlir][pdl] NFC fix missing include

2 years agoRevert "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"
Reid Kleckner [Tue, 22 Feb 2022 18:46:49 +0000 (10:46 -0800)]
Revert "[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op"

This reverts commit 63eb963e58663541d6feb58f53a1bd4903e3dabf.

Breaks MLIR build.

2 years agoRevert "[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors"
Reid Kleckner [Tue, 22 Feb 2022 18:31:09 +0000 (10:31 -0800)]
Revert "[AArch64] Alter mull shuffle(ext(..)) combine to work on buildvectors"

This reverts commit 9fc1a0dcb79afb31470751651c30e843c12e9ca5.

We have bisected a compiler crash to this revision and will provide a
test case soon.

2 years ago[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op
Mogball [Tue, 22 Feb 2022 18:26:52 +0000 (18:26 +0000)]
[mlir][pdl] NFC re-add NoSideEffect to Result and Results Op

2 years ago[SLP] Use isInSchedulingRegion consistently [NFC]
Philip Reames [Tue, 22 Feb 2022 18:27:00 +0000 (10:27 -0800)]
[SLP] Use isInSchedulingRegion consistently [NFC]

2 years ago[WebAssembly] Allow .data shorthand for .section .data,"",@
Wouter van Oortmerssen [Mon, 14 Feb 2022 23:55:24 +0000 (15:55 -0800)]
[WebAssembly] Allow .data shorthand for .section .data,"",@

2 years agoUpdated reflection-dump.test for mpenum section
Shubham Sandeep Rastogi [Tue, 22 Feb 2022 00:44:38 +0000 (16:44 -0800)]
Updated reflection-dump.test for mpenum section

With 1c1e2cce9a50ac9fe6b884b79925d71914cf5a30 a new swift5 reflection section for multi-payload enum mask information was added, which is called mpenum. This change simply adds a check to make sure dsymutil can dump out information in that section into the dSYM bundle.

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

2 years ago[pdl] Remove `NoSideEffect` from all PDL ops
Mogball [Mon, 21 Feb 2022 00:28:21 +0000 (00:28 +0000)]
[pdl] Remove `NoSideEffect` from all PDL ops

This trait results in PDL ops being erroneously CSE'd. These ops are side-effect free in the rewriter but not in the matcher (where unused values aren't allowed anyways). These ops should have a more nuanced side-effect modeling, this is fixing a bug introduced by a previous change.

Reviewed By: rriddle

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

2 years ago[SLP] Schedule only sub-graph of vectorizable instructions
Philip Reames [Tue, 22 Feb 2022 18:13:14 +0000 (10:13 -0800)]
[SLP] Schedule only sub-graph of vectorizable instructions

SLP currently schedules all instructions within a scheduling window which stretches from the first instruction potentially vectorized to the last. This window can include a very large number of unrelated instructions which are not being considered for vectorization. This change switches the code to only schedule the sub-graph consisting of the instructions being vectorized and their transitive users.

This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:

Before this patch:

704357 SLP                          - Number of calcDeps actions
 699021 SLP                          - Number of schedule calls
   5598 SLP                          - Number of ReSchedule actions
     59 SLP                          - Number of ReScheduleOnFail actions
  10084 SLP                          - Number of schedule resets
   8523 SLP                          - Number of vector instructions generated

After this patch:

102895 SLP                          - Number of calcDeps actions
 161916 SLP                          - Number of schedule calls
   5637 SLP                          - Number of ReSchedule actions
     55 SLP                          - Number of ReScheduleOnFail actions
  10083 SLP                          - Number of schedule resets
   8403 SLP                          - Number of vector instructions generated

I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.

The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.

For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.

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

2 years ago[flang] Update PFTBuilder
Valentin Clement [Tue, 22 Feb 2022 18:08:51 +0000 (19:08 +0100)]
[flang] Update PFTBuilder

This patch update the PFTBuilder to be able to lower
the construct present in semantics.

This is a building block for other lowering patches that will be posted soon.

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

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[ELF] Move duplicate symbol check after input file parsing
Fangrui Song [Tue, 22 Feb 2022 18:07:58 +0000 (10:07 -0800)]
[ELF] Move duplicate symbol check after input file parsing

https://discourse.llvm.org/t/parallel-input-file-parsing/60164

To decouple symbol initialization and section initialization, `Defined::section`
assignment should be postponed after input file parsing. To avoid spurious
duplicate definition error due to two definitions in COMDAT groups of the same
signature, we should postpone the duplicate symbol check.

The function is called postScan instead of a more specific name like
checkDuplicateSymbols, because we may merge Symbol::mergeProperties into
postScan. It is placed after compileBitcodeFiles to apply to ET_REL files
produced by LTO. This causes minor diagnostic regression
for skipLinkedOutput configurations: ld.lld --thinlto-index-only a.bc b.o
(bitcode definition prevails) won't detect duplicate symbol error. I think this
is an acceptable compromise. The important cases where (a) both files are
bitcode or (b) --thinlto-index-only is unused are still detected.

Reviewed By: ikudrin

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

2 years ago[Clang][OpenMP] Add the codegen support for `atomic compare`
Shilei Tian [Tue, 22 Feb 2022 17:59:56 +0000 (12:59 -0500)]
[Clang][OpenMP] Add the codegen support for `atomic compare`

This patch adds the codegen support for `atomic compare` in clang.

Reviewed By: ABataev

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

2 years agoFix the Sphinx build after f8cedc642d9b85720cb7175ef25ddde90a3fbca2
Aaron Ballman [Tue, 22 Feb 2022 17:50:39 +0000 (12:50 -0500)]
Fix the Sphinx build after f8cedc642d9b85720cb7175ef25ddde90a3fbca2

2 years ago[StableHashing] Hash machine basic blocks and functions
Jay Foad [Fri, 18 Feb 2022 11:24:05 +0000 (11:24 +0000)]
[StableHashing] Hash machine basic blocks and functions

This adds very basic support for hashing MachineBasicBlock
and MachineFunction, for use in MachineFunctionPass to
detect passes that modify the MachineFunction wrongly.

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

2 years ago[StructurizeCFG] Fix boolean not bug
Jay Foad [Tue, 22 Feb 2022 09:49:19 +0000 (09:49 +0000)]
[StructurizeCFG] Fix boolean not bug

D118623 added code to fold not-of-compare into a compare
with the inverted predicate, if the compare had no other
uses. This relies on accurate use lists in the IR but it
was run before setPhiValues, when some phi inputs are still
stored in a data structure on the side, instead of being
real uses in the IR. The effect was that a phi that should
be using the original compare result would now get an
inverted result instead.

Fix this by moving simplifyConditions after setPhiValues.

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

2 years ago[MIPS] Add `-no-pie` option to the clang driver's tests depend on it
Simon Atanasyan [Tue, 22 Feb 2022 13:46:28 +0000 (16:46 +0300)]
[MIPS] Add `-no-pie` option to the clang driver's tests depend on it

2 years ago[AMDGPU] Extend SILoadStoreOptimizer to handle global saddr loads
Stanislav Mekhanoshin [Mon, 21 Feb 2022 22:48:59 +0000 (14:48 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global saddr loads

This adds handling of the _SADDR forms to the GLOBAL_LOAD combining.

TODO: merge global stores.
TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.

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

2 years ago[InstCombine] Add test for missed select fold due to one use limitation (NFC)
Nikita Popov [Tue, 22 Feb 2022 16:56:01 +0000 (17:56 +0100)]
[InstCombine] Add test for missed select fold due to one use limitation (NFC)

The eq sub zero fold currently has an artificial one-use limitation,
causing us to miss this fold.

2 years ago[AMDGPU] Extend SILoadStoreOptimizer to handle global loads
Stanislav Mekhanoshin [Mon, 21 Feb 2022 19:17:58 +0000 (11:17 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global loads

There can be situations where global and flat loads and stores are not
combined by the vectorizer, in particular if their address space
differ in the IR but they end up the same class instructions after
selection. For example a divergent load from constant address space
ends up being the same global_load as a load from global address space.

TODO: merge global stores.
TODO: handle SADDR forms.
TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.

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

2 years ago[Bitcode] Store type IDs for values
Nikita Popov [Mon, 14 Feb 2022 16:00:41 +0000 (17:00 +0100)]
[Bitcode] Store type IDs for values

This is the next step towards supporting bitcode auto upgrade with
opaque pointers. The ValueList now stores the Value* together with
its associated type ID, which allows inspecting the original pointer
element type of arbitrary values.

This is a largely mechanical change threading the type ID through
various places. I've left TODOTypeID placeholders in a number of
places where determining the type ID is either non-trivial or
requires allocating a new type ID not present in the original
bitcode. For this reason, the new type IDs are also not used for
anything yet (apart from propagation). They will get used once the
TODOs are resolved.

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

2 years agoRestore documentation for __builtin_assume
serge-sans-paille [Sun, 20 Feb 2022 08:05:46 +0000 (09:05 +0100)]
Restore documentation for __builtin_assume

This got removed by 6cacd420a1d72bca7809e6b516fb1e18ac6056c8, and that was a
mistake.

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

2 years ago[AArch64] Remove unused feature flags from AArch64TargetInfo
tyb0807 [Tue, 1 Feb 2022 21:41:23 +0000 (21:41 +0000)]
[AArch64] Remove unused feature flags from AArch64TargetInfo

This removes two feature flags from `AArch64TargetInfo` class:

- `HasHBC`: this feature does not involve generating any IR intrinsics,
so clang does not need to know about whether it is set

- `HasCrypto`: this feature is deprecated in favor of finer grained
features such as AES, SHA2, SHA3 and SM4. The associated ACLE macro
__ARM_FEATURE_CRYPTO is thus no longer used.

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

2 years ago[clang-format] Avoid parsing "requires" as a keyword in non-C++-like languages.
Marek Kurdej [Tue, 22 Feb 2022 14:46:28 +0000 (15:46 +0100)]
[clang-format] Avoid parsing "requires" as a keyword in non-C++-like languages.

Fixes the issue raised post-review in D113319 (cf. https://reviews.llvm.org/D113319#3337485).

Reviewed By: krasimir

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

2 years ago[PowerPC] Allow absolute expressions in relocations
Nemanja Ivanovic [Tue, 22 Feb 2022 15:52:19 +0000 (09:52 -0600)]
[PowerPC] Allow absolute expressions in relocations

The Linux kernel build uses absolute expressions suffixed with @lo/@ha
relocations. This currently doesn't work for DS/DQ form instructions and
there is no reason for it not to. It also works with GAS.
This patch allows this as long as the value is a multiple of 4/16
for DS/DQ form.

Differential revision: https://reviews.llvm.org/D115419

2 years ago[clang-format] Use FormatToken::is* functions without passing through `Tok`. NFC.
Marek Kurdej [Tue, 22 Feb 2022 15:40:30 +0000 (16:40 +0100)]
[clang-format] Use FormatToken::is* functions without passing through `Tok`. NFC.

2 years agoFix docs build after f8cedc642d9b85720cb7175ef25ddde90a3fbca2
Timm Bäder [Tue, 22 Feb 2022 15:34:12 +0000 (16:34 +0100)]
Fix docs build after f8cedc642d9b85720cb7175ef25ddde90a3fbca2

Looks like rst doesn't like '#' in link texts. Just remove it.

2 years ago[CodeGen] Add test for PR53990 (NFC)
Nikita Popov [Tue, 22 Feb 2022 15:31:46 +0000 (16:31 +0100)]
[CodeGen] Add test for PR53990 (NFC)

2 years ago[clang] Never wrap a nullptr in CXXNewExpr::getArraySize()
Timm Bäder [Fri, 11 Feb 2022 07:27:33 +0000 (08:27 +0100)]
[clang] Never wrap a nullptr in CXXNewExpr::getArraySize()

Otherwise callers of these functions have to check both the return value
for and the contents of the returned llvm::Optional.

Fixes #53742

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

2 years ago[mlir][bufferize] Fix GCC build
Matthias Springer [Tue, 22 Feb 2022 14:58:57 +0000 (23:58 +0900)]
[mlir][bufferize] Fix GCC build

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

2 years ago[lldb] Remove HostProcess:GetMainModule
Pavel Labath [Mon, 21 Feb 2022 14:38:52 +0000 (15:38 +0100)]
[lldb] Remove HostProcess:GetMainModule

the function is unused, and the posix implementation is only really correct on linux.

2 years ago[clang][www] Port make_cxx_dr_status script to Python3
Timm Bäder [Tue, 22 Feb 2022 10:07:39 +0000 (11:07 +0100)]
[clang][www] Port make_cxx_dr_status script to Python3

And run it to re-generate the cxx_dr_status.html

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

2 years ago[clang-format] Fix preprocessor nesting after commit 529aa4b011c4ae808d658022ef643c44...
Krasimir Georgiev [Tue, 22 Feb 2022 14:43:09 +0000 (15:43 +0100)]
[clang-format] Fix preprocessor nesting after commit 529aa4b011c4ae808d658022ef643c44dd9b2c9c

In https://github.com/llvm/llvm-project/commit/529aa4b011c4ae808d658022ef643c44dd9b2c9c
by setting the identifier info to nullptr, we started to subtly
interfere with the parts in the beginning of the function,
https://github.com/llvm/llvm-project/blob/529aa4b011c4ae808d658022ef643c44dd9b2c9c/clang/lib/Format/UnwrappedLineParser.cpp#L991
causing the preprocessor nesting to change in some cases. E.g., for the
added regression test, clang-format started incorrectly guessing the
language as C++.

This tries to address this by introducing an internal identifier info
element to use instead.

Reviewed By: curdeius, MyDeveloperDay

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

2 years ago[AArch64][SME] Remove term 'streaming-sve' from assembler diagnostics.
Sander de Smalen [Tue, 22 Feb 2022 13:48:21 +0000 (13:48 +0000)]
[AArch64][SME] Remove term 'streaming-sve' from assembler diagnostics.

'streaming-sve' is not a feature that users should be able to set,
hence why it shouldn't show up in user-diagnostics. The only
flag that end-users should be able to set is '+sme'.

Reviewed By: paulwalker-arm

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

2 years agoAdd DriverKit support
Egor Zhdan [Mon, 24 Jan 2022 14:18:14 +0000 (14:18 +0000)]
Add DriverKit support

This patch is the first in a series of patches to upstream the support for Apple's DriverKit. Once complete, it will allow targeting DriverKit platform with Clang similarly to AppleClang.

This code was originally authored by JF Bastien.

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

2 years ago[VE] Split unsupported v512.32 ops
Simon Moll [Tue, 22 Feb 2022 13:29:29 +0000 (14:29 +0100)]
[VE] Split unsupported v512.32 ops

Split v512.32 binary ops into two v256.32 ops using packing support
opcodes (vec_unpack_lo|hi, vec_pack).

Depends on D120053 for packing opcodes.

Reviewed By: kaz7

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

2 years ago[SVE] Add isel patterns for SABA/UABA.
Paul Walker [Mon, 14 Feb 2022 20:01:29 +0000 (20:01 +0000)]
[SVE] Add isel patterns for SABA/UABA.

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

2 years ago[x86] add load folding restriction to pushAddIntoCmovOfConsts()
Sanjay Patel [Tue, 22 Feb 2022 13:01:09 +0000 (08:01 -0500)]
[x86] add load folding restriction to pushAddIntoCmovOfConsts()

With only a load-fold the diffs look neutral. If there's a load and store (rmw)
fold opportunity as shown in the test based on #53862, then we end up with an
extra instruction.

Fixes #53862

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

2 years ago[Flang] Initial patch to lower a Fortran intrinsic
Kiran Chandramohan [Tue, 22 Feb 2022 10:12:04 +0000 (10:12 +0000)]
[Flang] Initial patch to lower a Fortran intrinsic

This patch brings in some initial changes for lowering Fortran
intrinsics. Intrinsics are generally lowered to a mix of FIR and
MLIR operations, runtime calls or LLVM intrinsics. This patch
particularly brings in the lowering of the Fortran `andi` intrinsic
to `arith.andi` in MLIR.

The significant changes are in ConvertExpr.cpp and IntrinsicCall.cpp.
Intrinsic functions occur as part of expressions. Lowering deals with this
in ConvertExpr.cpp in `genval(const Fortran::evaluate::FunctionRef<A> &funcRef)`.
The code in the above mentioned function kicks of a sequence of calls
that ultimately results in a call to the `genIand ` function in
IntrinsicCall.cpp which creates the MLIR `arith.andi` operation.

A few tests are also included.

Note: Generally intrinsics like `iand` can occur in array (elemental)
context, but since that part is not fully supported in lowering, tests
are only added for the scalar context.

This patch is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.

Reviewed By: clementval

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: zacharyselk <zrselk@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[AMDGPU] Fix typo in comment [NFC]
Thomas Symalla [Tue, 22 Feb 2022 12:27:26 +0000 (13:27 +0100)]
[AMDGPU] Fix typo in comment [NFC]

This replaces "V_MOB_B32" with "V_MOV_B32" in some comment.

2 years ago[GISel] Silence 'sideeffect in assertion' coverity warnings. NFCI.
Simon Pilgrim [Tue, 22 Feb 2022 11:52:45 +0000 (11:52 +0000)]
[GISel] Silence 'sideeffect in assertion' coverity warnings. NFCI.

Use llvm::enumerate to keep track of index.