platform/upstream/llvm.git
7 years agoFix example: byref struct's init was incorrect, and the block literal's holder should...
Jonathan Roelofs [Thu, 22 Dec 2016 23:48:23 +0000 (23:48 +0000)]
Fix example: byref struct's init was incorrect, and the block literal's holder should point to it.

llvm-svn: 290390

7 years agoUpdate isl to isl-0.18-9-gd4734f3
Tobias Grosser [Thu, 22 Dec 2016 23:08:57 +0000 (23:08 +0000)]
Update isl to isl-0.18-9-gd4734f3

llvm-svn: 290389

7 years ago[ObjectYAML] Fixing a compiler warning
Chris Bieneman [Thu, 22 Dec 2016 22:58:07 +0000 (22:58 +0000)]
[ObjectYAML] Fixing a compiler warning

Accidentally re-defined the variable instead of setting it. Oops!

llvm-svn: 290388

7 years ago[GlobalISel] More fix for the size vs. type typo. NFC.
Quentin Colombet [Thu, 22 Dec 2016 22:50:34 +0000 (22:50 +0000)]
[GlobalISel] More fix for the size vs. type typo. NFC.

I missed those in my previous commit (r290378).

llvm-svn: 290387

7 years ago[ObjectYAML] Support for DWARF debug_info section
Chris Bieneman [Thu, 22 Dec 2016 22:44:27 +0000 (22:44 +0000)]
[ObjectYAML] Support for DWARF debug_info section

This patch adds support for YAML<->DWARF for debug_info sections.

This re-lands r290147, reverted in 290148, re-landed in r290204 after fixing the issue that caused bots to fail (thank you UBSan!), and reverted again in r290209 due to failures on big endian systems.

After adding support for preserving endianness, this should be good now.

llvm-svn: 290386

7 years ago[AArch64] Simplify indexed-memory testcase. NFC.
Ahmed Bougacha [Thu, 22 Dec 2016 22:27:05 +0000 (22:27 +0000)]
[AArch64] Simplify indexed-memory testcase. NFC.

We're only testing the addressing mode on the stores; we don't
need to load/store pointers we can simply pass/return.

llvm-svn: 290385

7 years ago[cfi] Emit jump tables as a function-level inline asm.
Evgeniy Stepanov [Thu, 22 Dec 2016 22:22:35 +0000 (22:22 +0000)]
[cfi] Emit jump tables as a function-level inline asm.

Use a dummy private function with inline asm calls instead of module
level asm blocks for CFI jumptables.

The main advantage is that now jumptable codegen can be affected by
the function attributes (like target_cpu on ARM). Module level asm
gets the default subtarget based on the target triple, which is often
not good enough.

This change also uses asm constraints/arguments to reference
jumptable targets and aliases directly. We no longer do asm name
mangling in an IR pass.

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

llvm-svn: 290384

7 years ago[ObjectYAML] Fixing big endian bots from r290381
Chris Bieneman [Thu, 22 Dec 2016 22:16:04 +0000 (22:16 +0000)]
[ObjectYAML] Fixing big endian bots from r290381

Bot URL:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2505

llvm-svn: 290383

7 years agoReplace WRAP in interceptors with memset, memmove and memcpy implementation
Vitaly Buka [Thu, 22 Dec 2016 22:02:26 +0000 (22:02 +0000)]
Replace WRAP in interceptors with memset, memmove and memcpy implementation

Summary:
According https://reviews.llvm.org/D27659#625093 WRAP adds confusing stack
frame.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 290382

7 years ago[ObjectYAML] MachO support for endianness
Chris Bieneman [Thu, 22 Dec 2016 21:58:03 +0000 (21:58 +0000)]
[ObjectYAML] MachO support for endianness

This patch adds support to the macho<->yaml tools for preserving endianness in MachO structures and DWARF data.

llvm-svn: 290381

7 years ago[MachineVerifier] Check that even generic vregs comply to regclass constraints.
Quentin Colombet [Thu, 22 Dec 2016 21:56:39 +0000 (21:56 +0000)]
[MachineVerifier] Check that even generic vregs comply to regclass constraints.

We used to not check generic vregs, but that is actually a mistake given
nothing in the GlobalISel pipeline is going to fix the constraints on
target specific instructions. Therefore, the target has to have them
right from the start.

llvm-svn: 290380

7 years ago[AArch64] Change a test to use a generic instr instead of a target specific one.
Quentin Colombet [Thu, 22 Dec 2016 21:56:37 +0000 (21:56 +0000)]
[AArch64] Change a test to use a generic instr instead of a target specific one.

Target specific instructions have requirements that are not compatible
with what we want to test here. Namely, target specific instructions
must have their operands properly mapped on register classes.

llvm-svn: 290379

7 years ago[MIRParser] Fix a typo in comment and error message.
Quentin Colombet [Thu, 22 Dec 2016 21:56:35 +0000 (21:56 +0000)]
[MIRParser] Fix a typo in comment and error message.

We have long switched from size to type.

llvm-svn: 290378

