platform/upstream/llvm.git
6 years ago[CUDA] Include single GPU binary, NFCI.
Jonas Hahnfeld [Wed, 28 Feb 2018 17:53:46 +0000 (17:53 +0000)]
[CUDA] Include single GPU binary, NFCI.

Binaries for multiple architectures are combined by fatbinary,
so the current code was effectively not needed.

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

llvm-svn: 326342

6 years ago[TLS] use emulated TLS if the target supports only this mode
Chih-Hung Hsieh [Wed, 28 Feb 2018 17:48:55 +0000 (17:48 +0000)]
[TLS] use emulated TLS if the target supports only this mode

Emulated TLS is enabled by llc flag -emulated-tls,
which is passed by clang driver.
When llc is called explicitly or from other drivers like LTO,
missing -emulated-tls flag would generate wrong TLS code for targets
that supports only this mode.
Now use useEmulatedTLS() instead of Options.EmulatedTLS to decide whether
emulated TLS code should be generated.
Unit tests are modified to run with and without the -emulated-tls flag.

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

llvm-svn: 326341

6 years ago[WebAssembly] Use toArrayRef. NFC.
Rui Ueyama [Wed, 28 Feb 2018 17:43:15 +0000 (17:43 +0000)]
[WebAssembly] Use toArrayRef. NFC.

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

llvm-svn: 326340

6 years agoMerge {COFF,ELF}/Strings.cpp to Common/Strings.cpp.
Rui Ueyama [Wed, 28 Feb 2018 17:38:19 +0000 (17:38 +0000)]
Merge {COFF,ELF}/Strings.cpp to Common/Strings.cpp.

This should resolve the issue that lld build fails in some hosts
that uses case-insensitive file system.

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

llvm-svn: 326339

6 years ago[OMPT] Fix ompt_get_task_info() and add tests for it
Joachim Protze [Wed, 28 Feb 2018 17:36:18 +0000 (17:36 +0000)]
[OMPT] Fix ompt_get_task_info() and add tests for it

The thread_num parameter of ompt_get_task_info() was not being used previously,
but need to be set.

The print_task_type() function (form the task-types.c testcase) was merged into
the print_ids() function (in callback.h). Testing of ompt_get_task_info() was
added to the task-types.c testcase. It was not tested extensively previously.

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

llvm-svn: 326338

6 years ago[WebAssembly] Return a StringRef instead of std::string from getSectionName(). NFC.
Rui Ueyama [Wed, 28 Feb 2018 17:33:04 +0000 (17:33 +0000)]
[WebAssembly] Return a StringRef instead of std::string from getSectionName(). NFC.

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

llvm-svn: 326337

6 years ago[WebAssembly] Improve WasmSignatureDenseMapInfo.
Rui Ueyama [Wed, 28 Feb 2018 17:32:50 +0000 (17:32 +0000)]
[WebAssembly] Improve WasmSignatureDenseMapInfo.

Let X and Y be types. Previously, functions F(X, Y) and G(Y, X) had
the same hash value because their hash values are computed as follows:

  hash(F) = hash(X) + hash(Y)
  hash(G) = hash(Y) + hash(X)

This patch fixes the issue by using hash_combine.

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

llvm-svn: 326336

6 years ago[WebAssembly] Reorder symbol table to match MC order
Nicholas Wilson [Wed, 28 Feb 2018 17:20:51 +0000 (17:20 +0000)]
[WebAssembly] Reorder symbol table to match MC order

Update LLD test expectations for new symbol ordering introduced by
Differential D43685.

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

llvm-svn: 326335

6 years ago[WebAssembly] Reorder symbol table to match MC order
Nicholas Wilson [Wed, 28 Feb 2018 17:19:48 +0000 (17:19 +0000)]
[WebAssembly] Reorder symbol table to match MC order

This removes a TODO introduced in rL325860

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

llvm-svn: 326334

