platform/upstream/llvm.git
3 years ago[CostModel] Add costs for llvm.experimental.vector.{extract,insert} intrinsics
Bradley Smith [Wed, 9 Dec 2020 11:03:54 +0000 (11:03 +0000)]
[CostModel] Add costs for llvm.experimental.vector.{extract,insert} intrinsics

Adds cost model support for the new llvm.experimental.vector.{extract,insert}
intrinsics, using the existing getExtractSubvectorOverhead and
getInsertSubvectorOverhead functions for shuffles.

Previously this case would throw an assertion.

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

3 years ago[mlir][spirv] Add parsing and printing support for SpecConstantOperation
ergawy [Wed, 16 Dec 2020 13:20:24 +0000 (08:20 -0500)]
[mlir][spirv] Add parsing and printing support for SpecConstantOperation

Adds more support for `SpecConstantOperation` by defining a custom
syntax for the op and implementing its parsing and printing.

Reviewed By: mravishankar, antiagainst

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

3 years ago[CostModel]Migrate getTreeCost() to use InstructionCost
Caroline Concatto [Thu, 10 Dec 2020 13:52:35 +0000 (13:52 +0000)]
[CostModel]Migrate getTreeCost() to use InstructionCost

This patch changes the type of cost variables (for instance: Cost, ExtractCost,
SpillCost) to use InstructionCost.
This patch also changes the type of cost variables to InstructionCost in other
functions that use the result of getTreeCost()
This patch is part of a series of patches to use InstructionCost instead of
unsigned/int for the cost model functions.

See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Depends on D91174

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

3 years ago[CostModel]Replace FixedVectorType by VectorType in costgetIntrinsicInstrCost
Caroline Concatto [Wed, 25 Nov 2020 12:06:27 +0000 (12:06 +0000)]
[CostModel]Replace FixedVectorType by VectorType in costgetIntrinsicInstrCost

This patch replaces FixedVectorType by VectorType in getIntrinsicInstrCost
in BasicTTIImpl.h. It re-arranges the scalable type test earlier return
and add tests for scalable types.

Depends on D91532

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

3 years ago[clang][AArch64][SVE] Avoid going through memory for VLAT <-> VLST casts
Joe Ellis [Wed, 16 Dec 2020 09:01:28 +0000 (09:01 +0000)]
[clang][AArch64][SVE] Avoid going through memory for VLAT <-> VLST casts

This change makes use of the llvm.vector.extract intrinsic to avoid
going through memory when performing bitcasts between vector-length
agnostic types and vector-length specific types.

Depends on D91362

Reviewed By: c-rhodes

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

3 years ago[LLDB] Skip TestGuiBasicDebug.py on Arm and AArch64/Linux
Muhammad Omair Javaid [Wed, 16 Dec 2020 11:09:24 +0000 (16:09 +0500)]
[LLDB] Skip TestGuiBasicDebug.py on Arm and AArch64/Linux

TestGuiBasicDebug.py is intermittenly timing out on LLDB AArch64/Linux
buildbot. Putting SkipIf decorator untill root cuase is identified.

3 years agoRevert "Ensure SplitEdge to return the new block between the two given blocks"
Bangtian Liu [Wed, 16 Dec 2020 11:51:26 +0000 (11:51 +0000)]
Revert "Ensure SplitEdge to return the new block between the two given blocks"

This reverts commit cf638d793c489632bbcf0ee0fbf9d0f8c76e1f48.

3 years ago[X86][SSE] combineReductionToHorizontal - don't rely on widenSubVector to handle...
Simon Pilgrim [Wed, 16 Dec 2020 11:24:19 +0000 (11:24 +0000)]
[X86][SSE] combineReductionToHorizontal - don't rely on widenSubVector to handle illegal vector types.

Thanks to @asbirlea for reporting the bug.

3 years agoRevert "[LLDB] Remove AArch64/Linux xfail decorator from TestGuiBasicDebug"
Muhammad Omair Javaid [Wed, 16 Dec 2020 11:02:54 +0000 (16:02 +0500)]
Revert "[LLDB] Remove AArch64/Linux xfail decorator from TestGuiBasicDebug"

This reverts commit 3d27a99b2ed24e1951483cf13357ec188ad44bb0.

3 years ago[yaml2obj/obj2yaml] - Make Value/Size fields of Symbol optional.
Georgii Rymar [Wed, 9 Dec 2020 13:46:42 +0000 (16:46 +0300)]
[yaml2obj/obj2yaml] - Make Value/Size fields of Symbol optional.

When a field is optional we can use the `=<none>` syntax in macros.
This patch makes `Value`/`Size` fields of `Symbol` optional
and adds test cases for them.

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

3 years ago[lib/Object] - Make ELFObjectFile::getSymbol() return Expected<>.
Georgii Rymar [Tue, 15 Dec 2020 12:45:15 +0000 (15:45 +0300)]
[lib/Object] - Make ELFObjectFile::getSymbol() return Expected<>.

This was requested in comments for D93209:
https://reviews.llvm.org/D93209#inline-871192

D93209 fixes an issue with `ELFFile<ELFT>::getEntry`,
after what `getSymbol` starts calling `report_fatal_error` for previously
missed invalid cases.

This patch makes it return `Expected<>` and updates callers.
For few of them I had to add new `report_fatal_error` calls. But I see no
way to avoid it currently. The change would affects too many places, e.g:
`getSymbolBinding` and other methods are used from `ELFSymbolRef`
which is used in too many places across LLVM.

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

3 years ago[llvm-readelf/obj] - Handle out-of-order PT_LOADs better.
Georgii Rymar [Fri, 4 Dec 2020 08:54:03 +0000 (11:54 +0300)]
[llvm-readelf/obj] - Handle out-of-order PT_LOADs better.

This is https://bugs.llvm.org/show_bug.cgi?id=45698.

Specification says that
"Loadable segment entries in the program header table appear
in ascending order, sorted on the p_vaddr member."