7 years ago[AArch64][CallLowering] Constraint registers on target specific instruction
Quentin Colombet [Thu, 22 Dec 2016 21:56:31 +0000 (21:56 +0000)]
[AArch64][CallLowering] Constraint registers on target specific instruction

The InstructionSelect pass will not look at target specific instructions
since they are already selected. As a result, the operands of target
specific instructions must be properly constrained, because it is not
going to fix them.

This fixes invalid register classes on call instruction.

llvm-svn: 290377

7 years ago[MIRParser] Non-generic virtual register may have a type.
Quentin Colombet [Thu, 22 Dec 2016 21:56:29 +0000 (21:56 +0000)]
[MIRParser] Non-generic virtual register may have a type.

When generic virtual registers get constrained, because of a use on a
target specific operation for instance, we end up with regular virtual
registers with a type and that's perfectly fine.

llvm-svn: 290376

7 years ago[RegisterBankInfo] Allow to set a register class when nothing else is set
Quentin Colombet [Thu, 22 Dec 2016 21:56:26 +0000 (21:56 +0000)]
[RegisterBankInfo] Allow to set a register class when nothing else is set

This is going to be needed to be able to constraint register class on
target specific instruction while the RegBankSelect pass did not run
yet.

llvm-svn: 290375

7 years ago[GlobalISel] Refactor the logic to constraint registers.
Quentin Colombet [Thu, 22 Dec 2016 21:56:19 +0000 (21:56 +0000)]
[GlobalISel] Refactor the logic to constraint registers.

Move the logic to constraint register from InstructionSelector to a
utility function. It will be required by other passes in the GlobalISel
pipeline.

llvm-svn: 290374

7 years agoExpose thread local quarantine size as ASAN option.
Evgeniy Stepanov [Thu, 22 Dec 2016 21:43:22 +0000 (21:43 +0000)]
Expose thread local quarantine size as ASAN option.

Summary: Make thread local quarantine size an option so it can be turned off to save memory.

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 290373

7 years agoAMDGPU: Invert cmp + select with constant
Matt Arsenault [Thu, 22 Dec 2016 21:40:08 +0000 (21:40 +0000)]
AMDGPU: Invert cmp + select with constant

Canonicalize a select with a constant to the false side. This
enables more instruction shrinking opportunities since an
inline immediate can be used for the false side of v_cndmask_b32_e32.

This seems to usually be better but causes some code size regressions
in some tests.

llvm-svn: 290372

7 years agoImprove ThreadedQuarantineTest heap memory measurements.
Evgeniy Stepanov [Thu, 22 Dec 2016 21:16:04 +0000 (21:16 +0000)]
Improve ThreadedQuarantineTest heap memory measurements.

Summary:
Warm up ASAN caches in ThreadedQuarantineTest to get more predictable
incremental heap memory usage measurements.

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: aemerson, kubabrecka, llvm-commits

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

llvm-svn: 290371

7 years ago[PowerPC] Add ppc support to update_llc_test_checks.py, and ppc tests. NFC.
Tim Shen [Thu, 22 Dec 2016 20:59:39 +0000 (20:59 +0000)]
[PowerPC] Add ppc support to update_llc_test_checks.py, and ppc tests. NFC.

Reviewers: chandlerc, hfinkel, echristo, iteratee

Subscribers: mehdi_amini, nemanjai, llvm-commits

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

llvm-svn: 290370

7 years agoTestbed and skeleton of a new expression parser
Sean Callanan [Thu, 22 Dec 2016 20:03:14 +0000 (20:03 +0000)]
Testbed and skeleton of a new expression parser

Recommitted after formal approval.

LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project.

Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault.

Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code.

I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features:

A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests.
A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside.
This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals.

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

llvm-svn: 290367

7 years ago[Hexagon] Add DAG mutations for machine pipeliner
Krzysztof Parzyszek [Thu, 22 Dec 2016 19:44:55 +0000 (19:44 +0000)]
[Hexagon] Add DAG mutations for machine pipeliner

llvm-svn: 290366

7 years agoRedo store splitting in CodeGenPrepare.
Wei Mi [Thu, 22 Dec 2016 19:44:45 +0000 (19:44 +0000)]
Redo store splitting in CodeGenPrepare.

This is a succeeding patch of https://reviews.llvm.org/D22840 to address the
issue when a value to be merged into an int64 pair is in a different BB. Redoing
the store splitting in CodeGenPrepare so we can match the pattern across multiple
BBs and move some instructions into the same BB. We still keep the code in dag
combine so that we can catch cases that show up after DAG combining runs.

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

llvm-svn: 290365

7 years ago[OPENMP] Fix for PR31417: assert failure when compiling trivial openmp
Alexey Bataev [Thu, 22 Dec 2016 19:44:05 +0000 (19:44 +0000)]
[OPENMP] Fix for PR31417: assert failure when compiling trivial openmp
program

Offload related code is not quite ready yet, but some simple examples
must not crash the compiler. Patch fixes the problem in offloading code
with exceptions.

llvm-svn: 290364

