platform/upstream/llvm.git
7 years ago[libFuzzer] one more puzzle, value_profile cracks it in a second
Kostya Serebryany [Fri, 9 Sep 2016 18:00:04 +0000 (18:00 +0000)]
[libFuzzer] one more puzzle, value_profile cracks it in a second

llvm-svn: 281066

7 years ago[OPENMP] Implementation of omp_get_default_device and omp_set_default_device
George Rokos [Fri, 9 Sep 2016 17:55:26 +0000 (17:55 +0000)]
[OPENMP] Implementation of omp_get_default_device and omp_set_default_device

Implementation of missing OpenMP 4.0 API functions omp_get_default_device and omp_set_default_device.
Also, added support for the environment variable OMP_DEFAULT_DEVICE.

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

llvm-svn: 281065

7 years agoAlso cleanup comments around redundant colons/commas in format::cleanup.
Eric Liu [Fri, 9 Sep 2016 17:50:49 +0000 (17:50 +0000)]
Also cleanup comments around redundant colons/commas in format::cleanup.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281064

7 years ago[pdb] Write PDB TPI Stream from Yaml.
Zachary Turner [Fri, 9 Sep 2016 17:46:17 +0000 (17:46 +0000)]
[pdb] Write PDB TPI Stream from Yaml.

This writes the full sequence of type records described in
Yaml to the TPI stream of the PDB file.

Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D24316

llvm-svn: 281063

7 years ago[llvm-cov] Handle native paths correctly in the text index
Vedant Kumar [Fri, 9 Sep 2016 17:37:11 +0000 (17:37 +0000)]
[llvm-cov] Handle native paths correctly in the text index

Treat filenames the same way in the text index as we do in the html
index. This is a follow-up to r281008 (an attempt to unbreak the
native_separators.c test on Windows).

Patch by Maggie Yi!

llvm-svn: 281062

7 years agoMove the ocaml_all target into the Misc folder for cleanliness; NFC.
Aaron Ballman [Fri, 9 Sep 2016 17:30:59 +0000 (17:30 +0000)]
Move the ocaml_all target into the Misc folder for cleanliness; NFC.

llvm-svn: 281061

7 years ago[codeview] Don't assert if the array element type is incomplete
Reid Kleckner [Fri, 9 Sep 2016 17:29:36 +0000 (17:29 +0000)]
[codeview] Don't assert if the array element type is incomplete

This can happen when the frontend knows the debug info will be emitted
somewhere else. Usually this happens for dynamic classes with out of
line constructors or key functions, but it can also happen when modules
are enabled.

llvm-svn: 281060

7 years ago[Bitcode] Add compatibility test for the 3.9 release
Vedant Kumar [Fri, 9 Sep 2016 17:24:31 +0000 (17:24 +0000)]
[Bitcode] Add compatibility test for the 3.9 release

Fork off compatibility.ll for the 3.9 release. The *.bc file in this
commit was produced using a Release build of the release_39 branch.

llvm-svn: 281059

7 years agoxfail DarwinLog "filter message by regex" tests
Todd Fiala [Fri, 9 Sep 2016 17:07:15 +0000 (17:07 +0000)]
xfail DarwinLog "filter message by regex" tests

These tests are not working reliably.  I'm marking them
xfail until I resolve the issue.

Tracked by:
llvm.org/pr30299

llvm-svn: 281058

7 years ago[DebugInfo] Ensure complete type is emitted with -fstandalone-debug
Reid Kleckner [Fri, 9 Sep 2016 17:03:53 +0000 (17:03 +0000)]
[DebugInfo] Ensure complete type is emitted with -fstandalone-debug

The logic for upgrading a class from a forward decl to a complete type
was not checking the debug info emission level before applying the
vtable optimization. This meant we ended up without debug info for a
class which was required to be complete. I noticed it because it
triggered an assertion during CodeView emission, but that's a separate
issue.

llvm-svn: 281057

7 years agoMake -fstandalone-debug and -flimit-debug-info available in clang-cl
Reid Kleckner [Fri, 9 Sep 2016 16:42:50 +0000 (16:42 +0000)]
Make -fstandalone-debug and -flimit-debug-info available in clang-cl

Our limited debug info optimizations are breaking down at DLL
boundaries, so we're going to evaluate the size impact of these
settings, and possibly change the default.

Users should be able to override our settings, though.

llvm-svn: 281056

7 years ago[InstCombine] add tests to show pattern matching failures due to commutation
Sanjay Patel [Fri, 9 Sep 2016 16:35:20 +0000 (16:35 +0000)]
[InstCombine] add tests to show pattern matching failures due to commutation

I was looking to fix a bug in getComplexity(), and these cases showed up as
obvious failures. I'm not sure how to find these in general though.

llvm-svn: 281055

7 years agoAttempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.
Justin Lebar [Fri, 9 Sep 2016 16:29:13 +0000 (16:29 +0000)]
Attempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.

These were added in r281051, which, I am embarrassed to admit, has an
incomplete commit message that I forgot to update before pushing.  You
can ignore element (2) in that list.

llvm-svn: 281054

7 years ago[codeview] Extend the heuristic for detecting classes imported from DLLs
Reid Kleckner [Fri, 9 Sep 2016 16:27:04 +0000 (16:27 +0000)]
[codeview] Extend the heuristic for detecting classes imported from DLLs

If a dynamic class contains a dllimport method, then assume the class
may not be constructed in this DLL, and therefore the vtable will live
in a different PDB.

This heuristic is still incomplete, and will miss things like abstract
base classes that are only constructed on one side of the DLL interface.
That said, this heuristic does detect some cases that are currently
problematic, and may be useful to other projects that don't use many
DLLs.

llvm-svn: 281053