Our `toMappedAddr()` relies on this condition. This patch
adds a warning when the sorting order of loadable segments is wrong.
In this case we force segments sorting and that allows
`toMappedAddr()` to work as expected.

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

3 years ago[clang][cli] Port DependencyOutput string based options to new option parsing system
Jan Svoboda [Tue, 15 Dec 2020 12:08:04 +0000 (13:08 +0100)]
[clang][cli] Port DependencyOutput string based options to new option parsing system

Depends on D84186

Reviewed By: dexonsmith

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

3 years ago[AMDGPU] Avoid calling copyFastMathFlags in wrong context
Piotr Sobczak [Wed, 16 Dec 2020 09:12:54 +0000 (10:12 +0100)]
[AMDGPU] Avoid calling copyFastMathFlags in wrong context

Calling Instruction::copyFastMathFlags() assumes the caller is
FPMathOperator. Avoid calling the function for instructions
that are not instances of FPMathOperator.

3 years ago[NFC] Pre-commit test for long-double builtins
Qiu Chaofan [Wed, 16 Dec 2020 09:19:54 +0000 (17:19 +0800)]
[NFC] Pre-commit test for long-double builtins

This test reflects clang behavior on long-double type math library
builtins under default or explicit 128-bit long-double options.

3 years ago[clang][cli] Port LangOpts option flags to new option parsing system
Jan Svoboda [Wed, 16 Dec 2020 09:05:09 +0000 (10:05 +0100)]
[clang][cli] Port LangOpts option flags to new option parsing system

Depends on D83892 & D83694 & D93104.

Reviewed By: dexonsmith

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

3 years ago[AMDGPU] Allow no saddr for global addtid insts
Sebastian Neubauer [Tue, 15 Dec 2020 10:15:53 +0000 (11:15 +0100)]
[AMDGPU] Allow no saddr for global addtid insts

I think the global_load/store_dword_addtid instructions support
switching off the scalar address.
Add assembler and disassembler support for this.

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

3 years ago[clang][cli] Port CodeGen option flags to new option parsing system
Jan Svoboda [Fri, 11 Dec 2020 14:41:35 +0000 (15:41 +0100)]
[clang][cli] Port CodeGen option flags to new option parsing system

Depends on D83697.

Reviewed By: dexonsmith

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

3 years ago[mlir] Lookup the latest value with a legal type when remapping values.
Alexander Belyaev [Wed, 16 Dec 2020 07:38:12 +0000 (08:38 +0100)]
[mlir] Lookup the latest value with a legal type when remapping values.

The current condition implies that the target materialization will be
called even if the type is the new operand type is legal, but slightly
different. For example, if there is a bufferization pattern that changes
memref layout, then target materialization for an illegal type
(TensorType) would be called.

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

3 years ago[clang][cli] Prevent double denormalization
Jan Svoboda [Wed, 9 Dec 2020 12:26:39 +0000 (13:26 +0100)]
[clang][cli] Prevent double denormalization

If both flags created through BoolOption are CC1Option and the keypath has a non-default or non-implied value, the denormalizer gets called twice. If the denormalizer has the ability to generate both flags, we can end up generating the same flag twice.

Reviewed By: dexonsmith, Bigcheese

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

3 years ago[clang][cli] Do not marshall only CC1Option flags in BoolOption
Jan Svoboda [Tue, 8 Dec 2020 17:15:21 +0000 (18:15 +0100)]
[clang][cli] Do not marshall only CC1Option flags in BoolOption

We cannot be sure whether a flag is CC1Option inside the definition of `BoolOption`. Take the example below:

```
let Flags = [CC1Option] in {
  defm xxx : BoolOption<...>;
}
```

where TableGen applies `Flags = [CC1Option]` to the `xxx` and `no_xxx` records **after** they have been is fully declared by `BoolOption`.

For the refactored `-f[no-]debug-pass-manager` flags (see the diff), this means `BoolOption` never adds any marshalling info, as it doesn't see either of the flags as `CC1Option`.

For that reason, we should defensively append the marshalling information to both flags inside `BoolOption`. Now the check for `CC1Option` needs to happen later, in the parsing macro, when all TableGen logic has been resolved.

However, for some flags defined through `BoolOption`, we can run into issues:

```
// Options.td
def fenable_xxx : /* ... */;

// Both flags are CC1Option, the first is implied.
defm xxx : BoolOption<"xxx,
  "Opts.Xxx", DefaultsToFalse,
  ChangedBy<PosFlag, [CC1Option], "", [fenable_xxx]>,
  ResetBy<NegFlag, [CC1Option]>>;
```

When parsing `clang -cc1 -fenable-xxx`:
* we run parsing for `PosFlag`:
  * set `Opts.Xxx` to default `false`,
  * discover `PosFlag` is implied by `-fenable-xxx`: set `Opts.Xxx` to `true`,
  * don't see `-fxxx` on command line: do nothing,
* we run parsing for `NegFlag`:
  * set `Opts.Xxx` to default `false`,
  * discover `NegFlag` cannot be implied: do nothing,
  * don't see `-fno-xxx` on command line: do nothing.

Now we ended up with `Opts.Xxx` set to `false` instead of `true`. For this reason, we need to ensure to append the same `ImpliedByAnyOf` instance to both flags.

This means both parsing runs now behave identically (they set the same default value, run the same "implied by" check, and call `makeBooleanOptionNormalizer` that already has information on both flags, so it returns the same value in both calls).

The solution works well, but what might be confusing is this: you have defined a flag **A** that is not `CC1Option`, but can be implied by another flag **B** that is `CC1Option`:
* if **A** is defined manually, it will never get implied, as the code never runs
```
def no_signed_zeros : Flag<["-"], "fno-signed-zeros">, Group<f_Group>, Flags<[]>,
  MarshallingInfoFlag<"LangOpts->NoSignedZero">, ImpliedByAnyOf<[menable_unsafe_fp_math]>;
```
* if **A** is defined by `BoolOption`, it could get implied, as the code is run by its `CC1Option` counterpart:
```
defm signed_zeros : BoolOption<"signed-zeros",
  "LangOpts->NoSignedZero", DefaultsToFalse,
  ChangedBy<NegFlag, [], "Allow optimizations that ignore the sign of floating point zeros",
            [cl_no_signed_zeros, menable_unsafe_fp_math]>,
  ResetBy<PosFlag, [CC1Option]>, "f">, Group<f_Group>;
```

