platform/upstream/llvm.git
3 years ago[ORC-RT] Add OrcRTCWrapperFunctionResult.
Lang Hames [Sat, 29 May 2021 00:08:23 +0000 (17:08 -0700)]
[ORC-RT] Add OrcRTCWrapperFunctionResult.

OrcRTCWrapperFunctionResult is a C struct that can be used to return serialized
results from "wrapper functions" -- functions that deserialize an argument
buffer, call through to an actual implementation function, then serialize and
return the result of that function. Wrapper functions allow calls between ORC
and the ORC Runtime to be written using a single signature,
WrapperFunctionResult(const char *ArgData, size_t ArgSize), and without coupling
either side to a particular transport mechanism (in-memory, TCP, IPC, ... the
actual mechanism will be determined by the TargetProcessControl implementation).

OrcRTCWrapperFunctionResult is designed to allow small serialized buffers to
be returned by value, with larger serialized results stored on the heap. They
also provide an error state to report failures in serialization/deserialization.

3 years ago[ARM] Guard against loop variant gather ptr operands
David Green [Sun, 30 May 2021 17:02:14 +0000 (18:02 +0100)]
[ARM] Guard against loop variant gather ptr operands

This ensures that the operands of any gather/scatter instructions that
we attempt to push out of the loop are invariant, preventing invalid IR
from being generated.

3 years ago[AVR] Improve inline assembly
Ben Shi [Sun, 30 May 2021 15:44:43 +0000 (23:44 +0800)]
[AVR] Improve inline assembly

Reviewed By: dylanmckay

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

3 years ago[LoopDeletion] Add more tests with infinite sub-loops & mustprogress.
Florian Hahn [Sun, 30 May 2021 15:34:30 +0000 (16:34 +0100)]
[LoopDeletion] Add more tests with infinite sub-loops & mustprogress.

A couple of additional tests inspired by PR50511.

3 years ago[mlir] StandardToLLVM: option to disable AllocOp lowering
Butygin [Wed, 19 May 2021 19:04:29 +0000 (22:04 +0300)]
[mlir] StandardToLLVM: option to disable AllocOp lowering

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

3 years ago[clang][AVR] Add avr-libc/include to clang system include paths
Ben Shi [Sun, 30 May 2021 14:39:07 +0000 (22:39 +0800)]
[clang][AVR] Add avr-libc/include to clang system include paths

Reviewed By: dylanmckay

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

3 years agoRevert "[clang-tidy] Simplify static assert check"
Roman Lebedev [Sun, 30 May 2021 13:40:01 +0000 (16:40 +0300)]
Revert "[clang-tidy] Simplify static assert check"

This patch starts to produce a very obvious false-positives,
despite the fact the preexisting tests already cover the pattern.
they clearly don't actually cover it.

https://godbolt.org/z/3zdqvbfxj

This reverts commit 1709bb8c7395418236ec94fe3b9d91fed746452b.

3 years ago[VectorCombine] Add tests with noundef index for load scalarization.
Florian Hahn [Sun, 30 May 2021 11:11:18 +0000 (12:11 +0100)]
[VectorCombine] Add tests with noundef index for load scalarization.

3 years ago[InstCombine] fix miscompile from vector select substitution
Sanjay Patel [Sun, 30 May 2021 10:43:33 +0000 (06:43 -0400)]
[InstCombine] fix miscompile from vector select substitution

This is similar to the fix in c590a9880d7a ( PR49832 ), but
we missed handling the pattern for select of bools (no compare
inst).

We can't substitute a vector value because the equality condition
replacement that we are attempting requires that the condition
is true/false for the entire value. Vector select can be partly
true/false.

I added an assert for vector types, so we shouldn't hit this again.
Fixed formatting while auditing the callers.

https://llvm.org/PR50500

3 years ago[DAGCombine] Poison-prove scalarizeExtractedVectorLoad.
Florian Hahn [Sat, 29 May 2021 17:50:14 +0000 (18:50 +0100)]
[DAGCombine] Poison-prove scalarizeExtractedVectorLoad.

extractelement is poison if the index is out-of-bounds, so just
scalarizing the load may introduce an out-of-bounds load, which is UB.

To avoid introducing new UB, we can mask the index so it only contains
valid indices.

Fixes PR50382.

Reviewed By: efriedma

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

3 years ago[NFCI] Move DEBUG_TYPE definition below #includes
Mindong Chen [Sun, 30 May 2021 09:13:48 +0000 (17:13 +0800)]
[NFCI] Move DEBUG_TYPE definition below #includes

When you try to define a new DEBUG_TYPE in a header file, DEBUG_TYPE
definition defined around the #includes in files include it could
result in redefinition warnings even compile errors.

Reviewed By: tejohnson

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

3 years ago[SafeStack] Use proper API to get stack guard
Pengxuan Zheng [Mon, 17 May 2021 19:16:07 +0000 (12:16 -0700)]
[SafeStack] Use proper API to get stack guard

Using the proper API automatically sets `__stack_chk_guard` to `dso_local` if
`Reloc::Static`. This wasn't strictly necessary until recently when dso_local was
no longer implied by `TargetMachine::shouldAssumeDSOLocal` for
`__stack_chk_guard`. By using the proper API, we can avoid generating unnecessary
GOT relocations.