7 years agoChange the interface of TLI.isMultiStoresCheaperThanBitsMerge.
Wei Mi [Thu, 22 Dec 2016 19:38:22 +0000 (19:38 +0000)]
Change the interface of TLI.isMultiStoresCheaperThanBitsMerge.

This is for splitMergedValStore in DAG Combine to share the target query interface
with similar logic in CodeGenPrepare.

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

llvm-svn: 290363

7 years agoRevert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing...
Renato Golin [Thu, 22 Dec 2016 19:38:04 +0000 (19:38 +0000)]
Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification"

This reverts commit r290354, as it broke the build. We need to make sure
this builds on AArch64 before committing again.

llvm-svn: 290362

7 years ago[mips] Fix compact branch hazard detection, part 2
Petar Jovanovic [Thu, 22 Dec 2016 19:29:50 +0000 (19:29 +0000)]
[mips] Fix compact branch hazard detection, part 2

Follow up to D27209 fix, this patch now properly handles single transient
instruction in basic block.

Patch by Aleksandar Beserminji.

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

llvm-svn: 290361

7 years agoAdd the DAG mutation interface to the software pipeliner
Krzysztof Parzyszek [Thu, 22 Dec 2016 19:21:20 +0000 (19:21 +0000)]
Add the DAG mutation interface to the software pipeliner

llvm-svn: 290360

7 years agoFix a couple of incorrect format string warnings
Luke Drummond [Thu, 22 Dec 2016 19:15:07 +0000 (19:15 +0000)]
Fix a couple of incorrect format string warnings

This patch fixes use of incorrect `%zi` to format a plain `int`, and using
`%llu` to format a `uint64_t`. The fix is to use the new typesafe
`llvm::Formatv` based API.

Differential Revision: https://reviews.llvm.org/D28028
Subscribers: lldb-commits

llvm-svn: 290359

7 years agoPass -Wa,-mbig-obj in 64-bit mingw builds
Reid Kleckner [Thu, 22 Dec 2016 19:12:14 +0000 (19:12 +0000)]
Pass -Wa,-mbig-obj in 64-bit mingw builds

COFF has a 2**16 section limit, and on Win64, every COMDAT function
creates at least 3 sections: .text, .pdata, and .xdata. For MSVC, we
enable bigobj on a file-by-file basis, but GCC appears to hit the limit
on different files.

Fixes PR25953

llvm-svn: 290358

7 years agoBuild KillTheDoctor with mingw-w64
Reid Kleckner [Thu, 22 Dec 2016 19:11:42 +0000 (19:11 +0000)]
Build KillTheDoctor with mingw-w64

compiler-rt uses it in its lit tests.

llvm-svn: 290357

7 years agoFix warning introduced by r290297.
George Burgess IV [Thu, 22 Dec 2016 19:00:31 +0000 (19:00 +0000)]
Fix warning introduced by r290297.

llvm-svn: 290356

7 years agoFix two bugs in the pipeliner in renaming phis in the prolog and epilog
Krzysztof Parzyszek [Thu, 22 Dec 2016 18:49:55 +0000 (18:49 +0000)]
Fix two bugs in the pipeliner in renaming phis in the prolog and epilog

When the pipeliner is renaming phi values, it may need to iterate through
the phi operands to check for other phis. However, the pipeliner should
stop once it reaches a phi that is outside the pipelined loop.

Also, when the generateExistingPhis code is unable to reuse an existing
phi, the default code that computes the PhiOp2 is only to be used when
the pipeliner is generating the kernel. Otherwise, the phi may be a value
computed earlier in the same epilog.

Patch by Brendon Cahoon.

llvm-svn: 290355