This is a surprising inconsistency.

One solution might be to somehow propagate the final `Flags` of the implied flag in `ImpliedByAnyOf` and check whether it has `CC1Option` in the parsing macro. However, I think it doesn't make sense to spend time thinking about a corner case that won't come up in real code.

An observation: it is unfortunate that the marshalling information is a part of the flag definition. If we represented it in a separate structure, we could avoid the "double parsing" problem by having a single source of truth. This would require a lot of additional work though.

Note: the original patch missed the `CC1Option` check in the parsing macro, making my reasoning here incomplete. Moreover, it contained a change to denormalization that wasn't necessarily related to these changes, so I've extracted that to a follow-up patch: D93094.

Reviewed By: dexonsmith, Bigcheese

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

3 years agoRevert "[Compiler-rt][AArch64] Workaround for .cfi_startproc assembler parser bug."
Raul Tambre [Wed, 16 Dec 2020 08:14:41 +0000 (10:14 +0200)]
Revert "[Compiler-rt][AArch64] Workaround for .cfi_startproc assembler parser bug."

039cb03dd0dcff4daa17a062f7414ac22bf5f2eb (D93378) fixed the assembly separator, so the workaround is no longer necessary.

This reverts commit 3000c19df64f89ff319590f3a6e4d6b93d20983d.

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

3 years ago[builtins] Use %% as the separator for aarch64-*-darwin and ; for powerpc{32,64}
Fangrui Song [Wed, 16 Dec 2020 08:13:22 +0000 (00:13 -0800)]
[builtins] Use %% as the separator for aarch64-*-darwin and ; for powerpc{32,64}

`;` is the default comment marker, which is also used by powerpc*-*-elf target triples.
`@` is the comment marker of powerpc*-*-darwin but the Darwin support has been deleted for PowerPC (D72063).
`%%` is the statement separator used by aarch64-*-darwin (see AArch64MCAsmInfoDarwin, it uses `;` as the comment marker, which is different from most other targets)

Reviewed By: tambre

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