6 years ago[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations
Pablo Barrio [Wed, 28 Feb 2018 17:13:07 +0000 (17:13 +0000)]
[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations

Summary:
Expressions of the form x < 0 ? 0 :  x; and x < -1 ? -1 : x can be lowered using bit-operations instead of branching or conditional moves

In thumb-mode this results in a two-instruction sequence, a shift followed by a bic or or while in ARM/thumb2 mode that has flexible second operand the shift can be folded into a single bic/or instructions. In most cases this results in smaller code and possibly less branches, and in no case larger than before.

Patch by Martin Svanfeldt

Reviewers: fhahn, pbarrio, rogfer01

Reviewed By: pbarrio, rogfer01

Subscribers: chrib, yroux, eugenis, efriedma, rogfer01, aemerson, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 326333

6 years agoTest commit access: apply clang-format suggestion
Joel E. Denny [Wed, 28 Feb 2018 16:57:33 +0000 (16:57 +0000)]
Test commit access: apply clang-format suggestion

llvm-svn: 326332

6 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Wed, 28 Feb 2018 16:53:45 +0000 (16:53 +0000)]
[InstCombine] auto-generate complete checks; NFC

llvm-svn: 326331

6 years ago[InstCombine] move invariant call out of loop; NFC
Sanjay Patel [Wed, 28 Feb 2018 16:50:51 +0000 (16:50 +0000)]
[InstCombine] move invariant call out of loop; NFC

We really shouldn't need a 2-loop here at all, but that's another cleanup.

llvm-svn: 326330

6 years ago[InstCombine] move constant check into foldBinOpIntoSelectOrPhi; NFCI
Sanjay Patel [Wed, 28 Feb 2018 16:36:24 +0000 (16:36 +0000)]
[InstCombine] move constant check into foldBinOpIntoSelectOrPhi; NFCI

Also, rename 'foldOpWithConstantIntoOperand' because that's annoyingly
vague. The constant check is redundant in some cases, but it allows
removing duplication for most of the calls.

llvm-svn: 326329

6 years ago[DEBUGINFO] Add flag for DWARF2 or less to use sections as references.
Alexey Bataev [Wed, 28 Feb 2018 15:02:59 +0000 (15:02 +0000)]
[DEBUGINFO] Add flag for DWARF2 or less to use sections as references.

Summary:
Some targets does not support labels inside debug sections, but support
references in form `section +|- offset`. Patch adds initial support
for this. Also, this patch disables emission of all additional debug
  sections that may have labels inside of it (like pub sections and
  string tables).

Reviewers: probinson, echristo

Subscribers: JDevlieghere, llvm-commits

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

llvm-svn: 326328

6 years agoRename a few checks from misc- to bugprone-.
Alexander Kornienko [Wed, 28 Feb 2018 14:47:20 +0000 (14:47 +0000)]
Rename a few checks from misc- to bugprone-.

Summary:
rename_check.py {misc,bugprone}-forwarding-reference-overload
rename_check.py {misc,bugprone}-macro-repeated-side-effects
rename_check.py {misc,bugprone}-lambda-function-name
rename_check.py {misc,bugprone}-misplaced-widening-cast

Reviewers: hokein, sammccall, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits, mgorny

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

llvm-svn: 326327

6 years ago[WebAssembly] Fix copy-paste error in debugging string
Nicholas Wilson [Wed, 28 Feb 2018 14:03:18 +0000 (14:03 +0000)]
[WebAssembly] Fix copy-paste error in debugging string

llvm-svn: 326326

6 years ago[clangd] A few more fixes for STL header mapping.
Eric Liu [Wed, 28 Feb 2018 14:02:18 +0000 (14:02 +0000)]
[clangd] A few more fixes for STL header mapping.

llvm-svn: 326325

6 years ago[analyzer] Fix a compiler warning
Gabor Horvath [Wed, 28 Feb 2018 14:01:48 +0000 (14:01 +0000)]
[analyzer] Fix a compiler warning

llvm-svn: 326324

6 years ago[analyzer] Support for naive cross translation unit analysis
Gabor Horvath [Wed, 28 Feb 2018 13:23:10 +0000 (13:23 +0000)]
[analyzer] Support for naive cross translation unit analysis

The aim of this patch is to be minimal to enable incremental development of
the feature on the top of the tree. This patch should be an NFC when the
feature is turned off. It is turned off by default and still considered as
experimental.

Technical details are available in the EuroLLVM Talk:
http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#7

Note that the initial prototype was done by A. Sidorin et al.: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045730.html

Contributions to the measurements and the new version of the code: Peter Szecsi, Zoltan Gera, Daniel Krupp, Kareem Khazem.

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

llvm-svn: 326323

6 years ago[mips] Begin reworking instruction predicates for ISAs/encodings (1/N)
Simon Dardis [Wed, 28 Feb 2018 13:02:44 +0000 (13:02 +0000)]
[mips] Begin reworking instruction predicates for ISAs/encodings (1/N)

The MIPS backend has inconsistent usage of instruction predicates
for assembly and code generation. The issue arises from supporting three
encodings, two (MIPS and microMIPS) of which have a near 1:1 instruction
mapping across ISA revisions and a third encoding with a more restricted
set of instructions (MIPS16e).

To enforce consistent usage, each of the ISA_* adjectives has (or will
have) the relevant encoding attached to it along the relevant ISA revision
where the instruction is defined.

Each instruction, pattern or alias will then have the correct ISA adjective
attached to it, and the base instruction description classes will have any
predicates relating to ISA encoding or revision removed.

Pseudo instructions will also be guarded for the encoding or ABI that they are
supported in.

Finally, the hasStandardEncoding() / inMicroMipsMode() / inMips16Mode() methods
of MipsSubtarget will be changed such that only one can be true at any one time.

The result of this is that code generation and assembly will produce the
correct encoding up front, while code generated from pseudo instructions
and other inserted sequences of instructions will be able to rely on the mapping
tables to produce the correct encoding. This should fix numerous bugs where
the result 'happens' to be correct but has edge cases where microMIPS and MIPS
have subtle differences (e.g. microMIPSR6 using 'j', 'jal' instructions.)

This patch starts the process by changing most of the ISA adjectives to make
use of the EncodingPredicate member of PredicateControl. Follow on patches
will annotate instructions with their correct ISA adjective and eliminate
the usage of "let Predicates = [..]", "let AdditionalPredicates = [..]" and
"isCodeGenOnly = 1" in the cases where it was used to control instruction
availability.

Contributions from Nitesh Jain.

Reviewers: atanasyan

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

llvm-svn: 326322

6 years ago[clang-tidy] Fix 'add_new_check.py --udpate-docs'
Alexander Kornienko [Wed, 28 Feb 2018 12:21:38 +0000 (12:21 +0000)]
[clang-tidy] Fix 'add_new_check.py --udpate-docs'

llvm-svn: 326321

6 years ago[GlobalIsel][X86] Support G_INTTOPTR instruction.
Alexander Ivchenko [Wed, 28 Feb 2018 12:11:53 +0000 (12:11 +0000)]
[GlobalIsel][X86] Support G_INTTOPTR instruction.

Add legalization/selection for x86/x86_64 and
corresponding tests.

Reviewed By: igorb

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

llvm-svn: 326320

6 years agoFix typo. NFC
Xin Tong [Wed, 28 Feb 2018 12:09:53 +0000 (12:09 +0000)]
Fix typo. NFC

llvm-svn: 326319

6 years ago[MergeICmp] Fix a bug in MergeICmp that can lead to a block being processed more...
Xin Tong [Wed, 28 Feb 2018 12:08:00 +0000 (12:08 +0000)]
[MergeICmp] Fix a bug in MergeICmp that can lead to a block being processed more than once.

Summary:
Fix a bug in MergeICmp that can lead to a BCECmp block being processed more than once and eventually lead to a broken LLVM module.
The problem is that if the non-constant value is not produced by the last block, the producer will be processed once when the its parent block
is processed and second time when the last block is processed.

We end up having 2 same BCECmpBlock in the merge queue. And eventually lead to a broken LLVM module.

Reviewers: courbet, davide

Reviewed By: courbet

Subscribers: llvm-commits

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

llvm-svn: 326318

6 years ago[IR] - Make User construction exception safe
Klaus Kretzschmar [Wed, 28 Feb 2018 11:32:23 +0000 (11:32 +0000)]
[IR] - Make User construction exception safe

There are many instruction ctors that call the setName method of the Value base class, which can throw a bad_alloc exception in OOM situations.
In such situations special User delete operators are called which are not implemented yet.

Example:
 Lets look at the construction of a CallInst instruction during IR generation:

static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args, .. ){
...

return new (TotalOps, DescriptorBytes) CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);

}