7 years ago[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruc...
Serge Rogatch [Thu, 22 Dec 2016 18:48:36 +0000 (18:48 +0000)]
[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification

Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 290354

7 years agoMake alloc_size only applicable to Functions.
George Burgess IV [Thu, 22 Dec 2016 18:48:34 +0000 (18:48 +0000)]
Make alloc_size only applicable to Functions.

I don't remember why I didn't make alloc_size only applicable to
Functions a year ago, but I can't see any compelling reason not to do
so now.

Fixes PR31453.

llvm-svn: 290353

7 years ago[analyzer] Update GTestChecker to tighten API detection
Devin Coughlin [Thu, 22 Dec 2016 17:52:57 +0000 (17:52 +0000)]
[analyzer] Update GTestChecker to tighten API detection

Update the GTestChecker to tighten up the API detection and make it
cleaner in response to post-commit feedback. Also add tests for when
temporary destructors are enabled to make sure we get the expected behavior
when inlining constructors for temporaries.

llvm-svn: 290352

7 years agoAMDGPU: Use i16 for i16 shift amount
Matt Arsenault [Thu, 22 Dec 2016 16:36:25 +0000 (16:36 +0000)]
AMDGPU: Use i16 for i16 shift amount

llvm-svn: 290351

7 years ago[NewGVN] Add the pass to PassRegistry.def.
Davide Italiano [Thu, 22 Dec 2016 16:35:02 +0000 (16:35 +0000)]
[NewGVN] Add the pass to PassRegistry.def.

We need to hook up here to get it working with the new PM.
Add a test while here (and remove a typo).

llvm-svn: 290350

7 years agoAMDGPU: Fix missing 16-bit cmpx instructions
Matt Arsenault [Thu, 22 Dec 2016 16:27:14 +0000 (16:27 +0000)]
AMDGPU: Fix missing 16-bit cmpx instructions

llvm-svn: 290349

7 years agoAMDGPU: Use i16 comparison instructions
Matt Arsenault [Thu, 22 Dec 2016 16:27:11 +0000 (16:27 +0000)]
AMDGPU: Use i16 comparison instructions

llvm-svn: 290348

7 years agoAMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert
Matt Arsenault [Thu, 22 Dec 2016 16:06:32 +0000 (16:06 +0000)]
AMDGPU: Fixed '!NodePtr->isKnownSentinel()' assert

Caused by dereferencing end iterator when trying to const cast the iterator.

Patch by Martin Sherburn

llvm-svn: 290347

7 years ago[GVN] Initial check-in of a new global value numbering algorithm.
Davide Italiano [Thu, 22 Dec 2016 16:03:48 +0000 (16:03 +0000)]
[GVN] Initial check-in of a new global value numbering algorithm.

The code have been developed by Daniel Berlin over the years, and
the new implementation goal is that of addressing shortcomings of
the current GVN infrastructure, i.e. long compile time for large
testcases, lack of phi predication, no load/store value numbering
etc...

The current code just implements the "core" GVN algorithm, although
other pieces (load coercion, phi handling, predicate system) are
already implemented in a branch out of tree. Once the core is stable,
we'll start adding pieces on top of the base framework.
The test currently living in test/Transform/NewGVN are a copy
of the ones in GVN, with proper `XFAIL` (missing features in NewGVN).
A flag will be added in a future commit to enable NewGVN, so that
interested parties can exercise this code easily.

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

llvm-svn: 290346

7 years ago[WebAssembly] Add an "explicit" keyword to a constructor.
Dan Gohman [Thu, 22 Dec 2016 16:03:02 +0000 (16:03 +0000)]
[WebAssembly] Add an "explicit" keyword to a constructor.

llvm-svn: 290345

7 years ago[WebAssembly] Don't use variadic operand indices in the MCOperandInfo array.
Dan Gohman [Thu, 22 Dec 2016 16:00:55 +0000 (16:00 +0000)]
[WebAssembly] Don't use variadic operand indices in the MCOperandInfo array.

llvm-svn: 290344

7 years ago[compiler-rt] Add missing includes of <errno.h> and <iterator>
Krzysztof Parzyszek [Thu, 22 Dec 2016 15:31:21 +0000 (15:31 +0000)]
[compiler-rt] Add missing includes of <errno.h> and <iterator>

The compilation failed due to undeclared identifiers: distance, errno,
and EINTR.

llvm-svn: 290343

7 years ago[WebAssembly] Don't old negative load/store offsets in fast-isel.
Dan Gohman [Thu, 22 Dec 2016 15:15:10 +0000 (15:15 +0000)]
[WebAssembly] Don't old negative load/store offsets in fast-isel.

WebAssembly's load/store offsets are unsigned and don't wrap, so it's not
valid to fold in a negative offset.

llvm-svn: 290342

7 years ago[analyzer] Improve suppress-on-sink behavior in incomplete analyses.
Artem Dergachev [Thu, 22 Dec 2016 14:48:52 +0000 (14:48 +0000)]
[analyzer] Improve suppress-on-sink behavior in incomplete analyses.

Warnings with suppress-on-sink are discarded during FlushReports when
BugReporter notices that all paths in ExplodedGraph that pass through the
warning eventually run into a sink node.

However, suppress-on-sink fails to filter out false positives when the analysis
terminates too early - by running into analyzer limits, such as block count
limits or graph size limits - and the interruption hits the narrow window
between throwing the leak report and reaching the no-return function call. In
such case the report is there, however suppression-on-sink doesn't work, because
the sink node was never constructed in the incomplete ExplodedGraph.

This patch implements a very partial solution: also suppress reports thrown
against a statement-node that corresponds to a statement that belongs to a
no-return block of the CFG.

rdar://problem/28832541

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

llvm-svn: 290341

7 years ago[clang-tidy] cppcoreguidelines-slicing: display discarded state size in bytes
Clement Courbet [Thu, 22 Dec 2016 14:12:31 +0000 (14:12 +0000)]
[clang-tidy] cppcoreguidelines-slicing: display discarded state size in bytes

https://reviews.llvm.org/D27212

llvm-svn: 290340

7 years ago[ELF] Linkerscript: print location of undefined symbol usage
Eugene Leviant [Thu, 22 Dec 2016 13:13:12 +0000 (13:13 +0000)]
[ELF] Linkerscript: print location of undefined symbol usage

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

llvm-svn: 290339

7 years ago[AMDGPU] Add pseudo SDWA instructions
Sam Kolton [Thu, 22 Dec 2016 12:57:41 +0000 (12:57 +0000)]
[AMDGPU] Add pseudo SDWA instructions

Summary: This is needed for later SDWA support in CodeGen.

Reviewers: vpykhtin, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 290338

7 years agoclang-format: Less eagerly try to keep label-value pairs on a line.
Daniel Jasper [Thu, 22 Dec 2016 12:37:06 +0000 (12:37 +0000)]
clang-format: Less eagerly try to keep label-value pairs on a line.

Before:
  string v =
      StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ", SomeFunction(aaaaaaaaaaaa,
                                                           aaaaaaaaaaaaaaa),
             bbbbbbbbbbbbbbbbbbbbbbb);