3 years ago[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.
Siva Chandra Reddy [Wed, 16 Dec 2020 07:44:44 +0000 (23:44 -0800)]
[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.

3 years ago[AMDGPU] Print SCRATCH_EN field after the kernel
Stanislav Mekhanoshin [Tue, 15 Dec 2020 23:31:29 +0000 (15:31 -0800)]
[AMDGPU] Print SCRATCH_EN field after the kernel

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

3 years ago[libc][NFC] Rename global `nan` in tests to `aNaN`.
Siva Chandra Reddy [Wed, 16 Dec 2020 06:23:22 +0000 (22:23 -0800)]
[libc][NFC] Rename global `nan` in tests to `aNaN`.

The name `nan` conflicts with the function `nan` defined declared in
math.h.

3 years ago[libc][NFC][Obvious] Remove few unnecessary #include directives in tests.
Siva Chandra Reddy [Wed, 16 Dec 2020 05:40:40 +0000 (21:40 -0800)]
[libc][NFC][Obvious] Remove few unnecessary #include directives in tests.

3 years ago[HIP] unbundle bundled preprocessor output
Yaxun (Sam) Liu [Fri, 4 Dec 2020 22:38:57 +0000 (17:38 -0500)]
[HIP] unbundle bundled preprocessor output

There is a use case that users want to emit preprocessor
output as file and compile the preprocessor output later
with -x hip-cpp-output.

Clang emits bundled preprocessor output when users
compile with -E for combined host/device compilations.
Clang should be able to compile the bundled preprocessor
output with -x hip-cpp-output. Basically clang should
unbundle the bundled preprocessor output and launch
device and host compilation actions.

Currently there is a bug in clang driver causing bundled
preprocessor output not unbundled.

This patch fixes that.

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

3 years ago[LV] Weaken a unnecessarily strong assert [NFC]
Philip Reames [Wed, 16 Dec 2020 03:06:12 +0000 (19:06 -0800)]
[LV] Weaken a unnecessarily strong assert [NFC]

Account for the fact that (in the future) the latch might be a switch not a branch.  The existing code is correct, minus the assert.

3 years ago[JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs.
Lang Hames [Wed, 16 Dec 2020 01:18:30 +0000 (12:18 +1100)]
[JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs.

Separates link graph creation from linking. This allows raw LinkGraphs to be
created and passed to a link. ObjectLinkingLayer is updated to support emission
of raw LinkGraphs in addition to object buffers.

Raw LinkGraphs can be created by in-memory compilers to bypass object encoding /
decoding (though this prevents caching, as LinkGraphs have do not have an
on-disk representation), and by utility code to add programatically generated
data structures to the JIT target process.

3 years ago[RISCV] Refine vector load/store tablegen pattern, NFC.
Zakk Chen [Wed, 16 Dec 2020 01:27:38 +0000 (17:27 -0800)]
[RISCV] Refine vector load/store tablegen pattern, NFC.

Refine tablegen pattern for vector load/store, and follow
D93012 to separate masked and unmasked definitions for
pseudo load/store instructions.

Reviewed By: craig.topper

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

3 years ago[LV] Extend dead instruction detection to multiple exiting blocks
Philip Reames [Wed, 16 Dec 2020 02:46:32 +0000 (18:46 -0800)]
[LV] Extend dead instruction detection to multiple exiting blocks

Given we haven't yet enabled multiple exiting blocks, this is currently non functional, but it's an obvious extension which cleans up a later patch.

I don't think this is worth review (as it's pretty obvious), if anyone disagrees, feel feel to revert or comment and I will.

3 years ago[ASTMatchers][NFC] Strip prefixes eagerly in dynamic matcher arg traits.
Nathan James [Wed, 16 Dec 2020 01:56:30 +0000 (01:56 +0000)]
[ASTMatchers][NFC] Strip prefixes eagerly in dynamic matcher arg traits.

3 years ago[flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF()
peter klausler [Tue, 15 Dec 2020 19:06:44 +0000 (11:06 -0800)]
[flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF()

STORAGE_SIZE() is a standard inquiry intrinsic (size in bits
of an array element of the same type as the argument); SIZEOF()
is a common extension that returns the size in bytes of its
argument; C_SIZEOF() is a renaming of SIZEOF() in module ISO_C_BINDING.

STORAGE_SIZE() and SIZEOF() are implemented via rewrites to
expressions; these expressions will be constant when the necessary
type parameters and bounds are also constant.

Code to calculate the sizes of types (with and without alignment)
was isolated into Evaluate/type.* and /characteristics.*.
Code in Semantics/compute-offsets.* to calculate sizes and alignments
of derived types' scopes was exposed so that it can be called at type
instantiation time (earlier than before) so that these inquiry intrinsics
could be called from specification expressions.

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

3 years ago[Hexagon] Rename test case, NFC
Krzysztof Parzyszek [Wed, 16 Dec 2020 01:05:31 +0000 (19:05 -0600)]
[Hexagon] Rename test case, NFC

3 years ago[Hexagon] Temporarily disable vector realignment for non-HVX vectors
Krzysztof Parzyszek [Wed, 16 Dec 2020 01:03:07 +0000 (19:03 -0600)]
[Hexagon] Temporarily disable vector realignment for non-HVX vectors

3 years ago[Hexagon] Emit enough stores when aligning vector addresses
Krzysztof Parzyszek [Wed, 16 Dec 2020 00:41:49 +0000 (18:41 -0600)]
[Hexagon] Emit enough stores when aligning vector addresses

3 years ago[mac/lld] fix amend mishap from ec88746a059
Nico Weber [Wed, 16 Dec 2020 00:41:00 +0000 (19:41 -0500)]
[mac/lld] fix amend mishap from ec88746a059

3 years ago[lld/mac] fill in current and compatibility version for LC_LOAD_(WEAK_)DYLIB
Nico Weber [Tue, 15 Dec 2020 20:25:15 +0000 (15:25 -0500)]
[lld/mac] fill in current and compatibility version for LC_LOAD_(WEAK_)DYLIB

Not sure if anything actually depends on this, but it makes `otool -L`
output look nicer.

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

3 years ago[flang] Fix false error message for "ptr => func()" array conformance
peter klausler [Tue, 15 Dec 2020 18:54:36 +0000 (10:54 -0800)]
[flang] Fix false error message for "ptr => func()" array conformance

Pointers must have deferred shapes, so CheckConformance must be
extended to allow for them.

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

3 years ago[mac/lld] simplify code using PackedVersion instead of VersionTuple
Nico Weber [Tue, 15 Dec 2020 21:37:37 +0000 (16:37 -0500)]
[mac/lld] simplify code using PackedVersion instead of VersionTuple

PackedVersion already does the correct range checks.

No behavior change.

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

3 years ago[flang] Fix bug with USE of USE of generic
Tim Keith [Wed, 16 Dec 2020 00:11:58 +0000 (16:11 -0800)]
[flang] Fix bug with USE of USE of generic

When merging use associations into a generic, we weren't handling
the case where the name that was use associated was itself a use
association. This is fixed by following that association to its
ultimate symbol (`useUltimate` in `DoAddUse`).

An example of the bug is `m12d` in `resolve17.f90`. `g` is associated
with `gc` in `m12c` which is associated with `gb` in `m12b`. It was that
last association that we weren't correctly following.

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

3 years ago[gn build] Port b9c77542e23
LLVM GN Syncbot [Wed, 16 Dec 2020 00:03:26 +0000 (00:03 +0000)]
[gn build] Port b9c77542e23

3 years agoRevert "[OpenMP] Add initial support for `omp [begin/end] assumes`"
Johannes Doerfert [Wed, 16 Dec 2020 00:02:22 +0000 (18:02 -0600)]
Revert "[OpenMP] Add initial support for `omp [begin/end] assumes`"

There is a build error with gcc-5 [0], investigating now.

[0] https://reviews.llvm.org/D91980#2456526

This reverts commit a5a14cbe7f87e01882ecaa14df5d596cbf38823a.

3 years agoDocument that AlignedCharArrayUnion exists to work around an MSVC bug
Reid Kleckner [Tue, 15 Dec 2020 23:59:21 +0000 (15:59 -0800)]
Document that AlignedCharArrayUnion exists to work around an MSVC bug

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

3 years ago[mlir] Allow SymbolTable to update existing symbols
Tres Popp [Tue, 15 Dec 2020 23:13:05 +0000 (00:13 +0100)]
[mlir] Allow SymbolTable to update existing symbols

Previous behavior would fail if inserting an operation that already
existed. Now SymbolTable::insert can also be used as a way to make a
symbol's name unique even after insertion.

Further TODOs have been left over naming and consistent behavior
considerations.

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

3 years agoEnsure SplitEdge to return the new block between the two given blocks
Bangtian Liu [Tue, 15 Dec 2020 23:28:42 +0000 (23:28 +0000)]
Ensure SplitEdge to return the new block between the two given blocks

This PR implements the function splitBasicBlockBefore to address an
issue
that occurred during SplitEdge(BB, Succ, ...), inside splitBlockBefore.
The issue occurs in SplitEdge when the Succ has a single predecessor
and the edge between the BB and Succ is not critical. This produces
the result â€˜BB->Succ->New’. The new function splitBasicBlockBefore
was added to splitBlockBefore to handle the issue and now produces
the correct result â€˜BB->New->Succ’.

Below is an example of splitting the block bb1 at its first instruction.

/// Original IR
bb0:
br bb1
bb1:
        %0 = mul i32 1, 2
br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlock
bb0:
br bb1
bb1:
br bb1.split
bb1.split:
        %0 = mul i32 1, 2
br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlockBefore
bb0:
br bb1.split
bb1.split
br bb1
bb1:
        %0 = mul i32 1, 2
br bb2
bb2:

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

3 years ago[ClangTidy] NFC: Add more tests for container-size-empty
Stephen Kelly [Mon, 14 Dec 2020 23:09:32 +0000 (23:09 +0000)]
[ClangTidy] NFC: Add more tests for container-size-empty

3 years ago[ASTMatcher] Avoid isImplicit call on object which could be nullptr
Stephen Kelly [Tue, 15 Dec 2020 19:02:29 +0000 (19:02 +0000)]
[ASTMatcher] Avoid isImplicit call on object which could be nullptr

A callExpr whose argument is dependent has a null getCalleeDecl().

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

3 years ago[FIX] Add the comma missing in D91979
Johannes Doerfert [Tue, 15 Dec 2020 23:24:53 +0000 (17:24 -0600)]
[FIX] Add the comma missing in D91979

3 years ago[X86] Add REX prefix for GOTTPOFF/TLSDESC relocs in x32 mode
Harald van Dijk [Tue, 15 Dec 2020 23:07:34 +0000 (23:07 +0000)]
[X86] Add REX prefix for GOTTPOFF/TLSDESC relocs in x32 mode

The REX prefix is needed to allow linker relaxations: even if the
instruction we emit may not need it, the linker may change it to a
different instruction which does need it.

3 years ago[mlir][Pass] Add a new PassNameCLParser specifically for parsing lists of pass names
River Riddle [Tue, 15 Dec 2020 22:42:16 +0000 (14:42 -0800)]
[mlir][Pass] Add a new PassNameCLParser specifically for parsing lists of pass names

This parser does not include the general `pass_pipeline` option, the pass pipeline entries, or the options of pass entries. This is useful for cases such as `print-ir-after` that just want the user to select specific pass types. This revision greatly reduces the amount of text in --help for several MLIR based tools.

Fixes PR#45495

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

3 years agoDR1413 and part of P1815R2: Minor improvements to Clang's determination
Richard Smith [Tue, 15 Dec 2020 22:18:48 +0000 (14:18 -0800)]
DR1413 and part of P1815R2: Minor improvements to Clang's determination
of type- and value-dependency.

A static data member initialized to a constant inside a class template
is no longer considered value-dependent, per DR1413. A const but not
constexpr variable of literal type (other than integer or enumeration)
is no longer considered value-dependent, per P1815R2.

3 years agoDR2100: &expr is value-dependent if expr constant-evaluates to a
Richard Smith [Tue, 15 Dec 2020 21:23:08 +0000 (13:23 -0800)]
DR2100: &expr is value-dependent if expr constant-evaluates to a
dependent declaration.

3 years ago[IR] Delete deprecated DebugLoc::get
Fangrui Song [Tue, 15 Dec 2020 22:53:12 +0000 (14:53 -0800)]
[IR] Delete deprecated DebugLoc::get

3 years ago[OpenMP] Add initial support for `omp [begin/end] assumes`
Johannes Doerfert [Mon, 23 Nov 2020 17:48:59 +0000 (11:48 -0600)]
[OpenMP] Add initial support for `omp [begin/end] assumes`

The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

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

3 years ago[OpenMP] Use assumptions during ICV tracking
Johannes Doerfert [Tue, 24 Nov 2020 19:38:55 +0000 (13:38 -0600)]
[OpenMP] Use assumptions during ICV tracking

The OpenMP 5.1 assumptions `no_openmp` and `no_openmp_routines` allow us
to ignore calls that would otherwise prevent ICV tracking.

Once we track more ICVs we might need to distinguish the ones that could
be impacted even with `no_openmp_routines`.

Reviewed By: sstefan1

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

3 years ago[Clang][Attr] Introduce the `assume` function attribute
Johannes Doerfert [Sat, 21 Nov 2020 19:49:41 +0000 (13:49 -0600)]
[Clang][Attr] Introduce the `assume` function attribute

The `assume` attribute is a way to provide additional, arbitrary
information to the optimizer. For now, assumptions are restricted to
strings which will be accumulated for a function and emitted as comma
separated string function attribute. The key of the LLVM-IR function
attribute is `llvm.assume`. Similar to `llvm.assume` and
`__builtin_assume`, the `assume` attribute provides a user defined
assumption to the compiler.

A follow up patch will introduce an LLVM-core API to query the
assumptions attached to a function. We also expect to add more options,
e.g., expression arguments, to the `assume` attribute later on.

The `omp [begin] asssumes` pragma will leverage this attribute and
expose the functionality in the absence of OpenMP.

Reviewed By: aaron.ballman

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

3 years ago[OpenMPOpt][NFC] Clang format
Johannes Doerfert [Fri, 11 Dec 2020 00:25:28 +0000 (18:25 -0600)]
[OpenMPOpt][NFC] Clang format

3 years ago[mlir] NFC: retire LLVM_Zero/OneResultOp from LLVM dialect ODS
Alex Zinenko [Tue, 15 Dec 2020 20:10:49 +0000 (21:10 +0100)]
[mlir] NFC: retire LLVM_Zero/OneResultOp from LLVM dialect ODS

These classes were initially introduced to factor out two common parts of LLVM
op definitions: the fact that they have no results or a single result of
LLVM_Type, and the default builders. Neither of the two parts is really
common anymore: many ops have more specific on the result type, and many ops
provide custom builders. The TableGen classes only add conceptual complexity
and make LLVM dialect definition dissimilar to other dialects. Remove them in
favor of explicitly specified builders (results are already specified).

Depends On D93329

Reviewed By: rriddle

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

3 years ago[mlir] Tighten type verifiers for LLVM dialect ops results
Alex Zinenko [Tue, 15 Dec 2020 20:10:21 +0000 (21:10 +0100)]
[mlir] Tighten type verifiers for LLVM dialect ops results

Now that we have predicates for LLVM dialect types in ODS, we can use them to
restrict the types allowed in results of LLVM dialect operations. This also
serves as additional documentation for these operations.

Reviewed By: rriddle

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

3 years agoDon't memcpy from an empty ArrayRef; the base pointer could be null, and
Richard Smith [Tue, 15 Dec 2020 22:29:22 +0000 (14:29 -0800)]
Don't memcpy from an empty ArrayRef; the base pointer could be null, and
the C rules say memcpy can't accept a null pointer.

This should fix a test failure with the ubsan buildbots.

3 years agoRegisterCoalescer: Remove phi-only subranges when erasing identity copies
Matt Arsenault [Tue, 13 Oct 2020 15:43:32 +0000 (11:43 -0400)]
RegisterCoalescer: Remove phi-only subranges when erasing identity copies

Undef subranges are not present in the live range values, except when
they cross block boundaries. In this situation, a identity copy is
inside a loop, and one of the lanes is undefined. It only appears
alive inside the loop due to the copy. Once the copy was erased, it
would leave behind a segment inside the loop body with no
corresponding def anywhere in the program.

When RenameIndependentSubregs processed this dummy interval, it would
introduce a "Multiple connected components in live interval" verifier
error when IMPLICIT_DEFs were added to the other two blocks. I believe
there is a missing verifier check for this type of dummy interval.

I have found additional cases from the same fundamental problem in
other areas I haven't managed to fix yet (e.g. the commented out
prune_subrange_phi_value_* cases).

3 years ago[libc++] Use consistent declaration for main() in test
Louis Dionne [Tue, 15 Dec 2020 22:33:47 +0000 (17:33 -0500)]
[libc++] Use consistent declaration for main() in test

3 years ago[RISCV] Define vfadd/vfsub/vfrsub intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 16:51:07 +0000 (00:51 +0800)]
[RISCV] Define vfadd/vfsub/vfrsub intrinsics.

Define vfadd/vfsub/vfrsub intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

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

3 years ago[RISCV] Define vmin/vminu/vmax/vmaxu intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 15:39:35 +0000 (23:39 +0800)]
[RISCV] Define vmin/vminu/vmax/vmaxu intrinsics.

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

3 years ago[RISCV] Define vnsrl/vnsra intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 13:47:15 +0000 (21:47 +0800)]
[RISCV] Define vnsrl/vnsra intrinsics.

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

3 years ago[RISCV] Define vsll/vsrl/vsra intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 06:54:14 +0000 (14:54 +0800)]
[RISCV] Define vsll/vsrl/vsra intrinsics.

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

