platform/upstream/llvm.git
3 years ago[libc++] Fix allocate_shared when used with an explicitly convertible allocator
Louis Dionne [Tue, 15 Dec 2020 16:45:53 +0000 (11:45 -0500)]
[libc++] Fix allocate_shared when used with an explicitly convertible allocator

When the allocator is only explicitly convertible from other specializations
of itself, the new version of std::allocate_shared would not work because
it would try to do an implicit conversion. This patch fixes the problem
and adds a test so that we don't fall into the same trap in the future.

3 years ago[utils] The func_dict for a prefix may just be empty
Mircea Trofin [Tue, 15 Dec 2020 16:40:01 +0000 (08:40 -0800)]
[utils] The func_dict for a prefix may just be empty

Follow up from D92965 - since we try to find failed prefixes
after each RUN line, it's possible the whole list of functions for a
prefix be non-existent, which is fine - this happens when none of the
RUN lines seen so far used the prefix.

3 years ago[clang][driver][NFC] Use StringRef instead of std::string
Nathan James [Tue, 15 Dec 2020 16:19:12 +0000 (16:19 +0000)]
[clang][driver][NFC] Use StringRef instead of std::string

3 years ago[NFC] Fix a few SVEInstrInfo related stylistic issues.
Paul Walker [Tue, 15 Dec 2020 15:31:57 +0000 (15:31 +0000)]
[NFC] Fix a few SVEInstrInfo related stylistic issues.

3 years ago[mlir] Add std op for X raised to the power of Y
Tres Popp [Thu, 10 Dec 2020 22:49:42 +0000 (23:49 +0100)]
[mlir] Add std op for X raised to the power of Y

Proposal:
https://llvm.discourse.group/t/rfc-standard-add-powop-to-std-dialect/2377

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

3 years ago[ARM] Match dual lane vmovs from insert_vector_elt
David Green [Tue, 15 Dec 2020 15:58:52 +0000 (15:58 +0000)]
[ARM] Match dual lane vmovs from insert_vector_elt

MVE has a dual lane vector move instruction, capable of moving two
general purpose registers into lanes of a vector register. They look
like one of:
  vmov q0[2], q0[0], r2, r0
  vmov q0[3], q0[1], r3, r1
They only accept these lane indices though (and only insert into an
i32), either moving lanes 1 and 3, or 0 and 2.

This patch adds some tablegen patterns for them, selecting from vector
inserts elements. Because the insert_elements are know to be
canonicalized to ascending order there are several patterns that we need
to select. These lane indices are:

3 2 1 0    -> vmovqrr 31; vmovqrr 20
3 2 1      -> vmovqrr 31; vmov 2
3 1        -> vmovqrr 31
2 1 0      -> vmovqrr 20; vmov 1
2 0        -> vmovqrr 20

With the top one being the most common. All other potential patterns of
lane indices will be matched by a combination of these and the
individual vmov pattern already present. This does mean that we are
selecting several machine instructions at once due to the need to
re-arrange the inserts, but in this case there is nothing else that will
attempt to match an insert_vector_elt node.

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

3 years ago[clangd] Improve goToDefinition on auto and dectype
Quentin Chateau [Tue, 15 Dec 2020 15:31:25 +0000 (16:31 +0100)]
[clangd] Improve goToDefinition on auto and dectype

locateSymbolAt (used in goToDeclaration) follows the
deduced type instead of failing to locate the declaration.

Reviewed By: sammccall

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

3 years ago[SystemZ] Remove most hard-coded R1D instances for sibcalls
Ulrich Weigand [Tue, 15 Dec 2020 15:18:43 +0000 (16:18 +0100)]
[SystemZ] Remove most hard-coded R1D instances for sibcalls

Indirect sibling calls need to use %r1 to hold the target address.
This is currently hard-coded in many places.  This is not only
unnecessary, but makes future changes in this area difficult.

This patch now encodes the target address as operand without
hard coding a register in most places throughout the MI back-end.
Code generation still always uses %r1, but this is now decided
solely in one place in SystemZTargetLowering::LowerCall.

NFC intended.

3 years ago[utils] Fix UpdateTestChecks case where 2 runs differ for last label
Mircea Trofin [Fri, 11 Dec 2020 00:15:18 +0000 (16:15 -0800)]
[utils] Fix UpdateTestChecks case where 2 runs differ for last label

Two RUN lines produce outputs that, each, have some common parts and
some different parts. The common parts are checked under label A. The
differing parts are associated to a function and checked under labels B
and C, respectivelly.
When build_function_body_dictionary is called for the first RUN line, it
will attribute the function body to labels A and C. When the second RUN
is passed to build_function_body_dictionary, it sees that the function
body under A is different from what it has. If in this second RUN line,
A were at the end of the prefixes list, A's body is still kept
associated with the first run's function.