After:
  string v = StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ",
                    SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa),
                    bbbbbbbbbbbbbbbbbbbbbbb);

llvm-svn: 290337

7 years ago[AMDGPU] Disassembler: fix for disaasembling v_mac_f32/16_dpp/sdwa
Sam Kolton [Thu, 22 Dec 2016 11:30:48 +0000 (11:30 +0000)]
[AMDGPU] Disassembler: fix for disaasembling v_mac_f32/16_dpp/sdwa

Summary: Real instruction should copy constraints from real instruction. This allows auto-generated disassembler to correctly process tied operands.

Reviewers: nhaustov, vpykhtin, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 290336

7 years ago[ELF] - Use error() instead of fatal() during relaxation of R_X86_64_GOTTPOFF
George Rimar [Thu, 22 Dec 2016 11:05:05 +0000 (11:05 +0000)]
[ELF] - Use error() instead of fatal() during relaxation of R_X86_64_GOTTPOFF

This is last known noticable fatal() in target.cpp.
We also have other ones for unknown relocations or
creating unknown targets, but that one can be just error I think.

Used yaml2obj to generate test.

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

llvm-svn: 290335

7 years agoDo not return null or Undefined from find{All,}ByVersion.
Rui Ueyama [Thu, 22 Dec 2016 09:54:32 +0000 (09:54 +0000)]
Do not return null or Undefined from find{All,}ByVersion.

Vectors returned form that function contained nullptrs or Undefined symbols.
This patch filter them out. This makes use of the function a bit easier.

llvm-svn: 290334

7 years ago[X86][AVX2] Passing the appropriate memory operand class to VPMADDWD instruction.
Ayman Musa [Thu, 22 Dec 2016 08:42:46 +0000 (08:42 +0000)]
[X86][AVX2] Passing the appropriate memory operand class to VPMADDWD instruction.

Replacing the memory operand in the ymm version of VPMADDWD from i128mem to i256mem.

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

llvm-svn: 290333

7 years agoMake -color-diagnostics an alias to -color-diagnostics=always.
Rui Ueyama [Thu, 22 Dec 2016 08:20:28 +0000 (08:20 +0000)]
Make -color-diagnostics an alias to -color-diagnostics=always.

Previously, that was an alias to -color-diagnostics=auto. However,
Clang's -fcolor-diagnostics is an alias to -fcolor-diagnostics=always,
so that was confusing. This patch fixes that issue.

llvm-svn: 290332

7 years ago[PM] Loosen the check ever so slightly -- MSVC appears to not include
Chandler Carruth [Thu, 22 Dec 2016 07:53:20 +0000 (07:53 +0000)]
[PM] Loosen the check ever so slightly -- MSVC appears to not include
a space after the comma in template arguments with our hacky type name
system.

llvm-svn: 290331