CallInst::CalInst(Value* Func, ...) {
...
Op<-1>() = Func;
....
setName(name); // throws
...
}
Op<-1>() returns a reference to a Use object of the CallInst instruction and the operator= inserts this use object into the UseList of Func.
The same object is removed from that UseList by calling the User::operator delete If the CallInst object is deleted.
Since setName can throw a bad_alloc exception (if LLVM_ENABLE_EXCEPTIONS is switched on), the unwind chain runs into assertions ("Constructor throws?") in
special User::operator deletes operators:

operator delete(void* Usr, unsigned)
operator delete(void* Usr, unsigned, bool)
This situation can be fixed by simlpy calling the User::operator delete(void*) in these unimplemented methods.

To ensure that this additional call succeeds all information that is necessary to calculate the storage pointer from the Usr address
must be restored in the special case that a sublass has changed this information, e.g. GlobalVariable can change the NumberOfOperands.

Reviewd by: rnk

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

llvm-svn: 326316

6 years ago[Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees
David Green [Wed, 28 Feb 2018 11:00:08 +0000 (11:00 +0000)]
[Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees

Removes verifyDomTree, using assert(verify()) everywhere instead, and
changes verify a little to always run IsSameAsFreshTree first in order
to print good output when we find errors. Also adds verifyAnalysis for
PostDomTrees, which will allow checking of PostDomTrees it the same way
we check DomTrees and MachineDomTrees.

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

llvm-svn: 326315

6 years ago[clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields.
Alexander Kornienko [Wed, 28 Feb 2018 10:30:25 +0000 (10:30 +0000)]
[clang-tidy] Add a test for readability-implicit-bool-conversion with bitfields.

llvm-svn: 326314

6 years ago[clangd] Prefer the definition of a TagDecl (e.g. class) as CanonicalDeclaration.
Eric Liu [Wed, 28 Feb 2018 09:33:15 +0000 (09:33 +0000)]
[clangd] Prefer the definition of a TagDecl (e.g. class) as CanonicalDeclaration.

Summary:
Currently, we pick the first declaration of a symbol in a TU, which is considered
canonical in the clangIndex, as the canonical declaration in clangd. This causes
forward declarations that might appear in a random header to be used as a
canonical declaration, which is not desirable for features like go-to-declaration
or include insertion.

For example, for class X, we would consider the forward declaration in fwd.h to
be the canonical declaration, while the preferred canonical declaration should
be the actual definition in x.h.
```
// fwd.h
class X;  // forward decl

// x.h
class X {};
```

This patch fixes the issue by making symbol collector favor the actual definition of
a TagDecl (i.e. class/struct/enum/union) found in a header file over the first seen
declarations in a TU. Other symbol types like functions are not handled because
using the first seen declarations as canonical declarations is usually a good
heuristic for them.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 326313

6 years ago[OMPT] Fix inconsistent testcases
Joachim Protze [Wed, 28 Feb 2018 09:28:51 +0000 (09:28 +0000)]
[OMPT] Fix inconsistent testcases

The main change of this patch is to insert {{.*}} in current_address=[[RETURN_ADDRESS_END]].
This is needed to match any of the alternatively printed addresses.

Additionally, clang-format is applied to the two tests.

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

llvm-svn: 326312

6 years ago[GlobalIsel][X86] Support G_PTRTOINT instruction.
Alexander Ivchenko [Wed, 28 Feb 2018 09:18:47 +0000 (09:18 +0000)]
[GlobalIsel][X86] Support G_PTRTOINT instruction.

Add legalization/selection for x86/x86_64 and
corresponding tests.

Reviewed By: igorb

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

llvm-svn: 326311

6 years ago[clangd] A few minor fixes for STL internal header mapping.
Eric Liu [Wed, 28 Feb 2018 08:56:11 +0000 (08:56 +0000)]
[clangd] A few minor fixes for STL internal header mapping.

llvm-svn: 326310

6 years ago[RISCV] Update two tests after r326208
Alex Bradbury [Wed, 28 Feb 2018 08:20:47 +0000 (08:20 +0000)]
[RISCV] Update two tests after r326208

llvm-svn: 326309

6 years ago[X86] Don't use EXTRACT_ELEMENT from v1i1 with i8/i32 result type when we need to...
Craig Topper [Wed, 28 Feb 2018 08:14:28 +0000 (08:14 +0000)]
[X86] Don't use EXTRACT_ELEMENT from v1i1 with i8/i32 result type when we need to guarantee zeroes in the upper bits of return.

An extract_element where the result type is larger than the scalar element type is semantically an any_extend of from the scalar element type to the result type. If we expect zeroes in the upper bits of the i8/i32 we need to mae sure those zeroes are explicit in the DAG.

For these cases the best way to accomplish this is use an insert_subvector to pad zeroes to the upper bits of the v1i1 first. We extend to either v16i1(for i32) or v8i1(for i8). Then bitcast that to a scalar and finish with a zero_extend up to i32 if necessary. We can't extend past v16i1 because that's the largest mask size on KNL. But isel is smarter enough to know that a zext of a bitcast from v16i1 to i16 can use a KMOVW instruction. The insert_subvectors will be dropped during isel because we can determine that the producing instruction already zeroed the upper bits of the k-register.

llvm-svn: 326308

6 years ago[ObjC] Allow declaring __strong pointer fields in structs in Objective-C
Akira Hatanaka [Wed, 28 Feb 2018 07:15:55 +0000 (07:15 +0000)]
[ObjC] Allow declaring __strong pointer fields in structs in Objective-C
ARC mode.

Declaring __strong pointer fields in structs was not allowed in
Objective-C ARC until now because that would make the struct non-trivial
to default-initialize, copy/move, and destroy, which is not something C
was designed to do. This patch lifts that restriction.

Special functions for non-trivial C structs are synthesized that are
needed to default-initialize, copy/move, and destroy the structs and
manage the ownership of the objects the __strong pointer fields point
to. Non-trivial structs passed to functions are destructed in the callee
function.

rdar://problem/33599681

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

llvm-svn: 326307

6 years ago[X86] Change the masked FPCLASS implementation to use AND instead of OR to combine...
Craig Topper [Wed, 28 Feb 2018 06:19:55 +0000 (06:19 +0000)]
[X86] Change the masked FPCLASS implementation to use AND instead of OR to combine the mask results.

While the description for the instruction does mention OR, its talking about how the individual classification test results are ORed together.

The incoming mask is used as a zeroing write mask. If the bit is 1 the classification is written to the output. The bit is 0 the output is 0. This equivalent to an AND.

Here is pseudocode from the intrinsics guide

FOR j := 0 to 1
        i := j*64
        IF k1[j]
                k[j] := CheckFPClass_FP64(a[i+63:i], imm8[7:0])
        ELSE
                k[j] := 0
        FI
ENDFOR
k[MAX:2] := 0

llvm-svn: 326306

6 years ago[ELF] Process linker scripts deeper when declaring symbols.
Igor Kudrin [Wed, 28 Feb 2018 05:55:56 +0000 (05:55 +0000)]
[ELF] Process linker scripts deeper when declaring symbols.

We should process symbols inside output section declarations the same way as top-level ones.

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

llvm-svn: 326305

6 years ago[ARM] Cortex-A57 scheduler fix for ARM backend (missed 16-bit, v8.1/v8.2/v8.3, thumb...
Andrew Zhogin [Wed, 28 Feb 2018 05:53:18 +0000 (05:53 +0000)]
[ARM] Cortex-A57 scheduler fix for ARM backend (missed 16-bit, v8.1/v8.2/v8.3, thumb and pseudo instructions)

Added missed scheduling info for ARM Cortex A57 (AArch32) to have CompleteModel with this checkCompleteness fix: https://reviews.llvm.org/D43235.

Reviewed By: RKSimon

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

llvm-svn: 326304

6 years ago[SLP] Added new tests and updated existing for jumbled load, NFC.
Mohammad Shahid [Wed, 28 Feb 2018 04:19:34 +0000 (04:19 +0000)]
[SLP] Added new tests and updated existing for jumbled load, NFC.

llvm-svn: 326303

6 years agoAdd EmulateInstructionPPC64.cpp to xcode project file.
Jason Molenda [Wed, 28 Feb 2018 04:11:37 +0000 (04:11 +0000)]
Add EmulateInstructionPPC64.cpp to xcode project file.

llvm-svn: 326302

6 years ago[WebAssembly] Fix variable name.
Rui Ueyama [Wed, 28 Feb 2018 03:43:38 +0000 (03:43 +0000)]
[WebAssembly] Fix variable name.

llvm-svn: 326301

6 years ago[WebAssembly] Remove unnecessary namespace specifiers. NFC.
Rui Ueyama [Wed, 28 Feb 2018 03:38:14 +0000 (03:38 +0000)]
[WebAssembly] Remove unnecessary namespace specifiers. NFC.

llvm-svn: 326300

6 years agoFix a couple of cases where we would fail to correctly parse deduced class template...
Richard Smith [Wed, 28 Feb 2018 03:02:23 +0000 (03:02 +0000)]
Fix a couple of cases where we would fail to correctly parse deduced class template specialization types.

Specifically, we would not properly parse these types within template arguments
(for non-type template parameters), and in tentative parses. Fixing both of
these essentially requires that we parse deduced template specialization types
as types in all contexts, even in template argument lists -- in particular,
tentative parsing may look ahead and annotate a deduced template specialization
type before we figure out that we're actually supposed to treat the tokens as a
template-name. We deal with this by simply permitting deduced template
specialization types when parsing template arguments, and converting them to
template template arguments.

llvm-svn: 326299

6 years agoUpdate cxx_status to mark "SVN" items as "Clang 6" instead.
Richard Smith [Wed, 28 Feb 2018 03:02:07 +0000 (03:02 +0000)]
Update cxx_status to mark "SVN" items as "Clang 6" instead.

llvm-svn: 326298

6 years ago[WebAssembly] Simplify initializeSymbols and merge it with ObjFile::parse. NFC.
Rui Ueyama [Wed, 28 Feb 2018 02:57:37 +0000 (02:57 +0000)]
[WebAssembly] Simplify initializeSymbols and merge it with ObjFile::parse. NFC.

This patch simplifies initializeSymbols. Since that function is called
at the tail context of ObjFile::parse, and the function is called only
once from that function, that's effectively just a continuation of
ObjFile::parse. So this patch merge it with ObjFile::parse.

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

llvm-svn: 326296

6 years ago[analyzer] [tests] Write to logfile instead of stdout while updating
George Karpenkov [Wed, 28 Feb 2018 01:55:23 +0000 (01:55 +0000)]
[analyzer] [tests] Write to logfile instead of stdout while updating

reference results

llvm-svn: 326295

6 years ago[WebAssembly] Add test for `--undefined` flag. NFC.
Sam Clegg [Wed, 28 Feb 2018 01:42:16 +0000 (01:42 +0000)]
[WebAssembly] Add test for `--undefined` flag. NFC.

Specifically the case where the undefined symbol is not found
during the link.

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

llvm-svn: 326294

6 years ago[WebAssembly] Simplify Symbol::getWasmType. NFC.
Rui Ueyama [Wed, 28 Feb 2018 01:10:50 +0000 (01:10 +0000)]
[WebAssembly] Simplify Symbol::getWasmType. NFC.

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

llvm-svn: 326293

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Wed, 28 Feb 2018 01:10:04 +0000 (01:10 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 326292

6 years ago[WebAssembly] Inline translateVA as it's trivial.
Rui Ueyama [Wed, 28 Feb 2018 01:01:34 +0000 (01:01 +0000)]
[WebAssembly] Inline translateVA as it's trivial.

The problem I want to address now is that chunks have too many data
members for "offsets", and their origins are not well defined.
For example, InputSegment has OutputSegmentOffset, but it's base class
also has OutputOffset. That's very confusing.

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

llvm-svn: 326291

6 years ago[RuntimeDyld][MachO] Support ARM64_RELOC_BRANCH26 for BL instructions by
Lang Hames [Wed, 28 Feb 2018 00:58:21 +0000 (00:58 +0000)]
[RuntimeDyld][MachO] Support ARM64_RELOC_BRANCH26 for BL instructions by
relaxing an assertion.

llvm-svn: 326290

6 years ago[WebAssembly] Remove ELF-ness.
Rui Ueyama [Wed, 28 Feb 2018 00:57:28 +0000 (00:57 +0000)]
[WebAssembly] Remove ELF-ness.

These output section names are ELF-specific. We shouldn't have this rule
for WebAssembly.

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

llvm-svn: 326289

6 years agoupdate_mir_test_checks: Use the regexes from UpdateTestChecks.common
Justin Bogner [Wed, 28 Feb 2018 00:56:24 +0000 (00:56 +0000)]
update_mir_test_checks: Use the regexes from UpdateTestChecks.common

Some of the update_*_test_checks regexes have been moved into a
library, so we might as well use them in update_mir_test_checks.
Also includes minor bugfixes to the regexes that are there so we
don't regress update_mir_test_checks

llvm-svn: 326288

6 years ago[ELF] Rename test/ELF/note-loadaddr.c to .s NFC
Fangrui Song [Wed, 28 Feb 2018 00:53:51 +0000 (00:53 +0000)]
[ELF] Rename test/ELF/note-loadaddr.c to .s NFC

llvm-svn: 326287

6 years ago[WebAssembly] Do not use inheritance to define SubSection.
Rui Ueyama [Wed, 28 Feb 2018 00:52:42 +0000 (00:52 +0000)]
[WebAssembly] Do not use inheritance to define SubSection.

SubSection inherited from SyntheticSection, and SyntheticSection inherits
from OutputSection, so SubSection was an OutputSection. But that's wrong
because SubSection is not actually a WebAssembly output section.
It shares some functionalities with OutputSection, but overall it's very
different.

This patch removes that inheritance.

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

llvm-svn: 326286

6 years ago[WebAssembly] Refactor ObjFile::initializeSymbols.
Rui Ueyama [Wed, 28 Feb 2018 00:50:54 +0000 (00:50 +0000)]
[WebAssembly] Refactor ObjFile::initializeSymbols.

The main purpose of this change is to make initializeSymbols shorter.

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

llvm-svn: 326285

6 years agoupdate_mir_test_checks: Drop support for vreg block checks
Justin Bogner [Wed, 28 Feb 2018 00:44:46 +0000 (00:44 +0000)]
update_mir_test_checks: Drop support for vreg block checks

Since vregs are printed in the instruction stream now, checking the
vreg block is always redundant. Remove the temporary feature that
allowed us to do that.

This reverts r316134

llvm-svn: 326284

6 years ago[WebAssembly] Do not use Subsection as a local variable name.
Rui Ueyama [Wed, 28 Feb 2018 00:39:30 +0000 (00:39 +0000)]
[WebAssembly] Do not use Subsection as a local variable name.

That variable hides the class of the same name.

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

llvm-svn: 326283

6 years ago[WebAssembly] Do not use default arguments for SymbolTable.
Rui Ueyama [Wed, 28 Feb 2018 00:37:03 +0000 (00:37 +0000)]
[WebAssembly] Do not use default arguments for SymbolTable.

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

llvm-svn: 326282

6 years ago[WebAssembly] Do not remove existing output file.
Rui Ueyama [Wed, 28 Feb 2018 00:33:59 +0000 (00:33 +0000)]
[WebAssembly] Do not remove existing output file.

FileOutputBuffer automatically removes an existing file, so we don't
need to do that. Actually doing that is discouraged because when the
linker fails to create an output for some reason after instantiating
FileOutputBufffer, FileOutputBuffer removes a temporary file and don't
touch an existing file. That's an desired behavior from the user's
point of view.

(Internally, FileOutputBuffer writes its contents to a temporary file
and then rename it over to an existing file on commit()).

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

llvm-svn: 326281

6 years ago[WebAssembly] Remove redundant local variables.
Rui Ueyama [Wed, 28 Feb 2018 00:31:16 +0000 (00:31 +0000)]
[WebAssembly] Remove redundant local variables.

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

llvm-svn: 326280

6 years ago[WebAssembly] Simplify createLikingSection.
Rui Ueyama [Wed, 28 Feb 2018 00:28:07 +0000 (00:28 +0000)]
[WebAssembly] Simplify createLikingSection.

Summary: [WebAssembly] Simplify createLikingSection.

Reviewers: sbc100

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 326279

6 years agoAMDGPU: Move run and check lines around to match processor order in AMDGPU.h
Konstantin Zhuravlyov [Wed, 28 Feb 2018 00:27:00 +0000 (00:27 +0000)]
AMDGPU: Move run and check lines around to match processor order in AMDGPU.h

llvm-svn: 326278

6 years ago[WebAssembly] Inline accessor functions that are called only once.
Rui Ueyama [Wed, 28 Feb 2018 00:26:26 +0000 (00:26 +0000)]
[WebAssembly] Inline accessor functions that are called only once.

Looks like these accessor functions are a bit overly defensive, and
due to the amount of code, that part isn't easy to read. We have
code to log translation results in writeTo and writeRelocations, so
I don't think we need to log it again in these functions.
I think the new function is much easier to understand.

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

llvm-svn: 326277

6 years ago[WebAssembly] Remove trivial accessors.
Rui Ueyama [Wed, 28 Feb 2018 00:20:29 +0000 (00:20 +0000)]
[WebAssembly] Remove trivial accessors.

{set,get}OutputSegment don't hide anything, so remove them.

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

llvm-svn: 326276

6 years ago[WebAssembly] Use more specific type and simplify code.
Rui Ueyama [Wed, 28 Feb 2018 00:18:34 +0000 (00:18 +0000)]
[WebAssembly] Use more specific type and simplify code.

Instead of {Function,Global,Data}Symbol, use Defined{Function,Global,Data}
because undefined symbol should never reach this function.

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

llvm-svn: 326275

6 years ago[WebAssembly] Remove LastDefinedKind for consistency with undefined kinds. NFC.
Rui Ueyama [Wed, 28 Feb 2018 00:16:11 +0000 (00:16 +0000)]
[WebAssembly] Remove LastDefinedKind for consistency with undefined kinds. NFC.

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

llvm-svn: 326274

6 years ago[WebAssembly] Remove premature optimization.
Rui Ueyama [Wed, 28 Feb 2018 00:15:59 +0000 (00:15 +0000)]
[WebAssembly] Remove premature optimization.

I think calling reserve() for each object file is too many and isn't useful.
We can add reserve() later. By default, we shouldn't add reserve() to a lot
of places.

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

llvm-svn: 326273

6 years agoInline trivial function. NFC.
Rafael Espindola [Wed, 28 Feb 2018 00:14:18 +0000 (00:14 +0000)]
Inline trivial function. NFC.

llvm-svn: 326272

6 years ago[WebAssembly] Separate addUndefined into addUndefined{Function,Data,Global}.
Rui Ueyama [Wed, 28 Feb 2018 00:09:22 +0000 (00:09 +0000)]
[WebAssembly] Separate addUndefined into addUndefined{Function,Data,Global}.

Previously, one function adds all types of undefined symbols. That
doesn't fit to the wasm's undefined symbol semantics well because
different types of undefined symbols are very different in wasm.
As a result, separate control flows merge in this addUndefined function
and then separate again for each type. That wasn't easy to read.

This patch separates the function into three functions. Now it is pretty
clear what we are doing for each undefined symbol type.

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

llvm-svn: 326271

6 years agoPass a GlobalDecl to setAliasAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 00:06:01 +0000 (00:06 +0000)]
Pass a GlobalDecl to setAliasAttributes. NFC.

This just makes a followup change easier to read.

llvm-svn: 326270

6 years ago[WebAssembly] Use StringRef instead of `const char *`.
Rui Ueyama [Wed, 28 Feb 2018 00:01:31 +0000 (00:01 +0000)]
[WebAssembly] Use StringRef instead of `const char *`.

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

llvm-svn: 326269

6 years ago[WebAssembly] Remove DataSize from linking metadata
Sam Clegg [Tue, 27 Feb 2018 23:58:03 +0000 (23:58 +0000)]
[WebAssembly] Remove DataSize from linking metadata

This means we don't need to write the linking metadata section
at all for executable (non-relocatable) output.

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

llvm-svn: 326268

6 years ago[WebAssembly] Remove DataSize from linking metadata section
Sam Clegg [Tue, 27 Feb 2018 23:57:37 +0000 (23:57 +0000)]
[WebAssembly] Remove DataSize from linking metadata section

Neither the linker nor the runtime need this information
anymore.  We were originally using this to model BSS size
but the plan is now to use the segment metadata to allow
for BSS segments.

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

llvm-svn: 326267

6 years agoImprove the way attribute argument printing happens for omitted optional arguments...
Aaron Ballman [Tue, 27 Feb 2018 23:49:28 +0000 (23:49 +0000)]
Improve the way attribute argument printing happens for omitted optional arguments when pretty printing.

Patch by Joel Denny.

llvm-svn: 326266

6 years agoPass a GlobalDecl to setFunctionDefinitionAttributes. NFC.
Rafael Espindola [Tue, 27 Feb 2018 23:44:36 +0000 (23:44 +0000)]
Pass a GlobalDecl to setFunctionDefinitionAttributes. NFC.

This just makes a followup patch easier to read.

llvm-svn: 326265

6 years agoFix lldbinline tests for remote targets
Pavel Labath [Tue, 27 Feb 2018 22:45:49 +0000 (22:45 +0000)]
Fix lldbinline tests for remote targets

r326140 exposed the fact that we are not actually running inline tests on
remote targets. The tests fail to launch the inferior in the first place
because they passed an invalid working directory to the launch function.

This should fix that.

llvm-svn: 326264

6 years ago[Hexagon] Recognize more sign-extensions as inputs to 32x32-bit multiply
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:44:41 +0000 (22:44 +0000)]
[Hexagon] Recognize more sign-extensions as inputs to 32x32-bit multiply

llvm-svn: 326263

6 years ago[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:40:52 +0000 (22:40 +0000)]
[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX

Absence of memory operands is treated as "aliasing everything", so
dropping them is sufficient.

Recommit r326256 with a fixed testcase.

llvm-svn: 326262

6 years ago[lldb] Use vFlash commands when writing to target's flash memory regions
Pavel Labath [Tue, 27 Feb 2018 22:14:33 +0000 (22:14 +0000)]
[lldb] Use vFlash commands when writing to target's flash memory regions

Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region.  A bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region

Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>

llvm-svn: 326261

6 years ago[CodeView] Lower __restrict and other pointer qualifiers correctly
Reid Kleckner [Tue, 27 Feb 2018 22:08:15 +0000 (22:08 +0000)]
[CodeView] Lower __restrict and other pointer qualifiers correctly

Qualifiers on a pointer or reference type may apply to either the
pointee or the pointer itself. Consider 'const char *' and 'char *
const'. In the first example, the pointee data may not be modified
without casts, and in the second example, the pointer may not be updated
to point to new data.

In the general case, qualifiers are applied to types with LF_MODIFIER
records, which support the usual const and volatile qualifiers as well
as the __unaligned extension qualifier.

However, LF_POINTER records, which are used for pointers, references,
and member pointers, have flags for qualifiers applying to the
*pointer*. In fact, this is the only way to represent the restrict
qualifier, which can only apply to pointers, and cannot qualify regular
data types.

This patch causes LLVM to correctly fold 'const' and 'volatile' pointer
qualifiers into the pointer record, as well as adding support for
'__restrict' qualifiers in the same place.

Based on a patch from Aaron Smith

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

llvm-svn: 326260

6 years agoRevert "[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX"
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:07:38 +0000 (22:07 +0000)]
Revert "[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX"

This reverts r326256. One testcase needs to be updated.

llvm-svn: 326259

6 years ago[analyzer] UndefinedAssignmentChecker: Better warning message in implicit ctors.
Artem Dergachev [Tue, 27 Feb 2018 22:05:55 +0000 (22:05 +0000)]
[analyzer] UndefinedAssignmentChecker: Better warning message in implicit ctors.

When a class forgets to initialize a field in the constructor, and then gets
copied around, a warning is emitted that the value assigned to a specific field
is undefined.

When the copy/move constructor is implicit (not written out in the code) but not
trivial (is not a trivial memory copy, eg. because members have an explicit copy
constructor), the body of such constructor is auto-generated in the AST.
In this case the checker's warning message is squeezed at the top of
the class declaration, and it gets hard to guess which field is at fault.

Fix the warning message to include the name of the field.

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

llvm-svn: 326258

6 years ago[ELF] Add llvm-readelf to the lit tool substitutions
Alexander Richardson [Tue, 27 Feb 2018 22:01:02 +0000 (22:01 +0000)]
[ELF] Add llvm-readelf to the lit tool substitutions

Summary:
Some of the tests invoke llvm-readelf. This currently appears to work
probably because the LLVM binary directory is included in $PATH. However,
this is quite fragile so let's just make lit expand the full path.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 326257

6 years ago[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX
Krzysztof Parzyszek [Tue, 27 Feb 2018 22:00:32 +0000 (22:00 +0000)]
[Pipeliner] Drop memrefs instead of creating ones with size UINT64_MAX

Absence of memory operands is treated as "aliasing everything", so
dropping them is sufficient.

llvm-svn: 326256

6 years ago[AsmPrinter] Handle qualified unnamed types in CodeView printer
Shoaib Meenai [Tue, 27 Feb 2018 21:48:41 +0000 (21:48 +0000)]
[AsmPrinter] Handle qualified unnamed types in CodeView printer

When attempting to compile the following Objective-C++ code with
CodeView debug info:

  void (^b)(void) = []() {};

The generated debug metadata contains a structure like the following:

  !43 = !DICompositeType(tag: DW_TAG_structure_type, name: "__block_literal_1", scope: !6, file: !6, line: 1, size: 168, elements: !44)
  !44 = !{!45, !46, !47, !48, !49, !52}
  ...
  !52 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !6, line: 1, baseType: !53, size: 8, offset: 160, flags: DIFlagPublic)
  !53 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !54)
  !54 = !DICompositeType(tag: DW_TAG_class_type, file: !6, line: 1, flags: DIFlagFwdDecl)

Note that the member node (!52) is unnamed, but rather than pointing to
a DICompositeType directly, it points to a DIDerivedType with tag
DW_TAG_const_type, which then points to the DICompositeType. However,
the CodeView assembly printer currently assumes that the base type for
an unnamed member will always be a DICompositeType, and attempts to
perform that cast, which triggers an assertion failure, since in this
case the base type is actually a DIDerivedType, not a DICompositeType
(and we would have to get the base type of the DIDerivedType to reach
the DICompositeType). I think the debug metadata being generated by the
frontend is correct (or at least plausible), and the CodeView printer
needs to handle this case.

This patch teaches the CodeView printer to unwrap any qualifier types.
The qualifiers are just dropped for now. Ideally, they would be applied
to the added indirect members instead, but this occurs infrequently
enough that adding the logic to handle the qualifiers correctly isn't
worth it for now. A FIXME is added to note this.

Additionally, Reid pointed out that the underlying assumption that an
unnamed member must be a composite type is itself incorrect and may not
hold for all frontends. Therefore, after all qualifiers have been
stripped, check if the resulting type is in fact a DICompositeType and
just return if it isn't, rather than assuming the type and crashing if
that assumption is violated.

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

llvm-svn: 326255

6 years agoAMDGPU: Define FP_FAST_FMA{F} macros for amdgcn
Konstantin Zhuravlyov [Tue, 27 Feb 2018 21:48:05 +0000 (21:48 +0000)]
AMDGPU: Define FP_FAST_FMA{F} macros for amdgcn

- Expand GK_*s (i.e. GFX6 -> GFX600, GFX601, etc.)
  - This allows us to choose features correctly in some cases (for example, fast fmaf is available on gfx600, but not gfx601)
- Move HasFMAF, HasFP64, HasLDEXPF to GPUInfo tables
- Add HasFastFMA, HasFastFMAF to GPUInfo tables
- Add missing tests

llvm-svn: 326254

6 years ago[codeview] Remove unused variable
Reid Kleckner [Tue, 27 Feb 2018 21:46:40 +0000 (21:46 +0000)]
[codeview] Remove unused variable

llvm-svn: 326253

6 years agoAMDGPU: Add fast fmaf feature to gfx702
Konstantin Zhuravlyov [Tue, 27 Feb 2018 21:46:15 +0000 (21:46 +0000)]
AMDGPU: Add fast fmaf feature to gfx702

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

llvm-svn: 326252

6 years ago[OPENMP] Emit warning for non-trivial types in map clauses.
Alexey Bataev [Tue, 27 Feb 2018 21:31:11 +0000 (21:31 +0000)]
[OPENMP] Emit warning for non-trivial types in map clauses.

If the mapped type is non-trivial, the warning message is emitted for
better user experience.

llvm-svn: 326251

6 years ago[libunwind][MIPS]: Add support for unwinding in N32 processes.
John Baldwin [Tue, 27 Feb 2018 21:24:02 +0000 (21:24 +0000)]
[libunwind][MIPS]: Add support for unwinding in N32 processes.

Summary:
N32 uses the same register context as N64.  However, N32 requires one
change to properly fetch addresses from registers stored in memory.
Since N32 is an ILP32 platform, getP() only fetches the first 32-bits
of a stored register.  For a big-endian platform this fetches the
upper 32-bits which will be zero.  To fix this, add a new
getRegister() method to AddressSpace which is responsible for
extracting the address stored in a register in memory.  This matches
getP() for all current ABIs except for N32 where it reads the 64-bit
register and returns the low 32-bits as an address.  The
DwarfInstructions::getSavedRegister() method uses
AddressSpace::getRegister() instead of AddressSpace::getP().

Reviewers: sdardis, compnerd

Reviewed By: sdardis

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

llvm-svn: 326250

6 years ago[analyzer] MallocChecker: Suppress false positives in shared pointers.
Artem Dergachev [Tue, 27 Feb 2018 21:19:33 +0000 (21:19 +0000)]
[analyzer] MallocChecker: Suppress false positives in shared pointers.

Throw away MallocChecker warnings that occur after releasing a pointer within a
destructor (or its callees) after performing C11 atomic fetch_add or fetch_sub
within that destructor (or its callees).

This is an indication that the destructor's class is likely a
reference-counting pointer. The analyzer is not able to understand that the
original reference count is usually large enough to avoid most use-after-frees.

Even when the smart pointer is a local variable, we still have these false
positives that this patch suppresses, because the analyzer doesn't currently
support atomics well enough.

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

llvm-svn: 326249

6 years ago[llvm-cvtres] Update the help test after SVN r326244.
Martin Storsjo [Tue, 27 Feb 2018 21:11:03 +0000 (21:11 +0000)]
[llvm-cvtres] Update the help test after SVN r326244.

llvm-svn: 326248

6 years ago[analyzer] Fix trivial copy for empty objects.
Artem Dergachev [Tue, 27 Feb 2018 21:10:08 +0000 (21:10 +0000)]
[analyzer] Fix trivial copy for empty objects.

The SVal for any empty C++ object is an UnknownVal. Because RegionStore does
not have binding extents, binding an empty object to an UnknownVal may
potentially overwrite existing bindings at the same offset.

Therefore, when performing a trivial copy of an empty object, don't try to
take the value of the object and bind it to the copy. Doing nothing is accurate
enough, and it doesn't screw any existing bindings.

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

llvm-svn: 326247

6 years ago[analyzer] Track temporaries without construction contexts for destruction.
Artem Dergachev [Tue, 27 Feb 2018 21:02:58 +0000 (21:02 +0000)]
[analyzer] Track temporaries without construction contexts for destruction.

Sometimes it is not known at compile time which temporary objects will be
constructed, eg. 'x ? A() : B()' or 'C() || D()'. In this case we track which
temporary was constructed to know how to properly call the destructor.

Once the construction context for temporaries was introduced, we moved the
tracking code to the code that investigates the construction context.

Bring back the old mechanism because construction contexts are not always
available yet - eg. in the case where a temporary is constructed without a
constructor expression, eg. returned from a function by value. The mechanism
should still go away eventually.

Additionally, fix a bug in the temporary cleanup code for the case when
construction contexts are not available, which could lead to temporaries
staying in the program state and increasing memory consumption.

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

llvm-svn: 326246

6 years ago[analyzer] Don't crash when dynamic type of a variable is set via placement new.
Artem Dergachev [Tue, 27 Feb 2018 20:54:40 +0000 (20:54 +0000)]
[analyzer] Don't crash when dynamic type of a variable is set via placement new.

If a variable or an otherwise a concrete typed-value region is being
placement-new'ed into, its dynamic type may change in arbitrary manners. And
when the region is used, there may be a third type that's different from both
the static and the dynamic type. It cannot be *completely* different from the
dynamic type, but it may be a base class of the dynamic type - and in this case
there isn't (and shouldn't be) any indication anywhere in the AST that there is
a derived-to-base cast from the dynamic type to the third type.

Perform a generic cast (evalCast()) from the third type to the dynamic type
in this case. From the point of view of the SVal hierarchy, this would have
produced non-canonical SVals if we used such generic cast in the normal case,
but in this case there doesn't seem to be a better option.

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

llvm-svn: 326245

6 years agollvm-cvtres: Mention ARM64 as a supported machine type in the help text. NFC.
Martin Storsjo [Tue, 27 Feb 2018 20:44:33 +0000 (20:44 +0000)]
llvm-cvtres: Mention ARM64 as a supported machine type in the help text. NFC.

llvm-svn: 326244

6 years agoAdd `--dynamic-linker=foo` as an alias for `--dynamic-linker foo`.
Rui Ueyama [Tue, 27 Feb 2018 20:37:18 +0000 (20:37 +0000)]
Add `--dynamic-linker=foo` as an alias for `--dynamic-linker foo`.

This patch fixes a minor compatibility issue with ld.gold and ld.bfd.

llvm-svn: 326243

6 years agoPut undefined symbols from shared libraries in the symbol table.
Rafael Espindola [Tue, 27 Feb 2018 20:31:22 +0000 (20:31 +0000)]
Put undefined symbols from shared libraries in the symbol table.

With the recent fixes these symbols have more in common than not with
regular undefined symbols.

llvm-svn: 326242

6 years ago[InstSimplify] add tests for FP with undef operand; NFC
Sanjay Patel [Tue, 27 Feb 2018 20:17:18 +0000 (20:17 +0000)]
[InstSimplify] add tests for FP with undef operand; NFC

Are any of these correct?

llvm-svn: 326241