Reviewed By: vitalybuka

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

3 years agoRevert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"
Arthur Eubanks [Sun, 30 May 2021 06:08:15 +0000 (23:08 -0700)]
Revert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"

This reverts commit 1c7f32334d4becc725b9025fd32291a0e5729acd.

Some code still needs to properly set parameter ABI attributes, see
D101806.

3 years agoRevert "[NFC] Use ArgListEntry indirect types more in ISel lowering"
Arthur Eubanks [Sun, 30 May 2021 05:40:07 +0000 (22:40 -0700)]
Revert "[NFC] Use ArgListEntry indirect types more in ISel lowering"

This reverts commit bc7d15c61da78864b35e3c114294d6e4db645611.

Dependent change is to be reverted.

3 years ago[analyzer] MallocSizeof: sizeof pointer type is compatible with void*
Xuanda Yang [Sun, 30 May 2021 01:51:41 +0000 (09:51 +0800)]
[analyzer] MallocSizeof: sizeof pointer type is compatible with void*

source: https://bugs.llvm.org/show_bug.cgi?id=50214

Make sizeof pointer type compatible with void* in MallocSizeofChecker.

Reviewed By: NoQ

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

3 years ago[libc++] Alphabetize and include-what-you-use. NFCI.
Arthur O'Dwyer [Wed, 19 May 2021 15:57:04 +0000 (11:57 -0400)]
[libc++] Alphabetize and include-what-you-use. NFCI.

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

3 years ago[libc++] [modules] Add __threading_support to the modulemap.
Arthur O'Dwyer [Sat, 29 May 2021 17:12:16 +0000 (13:12 -0400)]
[libc++] [modules] Add __threading_support to the modulemap.

It looks to me as if *every* helper header needs to be added to the modulemap,
actually; which is unfortunate since we keep proliferating them at such a
rapid pace.

3 years ago[InstrProfiling][test] Improve tests
Fangrui Song [Sat, 29 May 2021 21:30:44 +0000 (14:30 -0700)]
[InstrProfiling][test] Improve tests

3 years ago[libc++] [test] Update "test_compare.h" users to avoid removed-in-C++20 members....
Arthur O'Dwyer [Sat, 29 May 2021 14:13:14 +0000 (10:13 -0400)]
[libc++] [test] Update "test_compare.h" users to avoid removed-in-C++20 members. NFCI.

Drive-by minor improvements to a couple of uses of min_pointer.

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

3 years ago[ARM] Guard against WhileLoopStart kill flags
David Green [Sat, 29 May 2021 20:04:26 +0000 (21:04 +0100)]
[ARM] Guard against WhileLoopStart kill flags

If the operand of the WhileLoopStart is flagged as killed, that
currently gets propogated to both the t2CMPri as the instruction is
reverted, and the newly created t2DoLoopStart. Only the second should
remain as killing the operand, the first dropping the flags.

3 years ago[Dominance] Speed up recalculate noticable, NFC.
Chris Lattner [Sat, 29 May 2021 17:50:15 +0000 (10:50 -0700)]
[Dominance] Speed up recalculate noticable, NFC.

This avoids trying to find the RegionKindInterface for every
operation in the program, we only need it if they have regions.

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

3 years ago[Verifier] Inline a method to simplify the code in preparation for bigger changes...
Chris Lattner [Sat, 29 May 2021 17:33:20 +0000 (10:33 -0700)]
[Verifier] Inline a method to simplify the code in preparation for bigger changes, NFC.

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

3 years ago[clang-format] successive C# attributes cause line breaking issues
mydeveloperday [Sat, 29 May 2021 15:43:55 +0000 (16:43 +0100)]
[clang-format] successive C# attributes cause line breaking issues

{D74265} reduced the aggressiveness of line breaking following C# attributes, however this change removed any support for attributes on properties, causing significant ugliness to be introduced.

This revision goes some way to addressing that by re-introducing the more aggressive check to `mustBreakBefore()`, but constraining it to the most common cases where we use properties which should not impact the "caller info attributes"  or the "[In , Out]" decorations that are normally put on pinvoke

It does not address my additional concerns of the original change regarding multiple C# attributes, as these are somewhat incorrectly handled by virtue of the fact its not recognising the second attribute as an attribute at all. But instead thinking its an array.

The purpose of this revision is to get back to where we were for the most common of cases as a stepping stone to resolving this. However {D74265} has broken a lot of C# code and this revision will go someway alone to addressing the majority.

Reviewed By: jbcoe, HazardyKnusperkeks, curdeius

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

3 years agoRevert "[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases"
Jessica Clarke [Sat, 29 May 2021 14:11:37 +0000 (15:11 +0100)]
Revert "[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases"

The replacement doesn't work for llc, but it is needed by
patchable-function-entry.ll.

This reverts commit aa9a30b83a06e3e5e68e32ea645ec2d9edc27efc.