7 years ago[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files
Diana Picus [Thu, 22 Dec 2016 07:35:56 +0000 (07:35 +0000)]
[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files

Reapply r290077.

Authors: pelikan

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

llvm-svn: 290330

7 years agoSpeculative revert of r290310 to see if that's the change that's making some of
Richard Smith [Thu, 22 Dec 2016 07:24:39 +0000 (07:24 +0000)]
Speculative revert of r290310 to see if that's the change that's making some of
the bots unhappy.

llvm-svn: 290329

7 years ago[PM] Make a couple of CHECK lines a bit more precise, NFC.
Chandler Carruth [Thu, 22 Dec 2016 07:14:35 +0000 (07:14 +0000)]
[PM] Make a couple of CHECK lines a bit more precise, NFC.

I was staring at these and didn't realize these were module-layer
proxies as opposed to some other layer. Justin and I have a plan to
rename things to make the names themselves much easier to reason about,
but I at least want the CHECK lines to be precise for now.

llvm-svn: 290328

7 years ago[PM] Remove now-dead extern template and explicit instantiation
Chandler Carruth [Thu, 22 Dec 2016 07:14:33 +0000 (07:14 +0000)]
[PM] Remove now-dead extern template and explicit instantiation
declarations.

We're using a custom class here instead of the helper template, these
bits just didn't get deleted when the other bits did get deleted. This
was found by a really nice MSVC warning about explicitly instantiating
a template where some member functions aren't defined and thus can't be
instantiatied.

llvm-svn: 290327

7 years ago[CrashReproducer] Add support for merging -ivfsoverlay
Bruno Cardoso Lopes [Thu, 22 Dec 2016 07:06:03 +0000 (07:06 +0000)]
[CrashReproducer] Add support for merging -ivfsoverlay

Merge all VFS mapped files inside -ivfsoverlay inputs into the vfs
overlay provided by the crash reproducer. This is the last missing piece
to allow crash reproducers to fully work with user frameworks; when
combined with headermaps, it allows clang to find additional frameworks.

rdar://problem/27913709

llvm-svn: 290326

7 years ago[PM] Introduce a reasonable port of the main per-module pass pipeline
Chandler Carruth [Thu, 22 Dec 2016 06:59:15 +0000 (06:59 +0000)]
[PM] Introduce a reasonable port of the main per-module pass pipeline
from the old pass manager in the new one.

I'm not trying to support (initially) the numerous options that are
currently available to customize the pass pipeline. If we end up really
wanting them, we can add them later, but I suspect many are no longer
interesting. The simplicity of omitting them will help a lot as we sort
out what the pipeline should look like in the new PM.

I've also documented to the best of my ability *why* each pass or group
of passes is used so that reading the pipeline is more helpful. In many
cases I think we have some questionable choices of ordering and I've
left FIXME comments in place so we know what to come back and revisit
going forward. But for now, I've left it as similar to the current
pipeline as I could.

Lastly, I've had to comment out several places where passes are not
ported to the new pass manager or where the loop pass infrastructure is
not yet ready. I did at least fix a few bugs in the loop pass
infrastructure uncovered by running the full pipeline, but I didn't want
to go too far in this patch -- I'll come back and re-enable these as the
infrastructure comes online. But I'd like to keep the comments in place
because I don't want to lose track of which passes need to be enabled
and where they go.

One thing that seemed like a significant API improvement was to require
that we don't build pipelines for O0. It seems to have no real benefit.

I've also switched back to returning pass managers by value as at this
API layer it feels much more natural to me for composition. But if
others disagree, I'm happy to go back to an output parameter.

I'm not 100% happy with the testing strategy currently, but it seems at
least OK. I may come back and try to refactor or otherwise improve this
in subsequent patches but I wanted to at least get a good starting point
in place.

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

llvm-svn: 290325

7 years agoFix an assertion in DwarfExpression when emitting fragments in vector registers
Adrian Prantl [Thu, 22 Dec 2016 06:10:41 +0000 (06:10 +0000)]
Fix an assertion in DwarfExpression when emitting fragments in vector registers

When DwarfExpression is emitting a fragment that is located in a
register and that fragment is smaller than the register, and the
register must be composed from sub-registers (are you still with me?)
the last DW_OP_piece operation must not be larger than the size of the
fragment itself, since the last piece of the fragment could be smaller
than the last subregister that is being emitted.

rdar://problem/29779065

llvm-svn: 290324

7 years agoDefine a getter function for a lazily-created object.
Rui Ueyama [Thu, 22 Dec 2016 05:31:52 +0000 (05:31 +0000)]
Define a getter function for a lazily-created object.

Previously, you had to call initDemangledSyms() before accessing DemangledSyms.
Now getDemangledSyms() initializes it and then returns it. So it is now less easy
to use it in a wrong way.

llvm-svn: 290323

7 years agoRefactor the DIExpression fragment query interface (NFC)
Adrian Prantl [Thu, 22 Dec 2016 05:27:12 +0000 (05:27 +0000)]
Refactor the DIExpression fragment query interface (NFC)
... so it becomes available to DIExpressionCursor.

llvm-svn: 290322

7 years agoSimplify. NFC.
Rui Ueyama [Thu, 22 Dec 2016 05:22:29 +0000 (05:22 +0000)]
Simplify. NFC.

llvm-svn: 290321

7 years agoDefine a function to avoid a magic variable 0x3.
Rui Ueyama [Thu, 22 Dec 2016 05:11:12 +0000 (05:11 +0000)]
Define a function to avoid a magic variable 0x3.

llvm-svn: 290320

7 years agoMake FormatStyle.GetStyleOfFile test work on MSVC
Antonio Maiorano [Thu, 22 Dec 2016 05:10:07 +0000 (05:10 +0000)]
Make FormatStyle.GetStyleOfFile test work on MSVC

Modify getStyle to use vfs::FileSystem::makeAbsolute just like FS.addFile does,
rather than sys::fs::make_absolute. The latter gets the CWD from the platform,
while the former expects it to be set by the client, causing a mismatch when
converting relative paths to absolute.

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

llvm-svn: 290319

7 years agoRemove a typedef that is used only once.
Rui Ueyama [Thu, 22 Dec 2016 04:40:56 +0000 (04:40 +0000)]
Remove a typedef that is used only once.

llvm-svn: 290318

7 years agoDAG: Add helper for testing constant values
Matt Arsenault [Thu, 22 Dec 2016 04:39:45 +0000 (04:39 +0000)]
DAG: Add helper for testing constant values

There are helpers for testing for constant or constant build_vector,
and for splat ConstantFP vectors, but not for a constantfp or
non-splat ConstantFP vector.

llvm-svn: 290317

7 years agoAMDGPU: Fix missing commute table entries for cmpx
Matt Arsenault [Thu, 22 Dec 2016 04:39:41 +0000 (04:39 +0000)]
AMDGPU: Fix missing commute table entries for cmpx

No tests because these aren't currently used anywhere.

llvm-svn: 290316

7 years agoSema: print qualified name for overload candidates
Saleem Abdulrasool [Thu, 22 Dec 2016 04:26:57 +0000 (04:26 +0000)]
Sema: print qualified name for overload candidates

Print the fully qualified names for the overload candidates.  This makes
it easier to tell what the ambiguity is.  Especially if a template
is instantiated after a using namespace, it will not inherit the
namespace where it was declared.  The specialization will give a message
about a partial order being ambiguous for the same (unqualified) name,
which does not help identify the failure.

Addresses PR31450!

llvm-svn: 290315

7 years ago[ThinLTO] Save 8B per summary entry by rearranging the fields (NFC)
Mehdi Amini [Thu, 22 Dec 2016 04:09:29 +0000 (04:09 +0000)]
[ThinLTO] Save 8B per summary entry by rearranging the fields (NFC)

Size goes from 72B to 64B per entry.

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

llvm-svn: 290314

7 years agoAMDGPU: Swap order of operands in fadd/fsub combine
Matt Arsenault [Thu, 22 Dec 2016 04:03:40 +0000 (04:03 +0000)]
AMDGPU: Swap order of operands in fadd/fsub combine

FMA is canonicalized to constant in the middle operand. Do
the same so fmad matches and avoid an extra combine step.

llvm-svn: 290313

7 years agoAMDGPU: Check fast math flags in fadd/fsub combines
Matt Arsenault [Thu, 22 Dec 2016 04:03:35 +0000 (04:03 +0000)]
AMDGPU: Check fast math flags in fadd/fsub combines

llvm-svn: 290312

7 years agoAMDGPU: Form more FMAs if fusion is allowed
Matt Arsenault [Thu, 22 Dec 2016 03:55:35 +0000 (03:55 +0000)]
AMDGPU: Form more FMAs if fusion is allowed

Extend the existing fadd/fsub->fmad combines to produce
FMA if allowed.

llvm-svn: 290311

7 years agoOnly substitute into type of non-type template parameter once, rather than
Richard Smith [Thu, 22 Dec 2016 03:52:37 +0000 (03:52 +0000)]
Only substitute into type of non-type template parameter once, rather than
twice, in finalization of template argumetn deduction.

llvm-svn: 290310

7 years agoAMDGPU: Move combines into separate functions
Matt Arsenault [Thu, 22 Dec 2016 03:44:42 +0000 (03:44 +0000)]
AMDGPU: Move combines into separate functions

llvm-svn: 290309

7 years agoAMDGPU: Enable some f32 fadd/fsub combines for f16
Matt Arsenault [Thu, 22 Dec 2016 03:40:39 +0000 (03:40 +0000)]
AMDGPU: Enable some f32 fadd/fsub combines for f16

llvm-svn: 290308

7 years agoAMDGPU: Implement isFMAFasterThanFMulAndFAdd for f16
Matt Arsenault [Thu, 22 Dec 2016 03:21:48 +0000 (03:21 +0000)]
AMDGPU: Implement isFMAFasterThanFMulAndFAdd for f16

llvm-svn: 290307

7 years agoAMDGPU: setcc test cleanup
Matt Arsenault [Thu, 22 Dec 2016 03:21:45 +0000 (03:21 +0000)]
AMDGPU: setcc test cleanup

llvm-svn: 290306

7 years agoDriver: use the triple to query the arch, not the toolchain
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:04 +0000 (03:09 +0000)]
Driver: use the triple to query the arch, not the toolchain

Although the result is the same, the intent is much more clear this way:
we care about the architecture we are targeting.  NFC.

llvm-svn: 290305

7 years agoDriver: remove unnecessary parameter
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:02 +0000 (03:09 +0000)]
Driver: remove unnecessary parameter

