platform/upstream/llvm.git
2 years ago[NewGVN] FIx phi-of-ops in the presence of memory read operations
Nuno Lopes [Wed, 26 Jan 2022 10:10:22 +0000 (10:10 +0000)]
[NewGVN] FIx phi-of-ops in the presence of memory read operations

The phi-of-ops functionality has a function OpIsSafeForPHIOfOps
to determine when it's safe to create the new phi.
But this function only checks for the obvious dominator conditions
and ignores memory.
This patch takes the conservative approach and disables phi-of-ops
whenever there's a load that doesn't dominate the phi, as its
value may be affected by a store inside the loop.

This can be improved later to check aliasing between the
load/stores.

Fixes https://llvm.org/PR53277

Reviewed By: asbirlea

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

2 years ago[NFC] Additional header dependency cleanup LLVMSupport
serge-sans-paille [Wed, 26 Jan 2022 07:50:00 +0000 (02:50 -0500)]
[NFC] Additional header dependency cleanup LLVMSupport

A few more forward-declarations, a few less headers. the impact on number of
preprocessed lines for LLVMSupport is negligible (-3K lines) but it's always
good to remove dependencies.

Related discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup

2 years ago[LICM] Generalize unwinding check during scalar promotion
Nikita Popov [Tue, 11 Jan 2022 10:02:26 +0000 (11:02 +0100)]
[LICM] Generalize unwinding check during scalar promotion

This extract a common isNotVisibleOnUnwind() helper into
AliasAnalysis, which handles allocas, byval arguments and noalias
calls. After D116998 this could also handle sret arguments. We
have similar logic in DSE and MemCpyOpt, which will be switched
to use this helper as well.

The noalias call case is a bit different from the others, because
it also requires that the object is not captured. The caller is
responsible for doing the appropriate check.

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

2 years agoFix edb02d8c5df36bb375df7171b4ba61635564dfb4
serge-sans-paille [Wed, 26 Jan 2022 10:06:12 +0000 (05:06 -0500)]
Fix edb02d8c5df36bb375df7171b4ba61635564dfb4

2 years ago[LICM] Add additional tests for promotion with unwinding (NFC)
Nikita Popov [Tue, 11 Jan 2022 09:57:56 +0000 (10:57 +0100)]
[LICM] Add additional tests for promotion with unwinding (NFC)

2 years ago[OpenMPIRBuilderTest] Avoid pointer element type access
Nikita Popov [Wed, 26 Jan 2022 10:02:03 +0000 (11:02 +0100)]
[OpenMPIRBuilderTest] Avoid pointer element type access

This was reintroduced by D110114.

2 years agoRestrict performPostLD1Combine to 64 and 128 bit vectors
Maciej Gabka [Wed, 26 Jan 2022 09:46:32 +0000 (09:46 +0000)]
Restrict performPostLD1Combine to 64 and 128 bit vectors

When wider vectors are used, for example fixed width SVE,
there is no patterns to select AArch64ISD::LD1LANEpost
nodes, so we should do an early exit.

Reviewed By: paulwalker-arm

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

2 years ago[mlir][Bazel] Remove unnecessary dependencies
Adrian Kuegel [Wed, 26 Jan 2022 09:15:44 +0000 (10:15 +0100)]
[mlir][Bazel] Remove unnecessary dependencies

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

