platform/upstream/llvm.git
7 years agoExpression evaluation for overloaded C functions (redux)
Luke Drummond [Mon, 19 Dec 2016 17:22:44 +0000 (17:22 +0000)]
Expression evaluation for overloaded C functions (redux)

This is a redux of [Ewan's patch](https://reviews.llvm.org/D17957) , refactored
to properly substitute primitive  types using a hook in the itanium demangler,
and updated after the previous patch went stale

The new `SubsPrimitiveParmItanium` function takes a symbol name and replacement
primitive type parameter as before but parses it using the FastDemangler, which
has been modified to be able to notify clients of parse events (primitive types
at this point).

Additionally, we now use a `set` of `ConstStrings` instead of a `vector` so
that we don't try and resolve the same invalid candidate multiple times.

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

llvm-svn: 290117

7 years ago [LoopVersioning] Require loop-simplify form for loop versioning.
Florian Hahn [Mon, 19 Dec 2016 17:13:37 +0000 (17:13 +0000)]
 [LoopVersioning] Require loop-simplify form for loop versioning.

Summary:
Requiring loop-simplify form for loop versioning ensures that the
runtime check block always dominates the exit block.

This patch closes #30958 (https://llvm.org/bugs/show_bug.cgi?id=30958).

Reviewers: silviu.baranga, hfinkel, anemet, ashutosh.nema

Subscribers: ashutosh.nema, mzolotukhin, efriedma, hfinkel, llvm-commits

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

llvm-svn: 290116

7 years agoDetemplate PhdrEntry. NFC.
Rafael Espindola [Mon, 19 Dec 2016 17:01:01 +0000 (17:01 +0000)]
Detemplate PhdrEntry. NFC.

llvm-svn: 290115

7 years ago[AMDGPU] When unifying metadata, add operands to named metadata individually
Konstantin Zhuravlyov [Mon, 19 Dec 2016 16:54:24 +0000 (16:54 +0000)]
[AMDGPU] When unifying metadata, add operands to named metadata individually

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

llvm-svn: 290114

7 years ago[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implement...
NAKAMURA Takumi [Mon, 19 Dec 2016 16:50:43 +0000 (16:50 +0000)]
[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implementation files."

mingw32-ld complains missing symbols in exports,

  Cannot export clang_findIncludesInFileWithBlock: symbol not defined
  Cannot export clang_findReferencesInFileWithBlock: symbol not defined
  Cannot export clang_visitChildrenWithBlock: symbol not defined

They are excluded conditionally in header along has_blocks.

We should do either;

  1. Exclude also function bodies conditionally, and introduce "optional" exporter.
  2. Give dummy function bodies for them.
  3. Implement functions w/o blocks.

llvm-svn: 290113

7 years agoUse existing variable. NFC.
Rafael Espindola [Mon, 19 Dec 2016 16:50:20 +0000 (16:50 +0000)]
Use existing variable. NFC.

llvm-svn: 290112

7 years ago[InstCombine] add folds for icmp (smax X, Y), X
Sanjay Patel [Mon, 19 Dec 2016 16:28:53 +0000 (16:28 +0000)]
[InstCombine] add folds for icmp (smax X, Y), X

This is a follow-up to:
https://reviews.llvm.org/rL289855 (D27531)

llvm-svn: 290111

7 years ago[ARM] Add missing -backend-option for -arm-execute-only
Prakhar Bahuguna [Mon, 19 Dec 2016 15:43:33 +0000 (15:43 +0000)]
[ARM] Add missing -backend-option for -arm-execute-only

llvm-svn: 290110

7 years agoSilence unused warning.
Daniel Jasper [Mon, 19 Dec 2016 14:24:22 +0000 (14:24 +0000)]
Silence unused warning.

llvm-svn: 290109

7 years ago[ARM] GlobalISel: Add more checks to test
Diana Picus [Mon, 19 Dec 2016 14:08:11 +0000 (14:08 +0000)]
[ARM] GlobalISel: Add more checks to test

llvm-svn: 290108

7 years ago[ARM] GlobalISel: Minor style fixup in test
Diana Picus [Mon, 19 Dec 2016 14:08:06 +0000 (14:08 +0000)]
[ARM] GlobalISel: Minor style fixup in test

llvm-svn: 290107

7 years ago[ARM] GlobalISel: Lower i8 and i16 register args
Diana Picus [Mon, 19 Dec 2016 14:08:02 +0000 (14:08 +0000)]
[ARM] GlobalISel: Lower i8 and i16 register args

This allows lowering i8 and i16 arguments if they can fit in the registers. Note
that the lowering is incomplete - ABI extensions are handled in a subsequent
patch.

(Last part of)
Differential Revision: https://reviews.llvm.org/D27704

llvm-svn: 290106

7 years ago[ARM] GlobalISel: Allow i8 and i16 adds
Diana Picus [Mon, 19 Dec 2016 14:07:56 +0000 (14:07 +0000)]
[ARM] GlobalISel: Allow i8 and i16 adds

Teach the instruction selector and legalizer that it's ok to have adds with 8 or
16-bit integers.

This is the second part of https://reviews.llvm.org/D27704

llvm-svn: 290105

7 years ago[ARM] GlobalISel: Select i8 and i16 copies
Diana Picus [Mon, 19 Dec 2016 14:07:50 +0000 (14:07 +0000)]
[ARM] GlobalISel: Select i8 and i16 copies

Teach the instruction selector that it's ok to copy small values from physical
registers.

First part of https://reviews.llvm.org/D27704

llvm-svn: 290104

7 years agoFix clang-format
Tobias Grosser [Mon, 19 Dec 2016 14:06:40 +0000 (14:06 +0000)]
Fix clang-format

llvm-svn: 290103

7 years ago[Power9] Processor Model for Scheduling
Ehsan Amiri [Mon, 19 Dec 2016 13:35:45 +0000 (13:35 +0000)]
[Power9] Processor Model for Scheduling

PWR9 processor model for instruction scheduling. A subsequent patch will migrate
PWR9 to Post RA MIScheduler.
https://reviews.llvm.org/D24525

llvm-svn: 290102

7 years agoRevert "[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files."
Diana Picus [Mon, 19 Dec 2016 12:43:08 +0000 (12:43 +0000)]
Revert "[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files."

This reverts commit r290077, 78, 79 and 83.

llvm-svn: 290101

7 years ago[Hexagon] Restore minimum profit check accidentally changed in r290024
Malcolm Parsons [Mon, 19 Dec 2016 12:37:26 +0000 (12:37 +0000)]
[Hexagon] Restore minimum profit check accidentally changed in r290024

llvm-svn: 290100

7 years agoELF/AArch64: Fix dynamic relocation against local symbol in shared objects
Adhemerval Zanella [Mon, 19 Dec 2016 11:58:01 +0000 (11:58 +0000)]
ELF/AArch64: Fix dynamic relocation against local symbol in shared objects

AArch64 TLSDESC for local symbol in shared objects are implemented in a
arch specific manner where the TLSDESC dynamic relocation addend is the
symbol VM inside the TLS block. For instance, with a shared library
created from the code:

--
static __thread int32_t x1;
static __thread int64_t x2;

int32_t foo1 (int32_t x)
{
  x1 += x;
  return x;
}

int64_t foo2 (int64_t x)
{
  x2 += x;
  return x;
}
--

The dynamic relocation should be create as:

Relocations [
  Section (N) .rela.dyn {
    <Address1> R_AARCH64_TLSDESC - 0x0
    <Address2> R_AARCH64_TLSDESC - 0x8
  }
]

Where 0x0 addend in first dynamic relocation is the address of 'x1'
in TLS block and '0x8' is the address of 'x2'.

Checked against test-suite on aarch64-linux-gnu.

llvm-svn: 290099

7 years ago[ARM] GlobalISel: Lower more than 4 arguments
Diana Picus [Mon, 19 Dec 2016 11:55:41 +0000 (11:55 +0000)]
[ARM] GlobalISel: Lower more than 4 arguments

This adds support for lowering more than 4 arguments (although still i32 only).
It uses the handleAssignments / ValueHandler infrastructure extracted from
the AArch64 backend in r288658.

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

llvm-svn: 290098

7 years agoAMDGPU: [AMDGPU] Assembler: add .hsa_code_object_metadata directive for functime...
Sam Kolton [Mon, 19 Dec 2016 11:43:15 +0000 (11:43 +0000)]
AMDGPU: [AMDGPU] Assembler: add .hsa_code_object_metadata directive for functime metadata V2.0

Summary:
Added pair of directives .hsa_code_object_metadata/.end_hsa_code_object_metadata.
Between them user can put YAML string that would be directly put to the generated note. E.g.:
'''
.hsa_code_object_metadata
    {
        amd.MDVersion: [ 2, 0 ]
    }
.end_hsa_code_object_metadata
'''
Based on D25046

Reviewers: vpykhtin, nhaustov, yaxunl, tstellarAMD

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

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

llvm-svn: 290097

7 years ago[ARM] GlobalISel: Support loading from the stack
Diana Picus [Mon, 19 Dec 2016 11:26:31 +0000 (11:26 +0000)]
[ARM] GlobalISel: Support loading from the stack

Add support for selecting simple G_LOAD and G_FRAME_INDEX instructions (32-bit
scalars only). This will be useful for functions that need to pass arguments on
the stack.

First part of https://reviews.llvm.org/D27195.

llvm-svn: 290096

7 years ago[CodeGen] Make MachineInstr::isIdenticalTo() symmetric.
Bjorn Pettersson [Mon, 19 Dec 2016 11:20:57 +0000 (11:20 +0000)]
[CodeGen] Make MachineInstr::isIdenticalTo() symmetric.

Summary:
MachineInstr::isIdenticalTo() is for some reason not
symmetric when comparing bundles, which gives us the
property:

  I1->isIdenticalTo(*I2) != I2->isIdenticalTo(*I1)

when comparing bundles where one bundle is longer than
the other.

This patch makes sure that bundles of different length
always are considered as not being identical. Thus, the
result of the comparison will be the same regardless of
which side that happens to be to the left.

Reviewers: dexonsmith, jonpa, andrew.w.kaylor

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 290095

7 years agoclang-format: Slightly tweak the behavior of <<-wrapping.
Daniel Jasper [Mon, 19 Dec 2016 11:14:23 +0000 (11:14 +0000)]
clang-format: Slightly tweak the behavior of <<-wrapping.

Before:
  SomeLongLoggingStatementOrMacro() << "Some long text "
                                    << some_variable << "\n";

Before:
  SomeLongLoggingStatementOrMacro()
      << "Some long text " << some_variable << "\n";

Short logging statements are already special cased in a different part
of the code.

llvm-svn: 290094

7 years ago[clang-format] revert an unintended change in r288493 and add a test case.
Eric Liu [Mon, 19 Dec 2016 10:41:05 +0000 (10:41 +0000)]
[clang-format] revert an unintended change in r288493 and add a test case.

llvm-svn: 290093

7 years agoRevert "[c++1z] P0195R2: Support pack-expansion of using-declarations."
Daniel Jasper [Mon, 19 Dec 2016 10:09:25 +0000 (10:09 +0000)]
Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."

This reverts commit r290080 as it leads to many Clang crashes, e.g.:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814

llvm-svn: 290092

7 years ago[XRay] Fix assertion failure on empty machine basic blocks (PR 31424)
Dean Michael Berris [Mon, 19 Dec 2016 09:20:38 +0000 (09:20 +0000)]
[XRay] Fix assertion failure on empty machine basic blocks (PR 31424)

The original version of the code in XRayInstrumentation.cpp assumed that
functions may not have empty machine basic blocks (or that the first one
couldn't be). This change addresses that by special-casing that specific
situation.

We provide two .mir test-cases to make sure we're handling this
appropriately.

Fixes llvm.org/PR31424.

Reviewers: chandlerc

Subscribers: varno, llvm-commits

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

llvm-svn: 290091

7 years agoclang-format: Fix regression introduced in r290084.
Daniel Jasper [Mon, 19 Dec 2016 08:40:56 +0000 (08:40 +0000)]
clang-format: Fix regression introduced in r290084.

We still want to try in linewrap within single elements of a 1-column
list.

After:
  Type *Params[] = {PointerType::getUnqual(FunctionType::get(
Builder.getVoidTy(), Builder.getInt8PtrTy(), false)),
    Builder.getInt8PtrTy(),
    Builder.getInt32Ty(),
    LongType,
    LongType,
    LongType};

Before:
  No line break in the first element, so column limit violation.

llvm-svn: 290090

7 years ago[X86] When recognizing vector loads or VZEXT_LOAD in selectScalarSSELoad make sure...
Craig Topper [Mon, 19 Dec 2016 08:35:56 +0000 (08:35 +0000)]
[X86] When recognizing vector loads or VZEXT_LOAD in selectScalarSSELoad make sure we pass the load's user rather than load itself to the second operand of IsLegalToFold.

llvm-svn: 290089

7 years ago[TableGen] Use 'unsigned' instead of 'bool' in a place where the code conditionally...
Craig Topper [Mon, 19 Dec 2016 08:35:08 +0000 (08:35 +0000)]
[TableGen] Use 'unsigned' instead of 'bool' in a place where the code conditionally assigns numeric values. They happen to be 0 and 1 so this is NFC.

llvm-svn: 290088

7 years agoAdd files I seem to have dropped in my revert (r290086).
Daniel Jasper [Mon, 19 Dec 2016 08:32:13 +0000 (08:32 +0000)]
Add files I seem to have dropped in my revert (r290086).

Sorry!

llvm-svn: 290087

7 years agoRevert @llvm.assume with operator bundles (r289755-r289757)
Daniel Jasper [Mon, 19 Dec 2016 08:22:17 +0000 (08:22 +0000)]
Revert @llvm.assume with operator bundles (r289755-r289757)

This creates non-linear behavior in the inliner (see more details in
r289755's commit thread).

llvm-svn: 290086

7 years agoFix format after recent clang-format change.
Daniel Jasper [Mon, 19 Dec 2016 07:54:15 +0000 (07:54 +0000)]
Fix format after recent clang-format change.

llvm-svn: 290085

7 years agoclang-format: Allow "single column" list layout even if that violates the
Daniel Jasper [Mon, 19 Dec 2016 07:26:11 +0000 (07:26 +0000)]
clang-format: Allow "single column" list layout even if that violates the
column limit.

Single-column layout basically means that we format the list with one
element per line. Not doing that when there is a column limit violation
doesn't change the fact that there is an item that doesn't fit within
the column limit.

Before (with a column limit of 30):
  std::vector<int> a = {
      aaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaa};

After:
  std::vector<int> a = {
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaaaa,
      aaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaa};

(and previously we would have formatted like "After" it wasn't for the one
item that is too long)

llvm-svn: 290084

7 years ago[XRay][compiler-rt] Fix missing include of <cerrno>
Dean Michael Berris [Mon, 19 Dec 2016 05:26:14 +0000 (05:26 +0000)]
[XRay][compiler-rt] Fix missing include of <cerrno>

Futher attempt to un-break ARM and AArch64 build.

Follow-up on D25360.

llvm-svn: 290083

7 years agoAdd __cpp_structured_bindings feature test macro for structured bindings, per
Richard Smith [Mon, 19 Dec 2016 04:21:36 +0000 (04:21 +0000)]
Add __cpp_structured_bindings feature test macro for structured bindings, per
latest (provisional) draft of SD-6.

llvm-svn: 290082

7 years ago[c++1z] cxx_status: mark p0195r2 as done.
Richard Smith [Mon, 19 Dec 2016 04:16:03 +0000 (04:16 +0000)]
[c++1z] cxx_status: mark p0195r2 as done.

llvm-svn: 290081

7 years ago[c++1z] P0195R2: Support pack-expansion of using-declarations.
Richard Smith [Mon, 19 Dec 2016 04:08:53 +0000 (04:08 +0000)]
[c++1z] P0195R2: Support pack-expansion of using-declarations.

This change introduces UsingPackDecl as a marker for the set of UsingDecls
produced by pack expansion of a single (unresolved) using declaration. This is
not strictly necessary (we just need to be able to map from the original using
declaration to its expansions somehow), but it's useful to maintain the
invariant that each declaration reference instantiates to refer to one
declaration.

llvm-svn: 290080

7 years ago[XRay][compiler-rt] Post-commit review fixup of XRay refactoring.
Dean Michael Berris [Mon, 19 Dec 2016 03:59:20 +0000 (03:59 +0000)]
[XRay][compiler-rt] Post-commit review fixup of XRay refactoring.

Missed a couple of files:

- Using #pragma once
- Missing top-matter for headers
- Missing an include for <cstdint>

Follow-up on D25360.

llvm-svn: 290079

7 years ago[XRay][compiler-rt] Explicitly include <cstdint> for types
Dean Michael Berris [Mon, 19 Dec 2016 03:47:35 +0000 (03:47 +0000)]
[XRay][compiler-rt] Explicitly include <cstdint> for types

This is an attempt to un-break the ARM7, AArch64 builds.

Follow-up on D25360.

llvm-svn: 290078

7 years ago[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files.
Dean Michael Berris [Mon, 19 Dec 2016 03:21:26 +0000 (03:21 +0000)]
[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files.

Summary: Include the necessary headers while there.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 290077

7 years agoRemove inappropriate use of CachedHashStringRef.
Rui Ueyama [Mon, 19 Dec 2016 03:14:16 +0000 (03:14 +0000)]
Remove inappropriate use of CachedHashStringRef.

Use of CachedHashStringRef makes sense only when we reuse hash values.
Sprinkling it to all DenseMap has no benefits and just complicates data types.
Basically we shouldn't use CachedHashStringRef unless there is a strong
reason to to do so.

llvm-svn: 290076

7 years agoAdd a lit test for PR31374
Yaxun Liu [Mon, 19 Dec 2016 02:55:53 +0000 (02:55 +0000)]
Add a lit test for PR31374

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

llvm-svn: 290075

7 years ago[XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support...
Dean Michael Berris [Mon, 19 Dec 2016 00:47:40 +0000 (00:47 +0000)]
[XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support %ld.

Summary:
Getting rid of the distance number altogether because:
- a person knowledgeable enough to know what the message means will also
  know how to do hexadecimal math (with the help of a calculator)
- numbers outside INT_MIN - INT_MAX are hard to comprehend anyway

This unbreaks the case when you dynamically link a library with XRay and
it exits pre-main() with a not very informative static string.

Author: pelikan

Reviewers: dberris

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 290074

7 years ago[X86] Remove all of the patterns that use X86ISD:FAND/FXOR/FOR/FANDN except for the...
Craig Topper [Mon, 19 Dec 2016 00:42:28 +0000 (00:42 +0000)]
[X86] Remove all of the patterns that use X86ISD:FAND/FXOR/FOR/FANDN except for the ones needed for SSE1. Anything SSE2 or above uses the integer ISD opcode.

This removes 11721 bytes from the DAG isel table or 2.2%

llvm-svn: 290073

7 years agoFix name hiding and redeclaration checking for dependent local
Richard Smith [Sun, 18 Dec 2016 22:01:46 +0000 (22:01 +0000)]
Fix name hiding and redeclaration checking for dependent local
using-declarations.

llvm-svn: 290072

7 years agoFix some interactions between C++11 and C++14 features and using-declarations:
Richard Smith [Sun, 18 Dec 2016 21:39:37 +0000 (21:39 +0000)]
Fix some interactions between C++11 and C++14 features and using-declarations:

 * a dependent non-type using-declaration within a function template can be
   valid, as it can refer to an enumerator, so don't reject it in the template
   definition
 * we can partially substitute into a dependent using-declaration if it appears
   within a (local class in a) generic lambda within a function template, which
   means an UnresolvedUsing*Decl doesn't necessarily instantiate to a UsingDecl.

llvm-svn: 290071

7 years ago[FileCheck] Fix --strict-whitespace --match-full-lines -- add test-case
Tom de Vries [Sun, 18 Dec 2016 21:04:47 +0000 (21:04 +0000)]
[FileCheck] Fix --strict-whitespace --match-full-lines -- add test-case

Add test-case that was missing in "[FileCheck] Fix --strict-whitespace
--match-full-lines" commit.

llvm-svn: 290070

7 years ago[FileCheck] Fix --strict-whitespace --match-full-lines
Tom de Vries [Sun, 18 Dec 2016 20:45:59 +0000 (20:45 +0000)]
[FileCheck] Fix --strict-whitespace --match-full-lines

Make sure FileCheck --strict-whitespace --match-full-lines translates
'CHECK: bla ' into pattern '^ bla $' instead of pattern '^bla$'.

llvm-svn: 290069

7 years ago[PDB] Don't use the long type
David Majnemer [Sun, 18 Dec 2016 20:10:50 +0000 (20:10 +0000)]
[PDB] Don't use the long type

Long is not the same size across a number of the platforms we support.
Use unsigned int here instead, it is more appropriate because
overflow/wrap-around is possible and, in this case, expected.

llvm-svn: 290068

7 years ago[InstCombine] use commutative matchers for patterns with commutative operators
Sanjay Patel [Sun, 18 Dec 2016 18:49:48 +0000 (18:49 +0000)]
[InstCombine] use commutative matchers for patterns with commutative operators

Background/motivation - I was circling back around to:
https://llvm.org/bugs/show_bug.cgi?id=28296

I made a simple patch for that and noticed some regressions, so added test cases for
those with rL281055, and this is hopefully the minimal fix for just those cases.

But as you can see from the surrounding untouched folds, we are missing commuted patterns
all over the place, and of course there are no regression tests to cover any of those cases.

We could sprinkle "m_c_" dust all over this file and catch most of the missing folds, but
then we still wouldn't have test coverage, and we'd still miss some fraction of commuted
patterns because they require adjustments to the match order.

I'm aware of the concern about the potential compile-time performance impact of adding
matches like this (currently being discussed on llvm-dev), but I don't think there's any
evidence yet to suggest that handling commutative pattern matching more thoroughly is not
a worthwhile goal of InstCombine.

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

llvm-svn: 290067

7 years agoRevert r289955 and r289962. This is causing lots of ASAN failures for us.
Daniel Jasper [Sun, 18 Dec 2016 14:36:38 +0000 (14:36 +0000)]
Revert r289955 and r289962. This is causing lots of ASAN failures for us.

Not sure whether it causes and ASAN false positive or whether it
actually leads to incorrect code or whether it even exposes bad code.
Hans, I'll get you instructions to reproduce this.

llvm-svn: 290066

7 years ago[X86] [AVX512] Minor fix in encoding of scalar EVEX instructions. NFC.
Michael Zuckerman [Sun, 18 Dec 2016 14:29:00 +0000 (14:29 +0000)]
[X86] [AVX512] Minor fix in encoding of scalar EVEX instructions. NFC.

Commit on behalf of Gadi Haber

Removed EVEX_V512 prefix from scalar EVEX instructions since HW ignores L'L bits anyway (LIG). 4 instructions are modified.
The changed encodings are validated with XED.
Rviewers: delena, igorb

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

llvm-svn: 290065

7 years ago[X86][SSE] Add support for combining target shuffles to SHUFPS.
Simon Pilgrim [Sun, 18 Dec 2016 14:26:02 +0000 (14:26 +0000)]
[X86][SSE] Add support for combining target shuffles to SHUFPS.

As discussed on D27692, the next step will be to allow cross-domain shuffles once the combined shuffle depth passes a certain point.

llvm-svn: 290064

7 years agoWdocumentation fix
Simon Pilgrim [Sun, 18 Dec 2016 14:12:38 +0000 (14:12 +0000)]
Wdocumentation fix

llvm-svn: 290063

7 years agoRemove lld/Support/Memory.h.
Rui Ueyama [Sun, 18 Dec 2016 14:06:06 +0000 (14:06 +0000)]
Remove lld/Support/Memory.h.

I thought for a while about how to remove it, but it looks like we
can just copy the file for now. Of course I'm not happy about that,
but it's just less than 50 lines of code, and we already have
duplicate code in Error.h and some other places. I want to solve
them all at once later.

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

llvm-svn: 290062

7 years ago[FileCheck] Fix comment in ReadCheckFile
Tom de Vries [Sun, 18 Dec 2016 09:41:20 +0000 (09:41 +0000)]
[FileCheck] Fix comment in ReadCheckFile

The comment in ReadCheckFile claims that both leading and trailing whitespace
are removed, but the associated statement only removes leading whitespace.

llvm-svn: 290061

7 years ago[X86][SSE][AVX-512] Convert FAND/FOR/FXOR/FANDN nodes to integer operations if they...
Craig Topper [Sun, 18 Dec 2016 07:54:23 +0000 (07:54 +0000)]
[X86][SSE][AVX-512] Convert FAND/FOR/FXOR/FANDN nodes to integer operations if they are available. This will allow a bunch of patterns to be removed.

These nodes are only emitted for lowering FABS/FNEG/FNABS/FCOPYSIGN. Ideally we just wouldn't create these nodes if SSE2 or higher is available, but it was simple to just convert them in DAG combine.

For SSE2, AVX, and AVX512 with DQI this is no functional change as the execution domain fixing pass ensures the right domain is selected regardless of the ISD opcode.

For AVX-512 without DQI we end up using integer instructions since the floating point versions aren't available. But we were already doing that for any logical operations in code that didn't come from FABS/FNEG/FNABS/FCOPYSIGN so this seems no worse. And we get the benefit of being able to fold broadcasts now.

llvm-svn: 290060

7 years agoFix a lit test issue exposed by r290056
Yaxun Liu [Sun, 18 Dec 2016 07:26:01 +0000 (07:26 +0000)]
Fix a lit test issue exposed by r290056

The test requests a target which supports cl_khr_gl_msaa_sharing since in test/PCH/ocl_types.h
it tries to enable cl_khr_gl_msaa_sharing. Therefore this test fails on targets not supporting
cl_khr_gl_msaa_sharing, e.g. ppc64, etc.

The fix is to add triple spir-unknown-unknown which supports cl_khr_gl_msaa_sharing.

llvm-svn: 290059

7 years agoAttempt to fix build failure and regressions due to r290056
Yaxun Liu [Sun, 18 Dec 2016 06:35:06 +0000 (06:35 +0000)]
Attempt to fix build failure and regressions due to r290056

Add llvm:: namespace to StringRef.
Make conversion between bool and uint64_t explicit.

llvm-svn: 290058

7 years ago[AVX-512] Use EVEX encoded XOR instruction for zeroing scalar registers when DQI...
Craig Topper [Sun, 18 Dec 2016 06:23:14 +0000 (06:23 +0000)]
[AVX-512] Use EVEX encoded XOR instruction for zeroing scalar registers when DQI and VLX instructions are available.

This can give the register allocator more registers to use.

llvm-svn: 290057

7 years agoRecommit r289979 [OpenCL] Allow disabling types and declarations associated with...
Yaxun Liu [Sun, 18 Dec 2016 05:18:55 +0000 (05:18 +0000)]
Recommit r289979 [OpenCL] Allow disabling types and declarations associated with extensions

Fixed undefined behavior due to cast integer to bool in initializer list.

llvm-svn: 290056

7 years ago[AVX-512] Make sure VLX is also enabled before using EVEX encoded logic ops for scala...
Craig Topper [Sun, 18 Dec 2016 04:17:00 +0000 (04:17 +0000)]
[AVX-512] Make sure VLX is also enabled before using EVEX encoded logic ops for scalars. I missed this in r290049.

llvm-svn: 290055

7 years ago[PDB] Don't reimplement CRC32
David Majnemer [Sun, 18 Dec 2016 00:41:15 +0000 (00:41 +0000)]
[PDB] Don't reimplement CRC32

We already have a CRC32 implementation which is compatible with the PDB
hash, reuse it.

llvm-svn: 290054

7 years ago[PDB] Validate superblock addresses
David Majnemer [Sun, 18 Dec 2016 00:41:10 +0000 (00:41 +0000)]
[PDB] Validate superblock addresses

- Validate the address of the block map.
- Validate the address of the free block map.

llvm-svn: 290053

7 years ago[CMake] Fix issue reported on sanitizer bots
Chris Bieneman [Sat, 17 Dec 2016 21:28:24 +0000 (21:28 +0000)]
[CMake] Fix issue reported on sanitizer bots

This should resolve an issue reported on the commit thread that impacted sanitizer bots.

llvm-svn: 290052

7 years ago[clang-tidy] Remove duplicated check from move-constructor-init
Malcolm Parsons [Sat, 17 Dec 2016 20:23:14 +0000 (20:23 +0000)]
[clang-tidy] Remove duplicated check from move-constructor-init

Summary:
An addition to the move-constructor-init check was duplicating the
modernize-pass-by-value check.
Remove the additional check and UseCERTSemantics option.
Run the move-constructor-init test with both checks enabled.
Fix modernize-pass-by-value false-positive when initializing a base
class.
Add option to modernize-pass-by-value to only warn about parameters
that are already values.

Reviewers: alexfh, flx, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 290051

7 years agoAMDGPU: Fix broken check prefix in test
Matt Arsenault [Sat, 17 Dec 2016 20:03:59 +0000 (20:03 +0000)]
AMDGPU: Fix broken check prefix in test

llvm-svn: 290050

7 years ago[AVX-512] Use EVEX encoded logic operations for scalar types when they are available...
Craig Topper [Sat, 17 Dec 2016 19:26:00 +0000 (19:26 +0000)]
[AVX-512] Use EVEX encoded logic operations for scalar types when they are available. This gives the register allocator more registers to work with.

llvm-svn: 290049

7 years ago[AVX-512] Update scalar logic test to show missed opportunity to use EVEX encoded...
Craig Topper [Sat, 17 Dec 2016 19:25:55 +0000 (19:25 +0000)]
[AVX-512] Update scalar logic test to show missed opportunity to use EVEX encoded logic instructions to get more registers to use.

llvm-svn: 290048

7 years agoRevert "AArch64CollectLOH: Rewrite as block-local analysis."
Matthias Braun [Sat, 17 Dec 2016 18:53:11 +0000 (18:53 +0000)]
Revert "AArch64CollectLOH: Rewrite as block-local analysis."

It is still breaking Chrome. http://llvm.org/PR31361

This reverts commit r290026.

llvm-svn: 290047

7 years ago[InstCombine] Simplify code slightly. NFC
Craig Topper [Sat, 17 Dec 2016 18:10:04 +0000 (18:10 +0000)]
[InstCombine] Simplify code slightly. NFC

llvm-svn: 290046

7 years agoFix the cmake declaration syntax
Sylvestre Ledru [Sat, 17 Dec 2016 13:04:35 +0000 (13:04 +0000)]
Fix the cmake declaration syntax

llvm-svn: 290045

7 years agoSupport of lldb on Kfreebsd
Sylvestre Ledru [Sat, 17 Dec 2016 12:48:06 +0000 (12:48 +0000)]
Support of lldb on Kfreebsd

Summary: Patch by Pino Toscano. Reported in http://bugs.debian.org/835665

Reviewers: tfiala, emaste

Subscribers: beanz, mgorny, emaste, krytarowski, brucem, tberghammer, danalbert, srhines, #lldb

Tags: #lldb

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

llvm-svn: 290044

7 years agoRevert "[libFuzzer] add an experimental flag -experimental_len_control=1 that sets...
Daniel Jasper [Sat, 17 Dec 2016 12:27:49 +0000 (12:27 +0000)]
Revert "[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually. Also remove a bit of dead code"

This reverts commit r289998.

See comment:
https://reviews.llvm.org/rL289998

llvm-svn: 290043

7 years ago[ELF] - Use DWARFDebugPubTable parser class intead of hand-written parsing.
George Rimar [Sat, 17 Dec 2016 10:18:05 +0000 (10:18 +0000)]
[ELF] - Use DWARFDebugPubTable parser class intead of hand-written parsing.

DWARFDebugPubTable was introduced recently and allows us to get rid of
code duplication in LLD.

llvm-svn: 290042

7 years ago[DWARF] - Make PubIndexEntryDescriptor::toBits() to be const.
George Rimar [Sat, 17 Dec 2016 10:15:39 +0000 (10:15 +0000)]
[DWARF] - Make PubIndexEntryDescriptor::toBits() to be const.

That is usefull when iterating over entries of new DWARFDebugPubTable class
via DWARFDebugPubTable::getData which returns ArrayRef.

llvm-svn: 290041

7 years ago[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections.
George Rimar [Sat, 17 Dec 2016 09:10:32 +0000 (09:10 +0000)]
[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections.

Patch implements parser of pubnames/pubtypes tables instead of static
function used before. It is now should be possible to reuse it
in LLD or other projects and clean up the duplication code.

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

llvm-svn: 290040

7 years ago[libFuzzer] use less memory for merge
Kostya Serebryany [Sat, 17 Dec 2016 08:20:24 +0000 (08:20 +0000)]
[libFuzzer] use less memory for merge

llvm-svn: 290039

7 years ago[OpenMP] Sema and parsing for 'target teams' pragma
Kelvin Li [Sat, 17 Dec 2016 05:48:59 +0000 (05:48 +0000)]
[OpenMP] Sema and parsing for 'target teams' pragma

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

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

llvm-svn: 290038

7 years agoAdd custom type for PseudoSourceValue
Tom Stellard [Sat, 17 Dec 2016 04:41:53 +0000 (04:41 +0000)]
Add custom type for PseudoSourceValue

Summary:
PseudoSourceValue can be used to attach a target specific value for "well behaved" side-effects lowered from target specific intrinsics.
This is useful whenever there is not an LLVM IR Value around when representing such "well behaved" side-effected operations in backends by attaching a MachineMemOperand with a custom PseudoSourceValue as this makes the scheduler not treating them as "GlobalMemoryObjects" which triggers a logic that makes the operation act like a barrier in the Schedule DAG.

This patch adds another Kind to the PseudoSourceValue object which is "TargetCustom". It indicates a type of PseudoSourceValue that has a target specific meaning (aka. LLVM shouldn't assume any specific usage for such a PSV).

It supports the possibility of having many different kinds of "TargetCustom" PseudoSourceValues.

We had a discussion about if this was valuable or not (in particular because there was a believe that PSV were going away sooner or later) but seems like they are not going anywhere and I think they are useful backend side.

It is not clear the interaction of this with MIRParser (do we need a target hook to parse these?) and I would like a comment from Alex about that :)

Reviewers: arphaman, hfinkel, arsenm

Subscribers: Eugene.Zelenko, llvm-commits

Patch By: Marcello Maggioni

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

llvm-svn: 290037

7 years agoADT: Add a getArrayRef() accessor to MapVector.
Peter Collingbourne [Sat, 17 Dec 2016 04:04:18 +0000 (04:04 +0000)]
ADT: Add a getArrayRef() accessor to MapVector.

llvm-svn: 290036

7 years ago[libFuzzer] speed up __sanitizer_cov_trace_switch a bit more (remove DIV)
Kostya Serebryany [Sat, 17 Dec 2016 02:23:35 +0000 (02:23 +0000)]
[libFuzzer] speed up __sanitizer_cov_trace_switch a bit more (remove DIV)

llvm-svn: 290034

7 years ago[libFuzzer] remove stale test
Kostya Serebryany [Sat, 17 Dec 2016 02:18:59 +0000 (02:18 +0000)]
[libFuzzer] remove stale test

llvm-svn: 290033

7 years agoMove test to correct directory
Matthias Braun [Sat, 17 Dec 2016 02:16:26 +0000 (02:16 +0000)]
Move test to correct directory

See also test/CodeGen/MIR/README

llvm-svn: 290032

7 years ago[libFuzzer] when tracing switch statements, handle only one case at a time (to make...
Kostya Serebryany [Sat, 17 Dec 2016 02:03:34 +0000 (02:03 +0000)]
[libFuzzer] when tracing switch statements, handle only one case at a time (to make things faster). Also ensure that the signals from value profile do not intersect with the regular coverage

llvm-svn: 290031

7 years agoRevert "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
Evgeniy Stepanov [Sat, 17 Dec 2016 01:53:15 +0000 (01:53 +0000)]
Revert "[GVNHoist] Move GVNHoist to function simplification part of pipeline."

This reverts r289696, which caused TSan perf regression.

See PR31382.

llvm-svn: 290030

7 years agoFix compilation.
Evgeniy Stepanov [Sat, 17 Dec 2016 01:31:46 +0000 (01:31 +0000)]
Fix compilation.

unittests/ADT/TwineTest.cpp:106:38: error: field 'Count' will be initialized after base 'llvm::FormatAdapter<int>' [-Werror,-Wreorder]
    explicit formatter(int &Count) : Count(Count), FormatAdapter(0) {}

llvm-svn: 290029

7 years ago[Hexagon] Other attempt to fix build with enabled asserts broken in 290024 (NFC).
Eugene Zelenko [Sat, 17 Dec 2016 01:29:35 +0000 (01:29 +0000)]
[Hexagon] Other attempt to fix build with enabled asserts broken in 290024 (NFC).

llvm-svn: 290028

7 years ago[Hexagon] Fix build with enabled asserts broken in 290024 (NFC).
Eugene Zelenko [Sat, 17 Dec 2016 01:17:18 +0000 (01:17 +0000)]
[Hexagon] Fix build with enabled asserts broken in 290024 (NFC).

llvm-svn: 290027

7 years agoAArch64CollectLOH: Rewrite as block-local analysis.
Matthias Braun [Sat, 17 Dec 2016 01:15:59 +0000 (01:15 +0000)]
AArch64CollectLOH: Rewrite as block-local analysis.

Re-apply r288561: Liveness tracking should be correct now after r290014.

Previously this pass was using up to 5% compile time in some cases which
is a bit much for what it is doing. The pass featured a full blown
data-flow analysis which in the default configuration was restricted to a
single block.

This rewrites the pass under the assumption that we only ever work on a
single block. This is done in a single pass maintaining a state machine
per general purpose register to catch LOH patterns.

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

llvm-svn: 290026

7 years ago[libclang] Remove the 'extern "C"' blocks from the implementation files.
Argyrios Kyrtzidis [Sat, 17 Dec 2016 01:09:40 +0000 (01:09 +0000)]
[libclang] Remove the 'extern "C"' blocks from the implementation files.

These are unnecessary, the declarations already carry the 'extern C' property, and if there is mismatch
between declaration and definition then we will get linker errors via libclang.exports.

llvm-svn: 290025

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Sat, 17 Dec 2016 01:09:05 +0000 (01:09 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 290024

7 years ago[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces
Devin Coughlin [Sat, 17 Dec 2016 01:08:17 +0000 (01:08 +0000)]
[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces

Update the UnixAPIChecker to not diagnose for calls to functions that
are declared in C++ namespaces. This avoids false positives when a
namespaced function has the same name as a Unix API.

This address PR28331.

llvm-svn: 290023

7 years agoRetry: [BPI] Use a safer constructor to calculate branch probabilities
Vedant Kumar [Sat, 17 Dec 2016 01:02:08 +0000 (01:02 +0000)]
Retry: [BPI] Use a safer constructor to calculate branch probabilities

BPI may trigger signed overflow UB while computing branch probabilities for
cold calls or to unreachables. For example, with our current choice of weights,
we'll crash if there are >= 2^12 branches to an unreachable.

Use a safer BranchProbability constructor which is better at handling fractions
with large denominators.

Changes since the initial commit:
  - Use explicit casts to ensure that multiplication operands are 64-bit
    ints.

rdar://problem/29368161

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

llvm-svn: 290022

7 years agoDelete unused file.
Zachary Turner [Sat, 17 Dec 2016 00:58:19 +0000 (00:58 +0000)]
Delete unused file.

llvm-svn: 290021

7 years agoAdd support for formatv to llvm::Twine.
Zachary Turner [Sat, 17 Dec 2016 00:38:15 +0000 (00:38 +0000)]
Add support for formatv to llvm::Twine.

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

llvm-svn: 290020

7 years agoRevert "[BPI] Use a safer constructor to calculate branch probabilities"
Vedant Kumar [Sat, 17 Dec 2016 00:19:06 +0000 (00:19 +0000)]
Revert "[BPI] Use a safer constructor to calculate branch probabilities"

This reverts commit r290016. It breaks this bot, even though the test
passes locally:

  http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/32956/

AnalysisTests: /home/bb/ninja-x64-msvc-RA-centos6/llvm-project/llvm/lib/Support/BranchProbability.cpp:52: static llvm::BranchProbability llvm::BranchProbability::getBranchProbability(uint64_t, uint64_t): Assertion `Numerator <= Denominator && "Probability cannot be bigger than 1!"' failed.
llvm-svn: 290019

7 years ago[libfuzzer] removing experimental FuzzerFnAdapter
Mike Aizatsky [Sat, 17 Dec 2016 00:12:13 +0000 (00:12 +0000)]
[libfuzzer] removing experimental FuzzerFnAdapter

Summary: This is superceded by protobuf mutation work.

Reviewers: kcc

Subscribers: mgorny

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

llvm-svn: 290018

7 years ago[sancov] skip dead files from computations
Mike Aizatsky [Sat, 17 Dec 2016 00:11:48 +0000 (00:11 +0000)]
[sancov] skip dead files from computations

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

llvm-svn: 290017