We can query the Triple and EffectiveTriple from the ToolChain.  Avoid
passing in the argument and query it in the function.  NFC.

llvm-svn: 290304

7 years agoDriver: rename parameter to reduce confusion
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:00 +0000 (03:09 +0000)]
Driver: rename parameter to reduce confusion

The parameter to ParsePICOpts passed the effective triple and then used
that in a few places and used the actual triple in others.  This was
slightly confusing.  Rename the parameter to make it more obvious.

llvm-svn: 290303

7 years agoAMDGPU: Allow rcp and rsq usage with f16
Matt Arsenault [Thu, 22 Dec 2016 03:05:44 +0000 (03:05 +0000)]
AMDGPU: Allow rcp and rsq usage with f16

llvm-svn: 290302

7 years agoAMDGPU: Custom lower f16 fdiv
Matt Arsenault [Thu, 22 Dec 2016 03:05:41 +0000 (03:05 +0000)]
AMDGPU: Custom lower f16 fdiv

llvm-svn: 290301

7 years agoAMDGPU: Implement f16 fcanonicalize
Matt Arsenault [Thu, 22 Dec 2016 03:05:37 +0000 (03:05 +0000)]
AMDGPU: Implement f16 fcanonicalize

llvm-svn: 290300

7 years agoAMDGPU: Update isFPImmLegal for f16
Matt Arsenault [Thu, 22 Dec 2016 03:05:30 +0000 (03:05 +0000)]
AMDGPU: Update isFPImmLegal for f16