3 years ago[Support] Fix getMainExecutable on FreeBSD when called via an absolute path
Jessica Clarke [Sat, 29 May 2021 13:59:46 +0000 (14:59 +0100)]
[Support] Fix getMainExecutable on FreeBSD when called via an absolute path

On FreeBSD, absolute paths are passed unmodified in AT_EXECPATH, but
relative paths are resolved to absolute paths, and any symlinks will be
followed in the process. This means that the resource dir calculation
will be wrong if Clang is invoked as an absolute path to a symlink, and
this currently causes clang/test/Driver/rocm-detect.hip to fail on
FreeBSD. Thus, make sure to call realpath on the result, just like is
done on macOS.

Whilst here, clean up the old fallback auxargs loop to use the actual
type for auxargs rather than using lots of hacky casts that rely on
addresses and pointers being the same (which is not the case on CHERI,
and thus Arm's prototype Morello, although for little-endian systems it
happens to work still as the word-sized integer will be padded to a full
pointer, and it's someone academic given dereferencing past the end of
environ will give a bounds fault, but CheriBSD is new enough that the
elf_aux_info path will be used). This also makes the code easier to
follow, and removes the confusing double-increment of p.

Reviewed By: dim, arichardson

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

3 years ago[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases
Jessica Clarke [Sat, 29 May 2021 13:57:19 +0000 (14:57 +0100)]
[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases

Whilst here, also remove a couple of unnecessary -o - instances.

Reviewed By: MaskRay

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

3 years ago[InstCombine] fold zext of masked bit set/clear
Sanjay Patel [Sat, 29 May 2021 12:52:26 +0000 (08:52 -0400)]
[InstCombine] fold zext of masked bit set/clear

This does not solve PR17101, but it is one of the
underlying diffs noted here:
https://bugs.llvm.org/show_bug.cgi?id=17101#c8

We could ease the one-use checks for the 'clear'
(no 'not' op) half of the transform, but I do not
know if that asymmetry would make things better
or worse.

Proofs:
https://rise4fun.com/Alive/uVB

Name: masked bit set
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp ne i32 %and, 0
%r = zext i1 %cmp to i32
=>
%s = lshr i32 %x, %y
%r = and i32 %s, 1

Name: masked bit clear
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp eq i32 %and, 0
%r = zext i1 %cmp to i32
=>
%xn = xor i32 %x, -1
%s = lshr i32 %xn, %y
%r = and i32 %s, 1

Note: this is a re-post of a patch that I committed at:
rGa041c4ec6f7a

The commit was reverted because it exposed another bug:
rGb212eb7159b40

But that has since been corrected with:
rG8a156d1c2795189 ( D101191 )

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

3 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Fri, 28 May 2021 20:03:09 +0000 (16:03 -0400)]
[InstCombine] reduce code duplication; NFC

3 years ago[analyzer] Use Optional as a return type of StoreManager::castRegion
Denys Petrov [Fri, 28 May 2021 13:52:44 +0000 (16:52 +0300)]
[analyzer]  Use Optional as a return type of StoreManager::castRegion

Summary: Make StoreManager::castRegion function usage safier. Replace `const MemRegion *` with `Optional<const MemRegion *>`. Simplified one of related test cases due to suggestions in D101635.

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

3 years ago[SystemZ] Set getExtendForAtomicOps to ISD::ANY_EXTEND
Ulrich Weigand [Sat, 29 May 2021 10:15:18 +0000 (12:15 +0200)]
[SystemZ] Set getExtendForAtomicOps to ISD::ANY_EXTEND

The implementation of subword atomics does not actually
guarantee the result is zero-extended, which now caused
build bot failures after https://reviews.llvm.org/D101342
was landed.

3 years ago[gn build] Port b13edf6e907b
LLVM GN Syncbot [Sat, 29 May 2021 07:51:43 +0000 (07:51 +0000)]
[gn build] Port b13edf6e907b

3 years agoRevert "[libc++] NFC: Move unwrap_iter to its own header"
Mark de Wever [Sat, 29 May 2021 07:50:26 +0000 (09:50 +0200)]
Revert "[libc++] NFC: Move unwrap_iter to its own header"

This reverts commit 9968896cd62a62b11ac61085534dd598c4bd3c60.

This commit seems to cause the build failures of main.

3 years ago[LoopUnroll] Make DomTree explicitly required (NFC)
Nikita Popov [Sat, 29 May 2021 07:31:28 +0000 (09:31 +0200)]
[LoopUnroll] Make DomTree explicitly required (NFC)

Some of the code was already assuming that DT is non-null, so
make that requirement more explicit and remove unnecessary null
checks.

3 years ago[AtomicExpandPass][AArch64] Promote xchg with floating-point types to integer ones
LemonBoy [Sat, 29 May 2021 06:50:34 +0000 (08:50 +0200)]
[AtomicExpandPass][AArch64] Promote xchg with floating-point types to integer ones

Follow the same strategy used for atomic loads/stores by converting the operands to equally-sized integer types.
This change prevents the atomic expansion pass from generating illegal LL/SC pairs when targeting AArch64: `expand-atomicrmw-xchg-fp.ll` would previously instantiate intrinsics such as `llvm.aarch64.ldaxr.p0f32` that cannot be lowered.

Reviewed By: efriedma

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

3 years ago[InstrProfiling][test] Fix stale linkage.ll
Fangrui Song [Sat, 29 May 2021 04:33:32 +0000 (21:33 -0700)]
[InstrProfiling][test] Fix stale linkage.ll

3 years ago[InstrProfiling][test] Fix stale tests
Fangrui Song [Sat, 29 May 2021 04:14:03 +0000 (21:14 -0700)]
[InstrProfiling][test] Fix stale tests

* Change linkage/visibility of __profn_ variables to match the reality
* alwaysinline.ll: Add "EnableValueProfiling", otherwise it doesn't test available_externally alwaysinline.
* Delete PR23499.ll - covered by other comdat tests.

3 years ago[RISCV] Enable interleaved vectorization for RVV
Luke [Wed, 28 Apr 2021 15:25:31 +0000 (23:25 +0800)]
[RISCV] Enable interleaved vectorization for RVV

Enable interleaved vectorization for RVV.

Reviewed By: craig.topper

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

3 years ago[lld/mac] Don't crash on -order_file with assembly inputs on arm64
Nico Weber [Sat, 29 May 2021 00:37:39 +0000 (20:37 -0400)]
[lld/mac] Don't crash on -order_file with assembly inputs on arm64

.s files with `-g` generate __debug_aranges on darwin/arm64 for some
reason, and those lead to `nullptr` symbols. Don't crash on that.

Fixes PR50517.

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

3 years ago[Internalize] Simplify comdat renaming with noduplicates after D103043
Fangrui Song [Fri, 28 May 2021 23:58:38 +0000 (16:58 -0700)]
[Internalize] Simplify comdat renaming with noduplicates after D103043

I realized that we can use `comdat noduplicates` which is available on ELF.
Add a special case for wasm which doesn't support the feature.

3 years ago[AArch64][GlobalISel] Fix a crash during selection of a G_ZEXT(s8 = G_LOAD)
Amara Emerson [Fri, 28 May 2021 22:33:02 +0000 (15:33 -0700)]
[AArch64][GlobalISel] Fix a crash during selection of a G_ZEXT(s8 = G_LOAD)

We have special handling for a zext of a load <32b because the load does a zext
for free. In that case, we just select the G_ZEXT as if it were a copy but this
triggered the copy checking code to balk at the mismatched size.

This was being hidden because normally these get combined into G_ZEXTLOAD but
for atomics this doesn't happen. The test case here just uses a normal load
because the particular atomic isn't supported yet anyway.

3 years ago[clang-format] New BreakInheritanceList style AfterComma
Zhihao Yuan [Wed, 26 May 2021 20:22:44 +0000 (13:22 -0700)]
[clang-format] New BreakInheritanceList style AfterComma

This inheritance list style has been widely adopted by Symantec,
a division of Broadcom Inc. It breaks after the commas that
separate the base-specifiers:

    class Derived : public Base1,
                    private Base2
    {
    };

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

3 years ago[Verifier] Significantly speed up IsolatedFromAbove checking. NFC.
Chris Lattner [Fri, 28 May 2021 22:12:44 +0000 (15:12 -0700)]
[Verifier] Significantly speed up IsolatedFromAbove checking. NFC.

The implementation had a couple of problems, including checking
"isProperAncestor" in an inefficient way.  It also recursed into
other "isolated from above" ops.  In the case of CIRCT, we get
three levels of isolated ops:

  mlir::ModuleOp
    firrtl::CircuitOp
       firrtl::FModuleOp

The verification for module would recurse into the circuits and
fmodules checking them.  The verifier hook for circuit would
recurse into all the modules reverifying them, fmoduleop would
then reverify them.  The same happens for mlir::ModuleOp and Func.

While here, fix an old design problem: IsolatedFromAbove checking
was implemented by a method on the Region class, which isn't
actually general and isn't used by anything else.  Move it over
to be a trait impl verifier method like the others and specialize
it for its task.

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

3 years ago[CGAtomic] Delete outdated code comparing success/failure ordering for cmpxchg.
Eli Friedman [Fri, 28 May 2021 22:32:36 +0000 (15:32 -0700)]
[CGAtomic] Delete outdated code comparing success/failure ordering for cmpxchg.

This doesn't actually have any effect: we only call this code with
SequentiallyConsistent orderings.  But delete it anyway for consistency
with other recent changes.

3 years ago[lld-macho][test] Simplify --allow-empty with count 0
Fangrui Song [Fri, 28 May 2021 22:15:59 +0000 (15:15 -0700)]
[lld-macho][test] Simplify --allow-empty with count 0

3 years ago[LoopUnroll] Use changeToUnreachable() (NFC)
Nikita Popov [Fri, 28 May 2021 20:38:36 +0000 (22:38 +0200)]
[LoopUnroll] Use changeToUnreachable() (NFC)

When fulling unrolling with a non-latch exit, the latch block is
folded to unreachable. Replace this folding with the existing
changeToUnreachable() helper, rather than performing it manually.

This also moves the fold to happen after the manual DT update
for exit blocks. I believe this is correct in that the conversion
of an unconditional backedge into unreachable should not affect
the DT at all.

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

3 years ago[RISCV] Add separate MxList tablegen classes for widening/narrowing and sext.zext...
Craig Topper [Fri, 28 May 2021 21:04:04 +0000 (14:04 -0700)]
[RISCV] Add separate MxList tablegen classes for widening/narrowing and sext.zext.vf2/4/8. NFC

This is cleaner than slicing the MxList to remove elements from
the beginning or end since that requires hardcoding the size.

I don't expect the size of the list to change, but we shouldn't
repeat it in multiple places.

3 years ago[LoopUnroll] Add store to unreachable latch test (NFC)
Nikita Popov [Fri, 28 May 2021 20:48:23 +0000 (22:48 +0200)]
[LoopUnroll] Add store to unreachable latch test (NFC)

This is to show that we currently only convert the terminator to
unreachable, but don't clean up instructions before it (unless
trivial DCE removes them).

