platform/upstream/llvm.git
4 years ago[Syntax] Mark synthesized nodes as modifiable
Ilya Biryukov [Tue, 14 Jan 2020 15:27:06 +0000 (16:27 +0100)]
[Syntax] Mark synthesized nodes as modifiable

This was an oversight in the original patch.
Also add corresponding tests.

4 years ago[Syntax] Assert invariants on tree structure and fix a bug in mutations
Ilya Biryukov [Tue, 14 Jan 2020 15:07:11 +0000 (16:07 +0100)]
[Syntax] Assert invariants on tree structure and fix a bug in mutations

Add checks for some structural invariants when building and mutating
the syntax trees.

Fix a bug failing the invariants after mutations: the parent of nodes
added into the tree was null.

4 years ago[clang-tidy] Match InitListExpr in modernize-use-default-member-init
Malcolm Parsons [Tue, 14 Jan 2020 15:19:19 +0000 (15:19 +0000)]
[clang-tidy] Match InitListExpr in modernize-use-default-member-init

Summary:
modernize-use-default-member-init wasn't warning about redundant initialisers
when the initialiser was an InitListExpr.  Add initListExpr to the matcher.

Fixes: PR44439

Reviewers: aaron.ballman, alexfh, JonasToth

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years agoRevert "[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests."
Tom Weaver [Tue, 14 Jan 2020 15:12:02 +0000 (15:12 +0000)]
Revert "[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests."

This reverts commit 35787e3a062a4a21c145137552d20cb1169c74fc.

4 years ago[AArch64] Fix save register pairing for Windows AAPCS
Sanne Wouda [Tue, 14 Jan 2020 13:16:57 +0000 (13:16 +0000)]
[AArch64] Fix save register pairing for Windows AAPCS

Summary:
On Windows, when a function does not have an unwind table (for example, EH
filtering funclets), we don't correctly pair FP and LR to form the frame record
in all circumstances.

Fix this by invalidating a pair when the second register is FP when compiling
for Windows, even when CFI is not needed.

Fixes PR44271 introduced by D65653.

Reviewers: efriedma, sdesmalen, rovka, rengolin, t.p.northover, thegameg, greened

Reviewed By: rengolin

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomput...
Florian Hahn [Tue, 14 Jan 2020 14:50:07 +0000 (14:50 +0000)]
Revert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.""

This reverts commit a03d7b0f24b65d69721dbbbc871df0629efcf774.

As discussed in D68298, this causes a compile-time regression, in case
the DTs requested are not used elsewhere in GlobalOpt. We should only
get the DTs if they are available here, but this seems not possible with
the legacy pass manager from a module pass.

4 years ago[OpenCL] Add MSAA sharing extension builtin functions
Sven van Haastregt [Tue, 14 Jan 2020 14:46:42 +0000 (14:46 +0000)]
[OpenCL] Add MSAA sharing extension builtin functions

Add the MSAA sharing builtin functions from the OpenCL Extension
Specification.

Patch by Pierre Gondois and Sven van Haastregt.