3 years ago[RISCV] Define vadc/vmadc/vsbc/vmsbc intrinsics.
Hsiangkai Wang [Sat, 12 Dec 2020 09:18:32 +0000 (17:18 +0800)]
[RISCV] Define vadc/vmadc/vsbc/vmsbc intrinsics.

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

3 years agoFrontend: Fix confusing comment at call to clearOutputFiles, NFC
Duncan P. N. Exon Smith [Tue, 15 Dec 2020 22:10:47 +0000 (14:10 -0800)]
Frontend: Fix confusing comment at call to clearOutputFiles, NFC

Fix the comment in front of `compileModuleImpl`'s call to
`CompilerInstance::clearOutputFiles`. The purpose of this call is to
delete any stray temporary files after the module generation thread
crashes.

The comment is from f545f67de3a1bfdbbfad88acde5b540ce3b82f4f, and
was associated with manually deleting a generated module map. Then
13afbf42d830dd43febbeb0855aa359ca9dbfbf9 added this `clearOutputFiles`
call between the comment and the code it referenced. Finally,
1f76c4e8101b9beaf8f1b10a57faa80256ab2b05 started sending the generated
module map directly to the SourceManager instead of putting it on disk,
deleting the call that the comment referenced.

No functionality change.

3 years ago[docs][unittest][Go][StackProtector] Migrate deprecated DebugInfo::get to DILocation...
Fangrui Song [Tue, 15 Dec 2020 22:17:04 +0000 (14:17 -0800)]
[docs][unittest][Go][StackProtector] Migrate deprecated DebugInfo::get to DILocation::get