When we output the function body (i.e. add_checks), we stop after
emitting for the first prefix matching that function. So we end up with
the wrong function body (first RUN's A-association).

There is no reason to special-case the last label in the prefixes list,
and the fix is to always clear a label association if we find a RUN line
where the body is different.

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

3 years ago[lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory
Raphael Isemann [Tue, 15 Dec 2020 15:13:17 +0000 (16:13 +0100)]
[lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory

7ad49aec125b3c1205b164331d0aa954d773f890 added a __memory subdirectory to libc++
but the code we use to find libc++ from the debug info support files wasn't
prepared to encounter unknown subdirectories within libc++. The import-std-module
tests automatically fell back to not importing the std module which caused
them to fail.

This patch removes our hardcoded exception for the 'experimental' subdirectory
and instead just ignores all subdirectories of c++/vX/ when searching the
support files.

3 years ago[AnnotationRemarks] Also generate annotation remarks when using -O0.
Florian Hahn [Tue, 15 Dec 2020 14:44:38 +0000 (14:44 +0000)]
[AnnotationRemarks] Also generate annotation remarks when using -O0.

The AnnotationRemarks pass is already run at the end of the module
pipeline. This patch also adds it before bailing out for -O0, so remarks
are also generated with -O0.

3 years ago[VE] Support FRAMEADDR
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 13:43:09 +0000 (22:43 +0900)]
[VE] Support FRAMEADDR

Implement FRAMEADDR for VE.  Add a regression test also.

Reviewed By: simoll

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

3 years ago[VE][NFC] Sort VEISD operations
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 12:52:51 +0000 (21:52 +0900)]
[VE][NFC] Sort VEISD operations

Reviewed By: simoll

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

3 years ago[VPlan] Use VPDef for VPWidenSelectRecipe.
Florian Hahn [Tue, 15 Dec 2020 14:02:52 +0000 (14:02 +0000)]
[VPlan] Use VPDef for VPWidenSelectRecipe.

This patch turns updates VPWidenSelectRecipe to manage the value
it defines using VPDef.

Reviewed By: gilr

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

3 years ago[AMDGPU] Unify flat offset logic
Sebastian Neubauer [Tue, 15 Dec 2020 09:33:50 +0000 (10:33 +0100)]
[AMDGPU] Unify flat offset logic

Move getNumFlatOffsetBits from AMDGPUAsmParser and SIInstrInfo into
AMDGPUBaseInfo.

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

3 years ago[AMDGPU][NFC] Add more global_atomic_cmpswap tests
Sebastian Neubauer [Tue, 15 Dec 2020 13:46:15 +0000 (14:46 +0100)]
[AMDGPU][NFC] Add more global_atomic_cmpswap tests

3 years ago[OpenMP] Initialize runtime in the forked child process
Hansang Bae [Mon, 14 Dec 2020 16:54:03 +0000 (10:54 -0600)]
[OpenMP] Initialize runtime in the forked child process

This patch enables serial initialization in the forked child process
to fix unstable runtime behavior when used with Python-based AI tools.

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

3 years ago[clangd] Oops, fix code in #ifdef WIN32
Sam McCall [Tue, 15 Dec 2020 13:17:44 +0000 (14:17 +0100)]
[clangd] Oops, fix code in #ifdef WIN32

3 years ago[InstCombine] Remove scalable vector restriction in foldVectorBinop
Jun Ma [Tue, 15 Dec 2020 09:20:55 +0000 (17:20 +0800)]
[InstCombine] Remove scalable vector restriction in foldVectorBinop

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

3 years agoReland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Tue, 15 Dec 2020 13:00:03 +0000 (14:00 +0100)]
Reland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit 4d956af594c5adc9d566d1846d86dd89c70c9c0b.

Assertion failures on windows fixed by
965d71c69acce658e9e3de00b25a351b00937820

3 years ago[clangd] Avoid traversing C:\ -> C: when looking for CDBs
Sam McCall [Tue, 15 Dec 2020 12:58:08 +0000 (13:58 +0100)]
[clangd] Avoid traversing C:\ -> C: when looking for CDBs

Boost in its infinite wisdom considers C: a parent of C:\, and we've
inherited that. This breaks the assumption that after canonicalizing a
path, the path parents are the directory's parents.

3 years ago[LV] Pass explicit vector width to not require a X86 target.
Florian Hahn [Tue, 15 Dec 2020 12:51:28 +0000 (12:51 +0000)]
[LV] Pass explicit vector width to not require a X86 target.