7 years agoFlattenAlgo: Ensure we _really_ obtain a param space
Tobias Grosser [Fri, 9 Sep 2016 16:11:26 +0000 (16:11 +0000)]
FlattenAlgo: Ensure we _really_ obtain a param space

This resolves "isl_space.c:1775: not a parameter space" errors I have seen
on two systems.

llvm-svn: 281052

7 years ago[SelectionDAG] Fix two issues with SDNode::getRawSubclassData().
Justin Lebar [Fri, 9 Sep 2016 16:07:06 +0000 (16:07 +0000)]
[SelectionDAG] Fix two issues with SDNode::getRawSubclassData().

1) On some platforms, sizeof(SDNodeBits) == 1, so we were only copying
one byte out of the bitfield when we wanted to copy two, and we were
leaving half of the return value of getRawSubclassData() undefined.

2) Something something bitfields, not sure exactly what the issue or fix
is, yet.  (TODO)

Summary:
Previously we were assuming that SDNodeBits covered all of SDNode's
anonymous subclass data bitfield union.  But that's not right; it might
have size 1, in which it clearly doesn't.

This patch adds a field that does cover the whole union and adds
static_asserts to ensure it stays correct.

Reviewers: ahatanak, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 281051

7 years agoAMDGPU] Assembler: better support for immediate literals in assembler.
Sam Kolton [Fri, 9 Sep 2016 14:44:04 +0000 (14:44 +0000)]
AMDGPU] Assembler: better support for immediate literals in assembler.

Summary:
Prevously assembler parsed all literals as either 32-bit integers or 32-bit floating-point values. Because of this we couldn't support f64 literals.
E.g. in instruction "v_fract_f64 v[0:1], 0.5", literal 0.5 was encoded as 32-bit literal 0x3f000000, which is incorrect and will be interpreted as 3.0517578125E-5 instead of 0.5. Correct encoding is inline constant 240 (optimal) or 32-bit literal 0x3FE00000 at least.

With this change the way immediate literals are parsed is changed. All literals are always parsed as 64-bit values either integer or floating-point. Then we convert parsed literals to correct form based on information about type of operand parsed (was literal floating or binary) and type of expected instruction operands (is this f32/64 or b32/64 instruction).
Here are rules how we convert literals:
    - We parsed fp literal:
        - Instruction expects 64-bit operand:
            - If parsed literal is inlinable (e.g. v_fract_f64_e32 v[0:1], 0.5)
                - then we do nothing this literal
            - Else if literal is not-inlinable but instruction requires to inline it (e.g. this is e64 encoding, v_fract_f64_e64 v[0:1], 1.5)
                - report error
            - Else literal is not-inlinable but we can encode it as additional 32-bit literal constant
                - If instruction expect fp operand type (f64)
                    - Check if low 32 bits of literal are zeroes (e.g. v_fract_f64 v[0:1], 1.5)
                        - If so then do nothing
                    - Else (e.g. v_fract_f64 v[0:1], 3.1415)
                        - report warning that low 32 bits will be set to zeroes and precision will be lost
                        - set low 32 bits of literal to zeroes
                - Instruction expects integer operand type (e.g. s_mov_b64_e32 s[0:1], 1.5)
                    - report error as it is unclear how to encode this literal
        - Instruction expects 32-bit operand:
            - Convert parsed 64 bit fp literal to 32 bit fp. Allow lose of precision but not overflow or underflow
            - Is this literal inlinable and are we required to inline literal (e.g. v_trunc_f32_e64 v0, 0.5)
                - do nothing
                - Else report error
            - Do nothing. We can encode any other 32-bit fp literal (e.g. v_trunc_f32 v0, 10000000.0)
    - Parsed binary literal:
        - Is this literal inlinable (e.g. v_trunc_f32_e32 v0, 35)
            - do nothing
        - Else, are we required to inline this literal (e.g. v_trunc_f32_e64 v0, 35)
            - report error
        - Else, literal is not-inlinable and we are not required to inline it
            - Are high 32 bit of literal zeroes or same as sign bit (32 bit)
                - do nothing (e.g. v_trunc_f32 v0, 0xdeadbeef)
            - Else
                - report error (e.g. v_trunc_f32 v0, 0x123456789abcdef0)

For this change it is required that we know operand types of instruction (are they f32/64 or b32/64). I added several new register operands (they extend previous register operands) and set operand types to corresponding types:
'''
enum OperandType {
    OPERAND_REG_IMM32_INT,
    OPERAND_REG_IMM32_FP,
    OPERAND_REG_INLINE_C_INT,
    OPERAND_REG_INLINE_C_FP,
}
'''

This is not working yet:
    - Several tests are failing
    - Problems with predicate methods for inline immediates
    - LLVM generated assembler parts try to select e64 encoding before e32.
More changes are required for several AsmOperands.

Reviewers: vpykhtin, tstellarAMD

Subscribers: arsenm, kzhuravl, artem.tamazov

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

llvm-svn: 281050

7 years agoRecommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.
George Rimar [Fri, 9 Sep 2016 14:35:36 +0000 (14:35 +0000)]
Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.

Fixed code that was not checked before on windows for me, because of testcases that are
disabled on that platform atm.

Inital commit message:
"[ELF] - Versionscript: do not treat non-wildcarded names as wildcards."
Previously we incorrectly handled cases when symbol name in extern c++ tag
was enclosed in quotes. Next case was treated as wildcard:

GLIBCXX_3.4 {
    extern "C++" {
    "aaa*"
   }
But it should have not. Quotes around aaa here means that we should have do exact
name matching.
That is PR30268 which has name with pointer is interpreted as wildcard by lld:

extern "C++" {
    "operator delete[](void*)";

Patch fixes the issue.

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

llvm-svn: 281049

7 years ago[asan] Since r280945 fixed the OS X abort() problem, merge scariness_score_test.cc...
Filipe Cabecinhas [Fri, 9 Sep 2016 14:18:22 +0000 (14:18 +0000)]
[asan] Since r280945 fixed the OS X abort() problem, merge scariness_score_test.cc and make it a general test.

Summary: Merges back both scariness_score_test.cc files, since the Linux-specific version shouldn't be needed any more.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281048

7 years ago[Sparc][LEON] Removed the parts of the errata fixes implemented using inline assembly...
Chris Dewhurst [Fri, 9 Sep 2016 14:16:51 +0000 (14:16 +0000)]
[Sparc][LEON] Removed the parts of the errata fixes implemented using inline assembly as this is not the desired behaviour for end-users. Small change to a unit test to implement this without requiring the inline assembly.

llvm-svn: 281047

7 years agoRevert r281045, it broke BB.
George Rimar [Fri, 9 Sep 2016 14:16:00 +0000 (14:16 +0000)]
Revert r281045, it broke BB.

Broken BB:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27211

llvm-svn: 281046

7 years agoRecommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.
George Rimar [Fri, 9 Sep 2016 13:58:07 +0000 (13:58 +0000)]
Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.

Fixed code that was not checked by testcases that are disabled on windows.

Inital commit message:
"[ELF] - Versionscript: do not treat non-wildcarded names as wildcards."
Previously we incorrectly handled cases when symbol name in extern c++ tag
was enclosed in quotes. Next case was treated as wildcard:

GLIBCXX_3.4 {
    extern "C++" {
    "aaa*"
   }
But it should have not. Quotes around aaa here means that we should have do exact
name matching.
That is PR30268 which has name with pointer is interpreted as wildcard by lld:

extern "C++" {
    "operator delete[](void*)";

Patch fixes the issue.

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

llvm-svn: 281045

7 years ago[ARM] ADD with a negative offset can become SUB for free
James Molloy [Fri, 9 Sep 2016 13:35:36 +0000 (13:35 +0000)]
[ARM] ADD with a negative offset can become SUB for free

So model that directly in TTI::getIntImmCost().

llvm-svn: 281044

7 years ago[ARM] icmp %x, -C can be lowered to a simple ADDS or CMN
James Molloy [Fri, 9 Sep 2016 13:35:28 +0000 (13:35 +0000)]
[ARM] icmp %x, -C can be lowered to a simple ADDS or CMN

Tell TargetTransformInfo about this so ConstantHoisting is informed.

llvm-svn: 281043

7 years ago[SelectionDAG] Ensure DAG::getZeroExtendInReg is called with a scalar type
Simon Pilgrim [Fri, 9 Sep 2016 13:31:52 +0000 (13:31 +0000)]
[SelectionDAG] Ensure DAG::getZeroExtendInReg is called with a scalar type

Fixes issue with rL280927 identified by Mikael Holmén

llvm-svn: 281042

7 years ago[ELF] - Revert r281038 to see if that unbreaks build bot.
George Rimar [Fri, 9 Sep 2016 12:56:55 +0000 (12:56 +0000)]
[ELF] - Revert r281038 to see if that unbreaks build bot.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19703

llvm-svn: 281041

7 years ago[Thumb] Select (CMPZ X, -C) -> (CMPZ (ADDS X, C), 0)
James Molloy [Fri, 9 Sep 2016 12:52:24 +0000 (12:52 +0000)]
[Thumb] Select (CMPZ X, -C) -> (CMPZ (ADDS X, C), 0)

The CMPZ #0 disappears during peepholing, leaving just a tADDi3, tADDi8 or t2ADDri. This avoids having to materialize the expensive negative constant in Thumb-1, and allows a shrinking from a 32-bit CMN to a 16-bit ADDS in Thumb-2.

llvm-svn: 281040

7 years agoAdd namespace specifier before nullptr_t
Tobias Grosser [Fri, 9 Sep 2016 12:31:38 +0000 (12:31 +0000)]
Add namespace specifier before nullptr_t

This fixes the following compile time errors:

  error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'

llvm-svn: 281039

7 years ago[ELF] - Versionscript: do not treat non-wildcarded names as wildcards.
George Rimar [Fri, 9 Sep 2016 12:22:28 +0000 (12:22 +0000)]
[ELF] - Versionscript: do not treat non-wildcarded names as wildcards.

Previously we incorrectly handled cases when symbol name in extern c++ tag
was enclosed in quotes. Next case was treated as wildcard:

GLIBCXX_3.4 {
    extern "C++" {
    "aaa*"
   }
But it should have not. Quotes around aaa here means that we should have do exact
name matching.
That is PR30268 which has name with pointer is interpreted as wildcard by lld:

extern "C++" {
    "operator delete[](void*)";

Patch fixes the issue.

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

llvm-svn: 281038

7 years agoGlobalISel: remove G_TYPE and G_PHI
Tim Northover [Fri, 9 Sep 2016 11:47:31 +0000 (11:47 +0000)]
GlobalISel: remove G_TYPE and G_PHI

These instructions were only necessary when type information was stored in the
MachineInstr (because only generic MachineInstrs possessed a type). Now that
it's in MachineRegisterInfo, COPY and PHI work fine.

llvm-svn: 281037

7 years agoGlobalISel: fix comments and add assertions for valid instructions.
Tim Northover [Fri, 9 Sep 2016 11:46:58 +0000 (11:46 +0000)]
GlobalISel: fix comments and add assertions for valid instructions.

llvm-svn: 281036

7 years agoGlobalISel: move type information to MachineRegisterInfo.
Tim Northover [Fri, 9 Sep 2016 11:46:34 +0000 (11:46 +0000)]
GlobalISel: move type information to MachineRegisterInfo.

We want each register to have a canonical type, which means the best place to
store this is in MachineRegisterInfo rather than on every MachineInstr that
happens to use or define that register.

Most changes following from this are pretty simple (you need an MRI anyway if
you're going to be doing any transformations, so just check the type there).
But legalization doesn't really want to check redundant operands (when, for
example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
operand type field to encode these constraints and limit legalization's work.

As an added bonus, more validation is possible, both in MachineVerifier and
MachineIRBuilder (coming soon).

llvm-svn: 281035

7 years agoIslNodeBuilder: Add missing __isl_take annotation
Tobias Grosser [Fri, 9 Sep 2016 11:16:50 +0000 (11:16 +0000)]
IslNodeBuilder: Add missing __isl_take annotation

llvm-svn: 281034

7 years agoRevert "[mips] Fix c.<cc>.<fmt> instruction definition."
Simon Dardis [Fri, 9 Sep 2016 11:06:01 +0000 (11:06 +0000)]
Revert "[mips] Fix c.<cc>.<fmt> instruction definition."

This reverts commit r281022. Mips buildbot broke, due to unhandled register
class FCC.

llvm-svn: 281033

7 years ago[LLDB][MIPS] Fix Emulation for JALR64 Instruction
Nitesh Jain [Fri, 9 Sep 2016 10:46:25 +0000 (10:46 +0000)]
[LLDB][MIPS] Fix Emulation for JALR64 Instruction

Subscribers: jaydeep, bhushan, slthakur, sdardis, lldb-commits
llvm-svn: 281032

7 years ago[LLDB][MIPS] Fix TestEhFrameUnwind.py for MIPS
Nitesh Jain [Fri, 9 Sep 2016 10:20:08 +0000 (10:20 +0000)]
[LLDB][MIPS] Fix TestEhFrameUnwind.py for MIPS

Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 281031

7 years agoFixing a build breakage caused from a change in LLVM rL281019
Dimitar Vlahovski [Fri, 9 Sep 2016 10:14:11 +0000 (10:14 +0000)]
Fixing a build breakage caused from a change in LLVM rL281019

Summary:
LLVM guys did some clean-up of the Attribute getters/setters
and because of that the build was failing.

Reviewers: ldrumm

Subscribers: lldb-commits

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

llvm-svn: 281030

7 years agoNFC: Reformat ABISysV_i386 register context into something readable
Pavel Labath [Fri, 9 Sep 2016 10:12:57 +0000 (10:12 +0000)]
NFC: Reformat ABISysV_i386 register context into something readable

add clang-format guards so it does not reformat it again.

llvm-svn: 281029

7 years ago[AMDGPU] Assembler: rename amd_kernel_code_t asm names according to spec
Sam Kolton [Fri, 9 Sep 2016 10:08:02 +0000 (10:08 +0000)]
[AMDGPU] Assembler: rename amd_kernel_code_t asm names according to spec

Summary:
Also removed duplicate code from AMDGPUTargetAsmStreamer.
This change only change how amd_kernel_code_t is parsed and printed. No variable names are changed.

Reviewers: vpykhtin, tstellarAMD

Subscribers: arsenm, wdng, nhaehnle

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

llvm-svn: 281028

7 years ago[Thumb1] Teach optimizeCompareInstr about thumb1 compares
James Molloy [Fri, 9 Sep 2016 09:51:06 +0000 (09:51 +0000)]
[Thumb1] Teach optimizeCompareInstr about thumb1 compares

This avoids us doing a completely unneeded "cmp r0, #0" after a flag-setting instruction if we only care about the Z or C flags.

Add LSL/LSR to the whitelist while we're here and add testing. This code could really do with a spring clean.

llvm-svn: 281027

7 years ago[LLDB][MIPS] Fix TestLldbGdbServer.py failure
Nitesh Jain [Fri, 9 Sep 2016 09:50:33 +0000 (09:50 +0000)]
[LLDB][MIPS] Fix TestLldbGdbServer.py failure

Subscribers: jaydeep, bhushan, slthakur, lldb-commits
llvm-svn: 281026

7 years agoFix new gdb-remote client unit test for windows
Pavel Labath [Fri, 9 Sep 2016 09:49:54 +0000 (09:49 +0000)]
Fix new gdb-remote client unit test for windows

The behaviour of FileSpec differed between host OS versions. Hardcode the path
syntax to posix, as we don't care about that in this test.

llvm-svn: 281025

7 years agoLinker script: implement AT [ (address) ] for PHDR
Eugene Leviant [Fri, 9 Sep 2016 09:46:16 +0000 (09:46 +0000)]
Linker script: implement AT [ (address) ] for PHDR

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

llvm-svn: 281024

7 years ago[AMDGPU] Assembler: match e32 VOP instructions before e64.
Sam Kolton [Fri, 9 Sep 2016 09:37:51 +0000 (09:37 +0000)]
[AMDGPU] Assembler: match e32 VOP instructions before e64.

Summary:
Split assembler match table in 4 tables with assembler variants:

Default - all instructions except VOP3, SDWA and DPP
  - VOP3
  - SDWA
  - DPP
First match Default table then VOP3, SDWA and DPP.

Reviewers:  tstellarAMD, artem.tamazov, vpykhtin

Subscribers: arsenm, wdng, nhaehnle, AMDGPU

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

llvm-svn: 281023

7 years ago[mips] Fix c.<cc>.<fmt> instruction definition.
Simon Dardis [Fri, 9 Sep 2016 09:22:52 +0000 (09:22 +0000)]
[mips] Fix c.<cc>.<fmt> instruction definition.

As part of this effort, remove MipsFCmp nodes and use tablegen
patterns rather than custom lowering through C++.

Unexpectedly, this improves codesize for microMIPS as previous floating
point setcc expansions would materialize 0 and 1 into GPRs before using
the relevant mov[tf].[sd] instruction. Now $zero is used directly.

Reviewers: dsanders, vkalintiris, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D23118

llvm-svn: 281022

7 years ago[Sparc][LEON] Unit test for CASA instruction supported by some LEON processors added.
Chris Dewhurst [Fri, 9 Sep 2016 09:08:13 +0000 (09:08 +0000)]
[Sparc][LEON] Unit test for CASA instruction supported by some LEON processors added.

llvm-svn: 281021

7 years ago[Coroutines] Part13: Handle single edge PHINodes across suspends
Gor Nishanov [Fri, 9 Sep 2016 05:39:00 +0000 (05:39 +0000)]
[Coroutines] Part13: Handle single edge PHINodes across suspends

Summary:
If one of the uses of the value is a single edge PHINode, handle it.

Original:

    %val = something
    <suspend>
    %p = PHINode [%val]

After Spill + Part13:

    %val = something
    %slot = gep val.spill.slot
    store %val, %slot
    <suspend>
    %p = load %slot

Plus tiny fixes/changes:
   * use correct index for coro.free in CoroCleanup
   * fixup id parameter in coro.free to allow authoring coroutine in plain C with __builtins

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 281020

7 years agoRationalise the attribute getter/setter methods on Function and CallSite.
Amaury Sechet [Fri, 9 Sep 2016 04:50:38 +0000 (04:50 +0000)]
Rationalise the attribute getter/setter methods on Function and CallSite.

Summary:
While woring on mapping attributes in the C API, it clearly appeared that the recent changes in the API on the C++ side left Function and Call/Invoke with an attribute API that grew in an ad hoc manner. This makes it difficult to work with it, because one doesn't know which overloads exists and which do not.

Make sure that getter/setter function exists for both enum and string version. Remove inconsistent getter/setter, unless they have many callsites.

This should make it easier to work with attributes in the future.

This doesn't change how attribute works.

Reviewers: bkramer, whitequark, mehdi_amini, void

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D21514

llvm-svn: 281019

7 years agoUpdate clang for D21514. NFC
Amaury Sechet [Fri, 9 Sep 2016 04:42:49 +0000 (04:42 +0000)]
Update clang for D21514. NFC

Summary: As per title.

Reviewers: ahatanak, bkramer, whitequark, mehdi_amini, void

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21515

llvm-svn: 281018

7 years ago[Docs] Fix typos, remove trailing whitespace.
George Burgess IV [Fri, 9 Sep 2016 02:45:48 +0000 (02:45 +0000)]
[Docs] Fix typos, remove trailing whitespace.

Avoided wrapping NullabilityDocs at 80cols, since that would've made
this diff much bigger, and never-ending lines seems to be the style for
many of the null-related docs.

llvm-svn: 281017

7 years ago[libFuzzer] improve -print_pcs to not print new PCs coming from libFuzzer itself
Kostya Serebryany [Fri, 9 Sep 2016 02:38:28 +0000 (02:38 +0000)]
[libFuzzer] improve -print_pcs to not print new PCs coming from libFuzzer itself

llvm-svn: 281016

7 years ago[sanitizer] fix a potential buffer overflow due to __sanitizer_symbolize_pc (need...
Kostya Serebryany [Fri, 9 Sep 2016 02:13:27 +0000 (02:13 +0000)]
[sanitizer] fix a potential buffer overflow due to __sanitizer_symbolize_pc (need to put a zero after strncmp). LOL

llvm-svn: 281015

7 years ago[libFuzzer] remove unneeded call
Kostya Serebryany [Fri, 9 Sep 2016 01:57:38 +0000 (01:57 +0000)]
[libFuzzer] remove unneeded call

llvm-svn: 281014

7 years ago[AVX-512] Add VPCMP instructions to the load folding tables and make them commutable.
Craig Topper [Fri, 9 Sep 2016 01:36:10 +0000 (01:36 +0000)]
[AVX-512] Add VPCMP instructions to the load folding tables and make them commutable.

llvm-svn: 281013

7 years ago[AVX-512] Add more integer vector comparison tests with loads. Some of these show...
Craig Topper [Fri, 9 Sep 2016 01:36:04 +0000 (01:36 +0000)]
[AVX-512] Add more integer vector comparison tests with loads. Some of these show opportunities where we can commute to fold loads.

Commutes will be added in a followup commit.

llvm-svn: 281012

7 years ago[llvm-cov] Emit a summary in the report directory's index
Vedant Kumar [Fri, 9 Sep 2016 01:32:55 +0000 (01:32 +0000)]
[llvm-cov] Emit a summary in the report directory's index

llvm-cov writes out an index file in '-output-dir' mode, albeit not a
very informative one. Try to fix that by using the CoverageReport API to
include some basic summary information in the index file.

llvm-svn: 281011

7 years ago[llvm-cov] Constify some methods (NFC)
Vedant Kumar [Fri, 9 Sep 2016 01:32:51 +0000 (01:32 +0000)]
[llvm-cov] Constify some methods (NFC)

llvm-svn: 281010

7 years ago[llvm-cov] Add an API to prepare file reports (NFC)
Vedant Kumar [Fri, 9 Sep 2016 01:32:49 +0000 (01:32 +0000)]
[llvm-cov] Add an API to prepare file reports (NFC)

It would be nice to prepare file reports (using the CoverageReport API)
without actually rendering them to the console. I plan on using this to
flesh out the 'index' files in the coverage views.

llvm-svn: 281009

7 years ago[llvm-cov] Speculate fix for a Windows-only test (NFC)
Vedant Kumar [Fri, 9 Sep 2016 01:32:47 +0000 (01:32 +0000)]
[llvm-cov] Speculate fix for a Windows-only test (NFC)

This test should have broken after r280896. Fix up the test case
speculatively, since I don't have a way to test it.

I wonder why I didn't get any angry bot emails about this. Maybe none of
the win32 bots test llvm-cov? That could explain it, since the test says
it 'REQUIRES: system-windows', which is restricted to win32 hosts.

Also: why is 'system-windows' not defined for non-win32 Windows bots?
llvm-svn: 281008

7 years ago[libFuzzer] remove use_traces=1 since use_value_profile seems to be strictly better
Kostya Serebryany [Fri, 9 Sep 2016 01:17:03 +0000 (01:17 +0000)]
[libFuzzer] remove use_traces=1 since use_value_profile seems to be strictly better

llvm-svn: 281007

7 years ago[X86] Tighten up a comment which confused x64 ABI terminology.
David Majnemer [Fri, 9 Sep 2016 01:07:01 +0000 (01:07 +0000)]
[X86] Tighten up a comment which confused x64 ABI terminology.

The x64 ABI has two major function types:
 - frame functions
 - leaf functions

A frame function is one which requires a stack frame.  A leaf function
is one which does not.  A frame function may or may not have a frame
pointer.

A leaf function does not require a stack frame and may never modify SP
except via a return (RET, tail call via JMP).

A frame function which has a frame pointer is permitted to use the LEA
instruction in the epilogue, a frame function without which doesn't
establish a frame pointer must use ADD to adjust the stack pointer epilogue.

Fun fact: Leaf functions don't require a function table entry
(associated PDATA/XDATA).

llvm-svn: 281006

7 years ago[X86] Add more baseline tests for "irregular" shuffles. NFC.
Michael Kuperstein [Fri, 9 Sep 2016 00:49:29 +0000 (00:49 +0000)]
[X86] Add more baseline tests for "irregular" shuffles. NFC.

This adds more tests for shuffles where the output width does not match
the input width and/or the output is generated from more than two inputs.

llvm-svn: 281005

7 years agoFix -output option.
Rui Ueyama [Fri, 9 Sep 2016 00:25:56 +0000 (00:25 +0000)]
Fix -output option.

Usually, options that are longer than one character can be preceded
either by "-" or "--", but options starting with "o" are exceptions
because they conflict with "-o" option. They have to be preceded by
"--".

llvm-svn: 281004

7 years agoWin64: Don't use REX prefix for direct tail calls
Hans Wennborg [Thu, 8 Sep 2016 23:35:10 +0000 (23:35 +0000)]
Win64: Don't use REX prefix for direct tail calls

The REX prefix should be used on indirect jmps, but not direct ones.
For direct jumps, the unwinder looks at the offset to determine if
it's inside the current function.

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

llvm-svn: 281003

7 years ago.clang-tidy: parameters and members should be CamelCased.
Mike Aizatsky [Thu, 8 Sep 2016 23:29:37 +0000 (23:29 +0000)]
.clang-tidy: parameters and members should be CamelCased.

Summary: Not sure why is it missing.

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

llvm-svn: 281002

7 years agoFix bug in -nostdlib.
Rui Ueyama [Thu, 8 Sep 2016 23:26:54 +0000 (23:26 +0000)]
Fix bug in -nostdlib.

We still have to skip a token inside SEARCH_DIR() when -nostdlib is
specified. Previuosly, we didn't skip it, so it caused a parse error.

llvm-svn: 281001

7 years agollvm-objdump: add missing ) in help output, NFC
Saleem Abdulrasool [Thu, 8 Sep 2016 23:17:34 +0000 (23:17 +0000)]
llvm-objdump: add missing ) in help output, NFC

Add a missing ')' in the help output.  NFC.

llvm-svn: 281000

7 years agoC++ Modules TS: Add parsing and some semantic analysis support for
Richard Smith [Thu, 8 Sep 2016 23:14:54 +0000 (23:14 +0000)]
C++ Modules TS: Add parsing and some semantic analysis support for
export-declarations. These don't yet have an effect on name visibility;
we still export everything by default.

llvm-svn: 280999

7 years ago[Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64
Vedant Kumar [Thu, 8 Sep 2016 22:53:19 +0000 (22:53 +0000)]
[Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64

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

llvm-svn: 280998

7 years agoImplement MS _rot intrinsics
Albert Gutowski [Thu, 8 Sep 2016 22:32:19 +0000 (22:32 +0000)]
Implement MS _rot intrinsics

Reviewers: thakis, Prazek, compnerd, rnk

Subscribers: majnemer, cfe-commits

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

llvm-svn: 280997

7 years ago[libFuzzer] add missing docs
Kostya Serebryany [Thu, 8 Sep 2016 22:21:13 +0000 (22:21 +0000)]
[libFuzzer] add missing docs

llvm-svn: 280996

7 years agoRemove debug info when hoisting instruction from then/else branch.
Dehao Chen [Thu, 8 Sep 2016 21:53:33 +0000 (21:53 +0000)]
Remove debug info when hoisting instruction from then/else branch.

Summary: The hoisted instruction is executed speculatively. It could affect the debugging experience as user would see gdb go into code that may not be expected to execute. It will also affect sample profile accuracy by assigning incorrect frequency to source within then/else branch.

Reviewers: davidxl, dblaikie, chandlerc, kcc, echristo

Subscribers: mehdi_amini, probinson, eric_niebler, andreadb, llvm-commits

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

llvm-svn: 280995

7 years agoDefine writeUint and use it. NFC.
Rui Ueyama [Thu, 8 Sep 2016 21:46:21 +0000 (21:46 +0000)]
Define writeUint and use it. NFC.

llvm-svn: 280994

7 years ago[InstCombine] regenerate checks
Sanjay Patel [Thu, 8 Sep 2016 21:40:21 +0000 (21:40 +0000)]
[InstCombine] regenerate checks

llvm-svn: 280993

7 years ago[LV] Ensure proper handling of multi-use case when collecting uniforms
Matthew Simpson [Thu, 8 Sep 2016 21:38:26 +0000 (21:38 +0000)]
[LV] Ensure proper handling of multi-use case when collecting uniforms

The test case included in r280979 wasn't checking what it was supposed to be
checking for the predicated store case. Fixing the test revealed that the
multi-use case (when a pointer is used by both vectorized and scalarized memory
accesses) wasn't being handled properly. We can't skip over
non-consecutive-like pointers since they may have looked consecutive-like with
a different memory access.

llvm-svn: 280992

7 years ago[InstCombine] regenerate checks
Sanjay Patel [Thu, 8 Sep 2016 21:32:21 +0000 (21:32 +0000)]
[InstCombine] regenerate checks

llvm-svn: 280991

7 years ago[ELF] Fix DT_NEEDED value.
Davide Italiano [Thu, 8 Sep 2016 21:18:38 +0000 (21:18 +0000)]
[ELF] Fix DT_NEEDED value.

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

llvm-svn: 280990

7 years agoELF: clarify error when we don't know the output format
Ed Maste [Thu, 8 Sep 2016 21:06:29 +0000 (21:06 +0000)]
ELF: clarify error when we don't know the output format

lld differs from GNU ld in that it does not have a built-in default
target emulation. Emulation is always specified via the -m option, or
obtained from the object file(s) being linked. In most cases at least
one ELF object is included in the link, so the emulation is known.

When using lld's (not yet committed) -b binary support with -r, to
convert a binary file into an ELF object we do not have a known
emulation. The error message previously emitted in this case
"-m or at least a .o file required" is accurate but does not offer
much insight. Add text to the error message to give a hint why -m or an
object file is required.

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

llvm-svn: 280989

7 years agosupport: clean up MSVC support
Saleem Abdulrasool [Thu, 8 Sep 2016 20:52:48 +0000 (20:52 +0000)]
support: clean up MSVC support

Visual Studio 2013 (CRT version 12) added support for many C99 long long and
long double functions. Visual Studio 2015 (CRT version 14) increased C99 and C11
compliance further. Since we don't support Visual Studio versions older than
2013, we can considerably clean up the support header.

Patch by Shoaib Meenai!

llvm-svn: 280988

7 years ago[RDF] Further improve handling of multiple phis reached from shadows
Krzysztof Parzyszek [Thu, 8 Sep 2016 20:48:42 +0000 (20:48 +0000)]
[RDF] Further improve handling of multiple phis reached from shadows

llvm-svn: 280987

7 years agoReduce templating. NFC.
Rafael Espindola [Thu, 8 Sep 2016 20:47:52 +0000 (20:47 +0000)]
Reduce templating. NFC.

llvm-svn: 280986

7 years agoDefine '-undefined foo' as an alias to '-undefined=foo'.
Rui Ueyama [Thu, 8 Sep 2016 20:35:29 +0000 (20:35 +0000)]
Define '-undefined foo' as an alias to '-undefined=foo'.

llvm-svn: 280985

7 years ago[modules] Apply ODR merging for function scoped tags only in C++ mode.
Vassil Vassilev [Thu, 8 Sep 2016 20:34:41 +0000 (20:34 +0000)]
[modules] Apply ODR merging for function scoped tags only in C++ mode.

In C mode, if we have a visible declaration but not a visible definition, a tag
defined in the declaration should be have a visible definition. In C++ we rely
on the ODR merging, whereas in C we cannot because each declaration of a
function gets its own set of declarations in its prototype scope.

Patch developed in collaboration with Richard Smith!

llvm-svn: 280984

7 years agoELF: Report original emulation name in "unknown emulation" error
Ed Maste [Thu, 8 Sep 2016 19:36:22 +0000 (19:36 +0000)]
ELF: Report original emulation name in "unknown emulation" error

A trailing _fbsd is stripped from emulation names, but if the result was
still not a valid emulation the error was somewhat confusing.

For example,

% ld.lld -m elf_amd64_fbsd
unknown emulation: elf_amd64

Use the original emulation name in error messages.

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

llvm-svn: 280983

7 years agoELF: accept -m elf_amd64 as an alias for -m elf_x86_64
Ed Maste [Thu, 8 Sep 2016 19:30:47 +0000 (19:30 +0000)]
ELF: accept -m elf_amd64 as an alias for -m elf_x86_64

In the FreeBSD world x86_64 still has its original name, amd64. Accept
it as an alias.

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

llvm-svn: 280982

7 years ago[llvm-cov] Fix issues with segment highlighting in the html view
Vedant Kumar [Thu, 8 Sep 2016 19:18:23 +0000 (19:18 +0000)]
[llvm-cov] Fix issues with segment highlighting in the html view

The text and html coverage views take different approaches to emitting
highlighted regions. That's because this problem is easier in the text
view: there's no need to worry about escaping text or adding tooltip
content to a highlighted snippet.

Unfortunately, the html view didn't get region highlighting quite right.

This patch fixes the situation, bringing parity between the two views.

llvm-svn: 280981

7 years agoFix tsan-go build.
Evgeniy Stepanov [Thu, 8 Sep 2016 19:16:01 +0000 (19:16 +0000)]
Fix tsan-go build.

Disable the new abort-in-SIGABRT code under SANITIZER_GO.

llvm-svn: 280980

7 years ago[LV] Don't mark pointers used by scalarized memory accesses uniform
Matthew Simpson [Thu, 8 Sep 2016 19:11:07 +0000 (19:11 +0000)]
[LV] Don't mark pointers used by scalarized memory accesses uniform

Previously, all consecutive pointers were marked uniform after vectorization.
However, if a consecutive pointer is used by a memory access that is eventually
scalarized, the pointer won't remain uniform after all. An example is
predicated stores. Even though a predicated store may be consecutive, it will
still be scalarized, making it's pointer operand non-uniform.

This patch updates the logic in collectLoopUniforms to consider the cases where
a memory access may be scalarized. If a memory access may be scalarized, its
pointer operand is not marked uniform. The determination of whether a given
memory instruction will be scalarized or not has been moved into a common
function that is used by the vectorizer, cost model, and legality analysis.

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

llvm-svn: 280979

7 years ago[pdb] Make YamlTypeDumperCallbacks reuse *this.
Zachary Turner [Thu, 8 Sep 2016 18:36:55 +0000 (18:36 +0000)]
[pdb] Make YamlTypeDumperCallbacks reuse *this.

Previously we were making new instances of YamlTypeDumperCallbacks
in order to recurse down and serialize / deserialize nested
records such as field lists.  This meant you could not pass
context from a higher operation to a lower operation because
it would be using a new instance of the visitor callback
delegate.

YAMLIO library was updated to support context-sensitive mappings,
so now we can reuse the same instance of the visitor callback
delegate even for nested operations.

llvm-svn: 280978

7 years ago[YAMLIO] Add the ability to map with context.
Zachary Turner [Thu, 8 Sep 2016 18:22:44 +0000 (18:22 +0000)]
[YAMLIO] Add the ability to map with context.

mapping a yaml field to an object in code has always been
a stateless operation.  You could still pass state by using the
`setContext` function of the YAMLIO object, but this represented
global state for the entire yaml input.  In order to have
context-sensitive state, it is necessary to pass this state in
at the granularity of an individual mapping.

This patch adds support for this type of context-sensitive state.
You simply pass an additional argument of type T to the
`mapRequired` or `mapOptional` functions, and provided you have
specialized a `MappingContextTraits<U, T>` class with the
appropriate mapping function, you can pass this context into
the mapping function.

Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D24162

llvm-svn: 280977

7 years ago[powerpc] Move #if to appease warnings-as-errors tests
Bill Seurer [Thu, 8 Sep 2016 18:09:47 +0000 (18:09 +0000)]
[powerpc] Move #if to appease warnings-as-errors tests

Previous patch added a #if which causes some unused identifier warnings.

llvm-svn: 280976

7 years agoRevert "Resubmit "Add a test for clang-tidy using the clang-cl driver.""
Ahmed Bougacha [Thu, 8 Sep 2016 18:02:14 +0000 (18:02 +0000)]
Revert "Resubmit "Add a test for clang-tidy using the clang-cl driver.""

This reverts commit r280839.
It's problematic on OS X, where the '/Users/...' paths are interpreted
as '/U' options.

Investigation ongoing in http://llvm.org/PR30328.

llvm-svn: 280975

7 years agoAMDGPU: Sign extend constants when splitting them
Matt Arsenault [Thu, 8 Sep 2016 17:44:36 +0000 (17:44 +0000)]
AMDGPU: Sign extend constants when splitting them

This will confuse later passes which try to look at the
immediate value and don't truncate first.

llvm-svn: 280974

7 years ago[Hexagon] Expand sext- and zextloads of vector types, not just extloads
Krzysztof Parzyszek [Thu, 8 Sep 2016 17:42:14 +0000 (17:42 +0000)]
[Hexagon] Expand sext- and zextloads of vector types, not just extloads

Recent change exposed this issue, breaking the Hexagon buildbots.

llvm-svn: 280973

7 years agoAMDGPU: Try to commute when selecting s_addk_i32/s_mulk_i32
Matt Arsenault [Thu, 8 Sep 2016 17:35:41 +0000 (17:35 +0000)]
AMDGPU: Try to commute when selecting s_addk_i32/s_mulk_i32

llvm-svn: 280972

7 years agoAArch64 .arch directive - Include default arch attributes with extensions.
Eric Christopher [Thu, 8 Sep 2016 17:27:03 +0000 (17:27 +0000)]
AArch64 .arch directive - Include default arch attributes with extensions.

Fix the .arch asm parser to use the full set of features for the architecture
and any extensions on the command line. Add and update testcases accordingly
as well as add an extension that was used but not supported.

llvm-svn: 280971

7 years agoAMDGPU: Support commuting with immediate in src0
Matt Arsenault [Thu, 8 Sep 2016 17:19:29 +0000 (17:19 +0000)]
AMDGPU: Support commuting with immediate in src0

llvm-svn: 280970

7 years agoRevert "[XRay] ARM 32-bit no-Thumb support in compiler-rt"
Renato Golin [Thu, 8 Sep 2016 17:13:15 +0000 (17:13 +0000)]
Revert "[XRay] ARM 32-bit no-Thumb support in compiler-rt"

This reverts commit r280890, as the related LLVM commit broke the thumb bots.

llvm-svn: 280969

7 years agoRevert "[XRay] ARM 32-bit no-Thumb support in Clang"
Renato Golin [Thu, 8 Sep 2016 17:12:32 +0000 (17:12 +0000)]
Revert "[XRay] ARM 32-bit no-Thumb support in Clang"

This reverts commit r280889, as the original LLVM commits broke the thumb
buildbots.

llvm-svn: 280968

7 years agoRevert "[XRay] ARM 32-bit no-Thumb support in LLVM"
Renato Golin [Thu, 8 Sep 2016 17:10:39 +0000 (17:10 +0000)]
Revert "[XRay] ARM 32-bit no-Thumb support in LLVM"

And associated commits, as they broke the Thumb bots.

This reverts commit r280935.
This reverts commit r280891.
This reverts commit r280888.

llvm-svn: 280967