3 years ago[Hexagon] Fix bitcasting v1i8 -> i8
Krzysztof Parzyszek [Tue, 15 Dec 2020 21:59:59 +0000 (15:59 -0600)]
[Hexagon] Fix bitcasting v1i8 -> i8

3 years agoGlobalISel: Fix generic handling of single outgoing call arguments
Matt Arsenault [Tue, 15 Dec 2020 15:39:27 +0000 (10:39 -0500)]
GlobalISel: Fix generic handling of single outgoing call arguments

Simply call the argument handler like is done for the incoming
case. This will allow removal of hacks in the AMDGPU call lowering in
a future change.

3 years agoAMDGPU: Remove redundant CCAction for i1
Matt Arsenault [Tue, 15 Dec 2020 19:14:10 +0000 (14:14 -0500)]
AMDGPU: Remove redundant CCAction for i1

3 years ago[clang] Migrate deprecated DebugInfo::get to DILocation::get
Fangrui Song [Tue, 15 Dec 2020 21:59:31 +0000 (13:59 -0800)]
[clang] Migrate deprecated DebugInfo::get to DILocation::get

3 years ago[RISCV] Only custom legalize i32 arguments to vector intrinsics on RV64.
Craig Topper [Tue, 15 Dec 2020 21:34:04 +0000 (13:34 -0800)]
[RISCV] Only custom legalize i32 arguments to vector intrinsics on RV64.