I don't think this matters because ConstantFP is legal.

llvm-svn: 290299

7 years agoClear the PendingTypeTests vector after moving from it.
Peter Collingbourne [Thu, 22 Dec 2016 02:52:23 +0000 (02:52 +0000)]
Clear the PendingTypeTests vector after moving from it.

This is to put the vector into a well defined state. Apparently the state of a
vector after being moved from is valid but unspecified. Found with clang-tidy.

llvm-svn: 290298

7 years agoAdd the alloc_size attribute to clang, attempt 2.
George Burgess IV [Thu, 22 Dec 2016 02:50:20 +0000 (02:50 +0000)]
Add the alloc_size attribute to clang, attempt 2.

This is a recommit of r290149, which was reverted in r290169 due to msan
failures. msan was failing because we were calling
`isMostDerivedAnUnsizedArray` on an invalid designator, which caused us
to read uninitialized memory. To fix this, the logic of the caller of
said function was simplified, and we now have a `!Invalid` assert in
`isMostDerivedAnUnsizedArray`, so we can catch this particular bug more
easily in the future.

Fingers crossed that this patch sticks this time. :)

Original commit message:

This patch does three things:
- Gives us the alloc_size attribute in clang, which lets us infer the
  number of bytes handed back to us by malloc/realloc/calloc/any user
  functions that act in a similar manner.
- Teaches our constexpr evaluator that evaluating some `const` variables
  is OK sometimes. This is why we have a change in
  test/SemaCXX/constant-expression-cxx11.cpp and other seemingly
  unrelated tests. Richard Smith okay'ed this idea some time ago in
  person.
- Uniques some Blocks in CodeGen, which was reviewed separately at
  D26410. Lack of uniquing only really shows up as a problem when
  combined with our new eagerness in the face of const.

llvm-svn: 290297

7 years ago[AArch64] Correct the check of signed 9-bit imm in getIndexedAddressParts().
Haicheng Wu [Thu, 22 Dec 2016 01:39:24 +0000 (01:39 +0000)]
[AArch64] Correct the check of signed 9-bit imm in getIndexedAddressParts().

-256 is a legal indexed address part.

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

llvm-svn: 290296

7 years agoPass GetAssumptionCache to InlineFunctionInfo constructor
Easwaran Raman [Thu, 22 Dec 2016 01:07:01 +0000 (01:07 +0000)]
Pass GetAssumptionCache to InlineFunctionInfo constructor

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

llvm-svn: 290295

7 years ago[NVVMIntrRange] Only set range metadata if none is already present
David Majnemer [Thu, 22 Dec 2016 00:51:59 +0000 (00:51 +0000)]
[NVVMIntrRange] Only set range metadata if none is already present

The range metadata inserted by NVVMIntrRange is pessimistic, range
metadata already present could be more precise.

llvm-svn: 290294

7 years agoRenumber testcase metadata nodes after r290153.
Adrian Prantl [Thu, 22 Dec 2016 00:45:21 +0000 (00:45 +0000)]
Renumber testcase metadata nodes after r290153.

This patch renumbers the metadata nodes in debug info testcases after
https://reviews.llvm.org/D26769. This is a separate patch because it
causes so much churn. This was implemented with a python script that
pipes the testcases through llvm-as - | llvm-dis - and then goes
through the original and new output side-by side to insert all
comments at a close-enough location.

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

llvm-svn: 290292

7 years ago[LLParser] Make the line field of DIMacro(File) optional.
Adrian Prantl [Thu, 22 Dec 2016 00:29:00 +0000 (00:29 +0000)]
[LLParser] Make the line field of DIMacro(File) optional.

Otherwise these records do not survive roundtrips.

llvm-svn: 290291

7 years ago[clang-tidy] Ignore `size() == 0` in the container implementation.
Alexander Kornienko [Wed, 21 Dec 2016 23:44:23 +0000 (23:44 +0000)]
[clang-tidy] Ignore `size() == 0` in the container implementation.

llvm-svn: 290289

7 years agoLegalize metadata in legacy testcases
Adrian Prantl [Wed, 21 Dec 2016 23:38:17 +0000 (23:38 +0000)]
Legalize metadata in legacy testcases

llvm-svn: 290288

7 years agoLegalize metadata in legacy testcases
Adrian Prantl [Wed, 21 Dec 2016 23:36:06 +0000 (23:36 +0000)]
Legalize metadata in legacy testcases

llvm-svn: 290287