platform/upstream/llvm.git
7 years agoDR1295 and cleanup for P0135R1: Make our initialization code more directly
Richard Smith [Fri, 9 Dec 2016 18:49:13 +0000 (18:49 +0000)]
DR1295 and cleanup for P0135R1: Make our initialization code more directly
mirror the description in the standard. Per DR1295, this means that binding a
const / rvalue reference to a bit-field no longer "binds directly", and per
P0135R1, this means that we materialize a temporary in reference binding
after adjusting cv-qualifiers and before performing a derived-to-base cast.

In C++11 onwards, this should have fixed the last case where we would
materialize a temporary of the wrong type (with a subobject adjustment inside
the MaterializeTemporaryExpr instead of outside), but we still have to deal
with that possibility in C++98, unless we want to start using xvalues to
represent materialized temporaries there too.

llvm-svn: 289250

7 years ago[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.
Ekaterina Romanova [Fri, 9 Dec 2016 18:35:50 +0000 (18:35 +0000)]
[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.

Tagged instruction names with <c> INSTR_NAME </c> to display them in typewriter font.

In the past, \c command was used, unfortunately it applied to only one word.
<c> .. </c> has the same meaning, but applies to all words in between the tags.

llvm-svn: 289249

7 years agoAMDGPU: Fix isTypeDesirableForOp for i16
Matt Arsenault [Fri, 9 Dec 2016 17:57:43 +0000 (17:57 +0000)]
AMDGPU: Fix isTypeDesirableForOp for i16

This should do nothing for targets without i16.

llvm-svn: 289235

7 years agoRelax IRgen check in decl-in-prototype.c to match signext on PPC64
Reid Kleckner [Fri, 9 Dec 2016 17:56:04 +0000 (17:56 +0000)]
Relax IRgen check in decl-in-prototype.c to match signext on PPC64

llvm-svn: 289234

7 years agoFix i386 being able to show member variables correctly by not returning empty objecti...
Greg Clayton [Fri, 9 Dec 2016 17:54:59 +0000 (17:54 +0000)]
Fix i386 being able to show member variables correctly by not returning empty objective C types from the runtime.

We don't parse ObjC v1 types from the runtime metadata like we do for ObjC v2, but doing so by creating empty types was ruining the i386 v1 debugging experience.

<rdar://problem/24093343>

llvm-svn: 289233

7 years ago[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes (REAPPLIED)
Simon Pilgrim [Fri, 9 Dec 2016 17:53:11 +0000 (17:53 +0000)]
[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes (REAPPLIED)

Reapplied with fix for PR31323 - X86 SSE2 vXi16 multiplies for illegal types were creating CONCAT_VECTORS nodes with vector inputs that might not total the number of elements in the result type.

llvm-svn: 289232

7 years agoAMDGPU: Fix i128 mul
Matt Arsenault [Fri, 9 Dec 2016 17:49:14 +0000 (17:49 +0000)]
AMDGPU: Fix i128 mul

llvm-svn: 289231

7 years agoAMDGPU: Allow TBA, TMA, TTMP* registers with SMEM instructions
Matt Arsenault [Fri, 9 Dec 2016 17:49:11 +0000 (17:49 +0000)]
AMDGPU: Allow TBA, TMA, TTMP* registers with SMEM instructions

Fixes assembler regressions.

llvm-svn: 289230

7 years agoAMDGPU: Clean up instruction bits
Matt Arsenault [Fri, 9 Dec 2016 17:49:08 +0000 (17:49 +0000)]
AMDGPU: Clean up instruction bits

Sort the instruction bits by type and make sure there is one
for each format.

Also cleanup namespaces.

llvm-svn: 289229

7 years agoDon't assert when redefining a built-in macro in a PCH, PR29119
Nico Weber [Fri, 9 Dec 2016 17:32:52 +0000 (17:32 +0000)]
Don't assert when redefining a built-in macro in a PCH, PR29119

PCH files store the macro history for a given macro, and the whole history list
for one identifier is given to the Preprocessor at once via
Preprocessor::setLoadedMacroDirective(). This contained an assert that no macro
history exists yet for that identifier. That's usually true, but it's not true
for builtin macros, which are created in Preprocessor() before flags and pchs
are processed. Luckily, ASTWriter stops writing macro history lists at builtins
(see shouldIgnoreMacro() in ASTWriter.cpp), so the head of the history list was
missing for builtin macros. So make the assert weaker, and splice the history
list to the existing single define for builtins.

https://reviews.llvm.org/D27545

llvm-svn: 289228

7 years ago[PPC] Add intrinsics for vector extract word and vector insert word.
Sean Fertile [Fri, 9 Dec 2016 17:21:42 +0000 (17:21 +0000)]
[PPC] Add intrinsics for vector extract word and vector insert word.

Revision: https://reviews.llvm.org/D26547
llvm-svn: 289227

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Fri, 9 Dec 2016 17:18:24 +0000 (17:18 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

This reverts commit r289221 which appears to be triggering an assertion

llvm-svn: 289226

7 years agoStore decls in prototypes on the declarator instead of in the AST
Reid Kleckner [Fri, 9 Dec 2016 17:14:05 +0000 (17:14 +0000)]
Store decls in prototypes on the declarator instead of in the AST

This saves two pointers from FunctionDecl that were being used for some
rare and questionable C-only functionality.  The DeclsInPrototypeScope
ArrayRef was added in r151712 in order to parse this kind of C code:

    enum e {x, y};
    int f(enum {y, x} n) {
     return x; // should return 1, not 0
    }

The challenge is that we parse 'int f(enum {y, x} n)' it its own
function prototype scope that gets popped before we build the
FunctionDecl for 'f'. The original change was doing two questionable
things:

1. Saving all tag decls introduced in prototype scope on a TU-global
Sema variable. This is problematic when you have cases like this, where
'x' and 'y' shouldn't be visible in 'f':
    void f(void (*fp)(enum { x, y } e)) { /* no x */ }
This patch fixes that, so now 'f' can't see 'x', which is consistent
with GCC.

2. Storing the decls in FunctionDecl in ActOnFunctionDeclarator so that
they could be used in ActOnStartOfFunctionDef. This is just an
inefficient way to move information around. The AST lives forever, but
the list of non-parameter decls in prototype scope is short lived.

Moving these things to the Declarator solves both of these issues.

Reviewers: rsmith

Subscribers: jmolloy, cfe-commits

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

llvm-svn: 289225

7 years agoFix parsing when one extern follows another.
Rafael Espindola [Fri, 9 Dec 2016 16:44:05 +0000 (16:44 +0000)]
Fix parsing when one extern follows another.

llvm-svn: 289224

7 years agoFix buildbots that are failing due to this test by adding all expected fails that...
Greg Clayton [Fri, 9 Dec 2016 16:25:13 +0000 (16:25 +0000)]
Fix buildbots that are failing due to this test by adding all expected fails that TestMultipleDebuggers.py has.

llvm-svn: 289223

7 years agoRename multiple target test so it is unique.
Greg Clayton [Fri, 9 Dec 2016 16:22:10 +0000 (16:22 +0000)]
Rename multiple target test so it is unique.

llvm-svn: 289222

7 years agoIn visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Nirav Dave [Fri, 9 Dec 2016 16:15:12 +0000 (16:15 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

Retrying after fixing overly aggressive load-store forwarding optimization.

Simplify Consecutive Merge Store Candidate Search

Now that address aliasing is much less conservative, push through
simplified store merging search which only checks for parallel stores
through the chain subgraph. This is cleaner as the separation of
non-interfering loads/stores from the store-merging logic.

Whem merging stores, search up the chain through a single load, and
finds all possible stores by looking down from through a load and a
TokenFactor to all stores visited. This improves the quality of the
output SelectionDAG and generally the output CodeGen (with some
exceptions).

Additional Minor Changes:

   1. Finishes removing unused AliasLoad code
   2. Unifies the the chain aggregation in the merged stores across
      code paths
   3. Re-add the Store node to the worklist after calling
      SimplifyDemandedBits.
   4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
      arbitrary, but seemed sufficient to not cause regressions in
      tests.

This finishes the change Matt Arsenault started in r246307 and
jyknight's original patch.

Many tests required some changes as memory operations are now
reorderable. Some tests relying on the order were changed to use
volatile memory operations

Noteworthy tests:

    CodeGen/AArch64/argument-blocks.ll -
      It's not entirely clear what the test_varargs_stackalign test is
      supposed to be asserting, but the new code looks right.

    CodeGen/AArch64/arm64-memset-inline.lli -
    CodeGen/AArch64/arm64-stur.ll -
    CodeGen/ARM/memset-inline.ll -

      The backend now generates *worse* code due to store merging
      succeeding, as we do do a 16-byte constant-zero store efficiently.

    CodeGen/AArch64/merge-store.ll -
      Improved, but there still seems to be an extraneous vector insert
      from an element to itself?

    CodeGen/PowerPC/ppc64-align-long-double.ll -
      Worse code emitted in this case, due to the improved store->load
      forwarding.

    CodeGen/X86/dag-merge-fast-accesses.ll -
    CodeGen/X86/MergeConsecutiveStores.ll -
    CodeGen/X86/stores-merging.ll -
    CodeGen/Mips/load-store-left-right.ll -
      Restored correct merging of non-aligned stores

    CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
      Improved. Correctly merges buffer_store_dword calls

    CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
      Improved. Sidesteps loading a stored value and
      merges two stores

    CodeGen/X86/pr18023.ll -
      This test has been removed, as it was asserting incorrect
      behavior. Non-volatile stores *CAN* be moved past volatile loads,
      and now are.

    CodeGen/X86/vector-idiv.ll -
    CodeGen/X86/vector-lzcnt-128.ll -
      It's basically impossible to tell what these tests are actually
      testing. But, looks like the code got better due to the memory
      operations being recognized as non-aliasing.

    CodeGen/X86/win32-eh.ll -
      Both loads of the securitycookie are now merged.

Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle

Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, dsanders, resistor, tstellarAMD, t.p.northover, spatel

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

llvm-svn: 289221

7 years agoUse SelectionDAG.getSplatBuildVector helper. NFCI.
Simon Pilgrim [Fri, 9 Dec 2016 16:01:50 +0000 (16:01 +0000)]
Use SelectionDAG.getSplatBuildVector helper. NFCI.

llvm-svn: 289220

7 years agoAMDGPU/SI: Don't mark VINTRP instructions as mayLoad
Tom Stellard [Fri, 9 Dec 2016 15:57:15 +0000 (15:57 +0000)]
AMDGPU/SI: Don't mark VINTRP instructions as mayLoad

Summary:
These instructions technically do read from memory, but the memory
is considered to be out of bounds for normal load/store instructions.

shader-db stats:

SGPRS: 1416075 -> 1413323 (-0.19 %)
VGPRS: 867413 -> 863935 (-0.40 %)
Spilled SGPRs: 1409 -> 1354 (-3.90 %)
Spilled VGPRs: 63 -> 63 (0.00 %)
Private memory VGPRs: 880 -> 880 (0.00 %)
Scratch size: 2648 -> 2632 (-0.60 %) dwords per thread
Code Size: 37889052 -> 37897340 (0.02 %) bytes
LDS: 2147 -> 2147 (0.00 %) blocks
Max Waves: 279243 -> 280369 (0.40 %)
Wait states: 0 -> 0 (0.00 %)

Reviewers: nhaehnle, mareko, arsenm

Subscribers: kzhuravl, wdng, yaxunl, tony-tye

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

llvm-svn: 289219

7 years ago[SelectionDAG] Use SelectionDAG.getBuildVector helper. NFCI.
Simon Pilgrim [Fri, 9 Dec 2016 15:23:41 +0000 (15:23 +0000)]
[SelectionDAG] Use SelectionDAG.getBuildVector helper. NFCI.

Makes interception of BUILD_VECTOR creation easier for debugging.

llvm-svn: 289218

7 years agoDon't crash on an extra symbol in a version script.
Rafael Espindola [Fri, 9 Dec 2016 15:08:40 +0000 (15:08 +0000)]
Don't crash on an extra symbol in a version script.

llvm-svn: 289217

7 years ago[SCEVExpander] Remove \brief, reflow comments; NFC
Sanjoy Das [Fri, 9 Dec 2016 14:42:14 +0000 (14:42 +0000)]
[SCEVExpander] Remove \brief, reflow comments; NFC

llvm-svn: 289216

7 years ago[SCEVExpander] Use llvm data structures; NFC
Sanjoy Das [Fri, 9 Dec 2016 14:42:11 +0000 (14:42 +0000)]
[SCEVExpander] Use llvm data structures; NFC

llvm-svn: 289215

7 years ago[SelectionDAG] Add additional checks to CONCAT_VECTORS creation
Simon Pilgrim [Fri, 9 Dec 2016 14:27:52 +0000 (14:27 +0000)]
[SelectionDAG] Add additional checks to CONCAT_VECTORS creation

Part of the work for PR31323 - add extra asserts checking that the input vectors are of consistent type and result in the correct number of vector elements.

llvm-svn: 289214

7 years agoDocument and publish the useful module-file-info flag.
Vassil Vassilev [Fri, 9 Dec 2016 14:20:32 +0000 (14:20 +0000)]
Document and publish the useful module-file-info flag.

llvm-svn: 289213

7 years agoGive preempting symbols precedence over linker script.
Rafael Espindola [Fri, 9 Dec 2016 14:12:02 +0000 (14:12 +0000)]
Give preempting symbols precedence over linker script.

llvm-svn: 289212

7 years ago[LLDB][MIPS] Fix TestWatchpointIter failure
Nitesh Jain [Fri, 9 Dec 2016 13:54:47 +0000 (13:54 +0000)]
[LLDB][MIPS] Fix TestWatchpointIter failure

Reviewers: jingham

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 289211

7 years ago[LLDB][MIPS] Fix TestMultipleHits for MIPS
Nitesh Jain [Fri, 9 Dec 2016 13:44:15 +0000 (13:44 +0000)]
[LLDB][MIPS] Fix TestMultipleHits for MIPS

Reviewers: clayborg, labath, zturner

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 289210

7 years ago[LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet.
Nitesh Jain [Fri, 9 Dec 2016 13:37:14 +0000 (13:37 +0000)]
[LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet.

Reviewers: jaydeep, bhushan, clayborg

Subscribers: slthakur, lldb-commits

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

llvm-svn: 289209

7 years agoPlug another leak in the DWARF unittests, DIEInlineStrings are never destroyed.
Benjamin Kramer [Fri, 9 Dec 2016 13:33:41 +0000 (13:33 +0000)]
Plug another leak in the DWARF unittests, DIEInlineStrings are never destroyed.

llvm-svn: 289208

7 years agoFix memory leak in unit test.
Benjamin Kramer [Fri, 9 Dec 2016 13:12:30 +0000 (13:12 +0000)]
Fix memory leak in unit test.

The StringPool entries are destroyed with the allocator, the string pool
itself is not.

llvm-svn: 289207

7 years agoUpdate doc version to 4.0
Eric Fiselier [Fri, 9 Dec 2016 12:33:49 +0000 (12:33 +0000)]
Update doc version to 4.0

llvm-svn: 289206

7 years ago[NFC] Change whitespace to force docs rebuild
Eric Fiselier [Fri, 9 Dec 2016 12:32:02 +0000 (12:32 +0000)]
[NFC] Change whitespace to force docs rebuild

llvm-svn: 289205

7 years agoFix missing const on set::count. Patch from Andrey Khalyavin
Eric Fiselier [Fri, 9 Dec 2016 12:17:31 +0000 (12:17 +0000)]
Fix missing const on set::count. Patch from Andrey Khalyavin

llvm-svn: 289204

7 years ago[clang-format] calculate MaxInsertOffset in the original code correctly.
Eric Liu [Fri, 9 Dec 2016 11:45:50 +0000 (11:45 +0000)]
[clang-format] calculate MaxInsertOffset in the original code correctly.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 289203

7 years agollvm/test/Object/archive-thin-create.test: Make sure that %t is empty to stabilize...
NAKAMURA Takumi [Fri, 9 Dec 2016 11:44:57 +0000 (11:44 +0000)]
llvm/test/Object/archive-thin-create.test: Make sure that %t is empty to stabilize the test.

llvm-svn: 289202

7 years ago[AVR] Remove a set of redundant tests
Dylan McKay [Fri, 9 Dec 2016 11:22:26 +0000 (11:22 +0000)]
[AVR] Remove a set of redundant tests

This fixes the build.

llvm-svn: 289201

7 years ago[SelectionDAG] Add partial BITCAST support to computeKnownBits
Simon Pilgrim [Fri, 9 Dec 2016 10:13:45 +0000 (10:13 +0000)]
[SelectionDAG] Add partial BITCAST support to computeKnownBits

Adds support for bitcasting a little endian 'small element' vector to 'large element' scalar/vector (e.g. v16i8 to v4i32 or v2i32 to i64), which is required for PR30845. We extract the knownbits for each 'small element' part and concatenate the results together.

We can add support for big endian and 'large element' scalar/vector to 'small element' vector bitcasting once we have test cases for them.

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

llvm-svn: 289200

7 years agoFix TestMultipleTargets for on x86_64 architectures
Pavel Labath [Fri, 9 Dec 2016 10:05:07 +0000 (10:05 +0000)]
Fix TestMultipleTargets for on x86_64 architectures

This test links against liblldb, so it can only run when the target arch is the
same arch as liblldb. We already have a decorator for that, so apply it.

While I'm in there, also mark the test as debug-info independent.

llvm-svn: 289199

7 years ago[ELF][I386] .got.plt entries for i386 should use VA of ifunc resolver
Peter Smith [Fri, 9 Dec 2016 09:59:54 +0000 (09:59 +0000)]
[ELF][I386] .got.plt entries for i386 should use VA of ifunc resolver

The i386 glibc ld.so expects the .got.slot entry that is relocated by a
R_386_IRELATIVE relocation to point directly at the ifunc resolver and
not the address of the PLT entry + 6 (thus entering the lazy resolver).
This is also the case for ARM and I suspect it is because these use REL
relocations and can't use the addend field to store the address of the
ifunc resolver. If the lazy resolver is used we get an error message
stating that only R_386_JUMP_SLOT is supported.

As ARM and i386 share the same code, I've removed the ARM specific test
and added a writeIgotPlt() function that by default calls writeGotPlt().
ARM and i386 override this to write the address of the ifunc resolver.

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

llvm-svn: 289198

7 years agoRefactor uses_allocator test types for upcoming fixes
Eric Fiselier [Fri, 9 Dec 2016 09:51:09 +0000 (09:51 +0000)]
Refactor uses_allocator test types for upcoming fixes

llvm-svn: 289197

7 years agoUpdate Doxygen comment in StringSaver (NFC)
Malcolm Parsons [Fri, 9 Dec 2016 09:33:33 +0000 (09:33 +0000)]
Update Doxygen comment in StringSaver (NFC)

llvm-svn: 289196

7 years agoPut C++ ABI headers in a special build directory instead of the top level.
Eric Fiselier [Fri, 9 Dec 2016 09:31:01 +0000 (09:31 +0000)]
Put C++ ABI headers in a special build directory instead of the top level.

    This patch changes where the C++ ABI headers are put during the build. Previously
    they were put in the top level include directory (not the libc++ header directory).
    However that just polutes the top level directory. Instead this patch creates a special
    directory to put them in. The reason they can't be put under c++/v1 until after the build
    is because libc++ uses the in-source headers, so we can't add the include path of the libc++
    headers in the object dir.

    Additionally this patch teaches the test suite how to find the ABI headers,
    and adds a demangling utility to help debug tests with.

llvm-svn: 289195

7 years agoRevert "[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes"
Daniel Jasper [Fri, 9 Dec 2016 09:04:51 +0000 (09:04 +0000)]
Revert "[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes"

This reverts commit r288916 as it is currently causing a crasher in
Halide. Reproducer on llvm.org/PR31323. While it might be that halide is
generating invalid IR, llc shouldn't crash.

llvm-svn: 289194

7 years ago[X86] Modify patterns from memory form of RCP/RSQRT/SQRT intrinsics to only allow...
Craig Topper [Fri, 9 Dec 2016 07:57:21 +0000 (07:57 +0000)]
[X86] Modify patterns from memory form of RCP/RSQRT/SQRT intrinsics to only allow (scalar_to_vector (loadf32/load64)) instead of anything that sse_load_f32/f64 can match.

sse_load_f32/f64 can also match loads that are zero extended to vectors. We shouldn't match that because we wouldn't be able to get the instruction to zero the upper bits like the intrinsic semantics would require for such a case.

There is a test case that does depend on this behavior.

llvm-svn: 289193

7 years ago[AVR] Use a more appropriate integer type for wide IN/OUT instructions
Dylan McKay [Fri, 9 Dec 2016 07:49:14 +0000 (07:49 +0000)]
[AVR] Use a more appropriate integer type for wide IN/OUT instructions

We could previously select an integer which would hit an assertion error
in pseudo expansion.

The new type will also generate the appropriate fixups if needed, which
wasn't done beforehand.

llvm-svn: 289192

7 years ago[AVR] Add tests for a large number of pseudo instructions
Dylan McKay [Fri, 9 Dec 2016 07:49:04 +0000 (07:49 +0000)]
[AVR] Add tests for a large number of pseudo instructions

This adds MIR tests for 24 pseudo instructions.

llvm-svn: 289191

7 years ago[AVX-512] Correctly preserve the passthru semantics of the FMA scalar intrinsics
Craig Topper [Fri, 9 Dec 2016 06:42:28 +0000 (06:42 +0000)]
[AVX-512] Correctly preserve the passthru semantics of the FMA scalar intrinsics

Summary:
Scalar intrinsics have specific semantics about the which input's upper bits are passed through to the output. The same input is also supposed to be the input we use for the lower element when the mask bit is 0 in a masked operation. We aren't currently keeping these semantics with instruction selection.

This patch corrects this by introducing new scalar FMA ISD nodes that indicate whether operand 1(one of the multiply inputs) or operand 3(the additon/subtraction input) should pass thru its upper bits.

We use this information to select 213/132 form for the operand 1 version and the 231 form for the operand 3 version.

We also use this information to suppress combining FNEG operations on the passthru input since semantically the passthru bits aren't negated. This is stronger than the earlier check added for a user being SELECTS so we can remove that.

This fixes PR30913.

Reviewers: delena, zvi, v_klochkov

Subscribers: llvm-commits

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

llvm-svn: 289190

7 years agoAMDGPU: Select i16 instructions to VOP3 forms
Matt Arsenault [Fri, 9 Dec 2016 06:19:12 +0000 (06:19 +0000)]
AMDGPU: Select i16 instructions to VOP3 forms

These were selecting directly to the VOP2 form instead
of VOP3 like the i32 instructions. Fixes regressions in
future commits where an immediate isn't folded because it was
initially used for the second operand.

Because uniform 16-bit operations are promoted to i32, it's
difficult to get a simple testcase where this matters. Fold
failures in SIFoldOperands here tend to be hidden by commute
and fold in SIShrinkInstructions.

llvm-svn: 289189

7 years agoRemove some more uses of Args::GetArgumentAtIndex.
Zachary Turner [Fri, 9 Dec 2016 05:46:41 +0000 (05:46 +0000)]
Remove some more uses of Args::GetArgumentAtIndex.

llvm-svn: 289188

7 years agoRe-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." with a...
Peter Collingbourne [Fri, 9 Dec 2016 05:20:43 +0000 (05:20 +0000)]
Re-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." with a configure-time check for lseek64.

llvm-svn: 289187

7 years ago[X86] Add masked versions of VPERMT2* and VPERMI2* to load folding tables.
Craig Topper [Fri, 9 Dec 2016 05:20:11 +0000 (05:20 +0000)]
[X86] Add masked versions of VPERMT2* and VPERMI2* to load folding tables.

llvm-svn: 289186

7 years agoRevert r289184, we need more configury for Darwin and *BSD.
Peter Collingbourne [Fri, 9 Dec 2016 05:04:30 +0000 (05:04 +0000)]
Revert r289184, we need more configury for Darwin and *BSD.

llvm-svn: 289185

7 years agoSupport: Use a 64-bit seek in raw_fd_ostream::seek().
Peter Collingbourne [Fri, 9 Dec 2016 04:57:19 +0000 (04:57 +0000)]
Support: Use a 64-bit seek in raw_fd_ostream::seek().

llvm-svn: 289184

7 years agoAdd type records to TPI stream.
Rui Ueyama [Fri, 9 Dec 2016 04:46:54 +0000 (04:46 +0000)]
Add type records to TPI stream.

I don't think the data I add to a TPI stream in this patch is correct,
but at least it can be displayed using llvm-pdbdump. Until I add more
streams to a PDB file, I'm not able to know whether the data will be
accepted by MSVC tools or not.

llvm-svn: 289183

7 years ago[SCCP] Make the test added in r289175 more meaningful.
Davide Italiano [Fri, 9 Dec 2016 03:49:20 +0000 (03:49 +0000)]
[SCCP] Make the test added in r289175 more meaningful.

Add a comment while here.

llvm-svn: 289182

7 years ago[Headers] Add #include_next for tgmath.h on Darwin
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:30:46 +0000 (03:30 +0000)]
[Headers] Add #include_next for tgmath.h on Darwin

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

llvm-svn: 289181

7 years agoReverting rL289088 while investigating some test issue on the build servers
Kostya Kortchinsky [Fri, 9 Dec 2016 03:28:12 +0000 (03:28 +0000)]
Reverting rL289088 while investigating some test issue on the build servers

Subscribers: kubabrecka

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

llvm-svn: 289180

7 years ago[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma
Kelvin Li [Fri, 9 Dec 2016 03:24:30 +0000 (03:24 +0000)]
[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma

This patch is to implement sema and parsing for 'teams distribute parallel for' pragma.

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

llvm-svn: 289179

7 years agofix misspelling in .clang-format
Eric Fiselier [Fri, 9 Dec 2016 03:18:45 +0000 (03:18 +0000)]
fix misspelling in .clang-format

llvm-svn: 289178

7 years agoTurn off header sorting and comment formatting
Eric Fiselier [Fri, 9 Dec 2016 03:17:25 +0000 (03:17 +0000)]
Turn off header sorting and comment formatting

llvm-svn: 289177

7 years ago[CrashReproducer] Provide a clean dir path for -fmodules-cache-path
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:11:48 +0000 (03:11 +0000)]
[CrashReproducer] Provide a clean dir path for -fmodules-cache-path

The most common workflow with module reproducers involves deleting the
module cache before running the script. This happens because leftovers
from the crash are present in the cache and could trigger unrelated and
confusing errors, misleading from the initial reproduction intent.
Change this to point to a clean path but leave the leftovers untouched.

rdar://problem/28655070

llvm-svn: 289176

7 years ago[SCCP] Teach the pass about `mul %x 0` even if %x is overdefined.
Davide Italiano [Fri, 9 Dec 2016 03:08:42 +0000 (03:08 +0000)]
[SCCP] Teach the pass about `mul %x 0` even if %x is overdefined.

The motivating example is:

extern int patatino;
int goo() {
    int x = 0;
    for (int i = 0; i < 1000000; ++i) {
        x *= patatino;
    }
    return x;
}

Currently SCCP will not realize that this function returns always zero,
therefore will try to unroll and vectorize the loop at -O3 producing an
awful lot of (useless) code. With this change, it will just produce:

0000000000000000 <g>:
   xor    %eax,%eax
   retq

llvm-svn: 289175

7 years ago[CrashReproducer] Rewrite relative include paths
Bruno Cardoso Lopes [Fri, 9 Dec 2016 02:22:47 +0000 (02:22 +0000)]
[CrashReproducer] Rewrite relative include paths

When -fmodules is on, the reproducer invocation currently leave paths
for include-like flags as is. If the path is relative, the reproducer
doesn't know how to access that file during reproduction time because
the VFS cannot reason about relative paths.

Expand relative paths to absolute ones when creating the reproducer
command line. This allows, for example, the reproducer to work for
crashes while building clang with modules; this wasn't possible before
because building clang requires using relative inc dir from within the
build directory.

rdar://problem/28655070

llvm-svn: 289174

7 years ago[AVX-512] Add vpermilps/pd to load folding tables.
Craig Topper [Fri, 9 Dec 2016 02:18:11 +0000 (02:18 +0000)]
[AVX-512] Add vpermilps/pd to load folding tables.

llvm-svn: 289173

7 years ago[AVX-512] Move some floating point stack folding test cases out of the integer test.
Craig Topper [Fri, 9 Dec 2016 02:18:07 +0000 (02:18 +0000)]
[AVX-512] Move some floating point stack folding test cases out of the integer test.

llvm-svn: 289172

7 years ago[Analysis] Fix typo in comment. NFC
Craig Topper [Fri, 9 Dec 2016 02:18:04 +0000 (02:18 +0000)]
[Analysis] Fix typo in comment. NFC

llvm-svn: 289171

7 years agoCOFF: Use make() in SymbolTable and Writer.
Rui Ueyama [Fri, 9 Dec 2016 02:13:12 +0000 (02:13 +0000)]
COFF: Use make() in SymbolTable and Writer.

llvm-svn: 289170

7 years agoCalling SBDebugger::CeeateTarget being called on multiple threads was crashing LLDB.
Greg Clayton [Fri, 9 Dec 2016 01:21:14 +0000 (01:21 +0000)]
Calling SBDebugger::CeeateTarget being called on multiple threads was crashing LLDB.

I found the race condition in:

ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create);

More than one "ScriptInterpreter *" was being returned due to the race which caused any clients with the first one to now be pointing to freed memory and we would quickly crash.

Added a test to catch this so we don't regress.

<rdar://problem/28356584>

llvm-svn: 289169

7 years agoFix some occurrences of passing StringRef to Printf.
Zachary Turner [Fri, 9 Dec 2016 01:20:58 +0000 (01:20 +0000)]
Fix some occurrences of passing StringRef to Printf.

Hopefully these will all disappear in the future once we move
to formatv.

llvm-svn: 289168

7 years agoSpecify -std=gnu++98 on some Rewriter tests. NFC.
Paul Robinson [Fri, 9 Dec 2016 01:20:40 +0000 (01:20 +0000)]
Specify -std=gnu++98 on some Rewriter tests. NFC.

Rewriter tests rewrite Objective-C++ to C++, and then compile the
result.  The rewritten result sometimes doesn't work with C++11.  As
we want to allow Clang's default dialect to become C++11, we need to
make sure the tests will still pass.

llvm-svn: 289167

7 years ago[libFuzzer] implement crash-resistant merge (https://github.com/google/sanitizers...
Kostya Serebryany [Fri, 9 Dec 2016 01:17:24 +0000 (01:17 +0000)]
[libFuzzer] implement crash-resistant merge (https://github.com/google/sanitizers/issues/722). This is a first experimental variant that needs some more testing, thus not yet adding a lit test (but there are unit tests).

llvm-svn: 289166

7 years agoWholeProgramDevirt: Teach the pass to handle structs of arrays.
Peter Collingbourne [Fri, 9 Dec 2016 01:10:11 +0000 (01:10 +0000)]
WholeProgramDevirt: Teach the pass to handle structs of arrays.

This will become necessary in some cases once D22296 lands.

llvm-svn: 289165

7 years agoModernize the Args access pattern in a few more commands.
Zachary Turner [Fri, 9 Dec 2016 01:08:29 +0000 (01:08 +0000)]
Modernize the Args access pattern in a few more commands.

llvm-svn: 289164

7 years ago[LCG] Minor cleanup to the LCG walk over a function, NFC.
Chandler Carruth [Fri, 9 Dec 2016 00:46:44 +0000 (00:46 +0000)]
[LCG] Minor cleanup to the LCG walk over a function, NFC.

This just hoists the check for declarations up a layer which allows
various sets used in the walk to be smaller. Also moves the relevant
comments to match, and catches a few other cleanups in this code.

llvm-svn: 289163

7 years agoMake WholeProgramDevirt understand ConstStruct vtables.
Peter Collingbourne [Fri, 9 Dec 2016 00:33:27 +0000 (00:33 +0000)]
Make WholeProgramDevirt understand ConstStruct vtables.

Based on a patch by LemonBoy!

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

llvm-svn: 289162

7 years ago[ObjectYAML] Support for DWARF debug_aranges
Chris Bieneman [Fri, 9 Dec 2016 00:26:44 +0000 (00:26 +0000)]
[ObjectYAML] Support for DWARF debug_aranges

This patch adds support for round tripping DWARF debug_aranges in and out of YAML.

llvm-svn: 289161

7 years ago[AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You Use...
Eugene Zelenko [Fri, 9 Dec 2016 00:11:53 +0000 (00:11 +0000)]
[AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 289160

7 years ago[DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 23:58:39 +0000 (23:58 +0000)]
[DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.

llvm-svn: 289159

7 years agoFix PR27374 - Remove the implicit reduced-arity-extension in tuple.
Eric Fiselier [Thu, 8 Dec 2016 23:57:08 +0000 (23:57 +0000)]
Fix PR27374 - Remove the implicit reduced-arity-extension in tuple.

This patch removes libc++'s tuple extension which allowed it to be
constructed from fewer initializers than elements; with the remaining
elements being default constructed. However the implicit version of
this extension breaks conforming code. For example:

    int fun(std::string);
    int fun(std::tuple<std::string, int>);
    int x = fun("hello"); // ambigious

Because existing code may already depend on this extension it can be re-enabled
by defining _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION.

Note that the explicit version of this extension is still supported,
although it's somewhat less useful than the implicit one.

llvm-svn: 289158

7 years ago[InstCombine] add tests for umin+icmp; NFC
Sanjay Patel [Thu, 8 Dec 2016 23:44:58 +0000 (23:44 +0000)]
[InstCombine] add tests for umin+icmp; NFC

llvm-svn: 289157

7 years ago[InstCombine] add tests for umax+icmp; NFC
Sanjay Patel [Thu, 8 Dec 2016 23:36:57 +0000 (23:36 +0000)]
[InstCombine] add tests for umax+icmp; NFC

llvm-svn: 289156

7 years agoClean up the new TestInterruptThreadNames test a bit.
Jason Molenda [Thu, 8 Dec 2016 23:34:56 +0000 (23:34 +0000)]
Clean up the new TestInterruptThreadNames test a bit.

llvm-svn: 289155

7 years ago[DOXYGEN] Improved doxygen comments.
Ekaterina Romanova [Thu, 8 Dec 2016 23:32:07 +0000 (23:32 +0000)]
[DOXYGEN] Improved doxygen comments.

Improved doxygen comments for fxsrintrin.h and mmintrin.h intrinsics by taagging parameter names with \a doxygen command to display parameters in italics.

Formatted comments to fit into 80 chars.

llvm-svn: 289154

7 years ago[InstSimplify] Add "X / 1.0" to SimplifyFDivInst.
Zia Ansari [Thu, 8 Dec 2016 23:27:40 +0000 (23:27 +0000)]
[InstSimplify] Add "X / 1.0" to SimplifyFDivInst.

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

llvm-svn: 289153

7 years ago[ELF] Allow output section data commands to take expressions
Meador Inge [Thu, 8 Dec 2016 23:21:30 +0000 (23:21 +0000)]
[ELF] Allow output section data commands to take expressions

The current implementation of the output section data store commands
can only handle integer literals, but it should really handle arbitrary
expressions [1].  This commit fixes that.

[1] https://sourceware.org/binutils/docs-2.27/ld/Output-Section-Data.html#Output-Section-Data

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

llvm-svn: 289152

7 years ago[InstCombine] add tests for smax+icmp; NFC
Sanjay Patel [Thu, 8 Dec 2016 23:16:06 +0000 (23:16 +0000)]
[InstCombine] add tests for smax+icmp; NFC

llvm-svn: 289151

7 years agoGlobalISel: fall back gracefully for debug intrinsics.
Tim Northover [Thu, 8 Dec 2016 22:44:13 +0000 (22:44 +0000)]
GlobalISel: fall back gracefully for debug intrinsics.

Supporting them properly is a reasonably complex chunk of work, so to allow bot
testing before then we should at least be able to fall back to DAG ISel.

llvm-svn: 289150

7 years agoGlobalISel: factor overflow handling into separate function. NFC.
Tim Northover [Thu, 8 Dec 2016 22:44:00 +0000 (22:44 +0000)]
GlobalISel: factor overflow handling into separate function. NFC.

llvm-svn: 289149

7 years agoSplit linkerscript.s into small test files.
Rui Ueyama [Thu, 8 Dec 2016 22:36:12 +0000 (22:36 +0000)]
Split linkerscript.s into small test files.

linkerscript.s is the first test file for linker script, and at the moment
it contains all tests for linker scripts. Now that test file doesn't make
sense.

linkerscript2.s was just badly named. Renamed searchdir.s.

llvm-svn: 289148

7 years ago[SCCP] Make sure SCCP and ConstantFolding agree on undef >> a.
Davide Italiano [Thu, 8 Dec 2016 22:28:53 +0000 (22:28 +0000)]
[SCCP] Make sure SCCP and ConstantFolding agree on undef >> a.

Currently SCCP folds the value to -1, while ConstantProp folds to
0. This changes SCCP to do what ConstantFolding does.

llvm-svn: 289147

7 years agoPrint a warning message if ENTRY() symbol is not found.
Rui Ueyama [Thu, 8 Dec 2016 22:26:31 +0000 (22:26 +0000)]
Print a warning message if ENTRY() symbol is not found.

llvm-svn: 289146

7 years ago[sanitizer] Add workaround for empty strings
Vitaly Buka [Thu, 8 Dec 2016 22:26:03 +0000 (22:26 +0000)]
[sanitizer] Add workaround for empty strings

Summary: I see crashes on this check when some reports are being generated.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 289145

7 years ago[sanitizers] lsan+sancov doesn't need ubsanrt (multi def error)
Mike Aizatsky [Thu, 8 Dec 2016 22:25:01 +0000 (22:25 +0000)]
[sanitizers] lsan+sancov doesn't need ubsanrt (multi def error)

Reviewers: eugenis

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

llvm-svn: 289144

7 years ago[mips] Make the test case more specific and provide OS component of a triple. NFC
Simon Atanasyan [Thu, 8 Dec 2016 22:10:52 +0000 (22:10 +0000)]
[mips] Make the test case more specific and provide OS component of a triple. NFC

llvm-svn: 289117

7 years ago[DOXYGEN] Improved doxygen comments for emmintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 22:10:51 +0000 (22:10 +0000)]
[DOXYGEN] Improved doxygen comments for emmintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.

llvm-svn: 289116

7 years ago[mips] Change instruction s/daddiu/addiu/ since O32 prohibits the use of 64-bit GPRs...
Simon Atanasyan [Thu, 8 Dec 2016 22:10:48 +0000 (22:10 +0000)]
[mips] Change instruction s/daddiu/addiu/ since O32 prohibits the use of 64-bit GPRs. NFC

llvm-svn: 289115

7 years ago[mips] Change gnueabi to gnu in the triple because EABI has been removed recently...
Simon Atanasyan [Thu, 8 Dec 2016 22:10:44 +0000 (22:10 +0000)]
[mips] Change gnueabi to gnu in the triple because EABI has been removed recently. NFC

llvm-svn: 289114

7 years ago[mips] Remove N32 Android test because Android does not support N32 ABI. NFC
Simon Atanasyan [Thu, 8 Dec 2016 22:10:38 +0000 (22:10 +0000)]
[mips] Remove N32 Android test because Android does not support N32 ABI. NFC

llvm-svn: 289113

7 years agoFix -Wunused-private-field.
Rui Ueyama [Thu, 8 Dec 2016 21:49:18 +0000 (21:49 +0000)]
Fix -Wunused-private-field.

llvm-svn: 289112