3 years ago[mlir][IR] Define the singleton builtin types in ODS instead of C++
River Riddle [Tue, 15 Dec 2020 21:39:09 +0000 (13:39 -0800)]
[mlir][IR] Define the singleton builtin types in ODS instead of C++

This exposes several issues with the current generation that this revision also fixes.
 * TypeDef now allows specifying the base class to use when generating.
 * TypeDef now inherits from DialectType, which allows for using it as a TypeConstraint
 * Parser/Printers are now no longer generated in the header(removing duplicate symbols), and are now only generated when necessary.
    - Now that generatedTypeParser/Printer are only generated in the definition file,
      existing users will need to manually expose this functionality when necessary.
 * ::get() is no longer generated for singleton types, because it isn't necessary.

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

3 years ago[NFCI][SimplifyCFG] Add basic scaffolding for gradually making the pass DomTree-aware
Roman Lebedev [Tue, 15 Dec 2020 18:36:23 +0000 (21:36 +0300)]
[NFCI][SimplifyCFG] Add basic scaffolding for gradually making the pass DomTree-aware

Two observations:
1. Unavailability of DomTree makes it impossible to make
  `FoldBranchToCommonDest()` transform in certain cases,
   where the successor is dominated by predecessor,
   because we then don't have PHI's, and can't recreate them,
   well, without handrolling 'is dominated by' check,
   which doesn't really look like a great solution to me.
2. Avoiding invalidating DomTree in SimplifyCFG will
   decrease the number of `Dominator Tree Construction` by 5
   (from 28 now, i.e. -18%) in `-O3` old-pm pipeline
   (as per `llvm/test/Other/opt-O3-pipeline.ll`)
   This might or might not be beneficial for compile time.

So the plan is to make SimplifyCFG preserve DomTree, and then
eventually make DomTree fully required and preserved by the pass.

Now, SimplifyCFG is ~7KLOC. I don't think it will be nice
to do all this uplifting in a single mega-commit,
nor would it be possible to review it in any meaningful way.

But, i believe, it should be possible to do this in smaller steps,
introducing the new behavior, in an optional way, off-by-default,
opt-in option, and gradually fixing transforms one-by-one
and adding the flag to appropriate test coverage.

Then, eventually, the default should be flipped,
and eventually^2 the flag removed.

And that is what is happening here - when the new off-by-default option
is specified, DomTree is required and is claimed to be preserved,
and SimplifyCFG-internal assertions verify that the DomTree is still OK.

3 years ago[NFC][Tests][SimplifyCFG] Trim whitespaces at the end of lines
Roman Lebedev [Tue, 15 Dec 2020 21:32:50 +0000 (00:32 +0300)]
[NFC][Tests][SimplifyCFG] Trim whitespaces at the end of lines

3 years ago[flang] Clean up TODO comments and fix one (DATA constant ambiguity)
peter klausler [Tue, 15 Dec 2020 19:09:41 +0000 (11:09 -0800)]
[flang] Clean up TODO comments and fix one (DATA constant ambiguity)

Remove resolved & moot TODO comments in Common/, Parser/,
and Evaluate/.  Address a pending one relating to parsing
ambiguity in DATA statement constants, handling it with
symbol table information in Semantics and adding a test.

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

3 years ago[clang-tidy] Support all YAML supported spellings for bools in CheckOptions.
Nathan James [Tue, 15 Dec 2020 21:15:15 +0000 (21:15 +0000)]
[clang-tidy] Support all YAML supported spellings for bools in CheckOptions.

Depends on D92755

Reviewed By: aaron.ballman

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

3 years ago[PowerPC] Enable paired vector type and intrinsics when MMA is disabled
Baptiste Saleil [Tue, 15 Dec 2020 21:08:09 +0000 (15:08 -0600)]
[PowerPC] Enable paired vector type and intrinsics when MMA is disabled

This patch enables the Clang type __vector_pair and its associated LLVM
intrinsics even when MMA is disabled. With this patch, the type is now controlled
by the PPC paired-vector-memops option. The builtins and intrinsics will be
renamed to drop the mma prefix in another patch.

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

3 years ago[clangd] Validate clang-tidy Checks in clangd config.
Nathan James [Tue, 15 Dec 2020 21:10:56 +0000 (21:10 +0000)]
[clangd] Validate clang-tidy Checks in clangd config.

Add instrumentation in ConfigCompile to validate that items in ClangTidy:[Add|Remove] correspond to actual clang-tidy checks.
If they don't a warning will be presented to the user.

This is especially useful for catching typos in the glob items.

Reviewed By: sammccall

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

3 years ago[flang] Minor fix to list-directed REAL output editing
peter klausler [Tue, 15 Dec 2020 18:49:01 +0000 (10:49 -0800)]
[flang] Minor fix to list-directed REAL output editing

Always emit the letter 'E' in list-directed REAL output;
the library was omitting it for exponents greater than 99,
as should be done for E and D formatting of large exponents
without an Ed exponent digit count.

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

3 years ago[lld-macho] Add implicit dylib support for frameworks
Jez Ng [Tue, 15 Dec 2020 05:49:03 +0000 (00:49 -0500)]
[lld-macho] Add implicit dylib support for frameworks

{D93000} applied to frameworks. Partial fix for PR48511.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] Support -sub_umbrella
Jez Ng [Tue, 15 Dec 2020 03:55:28 +0000 (22:55 -0500)]
[lld-macho] Support -sub_umbrella

From what I can tell, it's essentially identical to
`-sub_library`, but it doesn't match files ending in ".dylib".

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] Don't emit rebase opcodes for relocs in TLV sections
Jez Ng [Mon, 14 Dec 2020 23:57:01 +0000 (18:57 -0500)]
[lld-macho] Don't emit rebase opcodes for relocs in TLV sections

Their addresses are already encoded as section-relative offsets, so
there's no need to rebase them at runtime. {D85080} has some context
on the weirdness of TLV sections.

Fixes llvm.org/PR48491.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] -weak_{library,framework} should always take priority
Jez Ng [Mon, 14 Dec 2020 22:59:22 +0000 (17:59 -0500)]
[lld-macho] -weak_{library,framework} should always take priority