Also clean up excessive whitespace in this test.

3 years ago[LoopUnroll] Clean up exit folding (NFC)
Nikita Popov [Fri, 28 May 2021 18:14:32 +0000 (20:14 +0200)]
[LoopUnroll] Clean up exit folding (NFC)

This does some non-functional cleanup of exit folding during
unrolling. The two main changes are:

 * First rewrite latch->header edges, which is unrelated to exit
   folding.
 * Combine folding for latch and non-latch exits. After the
   previous change, the only difference in their logic is that
   for non-latch exits we currently only fold "known non-exit"
   cases, but not "known exit" cases.

I think this helps a lot to clarify this code and prepare it for
future changes.

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

3 years ago[RISCV] Pre-commit test cases for D103211. NFC
Craig Topper [Fri, 28 May 2021 19:59:34 +0000 (12:59 -0700)]
[RISCV] Pre-commit test cases for D103211. NFC

3 years ago[NFC] Remove confusing info about MainLoop VF/UF from debug message
Bardia Mahjour [Fri, 28 May 2021 20:10:04 +0000 (16:10 -0400)]
[NFC] Remove confusing info about MainLoop VF/UF from debug message

3 years ago[dsymutil tests] Try to make eh_frames.test run on other platforms
Nico Weber [Thu, 27 May 2021 19:35:41 +0000 (15:35 -0400)]
[dsymutil tests] Try to make eh_frames.test run on other platforms