3 years ago[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading...
Chuanqi Xu [Tue, 15 Dec 2020 12:50:38 +0000 (20:50 +0800)]
[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading pointer alignment

Summary: The clang-format may go wrong when handle c++ coroutine keywords and pointer.
The default value for PointerAlignment is PAS_Right. So the following format is good:
```
co_return *a;
```
But within some code style, the value for PointerAlignment is PAS_Left, the behavior goes wrong:
```
co_return* a;
```

test-plan: check-clang

reviewers: MyDeveloperDay

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

3 years ago[InstCombine][NFC] Change cast of FixedVectorType to dyn_cast.
Jun Ma [Mon, 14 Dec 2020 06:42:55 +0000 (14:42 +0800)]
[InstCombine][NFC] Change cast of FixedVectorType to dyn_cast.

3 years ago[InstCombine] Remove scalable vector restriction in InstCombineCompares
Jun Ma [Tue, 15 Dec 2020 03:37:10 +0000 (11:37 +0800)]
[InstCombine] Remove scalable vector restriction in InstCombineCompares

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

3 years ago[InstCombine] Remove scalable vector restriction when fold SelectInst
Jun Ma [Fri, 11 Dec 2020 03:29:47 +0000 (11:29 +0800)]
[InstCombine] Remove scalable vector restriction when fold SelectInst

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

3 years ago[RISCV] Define vwadd/vwaddu/vwsub/vwsubu intrinsics.
Hsiangkai Wang [Fri, 11 Dec 2020 08:08:10 +0000 (16:08 +0800)]
[RISCV] Define vwadd/vwaddu/vwsub/vwsubu intrinsics.

Define vwadd/vwaddu/vwsub/vwsubu intrinsics and lower to V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93108

3 years ago[SVE] Move INT_TO_FP i1 promotion into custom lowering.
Paul Walker [Sat, 24 Oct 2020 10:23:10 +0000 (11:23 +0100)]
[SVE] Move INT_TO_FP i1 promotion into custom lowering.

AddPromotedToType is being used to legalise INT_TO_FP operations
when the source is a predicate. The point where this introduces
vector extends might cause problems in the future so this patch
falls back to manual promotion within custom lowering.

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

3 years ago[CodeGenPrepare] Update optimizeGatherScatterInst for scalable vectors.
Paul Walker [Thu, 3 Dec 2020 12:26:29 +0000 (12:26 +0000)]
[CodeGenPrepare] Update optimizeGatherScatterInst for scalable vectors.

optimizeGatherScatterInst does nothing specific to fixed length vectors
but uses FixedVectorType to extract the number of elements.  This patch
simply updates the code to use VectorType and getElementCount instead.

For testing I just copied Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
replacing `<4 x ` with `<vscale x 4`.

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

3 years ago[X86] Remove trailing whitespace. NFC.
Simon Pilgrim [Mon, 14 Dec 2020 17:54:49 +0000 (17:54 +0000)]
[X86] Remove trailing whitespace. NFC.

3 years ago[X86][AVX] LowerBUILD_VECTOR - reduce 256/512-bit build vectors with zero/undef upper...
Simon Pilgrim [Mon, 14 Dec 2020 17:49:33 +0000 (17:49 +0000)]
[X86][AVX] LowerBUILD_VECTOR - reduce 256/512-bit build vectors with zero/undef upper elements + pad.

As discussed on D92645, we don't do a good job of recognising when we don't require the full width of a ymm/zmm build vector because the upper elements are undef/zero.

This commit allows us to make use of implicit zeroing of upper elements with AVX instructions, which we emulate in DAG with a INSERT_SUBVECTOR into the bottom of a undef/zero vector of the original type.

This exposed a limitation in getTargetConstantBitsFromNode which didn't extract bits from INSERT_SUBVECTORs of different element widths which I've included as well to prevent a couple of regressions.

3 years ago[LV] Add reduction test, which exposed a crash in a pending patch.
Florian Hahn [Tue, 15 Dec 2020 09:39:47 +0000 (09:39 +0000)]
[LV] Add reduction test, which exposed a crash in a pending patch.

3 years ago[VPlan] Use VPDef for VPWidenGEPRecipe.
Florian Hahn [Tue, 15 Dec 2020 09:30:14 +0000 (09:30 +0000)]
[VPlan] Use VPDef for VPWidenGEPRecipe.

This patch turns updates VPWidenGEPRecipe to manage the value it defines
using VPDef. The VPValue is used  during VPlan construction and
codegeneration instead of the plain IR reference where possible.

Reviewed By: gilr

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

3 years ago[VPlan] Use VPdef for VPWidenCall.
Florian Hahn [Tue, 15 Dec 2020 09:11:24 +0000 (09:11 +0000)]
[VPlan] Use VPdef for VPWidenCall.

This patch turns updates VPWidenREcipe to manage the value it defines
using VPDef.

Reviewed By: gilr

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

3 years ago[clang][cli] Squash multiple cc1 -fxxx-exceptions flags into single -exception-model...
Jan Svoboda [Tue, 15 Dec 2020 08:59:19 +0000 (09:59 +0100)]
[clang][cli] Squash multiple cc1 -fxxx-exceptions flags into single -exception-model=xxx option

This patch enables marshalling of the exception model options while enforcing their mutual exclusivity. The clang driver interface remains the same, this only affects the cc1 command line.

Depends on D93215.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Squash exception model in LangOptions into one member
Jan Svoboda [Tue, 15 Dec 2020 08:41:11 +0000 (09:41 +0100)]
[clang][cli] Squash exception model in LangOptions into one member

This squashes multiple members in LangOptions into one. This is leveraged in a follow-up patch that implements marshalling of related command-line options.

Depends on D93214.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Create accessors for exception models in LangOptions
Jan Svoboda [Mon, 14 Dec 2020 12:08:48 +0000 (13:08 +0100)]
[clang][cli] Create accessors for exception models in LangOptions

This abstracts away the members that are being replaced in a follow-up patch.

Depends on D83979.

Reviewed By: dexonsmith

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

3 years ago[clangd] Add hover info for `this` expr
xndcn [Tue, 15 Dec 2020 08:45:56 +0000 (09:45 +0100)]
[clangd] Add hover info for `this` expr

How about add hover information for `this` expr?
It seems useful to show related information about the class for `this` expr sometimes.

Reviewed By: sammccall

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

3 years ago[VE] Support atomic exchange instructions
Kazushi (Jam) Marukawa [Sat, 12 Dec 2020 03:27:32 +0000 (12:27 +0900)]
[VE] Support atomic exchange instructions

Support atomic exchange and atomic compare and exchange instructions.
Change CAS and TS1AM instructions for ISel patterns.  Add selectADDRzi
pattern for them.  Add TS1AM pseudo instruction also for better ISel.
Add shouldExpandAtomicRMWInIR() function to expand all atomicrmw
instructions except atomicrmw xchg.  Add custom lower for i8/i16
atomicrmw xchg.  Modify replaceFI to support CAS/TS1AM instructions
which use "reg+disp" operands instead of "reg+imm+disp" operands.
And, add several regression tests to check the correctness.

Reviewed By: simoll

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

3 years ago[RISCV][NFC] Define scalable vectors for half types.
Hsiangkai Wang [Tue, 15 Dec 2020 05:49:54 +0000 (13:49 +0800)]
[RISCV][NFC] Define scalable vectors for half types.

This is a preperation work for vfadd intrinsics.

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

3 years ago[llvm-readelf] - Don't print OS/Processor specific prefix for known ELF file types.
Georgii Rymar [Mon, 14 Dec 2020 15:04:45 +0000 (18:04 +0300)]
[llvm-readelf] - Don't print OS/Processor specific prefix for known ELF file types.

This is a change suggested in post commit comments for
D93096 (https://reviews.llvm.org/D93096#2451796).

Imagine we want to add a custom OS specific ELF file type.
For that we can update the `ElfObjectFileType` array:

```
static const EnumEntry<unsigned> ElfObjectFileType[] = {
...
  {"Core",         "CORE (Core file)",         ELF::ET_CORE},
  {"MyType",       "MyType (my description)",     0xfe01},
};
```

The current code then might print:
```
OS Specific: (MyType (my description))
```

Though instead we probably would like to see a nicer output, e.g:
```
Type: MyType (my description)
```

To achieve that we can reorder the code slightly.

It is impossible to add a test I think, because we have no custom values in
the `ElfObjectFileType` array in LLVM.

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

3 years ago[SCEV] Add missing type check into getRangeForAffineNoSelfWrappingAR
Max Kazantsev [Tue, 15 Dec 2020 07:40:17 +0000 (14:40 +0700)]
[SCEV] Add missing type check into getRangeForAffineNoSelfWrappingAR

We make type widening without checking if it's needed. Bail if the max
iteration count is wider than AR's type.

3 years ago[GlobalISel][IRTranslator] Ensure branch probabilities are added when translating...
Amara Emerson [Mon, 14 Dec 2020 23:25:35 +0000 (15:25 -0800)]
[GlobalISel][IRTranslator] Ensure branch probabilities are added when translating invoke edges.

This uses a straightforward port of findUnwindDestinations() from SelectionDAG.

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

3 years ago[IR] Remove isPowerOf2ByteWidth
Kazu Hirata [Tue, 15 Dec 2020 07:00:17 +0000 (23:00 -0800)]
[IR] Remove isPowerOf2ByteWidth

The predicate used to be used with the C backend, which was removed on
Mar 23, 2012 in commit 64a232343aa649fdacf78698da3e4d5737dee56a.  It
seems to be unused since then.

3 years ago[Test] Test on assertion failure with expensive SCEV range inference
Max Kazantsev [Tue, 15 Dec 2020 06:46:09 +0000 (13:46 +0700)]
[Test] Test on assertion failure with expensive SCEV range inference

3 years ago[Analysis] Use llvm::erase_value (NFC)
Kazu Hirata [Tue, 15 Dec 2020 06:40:13 +0000 (22:40 -0800)]
[Analysis] Use llvm::erase_value (NFC)

3 years agoRe-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"
Raul Tambre [Tue, 15 Dec 2020 06:15:58 +0000 (08:15 +0200)]
Re-apply "[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately"

aa772fc85e0f526615c78b9c3979c2be945a754c (D92530) has landed fixing relocations on Darwin.
3000c19df64f89ff319590f3a6e4d6b93d20983d (D93236) has landed working around an assembly parser bug on Darwin.
Previous quick-fix d9697c2e6b153ac7dc40a69450d9b672f71b1029 (D93198) included in this commit.

Invoking the preprocessor ourselves is fragile and would require us to replicate CMake's handling of definitions, compiler flags, etc for proper compatibility.
In my toolchain builds this notably resulted in a bunch of warnings from unused flags as my CMAKE_C_FLAGS includes CPU-specific optimization options.
Notably this part was already duplicating the logic for VISIBILITY_HIDDEN define.

Instead, symlink the files and set the proper set of defines on each.
This should also be faster as we avoid invoking the compiler multiple times.

Fixes https://llvm.org/PR48494

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

3 years ago[Compiler-rt][AArch64] Workaround for .cfi_startproc assembler parser bug.
Raul Tambre [Tue, 15 Dec 2020 06:12:44 +0000 (08:12 +0200)]
[Compiler-rt][AArch64] Workaround for .cfi_startproc assembler parser bug.

Put .cfi_startproc on a new line to avoid hitting the assembly parser bug in MasmParser::parseDirectiveCFIStartProc().

Reviewed By: tambre

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

3 years ago[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload
Med Ismail Bennani [Tue, 15 Dec 2020 02:40:47 +0000 (03:40 +0100)]
[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload

This patch exposes the Target::CreateBreakpoint overload with the
boolean argument to move to the neareast code to the SBAPI.

This is useful when creating column breakpoints to restrict lldb's
resolution to the pointed source location, preventing it to go to the next
line.

rdar://72196842

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years agoRevert "[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload"
Med Ismail Bennani [Tue, 15 Dec 2020 05:11:35 +0000 (06:11 +0100)]
Revert "[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload"

This reverts commit 04696ff002e7d311887b7b7e6e171340a0623dd9.

Exposing the LazyBool private type in SBTarget.h breaks some tests.

3 years ago[RISCV] Define vadd/vsub/vrsub intrinsics and lower to V instructions.
Hsiangkai Wang [Fri, 11 Dec 2020 07:16:08 +0000 (15:16 +0800)]
[RISCV] Define vadd/vsub/vrsub intrinsics and lower to V instructions.

This patch is based on the proposal from Roger Ferrer Ibanez.
http://lists.llvm.org/pipermail/llvm-dev/2020-October/145850.html

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

3 years ago[gn build] Port d2ed9d6b7ec
LLVM GN Syncbot [Tue, 15 Dec 2020 03:35:00 +0000 (03:35 +0000)]
[gn build] Port d2ed9d6b7ec

3 years agoReland "[MachineDebugify] Insert synthetic DBG_VALUE instructions"
Nico Weber [Tue, 15 Dec 2020 03:33:29 +0000 (22:33 -0500)]
Reland "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

This reverts commit 841f9c937f6e593c926a26aedf054436eb807fe6.
The change landed many months ago; something else broke those tests.

3 years ago[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload
Med Ismail Bennani [Tue, 15 Dec 2020 02:40:47 +0000 (03:40 +0100)]
[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload

This patch exposes the Target::CreateBreakpoint overload with the
boolean argument to move to the neareast code to the SBAPI.

This is useful when creating column breakpoints to restrict lldb's
resolution to the pointed source location, preventing it to go to the next
line.

rdar://72196842

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years agoRevert "[MachineDebugify] Insert synthetic DBG_VALUE instructions"
Nico Weber [Tue, 15 Dec 2020 03:13:40 +0000 (22:13 -0500)]
Revert "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

This reverts commit 2a5675f11d3bc803a245c0e2a3b47491c8f8a065.
The tests it adds fail: https://reviews.llvm.org/D78135#2453736

3 years agoRevert "[Debugify] Support checking Machine IR debug info"
Nico Weber [Tue, 15 Dec 2020 03:12:15 +0000 (22:12 -0500)]
Revert "[Debugify] Support checking Machine IR debug info"

This reverts commit c4d2d4337d50bed3cafd564daece1a197005b22b.
Necessary to revert 2a5675f11d3bc803a245c0e.

3 years ago[X86] Add test case for commit e52bc1d2bba794b.
Luo, Yuanke [Sun, 13 Dec 2020 03:14:46 +0000 (11:14 +0800)]
[X86] Add test case for commit e52bc1d2bba794b.

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

3 years agoRevert "Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef"
Nico Weber [Tue, 15 Dec 2020 03:04:41 +0000 (22:04 -0500)]
Revert "Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef"

This reverts commit a40db5502b2515a6f2f1676b5d7a655ae0f41179.
and follow-up d636b881bb9214938973098a012fad453082c444

Somewhat speculative, likely broke check-clang on Windows:
https://reviews.llvm.org/D92975#2453482

3 years agoRevert "[amdgpu] Default to code object v3"
Nico Weber [Tue, 15 Dec 2020 02:59:51 +0000 (21:59 -0500)]
Revert "[amdgpu] Default to code object v3"

This reverts commit 4b2e7d0215021d0d1df1a6319884b21d33936265.
Breaks check-clang, see https://reviews.llvm.org/D93258#2453600

3 years ago[NFC] [Legalizer] Use common method for expanding fp-to-int operands
Qiu Chaofan [Tue, 15 Dec 2020 02:30:00 +0000 (10:30 +0800)]
[NFC] [Legalizer] Use common method for expanding fp-to-int operands

Reviewed By: RKSimon, steven.zhang

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

3 years ago[PGO] remove unintentional code in early commit
Rong Xu [Tue, 15 Dec 2020 02:41:09 +0000 (18:41 -0800)]
[PGO] remove unintentional code in early commit

Remove unintentional code in
commit 54e03d [PGO] Verify BFI counts after loading profile data.

3 years ago[mlir][Inliner] Refactor the inliner to use nested pass pipelines instead of just...
River Riddle [Tue, 15 Dec 2020 02:07:45 +0000 (18:07 -0800)]
[mlir][Inliner] Refactor the inliner to use nested pass pipelines instead of just canonicalization

Now that passes have support for running nested pipelines, the inliner can now allow for users to provide proper nested pipelines to use for optimization during inlining. This revision also changes the behavior of optimization during inlining to optimize before attempting to inline, which should lead to a more accurate cost model and prevents the need for users to schedule additional duplicate cleanup passes before/after the inliner that would already be run during inlining.

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

3 years ago[libc] Add remainder[f|l] and remquo[f|l] to the list of aarch64 entrypoints.
Siva Chandra [Tue, 15 Dec 2020 02:05:19 +0000 (18:05 -0800)]
[libc] Add remainder[f|l] and remquo[f|l] to the list of aarch64 entrypoints.

3 years ago[Debugify] Support checking Machine IR debug info
Xiang1 Zhang [Tue, 15 Dec 2020 01:51:21 +0000 (17:51 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.

For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".

Reviewed By: djtodoro

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

3 years ago[libc][NFC] Skip adding dummy targets for skipped unit tests.
Siva Chandra [Tue, 15 Dec 2020 01:51:13 +0000 (17:51 -0800)]
[libc][NFC] Skip adding dummy targets for skipped unit tests.

3 years agoRevert "[Debugify] Support checking Machine IR debug info"
Xiang1 Zhang [Tue, 15 Dec 2020 01:42:21 +0000 (17:42 -0800)]
Revert "[Debugify] Support checking Machine IR debug info"

This reverts commit 57a3d9ec4a8c1422f07264bed9f12a4ea416707e.

3 years ago[libc] Add memcmp implementation.
Cheng Wang [Fri, 4 Dec 2020 10:21:48 +0000 (18:21 +0800)]
[libc] Add memcmp implementation.

Reviewed By: gchatelet

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

3 years ago[Debugify] Support checking Machine IR debug info
Xiang1 Zhang [Tue, 15 Dec 2020 01:28:34 +0000 (17:28 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.

For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".

Reviewed By: djtodoro

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

3 years ago[RISCV] Prevent assertion in the assembler if vmerge or vfmerge are given a V0 destin...
Craig Topper [Tue, 15 Dec 2020 01:19:53 +0000 (17:19 -0800)]
[RISCV] Prevent assertion in the assembler if vmerge or vfmerge are given a V0 destination.

3 years ago[RISCV] Handle Match_InvalidSImm5 in RISCVAsmParser::MatchAndEmitInstruction
Craig Topper [Tue, 15 Dec 2020 00:48:56 +0000 (16:48 -0800)]
[RISCV] Handle Match_InvalidSImm5 in RISCVAsmParser::MatchAndEmitInstruction

3 years ago[RISCV] Teach debug output from assembly parser to print register names instead of...
Craig Topper [Tue, 15 Dec 2020 00:48:20 +0000 (16:48 -0800)]
[RISCV] Teach debug output from assembly parser to print register names instead of enum values.

3 years agoRemove the ast_type_traits namespace.
Alexander Kornienko [Mon, 14 Dec 2020 22:06:36 +0000 (23:06 +0100)]
Remove the ast_type_traits namespace.

This is the final cleanup after https://reviews.llvm.org/D74499

Reviewed By: steveire

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

3 years ago[libc][Obvious] Mark functions in DummyFEnv.h as static inline.
Siva Chandra Reddy [Tue, 15 Dec 2020 01:12:08 +0000 (17:12 -0800)]
[libc][Obvious] Mark functions in DummyFEnv.h as static inline.

3 years ago[amdgpu] Default to code object v3
Jon Chesterfield [Tue, 15 Dec 2020 01:10:41 +0000 (01:10 +0000)]
[amdgpu] Default to code object v3

[amdgpu] Default to code object v3
v4 is not yet readily available, and doesn't appear
to be implemented in the back end

Reviewed By: t-tye

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

3 years agoRevert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC"
Reid Kleckner [Tue, 15 Dec 2020 00:56:04 +0000 (16:56 -0800)]
Revert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC"

We determined that the MSVC implementation of std::aligned* isn't suited
to our needs. It doesn't support 16 byte alignment or higher, and it
doesn't really guarantee 8 byte alignment. See
https://github.com/microsoft/STL/issues/1533

Also reverts "ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC"

Also reverts "ADT: Remove AlignedCharArrayUnion, NFC" to bring back
AlignedCharArrayUnion.

This reverts commit 4d8bf870a82765eb0d4fe53c82f796b957c05954.

This reverts commit d10f9863a5ac1cb681af07719650c44b48f289ce.

This reverts commit 4b5dc150b9862271720b3d56a3e723a55dd81838.

3 years agoAMDGPU: If a store defines (alias) a load, it clobbers the load.
Changpeng Fang [Tue, 15 Dec 2020 00:34:32 +0000 (16:34 -0800)]
AMDGPU: If a store defines (alias) a load, it clobbers the load.

Summary:
 If a store defines (must alias) a load, it clobbers the load.

Fixes: SWDEV-258915

Reviewers:
  arsenm

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

3 years ago[PowerPC] Temporarily disable asan longjmp tests
Nemanja Ivanovic [Tue, 15 Dec 2020 00:07:45 +0000 (18:07 -0600)]
[PowerPC] Temporarily disable asan longjmp tests

Commit bfdc19e77868b849b5c636bf0512970264aef571 seems to have broken
some PPC bots with a couple of asan test cases. Disable those test
cases for now until I can resolve the issue.

3 years ago[PGO] Verify BFI counts after loading profile data
Rong Xu [Mon, 14 Dec 2020 23:54:28 +0000 (15:54 -0800)]
[PGO] Verify BFI counts after loading profile data

This patch adds the functionality to compare BFI counts with real
profile
counts right after reading the profile. It will print remarks under
-Rpass-analysis=pgo, or the internal option -pass-remarks-analysis=pgo.

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

3 years ago[X86] Fix variadic argument handling for x32
Harald van Dijk [Mon, 14 Dec 2020 23:47:27 +0000 (23:47 +0000)]
[X86] Fix variadic argument handling for x32

The X86-64 ABI defines va_list as

  typedef struct {
    unsigned int gp_offset;
    unsigned int fp_offset;
    void *overflow_arg_area;
    void *reg_save_area;
  } va_list[1];

This means the size, alignment, and reg_save_area offset will depend on
whether we are in LP64 or in ILP32 mode, so this commit adds the checks.
Additionally, the VAARG_64 pseudo-instruction assumed 64-bit pointers, so
this commit adds a VAARG_X32 pseudo-instruction that behaves just like
VAARG_64, except for assuming 32-bit pointers.

Some of these changes were originally done by
Michael Liao <michael.hliao@gmail.com>.

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

Reviewed By: RKSimon

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

3 years ago[lld/mac] implement -compatibility_version, -current_version
Nico Weber [Mon, 14 Dec 2020 23:24:50 +0000 (18:24 -0500)]
[lld/mac] implement -compatibility_version, -current_version

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

3 years agoscudo: Remove positional template arguments for secondary cache. NFCI.
Peter Collingbourne [Mon, 14 Dec 2020 21:57:59 +0000 (13:57 -0800)]
scudo: Remove positional template arguments for secondary cache. NFCI.

Make these arguments named constants in the Config class instead
of being positional arguments to MapAllocatorCache. This makes the
configuration easier to follow.

Eventually we should follow suit with the other classes but this is
a start.

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

3 years ago[VectorCombine] add alignment test for gep load; NFC
Sanjay Patel [Mon, 14 Dec 2020 23:30:40 +0000 (18:30 -0500)]
[VectorCombine] add alignment test for gep load; NFC

3 years ago[gn build] (semi-manually) port 19d57b5c42b
Nico Weber [Mon, 14 Dec 2020 23:23:15 +0000 (18:23 -0500)]
[gn build] (semi-manually) port 19d57b5c42b

3 years ago[gn build] (semi-manually) port 7ad49aec125
Nico Weber [Mon, 14 Dec 2020 23:22:54 +0000 (18:22 -0500)]
[gn build] (semi-manually) port 7ad49aec125

3 years ago[mlir] Fix opaque struct typedef in AsyncRuntime header
Eugene Zhulenev [Mon, 14 Dec 2020 22:55:46 +0000 (14:55 -0800)]
[mlir] Fix opaque struct typedef in AsyncRuntime header

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

3 years ago[mlir] Add section page for Rationale docs.
Richard Uhler [Mon, 14 Dec 2020 22:48:57 +0000 (14:48 -0800)]
[mlir] Add section page for Rationale docs.

With a brief overview and summary of each of the Rationale docs.

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

3 years ago[clang][IR] Add support for leaf attribute
Gulfem Savrun Yeniceri [Mon, 14 Dec 2020 21:56:11 +0000 (13:56 -0800)]
[clang][IR] Add support for leaf attribute

This patch adds support for leaf attribute as an optimization hint
in Clang/LLVM.

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

3 years ago[libc++] Remove unnecessary static assertion in allocate_shared
Louis Dionne [Mon, 14 Dec 2020 21:58:52 +0000 (16:58 -0500)]
[libc++] Remove unnecessary static assertion in allocate_shared

Checking that `T` is constructible from `Args...` is technically not
required by the Standard, although any implementation will obviously
error out if that's not satisfied. However, this check is incompatible
with using Allocator construction in the control block (upcoming change
as part of implementing P0674), so I'm removing it now to reduce the
upcoming diff as much as possible.

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

3 years ago[libc++] NFCI: Return pointer instead of reference from __shared_ptr_emplace helper...
Louis Dionne [Mon, 14 Dec 2020 22:40:56 +0000 (17:40 -0500)]
[libc++] NFCI: Return pointer instead of reference from __shared_ptr_emplace helper method

This makes __get_alloc consistent with __get_elem, and will reduce the
diff required to implement P0674R1.

3 years ago[VectorCombine] make load transform poison-safe
Sanjay Patel [Mon, 14 Dec 2020 22:20:15 +0000 (17:20 -0500)]
[VectorCombine] make load transform poison-safe

As noted in D93229, the transform from scalar load to vector load
potentially leaks poison from the extra vector elements that are
being loaded.

We could use freeze here (and x86 codegen at least appears to be
the same either way), but we already have a shuffle in this logic
to optionally change the vector size, so let's allow that
instruction to serve both purposes.

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

3 years agoAdapt lldb to a40db5502b2515a6f2f1676b5d7a655ae0f41179
Duncan P. N. Exon Smith [Mon, 14 Dec 2020 22:41:12 +0000 (14:41 -0800)]
Adapt lldb to a40db5502b2515a6f2f1676b5d7a655ae0f41179

The bots just told me about a place in LLDB I missed in
a40db5502b2515a6f2f1676b5d7a655ae0f41179 when changing
`HeaderSearch::LoadedModuleMaps`, but I think this will fix it.

3 years agoAdd comment to closing brace of anonymous namespace, NFC
Duncan P. N. Exon Smith [Mon, 14 Dec 2020 22:28:59 +0000 (14:28 -0800)]
Add comment to closing brace of anonymous namespace, NFC

3 years agoAST: Silence an instance of -Wsign-compare, NFC
Duncan P. N. Exon Smith [Mon, 14 Dec 2020 22:36:59 +0000 (14:36 -0800)]
AST: Silence an instance of -Wsign-compare, NFC

Looks this this was added by 68f53960e17d93c3a2727164dac4e54140bd98ba.

3 years agoLex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 22:46:34 +0000 (14:46 -0800)]
Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef

Migrate `HeaderSearch::LoadedModuleMaps` and a number of APIs over to
`FileEntryRef`. This should have no functionality change. Note that two
`FileEntryRef`s hash the same if they point at the same `FileEntry`.

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

3 years ago[LoopIdiomRecognize] Teach detectShiftUntilZeroIdiom to recognize loops where the...
Craig Topper [Mon, 14 Dec 2020 21:51:00 +0000 (13:51 -0800)]
[LoopIdiomRecognize] Teach detectShiftUntilZeroIdiom to recognize loops where the counter is decrementing.

This adds support for loops like

unsigned clz(unsigned x) {
    unsigned w = sizeof (x) * CHAR_BIT;
    while (x) {
        w--;
        x >>= 1;
    }

    return w;
}

and

unsigned clz(unsigned x) {
    unsigned w = sizeof (x) * CHAR_BIT - 1;
    while (x >>= 1) {
        w--;
    }

    return w;
}

To support these we look for add x, -1 as well as add x, 1 that
we already matched. If the value was -1 we need to subtract from
the initial counter value instead of adding to it.

Fixes PR48404.

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

3 years ago[mlir][OpDefGen] Add support for generating local functions for shared utilities
River Riddle [Mon, 14 Dec 2020 22:14:22 +0000 (14:14 -0800)]
[mlir][OpDefGen] Add support for generating local functions for shared utilities

This revision adds a new `StaticVerifierFunctionEmitter` class that emits local static functions in the .cpp file for shared operation verification. This class deduplicates shared operation verification code by emitting static functions alongside the op definitions. These methods are local to the definition file, and are invoked within the operation verify methods. The first bit of shared verification is for the type constraints used when verifying operands and results. An example is shown below:

```
static LogicalResult localVerify(...) {
  ...
}

LogicalResult OpA::verify(...) {
  if (failed(localVerify(...)))
    return failure();
  ...
}

LogicalResult OpB::verify(...) {
  if (failed(localVerify(...)))
    return failure();
  ...
}
```

This allowed for saving >400kb of code size from a downstream TensorFlow project (~15% of MLIR code size).

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

3 years ago[AMDGPU] Use multi-dword flat scratch for spilling
Stanislav Mekhanoshin [Wed, 25 Nov 2020 23:27:49 +0000 (15:27 -0800)]
[AMDGPU] Use multi-dword flat scratch for spilling

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

3 years ago[libc++] Refactor allocate_shared to use an allocation guard
Louis Dionne [Fri, 11 Dec 2020 17:20:06 +0000 (12:20 -0500)]
[libc++] Refactor allocate_shared to use an allocation guard

This commit is a step towards making it easier to add support for arrays
in allocate_shared. Adding support for arrays will require writing multiple
functions, and the current complexity of writing allocate_shared is
prohibitive for understanding.

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

3 years agoRevert "[DDG] Data Dependence Graph - DOT printer"
Bardia Mahjour [Mon, 14 Dec 2020 21:54:20 +0000 (16:54 -0500)]
Revert "[DDG] Data Dependence Graph - DOT printer"

This reverts commit fd4a10732c8bd646ccc621c0a9af512be252f33a, to
investigate the failure on windows: http://lab.llvm.org:8011/#/builders/127/builds/3274

3 years agoRevert "[mlir] Remove methods from mlir::OpState that just forward to mlir::Operation."
Christian Sigg [Mon, 14 Dec 2020 21:45:37 +0000 (22:45 +0100)]
Revert "[mlir] Remove methods from mlir::OpState that just forward to mlir::Operation."

This reverts commit 6f271e921ba48f4c4fa54bbd2c7a4c548ca5e59e.

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