We were not setting forceWeakImport for file paths given by
`-weak_library` if we had already loaded the file. This diff fixes that
by having `loadDylib` return a cached DylibFile instance even if we have
already loaded that file.

We still avoid emitting multiple LC_LOAD_DYLIBs, but we achieve this by
making inputFiles a SetVector instead of relying on the `loadedDylibs`
cache.

Reviewed By: #lld-macho, smeenai

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

3 years ago[mlir] Handle unknown ops in dynamic_tensor_from_elements bufferization
Sean Silva [Tue, 15 Dec 2020 02:22:58 +0000 (18:22 -0800)]
[mlir] Handle unknown ops in dynamic_tensor_from_elements bufferization

Due to how the conversion infra works, the "clone" call that this
pattern was using required all the cloned ops to be immediately
legalized as part of this dialect conversion invocation.

That was previously working due to a couple factors:

- In the test case, there was scf.if, which we happen to mark as legal
  as part of marking the entire SCF dialect as legal for the scf.parallel
  we generate here.

- Originally, this test case had std.extract_element in the body, which
  we happened to have a pattern for in this pass. After I migrated that to
  `tensor.extract` (which removed the tensor.extract bufferization from
  here), I hacked this up to use `std.dim` which we still have patterns
  for in this pass.

This patch updates the test case to use a truly opaque op `test.source`
that properly stresses this aspect of the pattern.

(this also removes a stray dependency on the `tensor` dialect that I
must have left behind as part of my hacking this pass up when migrating
to `tensor.extract`)

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

3 years ago[OpenMP] Introduce new file wrapper class for runtime
Peyton, Jonathan L [Thu, 3 Dec 2020 19:25:47 +0000 (13:25 -0600)]
[OpenMP] Introduce new file wrapper class for runtime

Introduce new kmp_safe_raii_file_t class with RAII semantics for file
open/close. It is essentially a wrapper around the C-style FILE* object.
This also unifies the way we error report if a file can't be opened.

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

3 years ago[LV] Restructure handling of -prefer-predicate-over-epilogue option [NFC]
Philip Reames [Tue, 15 Dec 2020 20:33:51 +0000 (12:33 -0800)]
[LV] Restructure handling of -prefer-predicate-over-epilogue option [NFC]

This should be purely non-functional.  When touching this code for another reason, I found the handling of the PredicateOrDontVectorize piece here very confusing.  Let's make it an explicit state (instead of an implicit combination of two variables), and use early return for options/hint processing.

3 years ago[RISCV] Use default member initializers for the feature flags in RISCVTargetInfo...
Craig Topper [Tue, 15 Dec 2020 20:33:21 +0000 (12:33 -0800)]
[RISCV] Use default member initializers for the feature flags in RISCVTargetInfo. NFC

This avoids having to repeat all the flags in the constructor's
initializer list in the same order. This style is already used by
several other targets.

3 years ago[AMDGPU] Clarify scratch initialization
Tony [Tue, 15 Dec 2020 01:42:25 +0000 (01:42 +0000)]
[AMDGPU] Clarify scratch initialization

- Clarify documentation on initializing scratch.
- Rename compute_pgm_rsrc2 field for enabling scratch from
  ENABLE_SGPR_PRIVATE_SEGMENT_WAVEFRONT_OFFSET to
  ENABLE_PRIVATE_SEGMENT to match hardware definition.

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

3 years ago[mlir] Allow nested regions in inlineRegionAndEmitStore
Tres Popp [Tue, 15 Dec 2020 16:40:12 +0000 (17:40 +0100)]
[mlir] Allow nested regions in inlineRegionAndEmitStore

This is useful for scalar code that uses for/while loops.
This has also been confirmed to work for representing std.pow as an
scf.for loop on gpus.

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

3 years agoSet decl on DeclRefExpr directly during deserialization rather than
Richard Smith [Tue, 15 Dec 2020 06:47:32 +0000 (22:47 -0800)]
Set decl on DeclRefExpr directly during deserialization rather than
relying on a setter that might have additional side-effects. NFC.

3 years agoConsider reference, pointer, and pointer-to-member TemplateArguments to be different...
Richard Smith [Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)]
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Re-commit with a fix for a couple of regressions.

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

3 years agoAdding a test case that I accidentally dropped from 27ea7d0a6e0dc51e0214707bcc265fa6f...
Aaron Ballman [Tue, 15 Dec 2020 19:56:03 +0000 (14:56 -0500)]
Adding a test case that I accidentally dropped from 27ea7d0a6e0dc51e0214707bcc265fa6f9dc9bc6

3 years agoReland dcdef5b5b3df457566e7faf61e1e5789c42528d1
Kirill Bobyrev [Tue, 15 Dec 2020 19:48:25 +0000 (20:48 +0100)]
Reland dcdef5b5b3df457566e7faf61e1e5789c42528d1

Reviewed By: sammccall

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

3 years ago[OPENMP51] Add present modifier in defaultmap clause
cchen [Tue, 15 Dec 2020 19:49:52 +0000 (13:49 -0600)]
[OPENMP51] Add present modifier in defaultmap clause

Support present modifier in defaultmap by adding an extra dimension
for `ImplicitMap`. Therefore, we now create OMPMapClause in `ActOnOpenMPExecutableDirective`
based on both `maptype` and `maptype-modifier`.

Reviewed By: ABataev

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

3 years ago[lld/mac] Set ordinal on dynamic undefined symbols in symbol table
Nico Weber [Tue, 15 Dec 2020 18:36:15 +0000 (13:36 -0500)]
[lld/mac] Set ordinal on dynamic undefined symbols in symbol table

This lets `nm -m` print "(from libfoo)" in its output, which is more
accessible than dumping the bind table.

See https://reviews.llvm.org/D57190#2455761 for the somewhat
surprising `AltEntry` that appears in symtab.s.

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