We now have llvm-otool :)

3 years ago[clang-format] [docs] Regenerate style options documentation.
Marek Kurdej [Fri, 28 May 2021 19:48:13 +0000 (21:48 +0200)]
[clang-format] [docs] Regenerate style options documentation.

Forgotten in commits fce8c10b9363aa908d93d7ff.

3 years ago[AArch64][RISCV] Make sure isel correctly honors failure orderings.
Eli Friedman [Thu, 27 May 2021 20:35:59 +0000 (13:35 -0700)]
[AArch64][RISCV] Make sure isel correctly honors failure orderings.

If a cmpxchg specifies acquire or seq_cst on failure, make sure we
generate code consistent with that ordering even if the success ordering
is not acquire/seq_cst.

At one point, it was ambiguous whether this sort of construct was valid,
but the C++ standad and LLVM now accept arbitrary combinations of
success/failure orderings.

This doesn't address the corresponding issue in AtomicExpand. (This was
reported as https://bugs.llvm.org/show_bug.cgi?id=33332 .)

Fixes https://bugs.llvm.org/show_bug.cgi?id=50512.

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

3 years ago[gn build] manually port 982e3c05108b6 (check-lld needs dsymutil)
Nico Weber [Fri, 28 May 2021 19:39:12 +0000 (15:39 -0400)]
[gn build] manually port 982e3c05108b6 (check-lld needs dsymutil)

3 years ago[libc++] [test] Constexpr-ify a couple of insert-iterator tests.
Arthur O'Dwyer [Fri, 28 May 2021 13:46:01 +0000 (09:46 -0400)]
[libc++] [test] Constexpr-ify a couple of insert-iterator tests.

This should have been done in D96385; thanks ldionne for the catch!
Also, make the back/front inserter behavior tests a little more thorough,
which incidentally caught a cut-and-paste-bug in `nasty_list`, so fix that.

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

3 years ago[gn build] Port 9968896cd62a
LLVM GN Syncbot [Fri, 28 May 2021 18:57:30 +0000 (18:57 +0000)]
[gn build] Port 9968896cd62a

3 years ago[RISCV] Add octuple to LMULInfo tablegen class, remove octuple_from_str. NFCI
Craig Topper [Fri, 28 May 2021 18:51:20 +0000 (11:51 -0700)]
[RISCV] Add octuple to LMULInfo tablegen class, remove octuple_from_str. NFCI

octuple_from_str was always used with the MX field from an
LMULInfo. Might as well just precompute it and put it in the class.

3 years agoRevert "[clang][Parse] Add parsing support for C++ attributes on using-declarations"
Nico Weber [Fri, 28 May 2021 18:49:18 +0000 (14:49 -0400)]
Revert "[clang][Parse] Add parsing support for C++ attributes on using-declarations"

