platform/upstream/llvm.git
7 years agoMake this REQUIRES match the other REQUIRES lines that mention requiring
Chandler Carruth [Tue, 20 Dec 2016 01:57:31 +0000 (01:57 +0000)]
Make this REQUIRES match the other REQUIRES lines that mention requiring
a darwin system.

llvm-svn: 290152

7 years agoSimplify type of Config->SymbolOrderingFile.
Rui Ueyama [Tue, 20 Dec 2016 01:51:08 +0000 (01:51 +0000)]
Simplify type of Config->SymbolOrderingFile.

That variable was of type DenseMap<StringRef, unsigned>, but the
unsigned numbers needed to be monotonicly increasing numbers because
the implementation that used the variable depended on that fact.
That was an implementation detail and shouldn't have leaked into Config.

This patch simplifies its type to std::vector<StringRef>.

llvm-svn: 290151

7 years agoInline a small function.
Rui Ueyama [Tue, 20 Dec 2016 01:34:31 +0000 (01:34 +0000)]
Inline a small function.

llvm-svn: 290150

7 years agoAdd the alloc_size attribute to clang.
George Burgess IV [Tue, 20 Dec 2016 01:05:42 +0000 (01:05 +0000)]
Add the alloc_size attribute to clang.

This patch does three things:

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

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

llvm-svn: 290149

7 years agoRevert "[ObjectYAML] Support for DWARF debug_info section"
Chris Bieneman [Tue, 20 Dec 2016 00:42:06 +0000 (00:42 +0000)]
Revert "[ObjectYAML] Support for DWARF debug_info section"

This reverts commit r290147.

This commit is breaking a bot (http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/621). I don't have time to investigate at the moment, so I'll revert for now.

llvm-svn: 290148

7 years ago[ObjectYAML] Support for DWARF debug_info section
Chris Bieneman [Tue, 20 Dec 2016 00:26:24 +0000 (00:26 +0000)]
[ObjectYAML] Support for DWARF debug_info section

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

llvm-svn: 290147