2 years ago[libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows
Martin Storsjö [Sun, 9 Jan 2022 22:32:47 +0000 (22:32 +0000)]
[libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows

This allows getting rid of one case of LIBCXX-WINDOWS-FIXME. The fixme
comment was inaccurate; aligned allocation functions are provided these
days, but the test kept failing as it was using mismatched allocation
and free functions.

A similar issue was fixed earlier, in
6596778b46ba69517191e7397289228168064ff4. That test was fixed by
overriding the aligned `operator new` too, and returning a dummy fixed
allocation instead. As this test is libcxx specific, it can use the
internal `std::__libcpp_aligned_free()` instead, to match libcxx's
internal aligned `operator new`.

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

2 years ago[SCEVExpander] Remove pointer element type access in assertion
Nikita Popov [Wed, 26 Jan 2022 09:34:23 +0000 (10:34 +0100)]
[SCEVExpander] Remove pointer element type access in assertion

Assert directly on i8 rather than the element type of i8*.

2 years ago[OpenMPOpt] Add const qualifier (NFC)
Nikita Popov [Wed, 26 Jan 2022 09:20:39 +0000 (10:20 +0100)]
[OpenMPOpt] Add const qualifier (NFC)

Make it clear that this large lambda does not modify the vector.

2 years ago[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions
serge-sans-paille [Tue, 25 Jan 2022 20:48:51 +0000 (15:48 -0500)]
[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions

It's a recommit of 6427f4c52c31cc36004 (patch included)

2 years ago[AddressSanitizer] Avoid pointer element type accesses
Nikita Popov [Wed, 26 Jan 2022 09:10:13 +0000 (10:10 +0100)]
[AddressSanitizer] Avoid pointer element type accesses

Determine masked load/store type based on the value operand and
result types, rather than pointer element type.

2 years ago[flang] Get rid of code duplication in wrapper. Fix checking of undefined variables.
Yury Gribov [Wed, 19 Jan 2022 08:21:44 +0000 (17:21 +0900)]
[flang] Get rid of code duplication in wrapper. Fix checking of undefined variables.

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

2 years ago[DAG] Create fptoui.sat from clamped fptoui
David Green [Wed, 26 Jan 2022 08:37:44 +0000 (08:37 +0000)]
[DAG] Create fptoui.sat from clamped fptoui

This is the unsigned variant of D111976, where we convert a clamped
fptoui to a fptoui.sat. Because we are unsigned, the condition this time
is only UMIN of UINT_MAX. Similarly to D111976 it handles ISD::UMIN,
ISD::SETCC/ISD::SELECT, ISD::VSELECT or ISD::SELECT_CC nodes.

This especially helps on ARM/AArch64 where the vcvt instructions
naturally saturate the result.

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

2 years ago[flang] Add a custom target for the "flang" wrapper script.
Yury Gribov [Wed, 19 Jan 2022 10:48:54 +0000 (19:48 +0900)]
[flang] Add a custom target for the "flang" wrapper script.

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

2 years agoAdd ieee_is_normal/ieee_is_negative to ieee_arithmetic module.
Yury Gribov [Fri, 21 Jan 2022 08:24:32 +0000 (17:24 +0900)]
Add ieee_is_normal/ieee_is_negative to ieee_arithmetic module.

2 years ago[RISCV] Fix support of vlen = 64.
jacquesguan [Wed, 26 Jan 2022 07:48:51 +0000 (15:48 +0800)]
[RISCV] Fix support of vlen = 64.

In the Zve* extensions, the vlen could be 64. This patch change the vlen constraint of low bound to 64.

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

2 years ago[mlir] Fix merging of delayed registrations during DialectRegistry::appendTo
Matthias Springer [Tue, 25 Jan 2022 18:35:33 +0000 (03:35 +0900)]
[mlir] Fix merging of delayed registrations during DialectRegistry::appendTo

The existing implementation called DenseMap::insert, which is a no-op if the map already contains an entry with the same key.

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

2 years ago[clang-format] Fix regression in parsing pointers to arrays.
Marek Kurdej [Wed, 26 Jan 2022 08:11:21 +0000 (09:11 +0100)]
[clang-format] Fix regression in parsing pointers to arrays.

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

After commit 5c2e7c9, the code:
```
template <> struct S : Template<int (*)[]> {};
```
was misformatted as:
```
template <> struct S : Template<int (*)[]>{};
```

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years agoAdd release note for aarch64-none-elf driver change.
Kristof Beyls [Wed, 26 Jan 2022 08:13:22 +0000 (09:13 +0100)]
Add release note for aarch64-none-elf driver change.

2 years ago[ELF] --gdb-index: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
Fangrui Song [Wed, 26 Jan 2022 07:53:23 +0000 (23:53 -0800)]
[ELF] --gdb-index: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC

2 years ago[flang] Change getLoweredName to translateNameToFrontendMangledName()
Valentin Clement [Tue, 25 Jan 2022 21:53:20 +0000 (22:53 +0100)]
[flang] Change getLoweredName to translateNameToFrontendMangledName()

getLoweredName() is not a well suited name change it to
translateNameToFrontendMangledName()

Reviewed By: schweitz

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

2 years ago[ELF] Optimize .relr.dyn to not grow vector<uint64_t>. NFC
Fangrui Song [Wed, 26 Jan 2022 07:33:40 +0000 (23:33 -0800)]
[ELF] Optimize .relr.dyn to not grow vector<uint64_t>. NFC

2 years ago[NFC] Group PowerPC clang codegen tests into directory
Qiu Chaofan [Wed, 26 Jan 2022 07:19:22 +0000 (15:19 +0800)]
[NFC] Group PowerPC clang codegen tests into directory

2 years ago[NFC] Remove duplicate include
Jim Lin [Wed, 26 Jan 2022 01:50:00 +0000 (09:50 +0800)]
[NFC] Remove duplicate include

2 years ago[ELF] Simplify and optimize .relr.dyn NFC
Fangrui Song [Wed, 26 Jan 2022 06:50:03 +0000 (22:50 -0800)]
[ELF] Simplify and optimize .relr.dyn NFC

2 years ago[JumpThreading] Add a test for handling zero !prof branch_weights
Yevgeny Rouban [Wed, 26 Jan 2022 05:38:17 +0000 (12:38 +0700)]
[JumpThreading] Add a test for handling zero !prof branch_weights

The test was a part of the revision D81499 and should have been
added with commit 707836ed4ed.

Reviewed By: yamauchi, wenlei
Differential Revision: https://reviews.llvm.org/D81499

2 years ago[ELF] Clarify that Z_BEST_SPEED==1 in a comment. NFC
Fangrui Song [Wed, 26 Jan 2022 06:40:53 +0000 (22:40 -0800)]
[ELF] Clarify that Z_BEST_SPEED==1 in a comment. NFC

2 years ago[ELF] --build-id: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
Fangrui Song [Wed, 26 Jan 2022 06:39:43 +0000 (22:39 -0800)]
[ELF] --build-id: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC

We can't use C++20 make_unique_for_overwrite yet.

2 years ago[ELF] Cast size to size_t. NFC
Fangrui Song [Wed, 26 Jan 2022 06:38:23 +0000 (22:38 -0800)]
[ELF] Cast size to size_t. NFC

To fix

../../chromeclang/bin/../include/c++/v1/__algorithm/min.h:39:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'unsigned long long')

on macOS arm64.

2 years agoRefactor: Extract Class MessagePrefix (NFC)
Richard [Mon, 3 Jan 2022 23:03:06 +0000 (16:03 -0700)]
Refactor: Extract Class MessagePrefix (NFC)

The work is the same, the only difference is the prefix
of the strings we look for in the reference files.

2 years ago[mlir] Propagate arith.index_cast past tensor.extract
Rob Suderman [Wed, 26 Jan 2022 06:15:55 +0000 (22:15 -0800)]
[mlir] Propagate arith.index_cast past tensor.extract

If we are extracting it is more useful to push the index_cast past the
extraction. This increases the chance the tensor.extract can evaluated at
compile time.

Reviewed By: rriddle

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

2 years ago[ELF] maybeCompress: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC
Fangrui Song [Wed, 26 Jan 2022 06:15:44 +0000 (22:15 -0800)]
[ELF] maybeCompress: replace vector<uint8_t> with unique_ptr<uint8_t[]>. NFC

And mention that it is zero-initialized. I do not notice a speed-up if
changed to be uninitialized by forcing the zero filler in writeTo.

2 years ago[regalloc] Fix assertion error when LiveInterval is empty
wangpc [Wed, 26 Jan 2022 06:04:53 +0000 (14:04 +0800)]
[regalloc] Fix assertion error when LiveInterval is empty

When evicting interference, it causes an asseertion error
since LiveIntervals::intervalIsInOneMBB assumes that input
is not empty.

This patch fixed bug mentioned in D118020.

Reviewed By: MatzeB

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

2 years ago[MC] Support constant offset for symbol PendingFixup
luxufan [Fri, 14 Jan 2022 15:02:27 +0000 (23:02 +0800)]
[MC] Support constant offset for symbol PendingFixup

This patch add support relocation offset of sym+constant(like `foo+4`) form for pending fixup.

In the past, llvm-mc ignored the constant in sym+constant form, for `foo+4`, `4` would be ignored. And test case
```
.text
  ret
  nop
  nop
  .reloc foo+4, R_RISCV_32, 6

.data
.globl foo
foo:
  .word 0
  .word 0
  .word 0
```
when run `llvm-mc -filetype=obj -triple=riscv64 %s | llvm-readobj -r`
The output is
```
Relocations [
  Section (3) .rela.text {
    0x0 R_RISCV_32 - 0x6
  }
]
```

After applying this patch, the output is
```
Relocations [
  Section (3) .rela.text {
    0x4 R_RISCV_32 - 0x6
  }
]
```

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

2 years ago[CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector
Hongtao Yu [Wed, 26 Jan 2022 00:11:41 +0000 (16:11 -0800)]
[CSSPGO] Adjust SampleContextFrameVector to be a shorter SmallVector

It appears that some memory saving can be archived by tweaking the existing `SampleContextFrameVector` setup. Below are memory usage for two benchmarks before and after this change.

1. Medium benchmark:
   - Before:

```
    note: After computeSizeForProfiledFunctions
    note: VM: 12.50 GB   RSS: 11.02 GB
    note: After generateProbeBasedProfile
    note: **VM: 30.56 GB   RSS: 29.08 GB**
    note: After postProcessProfiles
    note: VM: 31.91 GB   RSS: 30.43 GB
```
   - After:

```
    note: After computeSizeForProfiledFunctions
    note: VM: 12.26 GB   RSS: 10.80 GB
    note: After generateProbeBasedProfile
    note: **VM: 28.76 GB   RSS: 27.29 GB**
    note: After postProcessProfiles
    note: VM: 30.12 GB   RSS: 28.66 GB
```

2. Large benchmark:
   - Before:

```
    note: After computeSizeForProfiledFunctions
    note: VM: 106.28 GB   RSS: 91.25 GB
    note: After generateProbeBasedProfile
    note: **VM: 245.19 GB   RSS: 224.30 GB**
    note: After postProcessProfiles
    note: VM: 254.96 GB   RSS: 221.58 GB
```

   - After:

```
    note: After computeSizeForProfiledFunctions
    note: VM: 105.95 GB   RSS: 91.04 GB
    note: After generateProbeBasedProfile
    note: VM: **234.29 GB   RSS: 215.39 GB**
    note: After postProcessProfiles
    note: VM: 244.03 GB   RSS: 213.45 GB
```

Reviewed By: wenlei

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

2 years ago[PowerPC] Emit gnu_attribute according to float-abi metadata
Qiu Chaofan [Wed, 26 Jan 2022 05:23:21 +0000 (13:23 +0800)]
[PowerPC] Emit gnu_attribute according to float-abi metadata

According to GNU as documentation, PowerPC supports some .gnu_attribute
tags to represent the vector and float ABI type in the object file.
Some linkers like GNU ld respects the attribute and will prevent objects
with conflicting ABIs being linked.

This patch emits gnu_attribute value in assembly printer according to
the float-abi metadata. More attributes for soft-fp, hard single/double
and even vector ABI need to be supported in the future.

Reviewed By: jsji

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

2 years ago[AArch64] Fixes ADD/SUB opt bug and abstracts shared behavior in MIPeepholeOpt for...
Micah Weston [Wed, 26 Jan 2022 04:21:48 +0000 (04:21 +0000)]
[AArch64] Fixes ADD/SUB opt bug and abstracts shared behavior in MIPeepholeOpt for ADD, SUB, and AND.

This fixes a bug where (SUBREG_TO_REG 0 (MOVi32imm <negative-number>) sub_32)
would generate invalid code since the top 32-bits were not zeroed when inspecting the
immediate value. A new test was added for this case.

Change to abstract shared behavior in MIPeepholeOpt. Both
visitAND and visitADDSUB attempt to split an RR instruction with an immediate
operand into two RI instructions with the immediate split.

The differing behavior lies in how the immediate is split into two pieces and
how the new instructions are built. The rest of the behavior (adding new VRegs,
checking for the MOVImm, constraining reg classes, removing old intructions)
are shared between the operations.

The new helper function splitTwoPartImm implements the shared behavior and
delegates differing behavior to two function objects passed by the caller.
One function object splits the immediate into two values and returns the
opcode to use if it is a valid split. The other function object builds
the new instructions.

I felt this abstraction would help since I believe it will help reduce the
code repetition when adding new instructions of the pattern, such as
SUBS for this conditional optimization.

Tested it locally by running check all with compiler-rt, mlir, clang-tools-extra,
flang, llvm, and clang enabled.

Reviewed By: dmgreen

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

2 years ago[NFC][llvm] Align the comment
ly [Wed, 26 Jan 2022 03:49:50 +0000 (11:49 +0800)]
[NFC][llvm] Align the comment

Reviewed By: luismarques

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

2 years ago[lld][macho][NFC] Make MachO/start-end.s test less britle by checking for _main:
Puyan Lotfi [Wed, 26 Jan 2022 03:15:00 +0000 (19:15 -0800)]
[lld][macho][NFC] Make MachO/start-end.s test less britle by checking for _main:

In start-end.s there is a lit check line `# SEG: _main` to begin the
check at the start of the function main where `_main` is the Darwin name
mangling for C main. Because the text file that FileCheck is getting as
input has the path of the compiler build in it from llvm-mc and
llvm-objdump, and because of the lack of a trailing colon in this check
line we end up inadvertently matching against the line of text with the
compiler path in it in the case where said path contains "_main" some
place. This can be very likely if the compiler branch has "main" or
"_main" in it.

To fix this I include the training : since that will match on the
function label and not the path line.

2 years ago[MC] Put the Pending Fixups into location symbol's fragment
luxufan [Fri, 14 Jan 2022 14:03:23 +0000 (22:03 +0800)]
[MC] Put the Pending Fixups into location symbol's fragment

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

2 years ago[C++20] [Modules] Only check decls under namespace scope in CheckRedeclarationExported
Chuanqi Xu [Wed, 26 Jan 2022 02:53:50 +0000 (10:53 +0800)]
[C++20] [Modules] Only check decls under namespace scope in CheckRedeclarationExported

Since only the decls inhabit in a namespace scope could be exported, it
is not meaningful to check it in CheckRedeclarationExported, which
implements [module.interface]/p6.

Reviewed By: urnathan

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

2 years ago[OMPIRBuilder] Generate aggregate argument for parallel region outlined functions
Giorgis Georgakoudis [Wed, 26 Jan 2022 01:31:35 +0000 (20:31 -0500)]
[OMPIRBuilder] Generate aggregate argument for parallel region outlined functions

Summary:
This patch modifies code generation in OpenMPIRBuilder to pass arguments
to the parallel region outlined function in an aggregate (struct),
besides the global_tid and bound_tid arguments. It depends on the
updated CodeExtractor (see D96854) for support. It mirrors functionality
of Clang codegen (see D102107).

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

2 years ago[CodeExtractor] Enable partial aggregate arguments
Giorgis Georgakoudis [Wed, 26 Jan 2022 01:08:19 +0000 (20:08 -0500)]
[CodeExtractor] Enable partial aggregate arguments

Summary:
Enable CodeExtractor to construct output functions that partially
aggregate inputs/outputs in their argument list. A use case is the
OMPIRBuilder to create outlined functions for parallel regions that
aggregate in a struct the payload variables for the region while passing
as scalars thread and bound identifiers.

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

2 years ago[RISCV][NFC] Add getVLOperand for RVV intrinsics.
Zakk Chen [Tue, 25 Jan 2022 15:54:39 +0000 (07:54 -0800)]
[RISCV][NFC] Add getVLOperand for RVV intrinsics.

Use the VLOperand information to get the VL.

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

2 years ago[RISCV] Add the passthru operand for RVV nomask load intrinsics.
Zakk Chen [Tue, 25 Jan 2022 08:08:21 +0000 (00:08 -0800)]
[RISCV] Add the passthru operand for RVV nomask load intrinsics.

The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.

Co-Authored-by: Hsiangkai Wang <Hsiangkai@gmail.com>
Reviewers: craig.topper, frasercrmck

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

2 years ago[ASan] Added a unit test for D118184.
Kirill Stoimenov [Wed, 26 Jan 2022 00:57:40 +0000 (00:57 +0000)]
[ASan] Added a unit test for D118184.

To make sure the the libraries are there for executable and not there for DSOs.

Reviewed By: kda

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

2 years ago[NFC][IROutliner] fix namespace and unused variable
Andrew Litteken [Wed, 26 Jan 2022 00:41:18 +0000 (18:41 -0600)]
[NFC][IROutliner] fix namespace and unused variable

2 years ago[libc++] [test] Fix LWG3146 "Excessive unwrapping in std::ref/cref"
Arthur O'Dwyer [Sat, 22 Jan 2022 17:18:51 +0000 (12:18 -0500)]
[libc++] [test] Fix LWG3146 "Excessive unwrapping in std::ref/cref"

Drive-by constexprify the existing tests, too.

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

2 years ago[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the region.
Andrew Litteken [Sun, 2 Jan 2022 22:25:43 +0000 (16:25 -0600)]
[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the region.

We use the same similarity scheme we used for branch instructions for phi nodes, and allow them to be outlined. There is not a lot of special handling needed for these phi nodes when outlining, as they simply act as outputs. The code extractor does not currently allow for non entry blocks within the extracted region to have predecessors, so there are not conflicts to handle with respect to predecessors no longer contained in the function.

Recommit of 515eec3553b02533e9a88ee84bc245d5415163da

Reviewers: paquette

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

2 years agoRevert "[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the...
Andrew Litteken [Wed, 26 Jan 2022 00:23:38 +0000 (18:23 -0600)]
Revert "[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the region."

This reverts commit 515eec3553b02533e9a88ee84bc245d5415163da.

By mistake, commit message was not complete.

2 years ago[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the region.
Andrew Litteken [Sun, 2 Jan 2022 22:25:43 +0000 (16:25 -0600)]
[IRSim][IROutliner] Add support for outlining PHINodes with the rest of the region.

2 years agoRevert "[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matchin...
Andrew Litteken [Wed, 26 Jan 2022 00:18:27 +0000 (18:18 -0600)]
Revert "[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and Outlined Regions"

This reverts commit 8de76bd569732acae6a10fdcb0152a49f7d4cd39.

Reverting due to failure of different-intrinsics.ll on lld-x86_64-win buildbot.

2 years ago[ASan] Not linking asan_static library for DSO.
Kirill Stoimenov [Tue, 25 Jan 2022 21:33:55 +0000 (21:33 +0000)]
[ASan] Not linking asan_static library for DSO.

Without this change DSOs fail to link because of missing asan_report_(load|store)n functions.

Reviewed By: kda

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

2 years agoReland "[AlwaysInliner] Enable call site inlining to make flatten attribute working...
Dávid Bolvanský [Tue, 25 Jan 2022 22:21:15 +0000 (23:21 +0100)]
Reland "[AlwaysInliner] Enable call site inlining to make flatten attribute working again (#53360)"

2 years ago[mlir] Fold tensor.reshape operations into tensor.from_elements.
Rob Suderman [Tue, 25 Jan 2022 23:54:49 +0000 (15:54 -0800)]
[mlir] Fold tensor.reshape operations into tensor.from_elements.

There is not much of a benefit to reshape a from element vs reloading it.
Updated to progagate shape manipulations into the output type of
tensor.from_elements.

Reviewed By: NatashaKnk

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

2 years ago[clangd] Add designator inlay hints for initializer lists.
Sam McCall [Fri, 7 Jan 2022 03:15:07 +0000 (04:15 +0100)]
[clangd] Add designator inlay hints for initializer lists.

These make the init lists appear as if designated initialization was used.

Example:
  ExpectedHint{"param: ", "arg"}
becomes
  ExpectedHint{.Label="param: ", .RangeName="arg"}

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

2 years ago[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and...
Andrew Litteken [Thu, 23 Dec 2021 00:07:43 +0000 (18:07 -0600)]
[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and Outlined Regions

Due to some complications with lifetime, and assume-like intrinsics, intrinsics were not included as outlinable instructions. This patch opens up most intrinsics, excluding lifetime and assume-like intrinsics, to be outlined. For similarity, it is required that the intrinsic IDs, and the intrinsics names match exactly, as well as the function type. This puts intrinsics in a different class than normal call instructions (https://reviews.llvm.org/D109448), where the name will no longer have to match.

This also adds an additional command line flag debug option to disable outlining intrinsics.

Reviewers: paquette, jroelofs

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

2 years ago[NFC] DeclCXX: Fix -Wreorder-ctor
Jordan Rupprecht [Tue, 25 Jan 2022 22:27:25 +0000 (14:27 -0800)]
[NFC] DeclCXX: Fix -Wreorder-ctor

From 8ba9c794feb30cd969b9776c39873def10c51bff

2 years agoAdd support for sycl_special_class attribute.
Zahira Ammarguellat [Tue, 23 Nov 2021 22:58:03 +0000 (14:58 -0800)]
Add support for sycl_special_class attribute.

Special classes such as accessor, sampler, and stream need additional
implementation when they are passed from host to device.

This patch is adding a new attribute “sycl_special_class” used to mark
SYCL classes/struct that need the additional compiler handling.

2 years agoRevert "[AlwaysInliner] Enable call site inlining to make flatten attribute working...
Dávid Bolvanský [Tue, 25 Jan 2022 22:13:46 +0000 (23:13 +0100)]
Revert "[AlwaysInliner] Enable call site inlining to make flatten attribute working again (#53360)"

This reverts commit ceec4383681c42bfd3d06a6913ce7554bea160b0. Clang tests fail.

2 years ago[AlwaysInliner] Enable call site inlining to make flatten attribute working again...
Dávid Bolvanský [Tue, 25 Jan 2022 21:47:16 +0000 (22:47 +0100)]
[AlwaysInliner] Enable call site inlining to make flatten attribute working again (#53360)

Problem: Migration to new PM broke flatten attribute.

This is one use case why LLVM should support inlining call-site with alwaysinline.  The flatten attribute is nowdays broken, so we should either land patch like this one or remove everything related to  flatten attribute from Clang.

Second use case is something like "per call site inlining intrinsics" to control inlining even more; mentioned in
https://lists.llvm.org/pipermail/cfe-dev/2018-September/059232.html

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

Reviewed By: aeubanks

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

2 years agoRevert accidentally pushed commit. It was not yet reviewed.
Adrian Prantl [Tue, 25 Jan 2022 21:53:14 +0000 (13:53 -0800)]
Revert accidentally pushed commit. It was not yet reviewed.

"Fix UB in DwarfExpression::emitLegacyZExt()"

This reverts commit e37de5d36e3190283916604342b029859129e2a4.

2 years agoAdd missing include diagnosed by the modules build.
Adrian Prantl [Tue, 25 Jan 2022 21:52:44 +0000 (13:52 -0800)]
Add missing include diagnosed by the modules build.

2 years agoFix UB in DwarfExpression::emitLegacyZExt()
Adrian Prantl [Tue, 25 Jan 2022 21:29:22 +0000 (13:29 -0800)]
Fix UB in DwarfExpression::emitLegacyZExt()

A shift-left > 63 triggers a UBSAN failure. This patch kicks the can
down the road (to the consumer) by emitting a more compact
representation of the shift computation in DWARF expressions.

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

2 years agoRevert "[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter...
Nico Weber [Tue, 25 Jan 2022 21:36:38 +0000 (16:36 -0500)]
Revert "[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions"

This reverts commit 6427f4c52c31cc36004b14825e6598cd4a43f385.
Breaks a bunch of tests, see e.g. http://45.33.8.238/linux/66340/step_7.txt
or https://lab.llvm.org/buildbot/#/builders/139/builds/16807

2 years agoRevert "Fix build issue in assert mode introduced by 6427f4c52c31cc36004"
Nico Weber [Tue, 25 Jan 2022 21:31:57 +0000 (16:31 -0500)]
Revert "Fix build issue in assert mode introduced by 6427f4c52c31cc36004"

This reverts commit d65a3b3265d058ce1f0ac82fa4d0826bf1b2bbaf.
Breaks build everywhere, see e.g. http://45.33.8.238/linux/66344/step_4.txt
or https://lab.llvm.org/buildbot/#/builders/139/builds/16811

2 years agoFix build issue in assert mode introduced by 6427f4c52c31cc36004
serge-sans-paille [Tue, 25 Jan 2022 21:25:57 +0000 (22:25 +0100)]
Fix build issue in assert mode introduced by 6427f4c52c31cc36004

After 6427f4c52c31cc36004, one should use SortedCategories to check category
validity.

2 years ago[IRSim][IROutliner] Adding support for recognizing and outlining indirect function...
Andrew Litteken [Sun, 2 Jan 2022 20:31:47 +0000 (14:31 -0600)]
[IRSim][IROutliner] Adding support for recognizing and outlining indirect function calls, and function calls with different names, but the same type

The outliner currently requires that function calls not be indirect calls, and have that the function name, and function type must match, as well as other attributes such as calling conventions. This patch treats called functions as values, and just another operand, and named function calls as constants. This allows functions to be treated like any other constant, or input and output into the outlined functions.

There are also debugging flags added to enforce the old behaviors where indirect calls not be allowed, and to enforce the old rule that function calls names must also match.

Reviewers: paquette, jroelofs

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

2 years ago[test][DAGCombine] Add tests for cmp+add -> addcarry
Paweł Bylica [Sun, 23 Jan 2022 17:24:17 +0000 (18:24 +0100)]
[test][DAGCombine] Add tests for cmp+add -> addcarry

Tests for https://reviews.llvm.org/D118037.

2 years ago[InstrProf][Correlator] Do not compress names when reading debug info
Ellis Hoag [Tue, 25 Jan 2022 20:29:11 +0000 (12:29 -0800)]
[InstrProf][Correlator] Do not compress names when reading debug info

There is no need to compress the names string when correlating with
debug info since InstrProfReader will immediately uncompress it anyway.
This also removes the dependency on zlib in this case.

Reviewed By: kyulee

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

2 years ago[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions
serge-sans-paille [Tue, 25 Jan 2022 20:48:51 +0000 (15:48 -0500)]
[NFC] Use an llvm::DenseMap instead of std::map in CategorizedHelpPrinter::printOptions

2 years agoRemove unused <algorithm> include
serge-sans-paille [Tue, 25 Jan 2022 09:32:33 +0000 (04:32 -0500)]
Remove unused <algorithm> include

2 years ago[docs] HowToCrossCompileLLVM.rst: prefer --target= over legacy -target
Fangrui Song [Tue, 25 Jan 2022 20:39:32 +0000 (12:39 -0800)]
[docs] HowToCrossCompileLLVM.rst: prefer --target= over legacy -target

2 years ago[libc++][NFC] Fix typo
Louis Dionne [Tue, 25 Jan 2022 20:26:32 +0000 (15:26 -0500)]
[libc++][NFC] Fix typo

2 years ago[NFC] Added test with select with unpredictable metadata; regenerate x86-cmov-convert...
Dávid Bolvanský [Tue, 25 Jan 2022 20:24:05 +0000 (21:24 +0100)]
[NFC] Added test with select with unpredictable metadata; regenerate x86-cmov-converter.ll

2 years ago[libc] Make logf function correctly rounded for all rounding modes.
Tue Ly [Tue, 25 Jan 2022 14:54:01 +0000 (09:54 -0500)]
[libc] Make logf function correctly rounded for all rounding modes.

Make logf function correctly rounded for all rounding modes.

Reviewed By: sivachandra, zimmermann6, santoshn, jpl169

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

2 years ago[analyzer] Don't specify PLUGIN_TOOL for analyzer plugins
Aleksandr Platonov [Tue, 25 Jan 2022 19:46:25 +0000 (22:46 +0300)]
[analyzer] Don't specify PLUGIN_TOOL for analyzer plugins

Analyzer plugins explicitly export clang_registerCheckers and clang_analyzerAPIVersionString symbols, so we don't need to specify a tool to link agains.

Also, without this patch MSVC build fails with cmake flags -DLLVM_ENABLE_PLUGINS=On -DCLANG_PLUGINS_SUPPORT=On -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=On
```
[936/936] Linking CXX shared module bin\SampleAnalyzerPlugin.dll
FAILED: bin/SampleAnalyzerPlugin.dll
cmd.exe /C "cd . && "D:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=tools\clang\lib\Analysis\plugins\SampleAnalyzer\CMakeFiles\SampleAnalyzerPlugin.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\link.exe /nologo tools\clang\lib\Analysis\plugins\SampleAnalyzer\CMakeFiles\SampleAnalyzerPlugin.dir\MainCallChecker.cpp.obj  /out:bin\SampleAnalyzerPlugin.dll /implib:lib\SampleAnalyzerPlugin.lib /pdb:bin\SampleAnalyzerPlugin.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO  /DEF:"D:/work/llvm-project-original/build-plugins/tools/clang/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.def"  lib\clang.lib  lib\clangAnalysis.lib  lib\clangAST.lib  lib\clangStaticAnalyzerCore.lib  lib\clangStaticAnalyzerFrontend.lib  lib\clangStaticAnalyzerCheckers.lib  lib\clangStaticAnalyzerCore.lib  lib\clangCrossTU.lib  lib\clangIndex.lib  lib\clangFormat.lib  lib\clangToolingInclusions.lib  lib\clangFrontend.lib  lib\clangDriver.lib  version.lib  lib\clangParse.lib  lib\clangSerialization.lib  lib\clangSema.lib  lib\clangAnalysis.lib  lib\clangEdit.lib  lib\LLVMOption.lib  lib\clangToolingCore.lib  lib\clangRewrite.lib  lib\clangASTMatchers.lib  lib\clangAST.lib  lib\clangLex.lib  lib\clangBasic.lib  lib\LLVMFrontendOpenMP.lib  lib\LLVMScalarOpts.lib  lib\LLVMAggressiveInstCombine.lib  lib\LLVMInstCombine.lib  lib\LLVMTransformUtils.lib  lib\LLVMAnalysis.lib  lib\LLVMProfileData.lib  lib\LLVMDebugInfoDWARF.lib  lib\LLVMObject.lib  lib\LLVMBitReader.lib  lib\LLVMCore.lib  lib\LLVMRemarks.lib  lib\LLVMBitstreamReader.lib  lib\LLVMMCParser.lib  lib\LLVMMC.lib  lib\LLVMDebugInfoCodeView.lib  lib\LLVMTextAPI.lib  lib\LLVMBinaryFormat.lib  lib\LLVMSupport.lib  psapi.lib  shell32.lib  ole32.lib  uuid.lib  advapi32.lib  delayimp.lib  -delayload:shell32.dll  -delayload:ole32.dll  lib\LLVMDemangle.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK: command "C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\link.exe /nologo tools\clang\lib\Analysis\plugins\SampleAnalyzer\CMakeFiles\SampleAnalyzerPlugin.dir\MainCallChecker.cpp.obj /out:bin\SampleAnalyzerPlugin.dll /implib:lib\SampleAnalyzerPlugin.lib /pdb:bin\SampleAnalyzerPlugin.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /DEF:D:/work/llvm-project-original/build-plugins/tools/clang/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.def lib\clang.lib lib\clangAnalysis.lib lib\clangAST.lib lib\clangStaticAnalyzerCore.lib lib\clangStaticAnalyzerFrontend.lib lib\clangStaticAnalyzerCheckers.lib lib\clangStaticAnalyzerCore.lib lib\clangCrossTU.lib lib\clangIndex.lib lib\clangFormat.lib lib\clangToolingInclusions.lib lib\clangFrontend.lib lib\clangDriver.lib version.lib lib\clangParse.lib lib\clangSerialization.lib lib\clangSema.lib lib\clangAnalysis.lib lib\clangEdit.lib lib\LLVMOption.lib lib\clangToolingCore.lib lib\clangRewrite.lib lib\clangASTMatchers.lib lib\clangAST.lib lib\clangLex.lib lib\clangBasic.lib lib\LLVMFrontendOpenMP.lib lib\LLVMScalarOpts.lib lib\LLVMAggressiveInstCombine.lib lib\LLVMInstCombine.lib lib\LLVMTransformUtils.lib lib\LLVMAnalysis.lib lib\LLVMProfileData.lib lib\LLVMDebugInfoDWARF.lib lib\LLVMObject.lib lib\LLVMBitReader.lib lib\LLVMCore.lib lib\LLVMRemarks.lib lib\LLVMBitstreamReader.lib lib\LLVMMCParser.lib lib\LLVMMC.lib lib\LLVMDebugInfoCodeView.lib lib\LLVMTextAPI.lib lib\LLVMBinaryFormat.lib lib\LLVMSupport.lib psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib delayimp.lib -delayload:shell32.dll -delayload:ole32.dll lib\LLVMDemangle.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\SampleAnalyzerPlugin.dll.manifest" failed (exit code 1169) with the following output:
clangStaticAnalyzerCore.lib(BugReporter.cpp.obj) : error LNK2005: "public: __cdecl clang::ento::PathSensitiveBugReport::PathSensitiveBugReport(class clang::ento::BugType const &,class llvm::StringRef,class llvm::StringRef,class clang::ento::ExplodedNode const *,class clang::ento::PathDiagnosticLocation,class clang::Decl const *)" (??0PathSensitiveBugReport@ento@clang@@QEAA@AEBVBugType@12@VStringRef@llvm@@1PEBVExplodedNode@12@VPathDiagnosticLocation@12@PEBVDecl@2@@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(BugReporter.cpp.obj) : error LNK2005: "private: virtual void __cdecl clang::ento::BugType::anchor(void)" (?anchor@BugType@ento@clang@@EEAAXXZ) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(SVals.cpp.obj) : error LNK2005: "public: class clang::FunctionDecl const * __cdecl clang::ento::SVal::getAsFunctionDecl(void)const " (?getAsFunctionDecl@SVal@ento@clang@@QEBAPEBVFunctionDecl@3@XZ) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(ProgramState.cpp.obj) : error LNK2005: "void __cdecl clang::ento::ProgramStateRelease(class clang::ento::ProgramState const *)" (?ProgramStateRelease@ento@clang@@YAXPEBVProgramState@12@@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(ProgramState.cpp.obj) : error LNK2005: "void __cdecl clang::ento::ProgramStateRetain(class clang::ento::ProgramState const *)" (?ProgramStateRetain@ento@clang@@YAXPEBVProgramState@12@@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(Environment.cpp.obj) : error LNK2005: "public: __cdecl clang::ento::EnvironmentEntry::EnvironmentEntry(class clang::Stmt const *,class clang::LocationContext const *)" (??0EnvironmentEntry@ento@clang@@QEAA@PEBVStmt@2@PEBVLocationContext@2@@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(Environment.cpp.obj) : error LNK2005: "public: class clang::ento::SVal __cdecl clang::ento::Environment::getSVal(class clang::ento::EnvironmentEntry const &,class clang::ento::SValBuilder &)const " (?getSVal@Environment@ento@clang@@QEBA?AVSVal@23@AEBVEnvironmentEntry@23@AEAVSValBuilder@23@@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(CheckerManager.cpp.obj) : error LNK2005: "public: void __cdecl clang::ento::CheckerManager::_registerForPreStmt(class clang::ento::CheckerFn<void __cdecl(class clang::Stmt const *,class clang::ento::CheckerContext &)>,bool (__cdecl*)(class clang::Stmt const *))" (?_registerForPreStmt@CheckerManager@ento@clang@@QEAAXV?$CheckerFn@$$A6AXPEBVStmt@clang@@AEAVCheckerContext@ento@2@@Z@23@P6A_NPEBVStmt@3@@Z@Z) already defined in clang.lib(clang.exe)
clangStaticAnalyzerCore.lib(CoreEngine.cpp.obj) : error LNK2005: "protected: class clang::ento::ExplodedNode * __cdecl clang::ento::NodeBuilder::generateNodeImpl(class clang::ProgramPoint const &,class llvm::IntrusiveRefCntPtr<class clang::ento::ProgramState const >,class clang::ento::ExplodedNode *,bool)" (?generateNodeImpl@NodeBuilder@ento@clang@@IEAAPEAVExplodedNode@23@AEBVProgramPoint@3@V?$IntrusiveRefCntPtr@$$CBVProgramState@ento@clang@@@llvm@@PEAV423@_N@Z) already defined in clang.lib(clang.exe)
LLVMSupport.lib(SmallVector.cpp.obj) : error LNK2005: "protected: void __cdecl llvm::SmallVectorBase<unsigned int>::grow_pod(void *,unsigned __int64,unsigned __int64)" (?grow_pod@?$SmallVectorBase@I@llvm@@IEAAXPEAX_K1@Z) already defined in clang.lib(clang.exe)
LLVMSupport.lib(FoldingSet.cpp.obj) : error LNK2005: "protected: __cdecl llvm::FoldingSetBase::~FoldingSetBase(void)" (??1FoldingSetBase@llvm@@IEAA@XZ) already defined in clang.lib(clang.exe)
clangAST.lib(ASTImporter.cpp.obj) : error LNK2005: "public: __cdecl clang::ASTImporter::ASTImporter(class clang::ASTContext &,class clang::FileManager &,class clang::ASTContext &,class clang::FileManager &,bool,class std::shared_ptr<class clang::ASTImporterSharedState>)" (??0ASTImporter@clang@@QEAA@AEAVASTContext@1@AEAVFileManager@1@01_NV?$shared_ptr@VASTImporterSharedState@clang@@@std@@@Z) already defined in clang.lib(clang.exe)
clangAST.lib(ASTImporter.cpp.obj) : error LNK2005: "public: class llvm::Expected<class clang::Decl *> __cdecl clang::ASTImporter::Import(class clang::Decl *)" (?Import@ASTImporter@clang@@QEAA?AV?$Expected@PEAVDecl@clang@@@llvm@@PEAVDecl@2@@Z) already defined in clang.lib(clang.exe)
clangAST.lib(ExternalASTSource.cpp.obj) : error LNK2005: "public: virtual __cdecl clang::ExternalASTSource::~ExternalASTSource(void)" (??1ExternalASTSource@clang@@UEAA@XZ) already defined in clang.lib(clang.exe)
clangAST.lib(ExternalASTSource.cpp.obj) : error LNK2005: "public: virtual void __cdecl clang::ExternalASTSource::CompleteRedeclChain(class clang::Decl const *)" (?CompleteRedeclChain@ExternalASTSource@clang@@UEAAXPEBVDecl@2@@Z) already defined in clang.lib(clang.exe)
clangAST.lib(ExternalASTSource.cpp.obj) : error LNK2005: "public: virtual void __cdecl clang::ExternalASTSource::CompleteType(class clang::ObjCInterfaceDecl *)" (?CompleteType@ExternalASTSource@clang@@UEAAXPEAVObjCInterfaceDecl@2@@Z) already defined in clang.lib(clang.exe)
...
```

Reviewed By: aaron.ballman

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

2 years ago[lldb] Fix ProcessKDPLog for the logging refactor
Pavel Labath [Tue, 25 Jan 2022 19:49:55 +0000 (20:49 +0100)]
[lldb] Fix ProcessKDPLog for the logging refactor

2 years ago[cmake] Some NFC changes in preparation for accomodating `Ninja Multi-Config`
Argyrios Kyrtzidis [Tue, 25 Jan 2022 01:49:37 +0000 (17:49 -0800)]
[cmake] Some NFC changes in preparation for accomodating `Ninja Multi-Config`

* Use `MATCHES` so that `Ninja Multi-Config` generator also satisfies the Ninja check
* Pull out a couple of values into variables, inside `function(tablegen project ofn)`, NFC

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

2 years ago[mlir][Linalg] Add couple of convenience methods to `LinalgInterface`.
MaheshRavishankar [Tue, 25 Jan 2022 19:44:54 +0000 (11:44 -0800)]
[mlir][Linalg] Add couple of convenience methods to `LinalgInterface`.

Add methods to
- Get block argument that is tied with an opOperand
- Get the yield value that is tied with a output opOperand.

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

2 years ago[libTooling] Adds more support for constructing object access expressions.
Yitzhak Mandelbaum [Wed, 29 Dec 2021 15:46:43 +0000 (15:46 +0000)]
[libTooling] Adds more support for constructing object access expressions.

This patch adds a `buildAccess` function, which constructs a string with the
proper operator to use based on the expression's form and type. It also adds two
predicates related to smart pointers, which are needed by `buildAccess` but are
also of general value.

We deprecate `buildDot` and `buildArrow` in favor of the more general
`buildAccess`. These will be removed in a future patch.

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

2 years ago[mlir][Linalg] Fix incorrect fusion with reshape ops by linearization.
MaheshRavishankar [Tue, 25 Jan 2022 18:58:53 +0000 (10:58 -0800)]
[mlir][Linalg] Fix incorrect fusion with reshape ops by linearization.

Fusion of reshape ops by linearization incorrectly inverted the
indexing map before linearizing dimensions. This leads to incorrect
indexing maps used in the fused operation.

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

2 years ago[CUDA,NVPTX] Corrected fragment size for tf32 LD B matrix.
JackAKirk [Mon, 24 Jan 2022 20:32:36 +0000 (12:32 -0800)]
[CUDA,NVPTX] Corrected fragment size for tf32 LD B matrix.

Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
Reviewed By: tra

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

2 years ago[CMake] Set sanitizer test C++ library on Linux
Petr Hosek [Tue, 25 Jan 2022 17:37:14 +0000 (09:37 -0800)]
[CMake] Set sanitizer test C++ library on Linux

We always want to use the in-tree libc++ for tests.

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

2 years ago[IROutliner] Disallow outlining calls that return twice.
Andrew Litteken [Wed, 22 Dec 2021 23:42:10 +0000 (17:42 -0600)]
[IROutliner] Disallow outlining calls that return twice.

Functions that return twice can cause the IR Outliner to miscompile the given program. These function rely on information about the stack to be the same, and this may not necessarily be the case if called from an outlined function. So, we simply call these instructions illegal for the outliner to remove.

Reviewers: paquette

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

2 years ago[InstrProf][correlation] Read DWARFv5 `OP_addrx` location
Ellis Hoag [Tue, 25 Jan 2022 04:08:35 +0000 (20:08 -0800)]
[InstrProf][correlation] Read DWARFv5 `OP_addrx` location

Correctly read `OP_addrx` type encodings for DWARFv5 locations.

Reviewed By: dblaikie

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

2 years ago[libc++][nfc] Update formatting of some tests.
Mark de Wever [Tue, 25 Jan 2022 18:59:24 +0000 (19:59 +0100)]
[libc++][nfc] Update formatting of some tests.

These tests were formatted with older clang-format settings, this
updates them to the current settings.

In order to implement P2216 a lot of changes to these tests are
required. This makes it easier to review those patches.

2 years ago[compiler-rt][profile][AIX] pass extra link opts for test
David Tenty [Tue, 25 Jan 2022 04:20:18 +0000 (23:20 -0500)]
[compiler-rt][profile][AIX] pass extra link opts for test

The AIX linker doesn't export any symbols by default, so an export list is usually used. Since clang doesn't have the tools to auto-generate an export list yet, just pass the linker an extra opt to tell it to export everything. This is  generally not recommended for real shared libs, but is fine for the purpose of this test.

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

2 years ago[Support] #include <new> for std::align_val_t
Benjamin Kramer [Tue, 25 Jan 2022 18:36:52 +0000 (19:36 +0100)]
[Support] #include <new> for std::align_val_t

This is only used when aligned new is enabled.

2 years ago[mlir][Linalg] Disallow ops with index semantics in `PushExpandingReshape`.
MaheshRavishankar [Tue, 25 Jan 2022 18:36:34 +0000 (10:36 -0800)]
[mlir][Linalg] Disallow ops with index semantics in `PushExpandingReshape`.

This pattern is not written to handle operations with `linalg.index`
operations in its body, i.e. operations that have index semantics.

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

2 years ago[libcxx][test] Use bool allocators for vector<bool>::get_allocator test
Casey Carter [Sun, 2 Jan 2022 05:53:37 +0000 (21:53 -0800)]
[libcxx][test] Use bool allocators for vector<bool>::get_allocator test

... to be consistent with other `get_allocator` tests, and to avoid requiring `vector<T, allocator<U>>` to be valid.

2 years ago[ELF] Parallelize --compress-debug-sections=zlib
Fangrui Song [Tue, 25 Jan 2022 18:29:04 +0000 (10:29 -0800)]
[ELF] Parallelize --compress-debug-sections=zlib

When linking a Debug build clang (265MiB SHF_ALLOC sections, 920MiB uncompressed
debug info), in a --threads=1 link "Compress debug sections" takes 2/3 time and
in a --threads=8 link "Compress debug sections" takes ~70% time.

This patch splits a section into 1MiB shards and calls zlib `deflake` parallelly.

DEFLATE blocks are a bit sequence. We need to ensure every shard starts
at a byte boundary for concatenation. We use Z_SYNC_FLUSH for all shards
but the last to flush the output to a byte boundary. (Z_FULL_FLUSH can
be used as well, but Z_FULL_FLUSH clears the hash table which just
wastes time.)

The last block requires the BFINAL flag. We call deflate with Z_FINISH
to set the flag as well as flush the output to a byte boundary. Under
the hood, all of Z_SYNC_FLUSH, Z_FULL_FLUSH, and Z_FINISH emit a
non-compressed block (called stored block in zlib). RFC1951 says "Any
bits of input up to the next byte boundary are ignored."

In a --threads=8 link, "Compress debug sections" is 5.7x as fast and the total
speed is 2.54x. Because the hash table for one shard is not shared with the next
shard, the output is slightly larger. Better compression ratio can be achieved
by preloading the window size from the previous shard as dictionary
(`deflateSetDictionary`), but that is overkill.

```
# 1MiB shards
% bloaty clang.new -- clang.old
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.3%  +129Ki  [ = ]       0    .debug_str
  +0.1%  +105Ki  [ = ]       0    .debug_info
  +0.3%  +101Ki  [ = ]       0    .debug_line
  +0.2% +2.66Ki  [ = ]       0    .debug_abbrev
  +0.0% +1.19Ki  [ = ]       0    .debug_ranges
  +0.1%  +341Ki  [ = ]       0    TOTAL

# 2MiB shards
% bloaty clang.new -- clang.old
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.2% +74.2Ki  [ = ]       0    .debug_line
  +0.1% +72.3Ki  [ = ]       0    .debug_str
  +0.0% +69.9Ki  [ = ]       0    .debug_info
  +0.1%    +976  [ = ]       0    .debug_abbrev
  +0.0%    +882  [ = ]       0    .debug_ranges
  +0.0%  +218Ki  [ = ]       0    TOTAL
```

Bonus in not using zlib::compress

* we can compress a debug section larger than 4GiB
* peak memory usage is lower because for most shards the output size is less
  than 50% input size (all less than 55% for a large binary I tested, but
  decreasing the initial output size does not decrease memory usage)

Reviewed By: ikudrin

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

2 years agoCleanup header dependencies of llvm/Support/Compiler.h
serge-sans-paille [Tue, 25 Jan 2022 14:53:40 +0000 (09:53 -0500)]
Cleanup header dependencies of llvm/Support/Compiler.h

<new> and <cstdef> were introduced in aa60b3fd875c3 but the dependency
is now dead.

As a consequence you may need to include <new> where you use it while it
was auto-included as an implicit dependency before.

The impact on the codebase is small, as <new> is a very small header
(<100 SLOC) but it gets included everywhere, so that somehow counts (?)

2 years ago[libc++][doc] Update format implementation status.
Mark de Wever [Tue, 25 Jan 2022 18:23:48 +0000 (19:23 +0100)]
[libc++][doc] Update format implementation status.

2 years ago[Clang][RISCV] Guard vmulh, vsmul correctly
eopXD [Fri, 21 Jan 2022 19:29:10 +0000 (11:29 -0800)]
[Clang][RISCV] Guard vmulh, vsmul correctly

According to v-spec 1.0, `vmulh`, `vmulhu`, `vmulhsu` and `vsmul` are
NOT supported for EEW=64 in Zve64*.

This patch tries to guard it correctly.

Authored by: Craig Topper <craig.topper@sifive.com> @craig.topper
Co-Authored by: Eop Chen <eop.chen@sifive.com> @eopXD

Reviewed By: craig.topper

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

2 years ago[AArch64] Add extra vecreduce.add tests, including extending reductions. NFC
David Green [Tue, 25 Jan 2022 18:10:09 +0000 (18:10 +0000)]
[AArch64] Add extra vecreduce.add tests, including extending reductions. NFC

This is all the reductions from i8 -> i64 with either sign or zero
extensions.

2 years ago[clang-tidy] [bugprone-assert-side-effect] Ignore list for functions/methods
Zinovy Nis [Sat, 15 Jan 2022 13:07:51 +0000 (16:07 +0300)]
[clang-tidy] [bugprone-assert-side-effect] Ignore list for functions/methods

A semicolon-separated list of the names of functions or methods to be considered as not having side-effects was added for bugprone-assert-side-effect. It can be used to exclude methods like iterator::begin/end from being considered as having side-effects.

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

2 years ago[lldb] Only include mach headers on Darwin
Jonas Devlieghere [Tue, 25 Jan 2022 17:58:36 +0000 (09:58 -0800)]
[lldb] Only include mach headers on Darwin