This reverts commit dc672999a9b12a156991891dc400308b52d569ba.
Breaks check-clang everywhere, see https://reviews.llvm.org/D91630

3 years ago[VP] Make getMaskParamPos/getVectorLengthParamPos return unsigned. Lowercase function...
Craig Topper [Fri, 28 May 2021 18:28:45 +0000 (11:28 -0700)]
[VP] Make getMaskParamPos/getVectorLengthParamPos return unsigned. Lowercase function names.

Parameter positions seem like they should be unsigned.

While there, make function names lowercase per coding standards.

Reviewed By: frasercrmck

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

3 years ago[SelectionDAG] Fix typo in assert. NFC
Craig Topper [Fri, 28 May 2021 17:24:54 +0000 (10:24 -0700)]
[SelectionDAG] Fix typo in assert. NFC

3 years ago[VectorCombine] Check indices for all extracts we scalarize.
Florian Hahn [Fri, 28 May 2021 17:20:01 +0000 (18:20 +0100)]
[VectorCombine] Check indices for all extracts we scalarize.

We need to make sure that the indices of all extracts we scalarize are
valid.

3 years ago[VectorCombine] Add variants of multi-extract tests with assumes.
Florian Hahn [Fri, 28 May 2021 14:41:24 +0000 (15:41 +0100)]
[VectorCombine] Add variants of multi-extract tests with assumes.

3 years agoRevert "Return "[LoopDeletion] Break backedge if we can prove that the loop is exited...
Stefan Pintilie [Fri, 28 May 2021 16:35:25 +0000 (11:35 -0500)]
Revert "Return "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration" (try 2)"

This reverts commit be1a23203b1de655b8c7dac7549818d975a0cbbf.

3 years agoRevert "[NFCI][LoopDeletion] Only query SCEV about loop successor if another successo...
Stefan Pintilie [Fri, 28 May 2021 16:35:12 +0000 (11:35 -0500)]
Revert "[NFCI][LoopDeletion] Only query SCEV about loop successor if another successor is also in loop"

This reverts commit b0b2bf3b5da950679db1431aae431a6dedea2245.

3 years agoRevert "[NFC] Formatting fix"
Stefan Pintilie [Fri, 28 May 2021 16:34:02 +0000 (11:34 -0500)]
Revert "[NFC] Formatting fix"

This reverts commit 59d938e649e62db0cef4903d495e838fbc6a6eb8.

3 years agoRevert "[NFC] Reuse existing variables instead of re-requesting successors"
Stefan Pintilie [Fri, 28 May 2021 16:33:45 +0000 (11:33 -0500)]
Revert "[NFC] Reuse existing variables instead of re-requesting successors"

This reverts commit c467585682dcdda75e645ef3ab47c8b48440db12.

3 years agoRevert "[NFCI][LoopDeletion] Do not call complex analysis for known non-zero BTC"
Stefan Pintilie [Fri, 28 May 2021 16:17:46 +0000 (11:17 -0500)]
Revert "[NFCI][LoopDeletion] Do not call complex analysis for known non-zero BTC"

This reverts commit 7d418dadf6b1e6fd9bcccf7c5b5e1db74992ee70.

3 years ago[PassManager] unify late simplifycfg options between regular and LTO pipelines
Sanjay Patel [Fri, 28 May 2021 16:33:54 +0000 (12:33 -0400)]
[PassManager] unify late simplifycfg options between regular and LTO pipelines

This is split off from D102002, and I think it is clear that
the difference in behavior was not intended. Options were
added to SimplifyCFG over time, but different chunks of
the pass pipelines were not kept in sync.

3 years ago[PhaseOrdering] add test for late simplifycfg with LTO; NFC
Sanjay Patel [Fri, 28 May 2021 16:20:44 +0000 (12:20 -0400)]
[PhaseOrdering] add test for late simplifycfg with LTO; NFC

Part of D102002

3 years ago[LoopDeletion] Add test with potentially infinite sub-loop.
Florian Hahn [Fri, 28 May 2021 15:58:59 +0000 (16:58 +0100)]
[LoopDeletion] Add test with potentially infinite sub-loop.

Tests for PR50511.

3 years ago[libc++] NFC: Move unwrap_iter to its own header
Louis Dionne [Fri, 28 May 2021 16:41:58 +0000 (12:41 -0400)]
[libc++] NFC: Move unwrap_iter to its own header

3 years ago[mlir] Add missing namespace to createCanonicalizerPass.
Jacques Pienaar [Fri, 28 May 2021 16:12:55 +0000 (09:12 -0700)]
[mlir] Add missing namespace to createCanonicalizerPass.

3 years ago[clang][Parse] Add parsing support for C++ attributes on using-declarations
Erik Pilkington [Fri, 21 May 2021 16:53:02 +0000 (12:53 -0400)]
[clang][Parse] Add parsing support for C++ attributes on using-declarations

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