7 years agoFix completely bogus types for some builtins:
Richard Smith [Mon, 19 Dec 2016 23:59:34 +0000 (23:59 +0000)]
Fix completely bogus types for some builtins:

 * In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z
   crasher from r289754).

 * Fix type of __sync_synchronize to be a no-parameter function rather than a
   varargs function. This matches GCC.

 * Fix type of vfprintf to match its actual type. We gave it a wrong type due
   to PR4290 (apparently autoconf generates invalid code and expects compilers
   to choke it down or it miscompiles the program; the relevant error in clang
   was downgraded to a warning in r122744 to fix other occurrences of this
   autoconf brokenness, so we don't need this workaround any more).

 * Turn off vararg argument checking for __noop, since it's not *really* a
   varargs function. Alternatively we could add custom type checking for it
   and synthesize parameter types matching the actual arguments in each call,
   but that seemed like overkill.

llvm-svn: 290146

7 years agoMake another test insensitive to the default C++ dialect.
Paul Robinson [Mon, 19 Dec 2016 23:32:10 +0000 (23:32 +0000)]
Make another test insensitive to the default C++ dialect.

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

llvm-svn: 290145

7 years agoAdd ARM support to update_llc_test_checks.py
Eli Friedman [Mon, 19 Dec 2016 23:09:51 +0000 (23:09 +0000)]
Add ARM support to update_llc_test_checks.py

Just the minimal support to get it working at the moment.

Includes checks for test/CodeGen/ARM/vzip.ll as an example.

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

llvm-svn: 290144

7 years ago[analyzer] Add checker modeling gtest APIs.
Devin Coughlin [Mon, 19 Dec 2016 22:50:31 +0000 (22:50 +0000)]
[analyzer] Add checker modeling gtest APIs.

gtest is a widely-used unit-testing API. It provides macros for unit test
assertions:

  ASSERT_TRUE(p != nullptr);

that expand into an if statement that constructs an object representing
the result of the assertion and returns when the assertion is false:

  if (AssertionResult gtest_ar_ = AssertionResult(p == nullptr))
      ;
  else
    return ...;

Unfortunately, the analyzer does not model the effect of the constructor
precisely because (1) the copy constructor implementation is missing from the
the header (so it can't be inlined) and (2) the boolean-argument constructor
is constructed into a temporary (so the analyzer decides not to inline it since
it doesn't reliably call temporary destructors right now).

This results in false positives because the analyzer does not realize that the
the assertion must hold along the non-return path.

This commit addresses the false positives by explicitly modeling the effects
of the two un-inlined constructors on the AssertionResult state.

I've added a new package, "apiModeling", for these kinds of checkers that
model APIs but don't emit any diagnostics. I envision all the checkers in
this package always being on by default.

This addresses the false positives reported in PR30936.

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

rdar://problem/22705813

llvm-svn: 290143

7 years ago[LV] Sink tripcount query to where it's actually used. NFC.
Michael Kuperstein [Mon, 19 Dec 2016 22:47:52 +0000 (22:47 +0000)]
[LV] Sink tripcount query to where it's actually used. NFC.

llvm-svn: 290142

7 years agoDon't try to emit nullability fix-its within/around macros.
Jordan Rose [Mon, 19 Dec 2016 22:35:24 +0000 (22:35 +0000)]
Don't try to emit nullability fix-its within/around macros.

The newly-added notes from r290132 are too noisy even when the fix-it
is valid. For the existing warning from r286521, it's probably the
right decision 95% of the time to put the change outside the macro if
the array is outside the macro and inside otherwise, but I don't want
to overthink it right now.

Caught by the ASan bot!

More rdar://problem/29524992

llvm-svn: 290141

7 years ago[analyzer] Add sink after construction of temporary with no-return destructor.
Devin Coughlin [Mon, 19 Dec 2016 22:23:22 +0000 (22:23 +0000)]
[analyzer] Add sink after construction of temporary with no-return destructor.

The analyzer's CFG currently doesn't have nodes for calls to temporary
destructors. This causes the analyzer to explore infeasible paths in which
a no-return destructor would have stopped exploration and so results in false
positives when no-return destructors are used to implement assertions.

To mitigate these false positives, this patch stops generates a sink after
evaluating a constructor on a temporary object that has a no-return destructor.
This results in a loss of coverage because the time at which the destructor is
called may be after the time of construction (especially for lifetime-extended
temporaries).

This addresses PR15599.

rdar://problem/29131566

llvm-svn: 290140

7 years ago[ObjectYAML] Support for DWARF Pub Sections
Chris Bieneman [Mon, 19 Dec 2016 22:22:12 +0000 (22:22 +0000)]
[ObjectYAML] Support for DWARF Pub Sections

This patch adds support for YAML<->DWARF round tripping for pub* section data. The patch supports both GNU and non-GNU style entries.

llvm-svn: 290139

7 years ago[libfuzzer] dump_coverage command line flag
Mike Aizatsky [Mon, 19 Dec 2016 22:18:08 +0000 (22:18 +0000)]
[libfuzzer] dump_coverage command line flag

Reviewers: kcc, vitalybuka

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

llvm-svn: 290138

7 years ago[Axccel] Remove -Wno-missing-braces in build
Jason Henline [Mon, 19 Dec 2016 21:34:07 +0000 (21:34 +0000)]
[Axccel] Remove -Wno-missing-braces in build

Summary:
I originally added the -Wno-missing-braces flag because I thought it was
erroneously flagging std::array initializations. Now I realize the extra
braces really are desired for these initializations, so I'm turning the
warning flag back on.

Reviewers: jlebar

Subscribers: mgorny, parallel_libs-commits

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

llvm-svn: 290137

7 years agoFix corner cases of setting the section address.
Rafael Espindola [Mon, 19 Dec 2016 21:21:07 +0000 (21:21 +0000)]
Fix corner cases of setting the section address.

This handles all the corner cases if setting a section address:

- If the address is too low, we cannot allocate the program headers.
- If the load address is lowered, we have to do that before finalize

This also shares some code with the linker script since it was already
hitting similar cases.

This is used by the freebsd boot loader. It is not clear if we need to
support this with a non binary output, but it is not as bad as I was
expecting.

llvm-svn: 290136

7 years ago[Format] Remove dead code.
Benjamin Kramer [Mon, 19 Dec 2016 21:10:50 +0000 (21:10 +0000)]
[Format] Remove dead code.

No functionality change.

llvm-svn: 290135

7 years ago[ASTReader] Sort RawComments before merging
Bruno Cardoso Lopes [Mon, 19 Dec 2016 21:06:06 +0000 (21:06 +0000)]
[ASTReader] Sort RawComments before merging

`RawComments` are sorted by comparing underlying `SourceLocation`'s. This is
done by comparing `FileID` and `Offset`; when the `FileID` is the same it means
the locations are within the same TU and the `Offset` is used.

FileID, from the source code: "A mostly-opaque identifier, where 0 is
"invalid", >0 is this module, and <-1 is something loaded from another
module.". That said, when de-serializing SourceLocations, FileID's from
RawComments loaded from other modules get negative IDs where previously they
were positive. This makes imported RawComments unsorted, leading to a wrong
merge with other comments from the current TU. Fix that by sorting RawComments
properly after de-serialization and before merge.

This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`,
which fires only in a debug build of clang.

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

rdar://problem/29287314

llvm-svn: 290134

7 years ago[TargetInstrInfo] replace redundant expression in getMemOpBaseRegImmOfs
Michael LeMay [Mon, 19 Dec 2016 21:02:41 +0000 (21:02 +0000)]
[TargetInstrInfo] replace redundant expression in getMemOpBaseRegImmOfs

Summary:
The expression for computing the return value of getMemOpBaseRegImmOfs has only
one possible value. The other value would result in a return earlier in the
function. This patch replaces the expression with its only possible value.

Reviewers: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 290133

7 years agoAdd fix-it notes to the nullability consistency warning.
Jordan Rose [Mon, 19 Dec 2016 20:58:20 +0000 (20:58 +0000)]
Add fix-it notes to the nullability consistency warning.

This is especially important for arrays, since no one knows the proper
syntax for putting qualifiers in arrays.

    nullability.h:3:26: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
    void arrayParameter(int x[]);
                             ^
    nullability.h:3:26: note: insert '_Nullable' if the array parameter may be null
    void arrayParameter(int x[]);
                             ^
                              _Nullable
    nullability.h:3:26: note: insert '_Nonnull' if the array parameter should never be null
    void arrayParameter(int x[]);
                             ^
                              _Nonnull

rdar://problem/29524992

llvm-svn: 290132

7 years agoMake a function to correctly extract the DW_AT_high_pc given the low pc value.
Greg Clayton [Mon, 19 Dec 2016 20:36:41 +0000 (20:36 +0000)]
Make a function to correctly extract the DW_AT_high_pc given the low pc value.

DWARF 4 and later supports encoding the PC as an address or as as offset from the low PC. Clients using DWARFDie should be insulated from how to extract the high PC value. This function takes care of extracting the form value and looking for the correct form.

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

llvm-svn: 290131

7 years agoReverting r290004, r290006, r290010 pending review.
Sean Callanan [Mon, 19 Dec 2016 19:15:43 +0000 (19:15 +0000)]
Reverting r290004, r290006, r290010 pending review.

llvm-svn: 290130

7 years agoFixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how...
Kuba Mracek [Mon, 19 Dec 2016 18:54:34 +0000 (18:54 +0000)]
Fixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how to make it work on Linux.

llvm-svn: 290129

7 years agoMake a few OpenMP tests "C++11 clean."
Paul Robinson [Mon, 19 Dec 2016 18:43:26 +0000 (18:43 +0000)]
Make a few OpenMP tests "C++11 clean."

This time trying to commit just the relevant 3 tests!
Reviewed by abataev (in D27794)

llvm-svn: 290128

7 years ago[InstCombine] use commutative matcher for pattern with commutative operators
Sanjay Patel [Mon, 19 Dec 2016 18:35:37 +0000 (18:35 +0000)]
[InstCombine] use commutative matcher for pattern with commutative operators

This is a case that was missed in:
https://reviews.llvm.org/rL290067
...and it would regress if we fix operand complexity (PR28296).

llvm-svn: 290127

7 years agoMore fixup for r290119: Make the ifdef work.
Kuba Mracek [Mon, 19 Dec 2016 18:27:26 +0000 (18:27 +0000)]
More fixup for r290119: Make the ifdef work.

llvm-svn: 290126

7 years agoRevert another accidental bit
Paul Robinson [Mon, 19 Dec 2016 18:20:19 +0000 (18:20 +0000)]
Revert another accidental bit

llvm-svn: 290125

7 years agoAnother fix-up for r290119: Include stdint.h so we have uint64_t on Linux.
Kuba Mracek [Mon, 19 Dec 2016 18:09:18 +0000 (18:09 +0000)]
Another fix-up for r290119: Include stdint.h so we have uint64_t on Linux.

llvm-svn: 290124

7 years agoFix-up for r290119 - don't check global size, it might not be available when using...
Kuba Mracek [Mon, 19 Dec 2016 18:06:49 +0000 (18:06 +0000)]
Fix-up for r290119 - don't check global size, it might not be available when using atos

llvm-svn: 290123

7 years ago[ELF] - Implemented --retain-symbols-file option
George Rimar [Mon, 19 Dec 2016 18:00:52 +0000 (18:00 +0000)]
[ELF] - Implemented --retain-symbols-file option

--retain-symbols-file=filename
Retain only the symbols listed in the file filename, discarding all others.
filename is simply a flat file, with one symbol name per line. This option
is especially useful in environments (such as VxWorks) where a large global
symbol table is accumulated gradually, to conserve run-time memory.

Note: though documentation says "--retain-symbols-file does not discard
undefined symbols, or symbols needed for relocations.", both bfd and gold
do that, and this patch too, like testcase show.

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

llvm-svn: 290122

7 years agoUndo accidental comit
Paul Robinson [Mon, 19 Dec 2016 18:00:45 +0000 (18:00 +0000)]
Undo accidental comit

llvm-svn: 290121

7 years agoMake a few OpenMP tests "C++11 clean."
Paul Robinson [Mon, 19 Dec 2016 17:58:09 +0000 (17:58 +0000)]
Make a few OpenMP tests "C++11 clean."

Reviewed by abataev (in D27794)

llvm-svn: 290120

7 years ago[tsan] Implement __tsan_get_alloc_stack and __tsan_locate_address to query pointer...
Kuba Mracek [Mon, 19 Dec 2016 17:52:20 +0000 (17:52 +0000)]
[tsan] Implement __tsan_get_alloc_stack and __tsan_locate_address to query pointer types and allocation stacks of heap pointers

In ASan, we have __asan_locate_address and __asan_get_alloc_stack, which is used in LLDB/Xcode to show the allocation backtrace for a heap memory object. This patch implements the same for TSan.

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

llvm-svn: 290119

7 years ago[InstCombine] add folds for icmp (umin|umax X, Y), X
Sanjay Patel [Mon, 19 Dec 2016 17:32:37 +0000 (17:32 +0000)]
[InstCombine] add folds for icmp (umin|umax X, Y), X

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

llvm-svn: 290118

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