4 years ago[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.
Tom Weaver [Tue, 14 Jan 2020 14:43:30 +0000 (14:43 +0000)]
[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.

Adds 22 distinct tests that exercise the live-debug-values passes
expected behaviour.

reviewers: aprantl, vsk

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

4 years ago[AIX] ExternalSymbolSDNode lowering
Xiangling Liao [Tue, 7 Jan 2020 15:53:24 +0000 (10:53 -0500)]
[AIX] ExternalSymbolSDNode lowering

For memcpy/memset/memmove etc., replace ExternalSymbolSDNode with a
MCSymbolSDNode, which have a prefix dot before function name as entry
point symbol.

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

4 years ago[lldb/DWARF] Move location list sections into DWARFContext
Pavel Labath [Mon, 23 Dec 2019 15:31:36 +0000 (16:31 +0100)]
[lldb/DWARF] Move location list sections into DWARFContext

These are the last sections not managed by the DWARFContext object. I
also introduce separate SectionType enums for dwo section variants, as
this is necessary for proper handling of single-file split dwarf.

4 years ago[llvm-readobj][llvm-readelf][test] - Add a few more dynamic section tests.
Georgii Rymar [Thu, 26 Dec 2019 11:55:53 +0000 (14:55 +0300)]
[llvm-readobj][llvm-readelf][test] - Add a few more dynamic section tests.

This adds a few more tests for dynamic section.

We only had tests for simple unknown values for 64-bits target,
in this patch I've added OS specific and processor specific tags.
Also it tests both 32 and 64-bits targets now.

It will help to fix the formatting issues we have and diagnose a possible new ones.

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

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:54:39 +0000 (13:54 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Remove Ctx null test as clang static analyzer assumes that this can fail - replace it with an assertion as the pointer is always dereferenced below.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:48:02 +0000 (13:48 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use cast<> instead of cast_or_null<> since the pointers are always dereferenced and cast<> will perform the null assertion for us.

4 years agoRemove duplicate variable. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:42:26 +0000 (13:42 +0000)]
Remove duplicate variable. NFCI.

4 years agoMerge isa<> and getAs<> calls to fix "pointer is null" static analyzer warnings....
Simon Pilgrim [Tue, 14 Jan 2020 13:41:07 +0000 (13:41 +0000)]
Merge isa<> and getAs<> calls to fix "pointer is null" static analyzer warnings. NFCI.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:28:46 +0000 (13:28 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix "null pointer passed to nonnull argument" clang static analyzer warnings. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 13:23:56 +0000 (13:23 +0000)]
Fix "null pointer passed to nonnull argument" clang static analyzer warnings. NFCI.

Assert that the memcpy arguments are valid.

4 years agoExpression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions
Levon Ter-Grigoryan [Tue, 14 Jan 2020 13:33:43 +0000 (14:33 +0100)]
Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions

Summary:
This change is connected with
https://reviews.llvm.org/D69843

In large codebases, we sometimes see Module::FindFunctions (when called from
ClangExpressionDeclMap::FindExternalVisibleDecls) returning huge amounts of
functions.

In current fix I trying to return only function_fullnames from ManualDWARFIndex::GetFunctions when eFunctionNameTypeFull is passed as argument.

Reviewers: labath, jarin, aprantl

Reviewed By: labath

Subscribers: shafik, clayborg, teemperor, arphaman, lldb-commits

Tags: #lldb

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

4 years agoAArch64: fix bitcode upgrade of @llvm.neon.addp.
Tim Northover [Thu, 9 Jan 2020 14:28:48 +0000 (14:28 +0000)]
AArch64: fix bitcode upgrade of @llvm.neon.addp.

We were upgrading it to faddp, but a version taking two type parameters instead
of one. This then got upgraded a second time to the version with just one
parameter, but occasionally (for reasons I don't understand) this unusual
two-stage process corrupted a use-list, leading to a crash when the two faddp
declarations didn't match.

4 years ago[InstSimplify] add tests for vector select; NFC
Sanjay Patel [Tue, 14 Jan 2020 13:40:27 +0000 (08:40 -0500)]
[InstSimplify] add tests for vector select; NFC

4 years ago[TableGen] Update editor modes for new keywords.
Simon Tatham [Tue, 14 Jan 2020 13:12:16 +0000 (13:12 +0000)]
[TableGen] Update editor modes for new keywords.

Summary:
D71407 and D71474 added new keywords to the Tablegen language:
`defvar`, `if`, `then` and `else`. This commit updates the various
editor modes to highlight them appropriately.

Some of the modes also didn't include `defset`, so I've added that too
while I was there.

Reviewers: MaskRay, lebedev.ri, plotfi

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef
Raphael Isemann [Tue, 14 Jan 2020 12:06:31 +0000 (13:06 +0100)]
[lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef

4 years ago[FPEnv] Add some comments to IRBuilder.h
Ulrich Weigand [Tue, 14 Jan 2020 13:19:02 +0000 (14:19 +0100)]
[FPEnv] Add some comments to IRBuilder.h

As requested via post-commit comment for D71467, this adds comments
documenting CreateFCmp vs. CreateFCmpS to the header file.

4 years ago[RISCV][NFC] Deduplicate Atomic Intrinsic Definitions
Sam Elliott [Tue, 14 Jan 2020 13:16:52 +0000 (13:16 +0000)]
[RISCV][NFC] Deduplicate Atomic Intrinsic Definitions

Summary:
This is a slight cleanup, to use multiclasses to avoid the duplication between
the different atomic intrinsic definitions. The produced intrinsics are
unchanged, they're just generated in a more succinct way.

Reviewers: asb, luismarques, jrtc27

Reviewed By: luismarques, jrtc27

Subscribers: Jim, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits

Tags: #llvm

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

4 years ago[FPEnv] Fix chain handling regression after 04a8696
Ulrich Weigand [Tue, 14 Jan 2020 13:04:53 +0000 (14:04 +0100)]
[FPEnv] Fix chain handling regression after 04a8696

Code in getRoot made the assumption that every node in PendingLoads
must always itself have a dependency on the current DAG root node.

After the changes in 04a8696, it turns out that this assumption no
longer holds true, causing wrong codegen in some cases (e.g. stores
after constrained FP intrinsics might get deleted).

To fix this, we now need to make sure that the TokenFactor created
by getRoot always includes the previous root, if there is no implicit
dependency already present.

The original getControlRoot code already has exactly this check,
so this patch simply reuses that code now for getRoot as well.
This fixes the regression.

NFC if no constrained FP intrinsic is present.

4 years agoMake helper functions static or move them into anonymous namespaces. NFC.
Benjamin Kramer [Tue, 14 Jan 2020 13:06:12 +0000 (14:06 +0100)]
Make helper functions static or move them into anonymous namespaces.  NFC.

4 years ago[unittests] Fix "comparison of integers of different signs" warnings
Miloš Stojanović [Mon, 13 Jan 2020 18:27:03 +0000 (19:27 +0100)]
[unittests] Fix "comparison of integers of different signs" warnings

A warning is sent because `std::distance()` returns a signed type so
`CmpHelperEQ()` gets instantiated into a function that compares
differently signed arguments.

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

4 years ago[ARM,MVE] Use the new Tablegen `defvar` and `if` statements.
Simon Tatham [Tue, 14 Jan 2020 12:02:30 +0000 (12:02 +0000)]
[ARM,MVE] Use the new Tablegen `defvar` and `if` statements.

Summary:
This cleans up a lot of ugly `foreach` bodges that I've been using to
work around the lack of those two language features. Now they both
exist, I can make then all into something more legible!

In particular, in the common pattern in `ARMInstrMVE.td` where a
multiclass defines an `Instruction` instance plus one or more `Pat` that
select it, I've used a `defvar` to wrap `!cast<Instruction>(NAME)` so
that the patterns themselves become a little more legible.

Replacing a `foreach` with a `defvar` removes a level of block
structure, so several pieces of code have their indentation changed by
this patch. Best viewed with whitespace ignored.

NFC: the output of `llvm-tblgen -print-records` on the two affected
Tablegen sources is exactly identical before and after this change, so
there should be no effect at all on any of the other generated files.

Reviewers: MarkMurrayARM, miyuki

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[lldb/Expression] Improve interpreter error message with a non-running target
Med Ismail Bennani [Tue, 14 Jan 2020 11:12:57 +0000 (12:12 +0100)]
[lldb/Expression] Improve interpreter error message with a non-running target

When trying to interpret an expression with a function call, if the
process hasn't been launched, the expression fails to be interpreted
and the user gets the following  error message:

```error: Can't run the expression locally```

This message doesn't explain why the expression failed to be
interpreted, that's why this patch improves the error message that is
displayed when trying to run an expression while no process is running.

rdar://11991708

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[ARM][LowOverheadLoops] Allow all MVE instrs.
Sam Parker [Tue, 14 Jan 2020 12:02:32 +0000 (12:02 +0000)]
[ARM][LowOverheadLoops] Allow all MVE instrs.

We have a whitelist of instructions that we allow when tail
predicating, since these are trivial ones that we've deemed need no
special handling. Now change ARMLowOverheadLoops to allow the
non-trivial instructions if they're contained within a valid VPT
block. Since a valid block is one that is predicated upon the VCTP so
we know that these non-trivial instructions will still behave as
expected once the implicit predication is used instead.

This also fixes a previous test failure.

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

4 years agoFix "MIParser::getIRValue(unsigned int)’ defined but not used" warning. NFCI.
Simon Pilgrim [Tue, 14 Jan 2020 11:58:54 +0000 (11:58 +0000)]
Fix "MIParser::getIRValue(unsigned int)’ defined but not used" warning. NFCI.

4 years ago[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and...
Simon Pilgrim [Tue, 14 Jan 2020 11:51:09 +0000 (11:51 +0000)]
[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SHL handling.

As mentioned by @nikic on rGef5debac4302, we can merge the guaranteed bottom zero bits from the shifted value, and then, if a min shift amount is known, zero out the bottom bits as well.

4 years ago[ARM][LowOverheadLoops] Change predicate inspection
Sam Parker [Fri, 10 Jan 2020 14:47:29 +0000 (14:47 +0000)]
[ARM][LowOverheadLoops] Change predicate inspection

Use the already provided helper function to get the operand type so
that we can detect whether the vpr is being used as a predicate or
not. Also use existing helpers to get the predicate indices when we
converting the vpt blocks. This enables us to support both types of
vpr predicate operand.

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

4 years ago[ARM][Thumb2] Fix ADD/SUB invalid writes to SP
Diogo Sampaio [Mon, 13 Jan 2020 11:36:02 +0000 (11:36 +0000)]
[ARM][Thumb2] Fix ADD/SUB invalid writes to SP

Summary:
This patch fixes pr23772  [ARM] r226200 can emit illegal thumb2 instruction: "sub sp, r12, #80".
The violation was that SUB and ADD (reg, immediate) instructions can only write to SP if the source register is also SP. So the above instructions was unpredictable.
To enforce that the instruction t2(ADD|SUB)ri does not write to SP we now enforce the destination register to be rGPR (That exclude PC and SP).
Different than the ARM specification, that defines one instruction that can read from SP, and one that can't, here we inserted one that can't write to SP, and other that can only write to SP as to reuse most of the hard-coded size optimizations.
When performing this change, it uncovered that emitting Thumb2 Reg plus Immediate could not emit all variants of ADD SP, SP #imm instructions before so it was refactored to be able to. (see test/CodeGen/Thumb2/mve-stacksplot.mir where we use a subw sp, sp, Imm12 variant )
It also uncovered a disassembly issue of adr.w instructions, that were only written as SUBW instructions (see llvm/test/MC/Disassembler/ARM/thumb2.txt).

Reviewers: eli.friedman, dmgreen, carwil, olista01, efriedma, andreadb

Reviewed By: efriedma

Subscribers: gbedwell, john.brawn, efriedma, ostannard, kristof.beyls, hiraditya, dmgreen, llvm-commits

Tags: #llvm

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

4 years ago[X86][SSE] Add add(shl(and(x,c1),c2),c3) test case with non-uniform shift value
Simon Pilgrim [Tue, 14 Jan 2020 11:41:26 +0000 (11:41 +0000)]
[X86][SSE] Add add(shl(and(x,c1),c2),c3) test case with non-uniform shift value

As mentioned by @nikic on rGef5debac4302, we should merge the guaranteed top zero bits from the shifted value and min shift amount code so they can both set the high bits to zero.

4 years ago[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and...
Simon Pilgrim [Tue, 14 Jan 2020 11:20:09 +0000 (11:20 +0000)]
[SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SRL handling.

As mentioned by @nikic on rGef5debac4302 (although that was just about SHL), we can merge the guaranteed top zero bits from the shifted value, and then, if a min shift amount is known, zero out the top bits as well.

SHL tests / handling will be added in a follow up patch.

4 years ago[ARM][MVE] Disallow VPSEL for tail predication
Sam Parker [Tue, 14 Jan 2020 11:02:32 +0000 (11:02 +0000)]
[ARM][MVE] Disallow VPSEL for tail predication

Due to the current way that we collect predicated instructions, we
can't easily handle vpsel in tail predicated loops. There are a
couple of issues:
1) It will use the VPR as a predicate operand, but doesn't have to be
   instead a VPT block, which means we can assert while building up
   the VPT block because we don't find another VPST to being a new
   one.
2) VPSEL still requires a VPR operand even after tail predicating,
   which means we can't remove it unless there is another
   instruction, such as vcmp, that can provide the VPR def.

The first issue should be a relatively simple fix in the logic of the
LowOverheadLoops pass, whereas the second will require us to
represent the 'implicit' tail predication with an explicit value.

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

4 years ago[mlir] Fix translation of splat constants to LLVM IR
Alex Zinenko [Tue, 14 Jan 2020 10:30:25 +0000 (11:30 +0100)]
[mlir] Fix translation of splat constants to LLVM IR

Summary:
When converting splat constants for nested sequential LLVM IR types wrapped in
MLIR, the constant conversion was erroneously assuming it was always possible
to recursively construct a constant of a sequential type given only one value.
Instead, wait until all sequential types are unpacked recursively before
constructing a scalar constant and wrapping it into the surrounding sequential
type.

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Fix ILP32D lowering for double+double/double+int return types
James Clarke [Tue, 14 Jan 2020 11:17:19 +0000 (11:17 +0000)]
[RISCV] Fix ILP32D lowering for double+double/double+int return types

Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.

Reviewers: asb, lenary

Reviewed By: asb, lenary

Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits

Tags: #clang

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

4 years ago[mlir] Create a gpu.module operation for the GPU Dialect.
Tres Popp [Tue, 14 Jan 2020 10:09:59 +0000 (11:09 +0100)]
[mlir] Create a gpu.module operation for the GPU Dialect.

Summary:
This is based on the use of code constantly checking for an attribute on
a model and instead represents the distinct operaion with a different
op. Instead, this op can be used to provide better filtering.

Reviewers: herhut, mravishankar, antiagainst, rriddle

Reviewed By: herhut, antiagainst, rriddle

Subscribers: liufengdb, aartbik, jholewinski, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinition
Raphael Isemann [Tue, 14 Jan 2020 10:35:57 +0000 (11:35 +0100)]
[lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinition

Makes this function exit early instead of nesting if statements.

Also removed all the if (tag_type->getDecl()) checks. If we created
a TagType with a nullptr as a Decl then Clang would have already
deferenced that nullptr during TagType creation so there is no point
in gracefully handling a nullptr here.

4 years ago[mlir] Ran git-clang-format.
Adrian [Tue, 14 Jan 2020 10:41:40 +0000 (11:41 +0100)]
[mlir] Ran git-clang-format.

Summary:
I forgot to ran git-clang-format before committing.

4 years ago[mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations.
Adrian Kuegel [Wed, 8 Jan 2020 13:06:22 +0000 (14:06 +0100)]
[mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations.

Summary:
These operations can be used to specify a loop nest with a body that can
contain reductions. The iteration space can be iterated in any order.

RFC: https://groups.google.com/a/tensorflow.org/d/topic/mlir/pwtSgiKFPis/discussion

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

4 years ago[ARM][MVE] Masked gathers from base + vector of offsets
Anna Welker [Tue, 14 Jan 2020 09:48:02 +0000 (09:48 +0000)]
[ARM][MVE] Masked gathers from base + vector of offsets

Enables the masked gather pass to create a masked
gather loading from a base and vector of offsets.
This also enables v8i16 and v16i8 gather loads.

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

4 years ago[Target] Fix uninitialized value in 10c11e4e2d05cf0e8f8251f50d84ce77eb1e9b8d
Sam McCall [Tue, 14 Jan 2020 10:16:41 +0000 (11:16 +0100)]
[Target] Fix uninitialized value in 10c11e4e2d05cf0e8f8251f50d84ce77eb1e9b8d

4 years ago[TableGen] Introduce an if/then/else statement.
Simon Tatham [Tue, 14 Jan 2020 09:10:34 +0000 (09:10 +0000)]
[TableGen] Introduce an if/then/else statement.

Summary:
This allows you to make some of the defs in a multiclass or `foreach`
conditional on an expression computed from the parameters or iteration
variables.

It was already possible to simulate an if statement using a `foreach`
with a dummy iteration variable and a list constructed using `!if` so
that it had length 0 or 1 depending on the condition, e.g.

  foreach unusedIterationVar = !if(condition, [1], []<int>) in { ... }

But this syntax is nicer to read, and also more convenient because it
allows an else clause.

To avoid upheaval in the implementation, I've implemented `if` as pure
syntactic sugar on the `foreach` implementation: internally, `ParseIf`
actually does construct exactly the kind of foreach shown above (and
another reversed one for the else clause if present).

Reviewers: nhaehnle, hfinkel

Reviewed By: hfinkel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[TableGen] Introduce a `defvar` statement.
Simon Tatham [Tue, 14 Jan 2020 09:10:18 +0000 (09:10 +0000)]
[TableGen] Introduce a `defvar` statement.

Summary:
This allows you to define a global or local variable to an arbitrary
value, and refer to it in subsequent definitions.

The main use I anticipate for this is if you have to compute some
difficult function of the parameters of a multiclass, and then use it
many times. For example:

  multiclass Foo<int i, string s> {
    defvar op = !cast<BaseClass>("whatnot_" # s # "_" # i);
    def myRecord {
      dag a = (op this, (op that, the other), (op x, y, z));
      int b = op.subfield;
    }
    def myOtherRecord<"template params including", op>;
  }

There are a couple of ways to do this already, but they're not really
satisfactory. You can replace `defvar x = y` with a loop over a
singleton list, `foreach x = [y] in { ... }` - but that's unintuitive
to someone who hasn't seen that workaround idiom before, and requires
an extra pair of braces that you often didn't really want. Or you can
define a nested pair of multiclasses, with the inner one taking `x` as
a template parameter, and the outer one instantiating it just once
with the desired value of `x` computed from its other parameters - but
that makes it awkward to sequentially compute each value based on the
previous ones. I think `defvar` makes things considerably easier.

You can also use `defvar` at the top level, where it inserts globals
into the same map used by `defset`. That allows you to define global
constants without having to make a dummy record for them to live in:

  defvar MAX_BUFSIZE = 512;

  // previously:
  // def Dummy { int MAX_BUFSIZE = 512; }
  // and then refer to Dummy.MAX_BUFSIZE everywhere

Reviewers: nhaehnle, hfinkel

Reviewed By: hfinkel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] Ignore implicit casts in modernize-use-default-member-init
Malcolm Parsons [Tue, 14 Jan 2020 09:54:31 +0000 (09:54 +0000)]
[clang-tidy] Ignore implicit casts in modernize-use-default-member-init

Summary:
Initialising a pointer from nullptr involves an implicit cast.
Ignore it after getting initialiser from InitListExpr.

Fixes: PR44440

Reviewers: aaron.ballman, alexfh, JonasToth

Reviewed By: JonasToth

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[llvm-readobj][test] - Fix grammar in comments.
Georgii Rymar [Tue, 14 Jan 2020 09:51:52 +0000 (12:51 +0300)]
[llvm-readobj][test] - Fix grammar in comments.

This addresses post commit review comments for D71766.

4 years ago[AMDGPU] Model distance to instruction in bundle
Stanislav Mekhanoshin [Tue, 14 Jan 2020 01:01:36 +0000 (17:01 -0800)]
[AMDGPU] Model distance to instruction in bundle

This change allows to model the height of the instruction
within a bundle for latency adjustment purposes.

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

4 years ago[libcxx] [test] Add casts to avoid signed/unsigned mismatch warnings on MSVC++
Billy Robert O'Neal III [Tue, 14 Jan 2020 09:10:11 +0000 (01:10 -0800)]
[libcxx] [test] Add casts to avoid signed/unsigned mismatch warnings on MSVC++

A bug was filed that these warnings should not be emitted as DevCom-883961. ( https://developercommunity.visualstudio.com/content/problem/883961/c4389-signedunsigned-mismatch-should-not-be-emitte.html )

4 years ago[lldb][NFC] Rewrite python_api/rdar-12481949 test
Raphael Isemann [Tue, 14 Jan 2020 09:06:46 +0000 (10:06 +0100)]
[lldb][NFC] Rewrite python_api/rdar-12481949 test

Summary:
This renames the test `rdar-12481949` to `get-value-32bit-int` as it just tests that we return the
correct result get calling GetValueAsSigned/GetValueAsUnsigned on 32-bit integers.

It also deletes all the strange things going on in this test including resetting the data formatters (which are to my
knowledge not used to calculate scalar values) and testing Python's long integers (let's just assume that our Python
distribution works correctly). Also modernises the setup code.

Reviewers: labath, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[AMDGPU] Fix getInstrLatency() always returning 1
Stanislav Mekhanoshin [Mon, 13 Jan 2020 22:30:21 +0000 (14:30 -0800)]
[AMDGPU] Fix getInstrLatency() always returning 1

We do not have InstrItinerary so generic getInstLatency() was always
defaulting to return 1 cycle. We need to use TargetSchedModel instead
to compute an instruction's latency.

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

4 years ago[mlir] Fix -Wunused
Sam McCall [Tue, 14 Jan 2020 09:07:51 +0000 (10:07 +0100)]
[mlir] Fix -Wunused

4 years ago[lldb] Don't defend against internal LLVM errors in IRInterpreter
Raphael Isemann [Tue, 14 Jan 2020 08:53:50 +0000 (09:53 +0100)]
[lldb] Don't defend against internal LLVM errors in IRInterpreter

Summary:
Whenever we cast an LLVM instruction to one of its subclasses, we do a double check if the RTTI
enum value actually allows us to cast the class. I don't see a way this can ever happen as even when
LLVM's RTTI system has some corrupt internal state (which we probably should not test in the first
place) we just reuse LLVM RTTI to do the second check.

This also means that if we ever make an actual programming error in this function (e.g., have a enum
value and then cast it to a different subclass), we just silently fall back to the JIT in our tests.

We also can't test this code in any reasonable way.

This removes the checks and uses `llvm::cast` instead which will raise a fatal error when casting fails.

Reviewers: labath, mib

Reviewed By: labath

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Fix that SBThread.GetStopDescription is returning strings with uninitialized...
Raphael Isemann [Tue, 14 Jan 2020 08:15:40 +0000 (09:15 +0100)]
[lldb] Fix that SBThread.GetStopDescription is returning strings with uninitialized memory at the end.

Summary:
`SBThread.GetStopDescription` is a curious API as it takes a buffer length as a parameter that specifies
how many bytes the buffer we pass has. Then we fill the buffer until the specified length (or the length
of the stop description string) and return the string length. If the buffer is a nullptr however, we instead
return how many bytes we would have written to the buffer so that the user can allocate a buffer with
the right size and pass that size to a subsequent `SBThread.GetStopDescription` call.

Funnily enough, it is not possible to pass a nullptr via the Python SWIG bindings, so that might be the
first API in LLDB that is not only hard to use correctly but impossible to use correctly. The only way to
call this function via Python is to throw in a large size limit that is hopefully large enough to contain the
stop description (otherwise we only get the truncated stop description).

Currently passing a size limit that is smaller than the returned stop description doesn't cause the
Python bindings to return the stop description but instead the truncated stop description + uninitialized characters
at the end of the string. The reason for this is that we return the result of `snprintf` from the method
which returns the amount of bytes that *would* have been written (which is larger than the buffer).
This causes our Python bindings to return a string that is as large as full stop description but the
buffer that has been filled is only as large as the passed in buffer size.

This patch fixes this issue by just recalculating the string length in our buffer instead of relying on the wrong
return value. We also have to do this in a new type map as the old type map is also used for all methods
with the given argument pair `char *dst, size_t dst_len` (e.g. SBProcess.GetSTDOUT`). These methods have
different semantics for these arguments and don't null-terminate the returned buffer (they instead return the
size in bytes) so we can't change the existing typemap without breaking them.

Reviewers: labath, jingham

Reviewed By: labath

Subscribers: clayborg, shafik, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[AMDGPU] Remove duplicate gfx10 assembler and disassembler tests
Jay Foad [Mon, 13 Jan 2020 13:52:02 +0000 (13:52 +0000)]
[AMDGPU] Remove duplicate gfx10 assembler and disassembler tests

Summary: Depends on D72611.

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Improve error checking in gfx10 assembler tests
Jay Foad [Mon, 13 Jan 2020 13:39:52 +0000 (13:39 +0000)]
[AMDGPU] Improve error checking in gfx10 assembler tests

Summary:
This adds checks that the expected error was actually reported against
the correct instruction, and fixes a couple of problems that that showed
up: one incorrect W32-ERR:

 v_cmp_class_f16_sdwa vcc, v1, v2 src0_sel:DWORD src1_sel:DWORD
 // W64: encoding: [0xf9,0x04,0x1e,0x7d,0x01,0x00,0x06,0x06]
-// W32-ERR: error: invalid operand for instruction
+// W32-ERR: error: {{instruction not supported on this GPU|invalid operand for instruction}}

and one missing W32-ERR:

 v_cmp_class_f16_sdwa s[6:7], v1, v2 src0_sel:DWORD src1_sel:DWORD
 // W64: encoding: [0xf9,0x04,0x1e,0x7d,0x01,0x86,0x06,0x06]
+// W32-ERR: error: invalid operand for instruction

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Add gfx9 assembler and disassembler test cases
Jay Foad [Sun, 12 Jan 2020 21:33:11 +0000 (21:33 +0000)]
[AMDGPU] Add gfx9 assembler and disassembler test cases

Summary:
This adds assembler tests for cases that were previously only in the
disassembler tests, and vice versa.

Reviewers: rampitec, arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

Tags: #llvm

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

4 years ago[OpenMP][Tool] Improving stack trace for Archer
Joachim Protze [Tue, 14 Jan 2020 08:12:48 +0000 (22:12 -1000)]
[OpenMP][Tool] Improving stack trace for Archer

The OpenMP runtime is not instrumented, so entering the runtime leaves no hint
on the source line of the pragma on ThreadSanitizer's function stack.

This patch adds function entry/exit annotations for OpenMP parallel regions,
and synchronization regions (barrier, taskwait, taskgroup).

Reviewed By: jdoerfert

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

4 years ago[ELF] Delete unintended --force-bti
Fangrui Song [Tue, 14 Jan 2020 07:56:47 +0000 (23:56 -0800)]
[ELF] Delete unintended --force-bti

4 years ago[OpenMP][Tool] Make tests for archer dependent on TSan
Joachim Protze [Tue, 14 Jan 2020 07:44:06 +0000 (21:44 -1000)]
[OpenMP][Tool] Make tests for archer dependent on TSan

If the openmp project is built standalone, the test compiler is feature tested for an available -fsanitize=thread flag.
If the openmp project is built as part of llvm, the target tsan is needed to test archer.

An additional line (requires tsan) was introduced to the tests, this patch updates the line numbers for the race.

Follow-up for 77ad98c

Reviewed By: jdoerfert

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

4 years ago[ELF] Add -z force-ibt and -z shstk for Intel Control-flow Enforcement Technology
Fangrui Song [Wed, 11 Dec 2019 02:05:36 +0000 (18:05 -0800)]
[ELF] Add -z force-ibt and -z shstk for Intel Control-flow Enforcement Technology

This patch is a joint work by Rui Ueyama and me based on D58102 by Xiang Zhang.

It adds Intel CET (Control-flow Enforcement Technology) support to lld.
The implementation follows the draft version of psABI which you can
download from https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI.

CET introduces a new restriction on indirect jump instructions so that
you can limit the places to which you can jump to using indirect jumps.

In order to use the feature, you need to compile source files with
-fcf-protection=full.

* IBT is enabled if all input files are compiled with the flag. To force enabling ibt, pass -z force-ibt.
* SHSTK is enabled if all input files are compiled with the flag, or if -z shstk is specified.

IBT-enabled executables/shared objects have two PLT sections, ".plt" and
".plt.sec".  For the details as to why we have two sections, please read
the comments.

Reviewed By: xiangzhangllvm

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

4 years ago[MC] Don't resolve relocations referencing STB_LOCAL STT_GNU_IFUNC
Fangrui Song [Tue, 14 Jan 2020 07:35:57 +0000 (23:35 -0800)]
[MC] Don't resolve relocations referencing STB_LOCAL STT_GNU_IFUNC

4 years ago[PowerPC] [NFC] set instruction number as 1st priority of lsr cost model.
Zheng Chen [Tue, 14 Jan 2020 07:18:21 +0000 (02:18 -0500)]
[PowerPC] [NFC] set instruction number as 1st priority of lsr cost model.

4 years ago[MLIR] Fix broken link locations after move to monorepo
Daniel Galvez [Tue, 14 Jan 2020 07:13:42 +0000 (07:13 +0000)]
[MLIR] Fix broken link locations after move to monorepo

I used the codemod python tool to do this with the following commands:

codemod 'tensorflow/mlir/blob/master/include' 'llvm/llvm-project/blob/master/mlir/include'
codemod 'tensorflow/mlir/blob/master' 'llvm/llvm-project/blob/master/mlir'
codemod 'tensorflow/mlir' 'llvm-project/llvm'

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

4 years ago[X86] Copy the nofpexcept flag when folding a load into an instruction using the...
Craig Topper [Tue, 14 Jan 2020 06:02:45 +0000 (22:02 -0800)]
[X86] Copy the nofpexcept flag when folding a load into an instruction using the load folding tables./

4 years ago[X86] Add test to show that nofpexcept flag is not preserved by stack reload folding.
Craig Topper [Tue, 14 Jan 2020 05:39:12 +0000 (21:39 -0800)]
[X86] Add test to show that nofpexcept flag is not preserved by stack reload folding.

4 years ago[clang] [test] Fix riscv-toolchain-extra to be less picky about paths
Michał Górny [Mon, 13 Jan 2020 09:13:44 +0000 (10:13 +0100)]
[clang] [test] Fix riscv-toolchain-extra to be less picky about paths

Fix riscv-toolchain-extra tests to pass when CLANG_RESOURCE_DIR is set
to another value than the default.

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

4 years ago[mlir] [VectorOps] fixed typo in verifier of slice op
Aart Bik [Mon, 13 Jan 2020 23:58:49 +0000 (15:58 -0800)]
[mlir] [VectorOps] fixed typo in verifier of slice op

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: nicolasvasilache, rriddle

Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Utility] Add std::move to make placate clang 3.8
Jonas Devlieghere [Tue, 14 Jan 2020 02:23:39 +0000 (18:23 -0800)]
[lldb/Utility] Add std::move to make placate clang 3.8

This fixes an error thrown by clang 3.8 that no viable conversion from
returned value to the function return type.

4 years agotry to fix InterfaceStubs/lambda.cpp on Windows after bd8c8827d96f0
Nico Weber [Tue, 14 Jan 2020 02:22:46 +0000 (21:22 -0500)]
try to fix InterfaceStubs/lambda.cpp on Windows after bd8c8827d96f0

4 years ago[LanguageRuntime] Retire an unused member function. NFCI.
Davide Italiano [Tue, 14 Jan 2020 01:37:39 +0000 (17:37 -0800)]
[LanguageRuntime] Retire an unused member function. NFCI.

4 years ago[llvm-exegesis] Initialize const bitvector member
Jonas Devlieghere [Tue, 14 Jan 2020 01:31:07 +0000 (17:31 -0800)]
[llvm-exegesis] Initialize const bitvector member

This causes an error with older versions of clang: constructor for
'llvm::exegesis::InstructionsCache' must explicitly initialize the const
member 'BVC'

4 years ago[GlobalISel] Change representation of shuffle masks in MachineOperand.
Eli Friedman [Mon, 13 Jan 2020 23:32:45 +0000 (15:32 -0800)]
[GlobalISel] Change representation of shuffle masks in MachineOperand.

We're planning to remove the shufflemask operand from ShuffleVectorInst
(D72467); fix GlobalISel so it doesn't depend on that Constant.

The change to prelegalizercombiner-shuffle-vector.mir happens because
the input contains a literal "-1" in the mask (so the parser/verifier
weren't really handling it properly). We now treat it as equivalent to
"undef" in all contexts.

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

4 years agoRe-enable testing of .s tests under test/CodeGen/X86.
Richard Smith [Tue, 14 Jan 2020 00:12:50 +0000 (16:12 -0800)]
Re-enable testing of .s tests under test/CodeGen/X86.

These were temporarily disabled in 2013 and we apparently forgot to
ever turn them back on again.

Fix spelling of flag to llvm-mc in recently-added test that wasn't
actually being run due to this.

4 years ago[mlir] NFC: Remove unused variable.
River Riddle [Tue, 14 Jan 2020 00:15:06 +0000 (16:15 -0800)]
[mlir] NFC: Remove unused variable.

4 years ago[mlir] Add support for attaching a visibility to symbols.
River Riddle [Mon, 13 Jan 2020 23:54:08 +0000 (15:54 -0800)]
[mlir] Add support for attaching a visibility to symbols.

Summary:
The visibility defines the structural reachability of the symbol within the IR. Symbols can define one of three visibilities:

* Public
The symbol \may be accessed from outside of the visible IR. We cannot assume that we can observe all of the uses of this symbol.

* Private
The symbol may only be referenced from within the operations in the current symbol table, via SymbolRefAttr.

* Nested
The symbol may be referenced by operations in symbol tables above the current symbol table, as long as each symbol table parent also defines a non-private symbol. This allows or referencing the symbol from outside of the defining symbol table, while retaining the ability for the compiler to see all uses.

These properties help to reason about the properties of a symbol, and will be used in a follow up to implement a dce pass on dead symbols.

A few examples of what this would look like in the IR are shown below:

  module @public_module {
    // This function can be accessed by 'live.user'
    func @nested_function() attributes { sym_visibility = "nested" }

    // This function cannot be accessed outside of 'public_module'
   func @private_function() attributes { sym_visibility = "private" }
  }

  // This function can only be accessed from within this module.
  func @private_function() attributes { sym_visibility = "private" }

  // This function may be referenced externally.
  func @public_function()

  "live.user"() {uses = [@public_module::@nested_function,
                                      @private_function,
                                      @public_function]} : () -> ()

Depends On D72043

Reviewed By: mehdi_amini

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

4 years ago[DebugInfo] Add another level to DebugInfoKind called Constructor
Amy Huang [Mon, 13 Jan 2020 23:54:54 +0000 (15:54 -0800)]
[DebugInfo] Add another level to DebugInfoKind called Constructor

The option will limit debug info by only emitting complete class
type information when its constructor is emitted.
This patch changes comparisons with LimitedDebugInfo to use the new
level instead.

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

4 years ago[mlir] Update the CallGraph for nested symbol references, and simplify CallableOpInte...
River Riddle [Mon, 13 Jan 2020 23:46:40 +0000 (15:46 -0800)]
[mlir] Update the CallGraph for nested symbol references, and simplify CallableOpInterface

Summary:
This enables tracking calls that cross symbol table boundaries. It also simplifies some of the implementation details of CallableOpInterface, i.e. there can only be one region within the callable operation.

Depends On D72042

Reviewed By: jpienaar

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

4 years ago[mlir] Update the use-list algorithms in SymbolTable to support nested references.
River Riddle [Mon, 13 Jan 2020 23:23:01 +0000 (15:23 -0800)]
[mlir] Update the use-list algorithms in SymbolTable to support nested references.

Summary: This updates the use list algorithms to support querying from a specific symbol, allowing for the collection and detection of nested references. This works by walking the parent "symbol scopes" and applying the existing algorithm at each level.

Reviewed By: jpienaar

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

4 years ago[lldb-server] Prefer target_include_directories
Alex Langford [Mon, 13 Jan 2020 22:53:05 +0000 (14:53 -0800)]
[lldb-server] Prefer target_include_directories

In the documentation of `include_directories`, it notes that
`target_include_directories` is preferred because it affects
specific targets intead of propagating include search paths
to the entire project.

4 years ago[PGO][CHR] Guard against 0-to-0 branch weight and avoid division by zero crash.
Hiroshi Yamauchi [Mon, 13 Jan 2020 22:19:45 +0000 (14:19 -0800)]
[PGO][CHR] Guard against 0-to-0 branch weight and avoid division by zero crash.

Summary: This fixes a crash in internal builds under SamplePGO.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang][IFS][test] Fixing mangled name of a test for Darwin.
Puyan Lotfi [Mon, 13 Jan 2020 21:48:59 +0000 (16:48 -0500)]
[clang][IFS][test] Fixing mangled name of a test for Darwin.

Darwin adds an extra '_' before every C/global function mangled name and
because of this, this test was breaking on Darwin.

This is a fix for commit: https://reviews.llvm.org/D71301

4 years agoRevert "[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return...
Amy Huang [Mon, 13 Jan 2020 21:55:51 +0000 (13:55 -0800)]
Revert "[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return type for C++ member functions."

This reverts commit c958639098a8702b831952b1a1a677ae19190a55, which
causes a crash. See https://reviews.llvm.org/D70524 for details.

4 years ago[mlir] Remove unnecessary assert for single region.
River Riddle [Mon, 13 Jan 2020 21:44:30 +0000 (13:44 -0800)]
[mlir] Remove unnecessary assert for single region.

This was left over debugging.

4 years agoPR44514: Fix recovery from noexcept with non-convertible expressions
Erich Keane [Mon, 13 Jan 2020 15:45:17 +0000 (07:45 -0800)]
PR44514: Fix recovery from noexcept with non-convertible expressions

We currently treat noexcept(not-convertible-to-bool) as 'none', which
results in the typeloc info being a different size, and causing an
assert later on in the process.  In order to make recovery less
destructive, replace this with noexcept(false) and a constructed 'false'
expression.

Bug Report: https://bugs.llvm.org/show_bug.cgi?id=44514

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

4 years ago[ThinLTO/WPD] Fix index-based WPD for alias vtables
Teresa Johnson [Thu, 5 Dec 2019 01:15:10 +0000 (17:15 -0800)]
[ThinLTO/WPD] Fix index-based WPD for alias vtables

Summary:
A recent fix in D69452 fixed index based WPD in the presence of
available_externally vtables. It added a cast of the vtable def
summary to a GlobalVarSummary. However, in some cases one def may be an
alias, in which case we need to get the base object before casting,
otherwise we will crash.

Reviewers: evgeny777, steven_wu, aganea

Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[ItaniumCXXABI] Make tls wrappers properly comdat
Martin Storsjö [Mon, 16 Dec 2019 22:20:32 +0000 (00:20 +0200)]
[ItaniumCXXABI] Make tls wrappers properly comdat

Just marking a symbol as weak_odr/linkonce_odr isn't enough for
actually tolerating multiple copies of it at linking on windows,
it has to be made a proper comdat; make it comdat for all platforms
for consistency.

This should hopefully fix
https://bugzilla.mozilla.org/show_bug.cgi?id=1566288.

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

4 years ago[InstCombine] add FMF to tests for more coverage; NFC
Sanjay Patel [Mon, 13 Jan 2020 21:28:28 +0000 (16:28 -0500)]
[InstCombine] add FMF to tests for more coverage; NFC

4 years agoImplement VectorType conditional operator GNU extension.
Erich Keane [Thu, 5 Dec 2019 14:17:39 +0000 (06:17 -0800)]
Implement VectorType conditional operator GNU extension.

GCC supports the conditional operator on VectorTypes that acts as a
'select' in C++ mode. This patch implements the support. Types are
converted as closely to GCC's behavior as possible, though in a few
places consistency with our existing vector type support was preferred.

Note that this implementation is different from the OpenCL version in a
number of ways, so it unfortunately required a different implementation.

First, the SEMA rules and promotion rules are significantly different.

Secondly, GCC implements COND[i] != 0 ? LHS[i] : RHS[i] (where i is in
the range 0- VectorSize, for each element).  In OpenCL, the condition is
COND[i] < 0 ? LHS[i]: RHS[i].

In the process of implementing this, it was also required to make the
expression COND ? LHS : RHS type dependent if COND is type dependent,
since the type is now dependent on the condition.  For example:

    T ? 1 : 2;

Is not typically type dependent, since the result can be deduced from
the operands.  HOWEVER, if T is a VectorType now, it could change this
to a 'select' (basically a swizzle with a non-constant mask) with the 1
and 2 being promoted to vectors themselves.

While this is a change, it is NOT a standards incompatible change. Based
on my (and D. Gregor's, at the time of writing the code) reading of the
standard, the expression is supposed to be type dependent if ANY
sub-expression is type dependent.

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

4 years ago[mlir] Change the syntax of AffineMapAttr and IntegerSetAttr to avoid conflicts with...
River Riddle [Mon, 13 Jan 2020 21:12:37 +0000 (13:12 -0800)]
[mlir] Change the syntax of AffineMapAttr and IntegerSetAttr to avoid conflicts with function types.

Summary: The current syntax for AffineMapAttr and IntegerSetAttr conflict with function types, making it currently impossible to round-trip function types(and e.g. FuncOp) in the IR. This revision changes the syntax for the attributes by wrapping them in a keyword. AffineMapAttr is wrapped with `affine_map<>` and IntegerSetAttr is wrapped with `affine_set<>`.

Reviewed By: nicolasvasilache, ftynse

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

4 years ago[LegalizeIntegerTypes][X86] Add support for expanding input of STRICT_SINT_TO_FP...
Craig Topper [Mon, 13 Jan 2020 20:40:15 +0000 (12:40 -0800)]
[LegalizeIntegerTypes][X86] Add support for expanding input of STRICT_SINT_TO_FP/STRICT_UINT_TO_FP into a libcall.

Needed to support i128->fp128 on 32-bit X86.

Add full set of strict sint_to_fp/uint_to_fp conversion tests for fp128.

4 years ago[lldb] Revert ddf044290ede for TestProcessAPI.py
Raphael Isemann [Mon, 13 Jan 2020 21:09:18 +0000 (22:09 +0100)]
[lldb] Revert ddf044290ede for TestProcessAPI.py

It seems ddf044290ede7d7fd47f4f673e3e628f551a8aac caused the test to
time out on the Windows bot, but it's unclear to me why.

4 years ago[clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.
Puyan Lotfi [Mon, 13 Jan 2020 20:22:08 +0000 (15:22 -0500)]
[clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

Built libdispatch with clang interface stubs. Ran into some block
related issues. Basically VarDecl symbols can leak out because I wasn't
checking the case where a VarDecl is contained inside a BlockDecl
(versus a method or function).

This patch checks that a VarDecl is not a child decl of a BlockDecl.
This patch also does something very similar for c++ lambdas as well.

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

4 years ago[NFC][clang][IFS] Adding braces to if-statement as prep for D71301.
Puyan Lotfi [Mon, 13 Jan 2020 20:19:56 +0000 (15:19 -0500)]
[NFC][clang][IFS] Adding braces to if-statement as prep for D71301.

Just trying to make https://reviews.llvm.org/D71301 look cleaner.

4 years agoFix a test case by adding -fno-delayed-template-parsing.
Aaron Ballman [Mon, 13 Jan 2020 21:01:50 +0000 (16:01 -0500)]
Fix a test case by adding -fno-delayed-template-parsing.

4 years ago[InstCombine] add tests for select --> copysign; NFC
Sanjay Patel [Mon, 13 Jan 2020 20:24:18 +0000 (15:24 -0500)]
[InstCombine] add tests for select --> copysign; NFC

This is testing for another (possibly final) transform suggested in:
https://bugs.llvm.org/show_bug.cgi?id=44153

4 years ago[Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing part.
Alexey Lapshin [Thu, 9 Jan 2020 13:02:50 +0000 (16:02 +0300)]
[Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing part.

Summary:
This is the next portion of patches for dsymutil.

Create DwarfEmitter interface to generate all debug info tables.
Put DwarfEmitter into DwarfLinker library and make tools/dsymutil/DwarfStreamer
to be child of DwarfEmitter.

It passes check-all testing. MD5 checksum for clang .dSYM bundle matches
for the dsymutil with/without that patch.

Reviewers: JDevlieghere, friss, dblaikie, aprantl

Reviewed By: JDevlieghere

Subscribers: merge_guards_bot, hiraditya, thegameg, probinson, llvm-commits

Tags: #llvm, #debug-info

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

4 years ago[LTO] Constify lto::Config reference passed to backends (NFC)
Teresa Johnson [Mon, 13 Jan 2020 20:23:34 +0000 (12:23 -0800)]
[LTO] Constify lto::Config reference passed to backends (NFC)

The lto::Config object saved on the global LTO object should not be
updated by any of the LTO backends. Otherwise we could run into
interference between threads utilizing it. Motivated by some proposed
changes that would have caused it to get modified in the ThinLTO
backends.