3 years agoRevert "Fix "enumerator 'llvm::TargetStackID::WasmLocal' in switch of enum 'llvm...
Nemanja Ivanovic [Fri, 28 May 2021 15:53:49 +0000 (10:53 -0500)]
Revert "Fix "enumerator 'llvm::TargetStackID::WasmLocal' in switch of enum 'llvm::TargetStackID::Value' is not handled" MSVC warnings. NFCI."

Since ca5f07f8c4bc96d16ed1992b810aa3897df157f2 already reverted
the cause for this warning, this commit now causes warnings about
a default label in a switch that covers the enum.

This reverts commit cf2eeb114c59cfc3a80133e96c585188fa16cc98.

3 years ago[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass
eopXD [Fri, 28 May 2021 06:58:10 +0000 (06:58 +0000)]
[LoopNest][LoopFlatten] Change LoopFlattenPass to LoopNest pass

This patch changes LoopFlattenPass from FunctionPass to LoopNestPass.

Utilize LoopNest and let function 'Flatten' generate information from it.

Reviewed By: Whitney

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

3 years ago[IR] Make TypeFinder aware of DIArgList values
David Stenberg [Fri, 28 May 2021 14:37:47 +0000 (16:37 +0200)]
[IR] Make TypeFinder aware of DIArgList values

TypeFinder did not find types under DIArgList. This resulted in a case
of invalid IR after GlobalOpt removed a global that was the only
non-DIArgList use of a struct type.

  error: use of undefined type named 'struct.S'
    call void @llvm.dbg.value(
      metadata !DIArgList([1 x %struct.S]* undef, i64 %idxprom),
      metadata !24, metadata !DIExpression([...]))

Reviewed By: jmorse

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

3 years ago[gn] Make ubsan errors fatal, as in cmake
Reid Kleckner [Fri, 28 May 2021 03:00:20 +0000 (20:00 -0700)]
[gn] Make ubsan errors fatal, as in cmake

Apparently ubsan errors are non-fatal by default. If you introduce UB
into LLVM and run the tests, if errors are not fatal, the test will
still produce the expected output and the tests will pass. In order to
make ubsan errors show up as test failures, they have to be made fatal.
Pass the -fno-sanitize-recover=all flag to make it so.

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

3 years ago[gn build] Port 58b29a4efc22
LLVM GN Syncbot [Fri, 28 May 2021 14:09:31 +0000 (14:09 +0000)]
[gn build] Port 58b29a4efc22

3 years ago[libc++] Add all indirect callable concepts and projected
Louis Dionne [Wed, 28 Apr 2021 19:02:08 +0000 (15:02 -0400)]
[libc++] Add all indirect callable concepts and projected

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

3 years ago[LLD][COFF] Reduce the maximum size of the GHASH table
Alexandre Ganea [Fri, 28 May 2021 13:45:31 +0000 (09:45 -0400)]
[LLD][COFF] Reduce the maximum size of the GHASH table

Before this patch, the maximum size of the GHASH table was 2^31 buckets. However we were storing the bucket index into a TypeIndex which has an input limit of (2^31)-4095 indices, see this link. Any value above that limit will improperly set the TypeIndex's high bit, which is interpreted as DecoratedItemIdMask. This used to cause bad indices on extraction when calling TypeIndex::toArrayIndex().

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

3 years ago[AArch64] Add additional vector load scalarization tests for D103077.
Florian Hahn [Fri, 28 May 2021 12:33:40 +0000 (13:33 +0100)]
[AArch64] Add additional vector load scalarization tests for D103077.

3 years ago[clang] NFC: Replace std::pair by a struct in InitHeaderSearch
Jan Svoboda [Fri, 28 May 2021 12:05:22 +0000 (14:05 +0200)]
[clang] NFC: Replace std::pair by a struct in InitHeaderSearch

This patch replaces a `std::pair` by a proper struct in `InitHeaderSearch`. This will be useful in a follow-up: D102923.

Reviewed By: dexonsmith

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

3 years ago[gn build] (semi-manually) port bd04d78d649b
Nico Weber [Fri, 28 May 2021 12:04:39 +0000 (08:04 -0400)]
[gn build] (semi-manually) port bd04d78d649b

3 years ago[Matrix] Move C++ matrix cast checks to TryStaticCast.
Florian Hahn [Fri, 28 May 2021 11:12:50 +0000 (12:12 +0100)]
[Matrix] Move C++ matrix cast checks to TryStaticCast.

At the moment, the matrix support in CheckCXXCStyleCast (added in
D101696) breaks function-style constructor calls that take a
single matrix value, because it is treated as matrix cast.

Instead, unify the C++ matrix cast handling by moving the logic to
TryStaticCast and only handle the case where both types are matrix
types. Otherwise, fall back to the generic mis-match detection.

Suggested by @rjmccall

Reviewed By: SaurabhJha

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

3 years ago[x86] add test for extend of legal vector compare; NFC
Sanjay Patel [Fri, 28 May 2021 10:30:28 +0000 (06:30 -0400)]
[x86] add test for extend of legal vector compare; NFC

Additional test coverage for D103280.

3 years agoFix "enumerator 'llvm::TargetStackID::WasmLocal' in switch of enum 'llvm::TargetStack...
Simon Pilgrim [Fri, 28 May 2021 11:47:05 +0000 (12:47 +0100)]
Fix "enumerator 'llvm::TargetStackID::WasmLocal' in switch of enum 'llvm::TargetStackID::Value' is not handled" MSVC warnings. NFCI.

3 years ago[RISCV][NFC] Merge identical RV32 and RV64 test checks
Fraser Cormack [Fri, 28 May 2021 11:14:49 +0000 (12:14 +0100)]
[RISCV][NFC] Merge identical RV32 and RV64 test checks

3 years ago[RISCV] Add tests for fixed vector conversions between fp to/from i1
Fraser Cormack [Fri, 28 May 2021 11:03:04 +0000 (12:03 +0100)]
[RISCV] Add tests for fixed vector conversions between fp to/from i1

These fixed-length versions don't crash unlike the corresponding
scalable ones, but the code generation is scalarized. An imminent patch
will support scalable-vector conversions and improve the codegen for
these fixed-length conversions.

3 years agoSwiftAsync: add Clang attribute to apply the LLVM `swiftasync` one.
Tim Northover [Fri, 28 May 2021 11:28:52 +0000 (12:28 +0100)]
SwiftAsync: add Clang attribute to apply the LLVM `swiftasync` one.

Expected to be used by Swift runtime developers.

3 years ago[mlir] Don't elide the last op if there is no terminator
Lei Zhang [Fri, 28 May 2021 11:21:41 +0000 (07:21 -0400)]
[mlir] Don't elide the last op if there is no terminator

Reviewed By: mehdi_amini

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

3 years agoRevert "[WebAssembly][CodeGen] IR support for WebAssembly local variables"
Andy Wingo [Fri, 28 May 2021 10:42:12 +0000 (12:42 +0200)]
Revert "[WebAssembly][CodeGen] IR support for WebAssembly local variables"

This reverts commit 00ecf18979e3326b3afee8af3dc701c53ffdc93f, as it
broke the AMDGPU build.  Will reland later with a fix.

3 years agoSwiftTailCC: teach verifier musttail rules applicable to this CC.
Tim Northover [Wed, 10 Feb 2021 14:35:16 +0000 (14:35 +0000)]
SwiftTailCC: teach verifier musttail rules applicable to this CC.

SwiftTailCC has a different set of requirements than the C calling convention
for a tail call. The exact argument sequence doesn't have to match, but fewer
ABI-affecting attributes are allowed.

Also make sure the musttail diagnostic triggers if a musttail call isn't
actually a tail call.

3 years agoARM: support mandatory tail calls for tailcc & swifttailcc
Tim Northover [Mon, 1 Feb 2021 10:08:40 +0000 (10:08 +0000)]
ARM: support mandatory tail calls for tailcc & swifttailcc

This adds support for callee-pop conventions to the ARM backend so that it can
ensure a call marked "tail" is actually a tail call.

3 years ago[NFC][Transforms][Utils] remove useless variable in CloneBasicBlock
dongAxis [Fri, 28 May 2021 09:50:38 +0000 (17:50 +0800)]
[NFC][Transforms][Utils] remove useless variable in CloneBasicBlock

3 years agoRevert "[LAA] Support pointer phis in loop by analyzing each incoming pointer."
Florian Hahn [Fri, 28 May 2021 09:32:40 +0000 (10:32 +0100)]
Revert "[LAA] Support pointer phis in loop by analyzing each incoming pointer."

This reverts commit 1ed7f8ede564c3b11da4fdca30c36ccbff422576.

This change can cause loop-distribute to crash in some cases. Revert
until I have more time to wrap up a fix.

See  PR50296, PR5028 and D102266.

3 years ago[AMDGPU] Fix function calls with flat scratch
Sebastian Neubauer [Thu, 27 May 2021 16:32:42 +0000 (18:32 +0200)]
[AMDGPU] Fix function calls with flat scratch

When flat scratch is used, the stack pointer needs to be added when
writing arguments to the stack.
For buffer instructions, this is done in SelectMUBUFScratchOffen
and SelectMUBUFScratchOffset.

Move that to call argument lowering, like it is done in GlobalISel.

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

3 years ago[AMDGPU] Precommit test
Sebastian Neubauer [Wed, 26 May 2021 12:29:04 +0000 (14:29 +0200)]
[AMDGPU] Precommit test

Add scratch run to gfx-callable-argument-types.ll.

3 years ago[WebAssembly][CodeGen] IR support for WebAssembly local variables
Andy Wingo [Wed, 21 Apr 2021 13:41:48 +0000 (15:41 +0200)]
[WebAssembly][CodeGen] IR support for WebAssembly local variables

This patch adds TargetStackID::WasmLocal.  This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.

For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1.  SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there.  Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.

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

3 years ago[cmake][scudo] Add missing headers
Vitaly Buka [Fri, 28 May 2021 06:05:35 +0000 (23:05 -0700)]
[cmake][scudo] Add missing headers

3 years ago[NFC][scudo] Re-enable check in the test
Vitaly Buka [Fri, 28 May 2021 08:57:55 +0000 (01:57 -0700)]
[NFC][scudo] Re-enable check in the test

It should pass with patched QEMU.