platform/upstream/llvm.git
8 years agoAdd an option to save the backend-produced YAML optimization record to a file
Hal Finkel [Tue, 11 Oct 2016 00:26:09 +0000 (00:26 +0000)]
Add an option to save the backend-produced YAML optimization record to a file

The backend now has the capability to save information from optimizations, the
same information that can be used to generate optimization diagnostics but in
machine-consumable form, into an output file. This can be enabled when using
opt (see r282539), and this change enables it when using clang. The idea is
that other tools will be able to consume these files, and perhaps in
combination with the original source code, produce various kinds of
optimization reports for users (and for compiler developers).

We now have at-least two tools that can consume these files:
  * tools/llvm-opt-report
  * utils/opt-viewer

Using the flag -fsave-optimization-record will cause the YAML file to be
generated; the file name will be based on the output file name (if we're using
-c or -S and have an output name), or the input file name. When we're using
CUDA, or some other offloading mechanism, separate files are generated for each
backend target. The output file name can be specified by the user using
-foptimization-record-file=filename.

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

llvm-svn: 283834

8 years ago[Sema] Add explicit move constructor for ExpressionEvaluationContextRecord.
Justin Lebar [Tue, 11 Oct 2016 00:23:53 +0000 (00:23 +0000)]
[Sema] Add explicit move constructor for ExpressionEvaluationContextRecord.

This is needed to keep MSVC 2013 happy.

llvm-svn: 283833

8 years ago[AArch64][InstructionSelector] Teach how to select FP load/store.
Quentin Colombet [Tue, 11 Oct 2016 00:21:14 +0000 (00:21 +0000)]
[AArch64][InstructionSelector] Teach how to select FP load/store.

This patch allows to select 32 and 64-bit FP load and store.

llvm-svn: 283832

8 years ago[AArch64][InstructionSelector] Teach the selector how to handle vector OR.
Quentin Colombet [Tue, 11 Oct 2016 00:21:11 +0000 (00:21 +0000)]
[AArch64][InstructionSelector] Teach the selector how to handle vector OR.

This only adds the support for 64-bit vector OR. Adding more sizes is
not difficult, but it requires a bigger refactoring because ORs work on
any size, not necessarly the ones that match the width of the register
width. Right now, this is not expressed in the legalization, so don't
bother pushing the refactoring yet.

llvm-svn: 283831

8 years agoAligned allocation versus CUDA: make deallocation function preference order
Richard Smith [Tue, 11 Oct 2016 00:21:10 +0000 (00:21 +0000)]
Aligned allocation versus CUDA: make deallocation function preference order
match other CUDA preference orders, per discussion with jlebar. We now model
this in an attempt to match overload resolution as closely as possible:

- First, we throw out all non-callable (due to CUDA host/device mismatch)
  operator delete functions.
- Then we apply sizedness / alignedness preferences based on whether the type
  is overaligned and whether the deallocation function is a member.
- Finally, we use the CUDA callability preference as a tiebreaker.

llvm-svn: 283830

8 years ago[AArch64][MachineLegalizer] Mark v2s32 G_LOAD as legal.
Quentin Colombet [Tue, 11 Oct 2016 00:21:08 +0000 (00:21 +0000)]
[AArch64][MachineLegalizer] Mark v2s32 G_LOAD as legal.

Actually every 64-bit loads are legal, but right now the API does not
offer a simple way to express that.

llvm-svn: 283829

8 years agoRevert r283824 and r283823: Define DbiStreamBuilder::addDbgStream to add stream.
Rui Ueyama [Tue, 11 Oct 2016 00:15:50 +0000 (00:15 +0000)]
Revert r283824 and r283823: Define DbiStreamBuilder::addDbgStream to add stream.

This reverts commit r283824 and r283823 to fix buildbots.

llvm-svn: 283828

8 years ago[Driver][Diagnostics] Make 'show option names' default for driver warnings
Bruno Cardoso Lopes [Tue, 11 Oct 2016 00:01:22 +0000 (00:01 +0000)]
[Driver][Diagnostics] Make 'show option names' default for driver warnings

Currently, driver level warnings do not show option names (e.g. warning:
complain about foo [-Woption-name]) in a diagnostic unless
-fdiagnostics-show-option is explictly specified. OTOH, the driver by
default turn this option on for CC1. Change the logic to show option
names by default in the driver as well.

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

rdar://problem/27300909

llvm-svn: 283827

8 years ago[ThinLTO] Attempt to fix the test (and the bots).
Davide Italiano [Mon, 10 Oct 2016 23:56:13 +0000 (23:56 +0000)]
[ThinLTO] Attempt to fix the test (and the bots).

llvm-svn: 283826

8 years agoAdd section header stream to PDB.
Rui Ueyama [Mon, 10 Oct 2016 23:44:10 +0000 (23:44 +0000)]
Add section header stream to PDB.

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

llvm-svn: 283825

8 years agoFix a bug in DbiStreamBuilder::addDbgStream.
Rui Ueyama [Mon, 10 Oct 2016 23:44:04 +0000 (23:44 +0000)]
Fix a bug in DbiStreamBuilder::addDbgStream.

This feature will be tested in LLD unit tests.

llvm-svn: 283824

8 years agoDefine DbiStreamBuilder::addDbgStream to add stream.
Rui Ueyama [Mon, 10 Oct 2016 23:35:36 +0000 (23:35 +0000)]
Define DbiStreamBuilder::addDbgStream to add stream.

Previously, there is no way to create a stream other than pre-defined
special stream such as DBI or IPI. This patch adds a new method,
addDbgStream, to add a debug stream to a PDB file.

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

llvm-svn: 283823

8 years agoAdding radar number on our end for llvm.org/pr15824.
Jim Ingham [Mon, 10 Oct 2016 23:31:36 +0000 (23:31 +0000)]
Adding radar number on our end for llvm.org/pr15824.

llvm-svn: 283821

8 years agoAdd the related radar on our end for llvm.org/pr15824.
Jim Ingham [Mon, 10 Oct 2016 23:29:01 +0000 (23:29 +0000)]
Add the related radar on our end for llvm.org/pr15824.

llvm-svn: 283820

8 years agoFix clang-tools-extra build after r283815 (Store FileEntry::Filename as a StringRef...
Mehdi Amini [Mon, 10 Oct 2016 23:24:16 +0000 (23:24 +0000)]
Fix clang-tools-extra build after r283815 (Store FileEntry::Filename as a StringRef instead of raw pointer)

llvm-svn: 283819

8 years agoFix issue which cases lit installed with setup.py to not resolve main
Chris Matthews [Mon, 10 Oct 2016 23:22:11 +0000 (23:22 +0000)]
Fix issue which cases lit installed with setup.py to not resolve main

llvm-svn: 283818

8 years ago[LTO] Split the options for ThinLTO jobs and Regular LTO partitions
Davide Italiano [Mon, 10 Oct 2016 23:12:14 +0000 (23:12 +0000)]
[LTO] Split the options for ThinLTO jobs and Regular LTO partitions

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

llvm-svn: 283817

8 years agoFix llvm-lit.in corresponding to r283710.
NAKAMURA Takumi [Mon, 10 Oct 2016 23:02:42 +0000 (23:02 +0000)]
Fix llvm-lit.in corresponding to r283710.

  Traceback (most recent call last):
    File "bin/llvm-lit", line 44, in <module>
      lit.main(builtin_parameters)
  AttributeError: 'module' object has no attribute 'main'

Suggested by Artem Belevich.

llvm-svn: 283816

8 years agoStore FileEntry::Filename as a StringRef instead of raw pointer (NFC)
Mehdi Amini [Mon, 10 Oct 2016 22:52:47 +0000 (22:52 +0000)]
Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)

llvm-svn: 283815

8 years agoRevert r283690, "MC: Remove unused entities."
Peter Collingbourne [Mon, 10 Oct 2016 22:49:37 +0000 (22:49 +0000)]
Revert r283690, "MC: Remove unused entities."

llvm-svn: 283814

8 years agoAdd the radar number on our end.
Jim Ingham [Mon, 10 Oct 2016 22:21:47 +0000 (22:21 +0000)]
Add the radar number on our end.

llvm-svn: 283813

8 years ago[x86] auto-generate checks
Sanjay Patel [Mon, 10 Oct 2016 22:04:12 +0000 (22:04 +0000)]
[x86] auto-generate checks

llvm-svn: 283812

8 years ago[x86] auto-generate checks
Sanjay Patel [Mon, 10 Oct 2016 22:01:42 +0000 (22:01 +0000)]
[x86] auto-generate checks

llvm-svn: 283811

8 years ago[Driver] Let -gline-tables-only win when it comes after -gmodules.
Adrian Prantl [Mon, 10 Oct 2016 21:56:20 +0000 (21:56 +0000)]
[Driver] Let -gline-tables-only win when it comes after -gmodules.
The -gmodules option is all about putting debug type info into clang
modules and for line tables the type information is irrelevant, so
combining these two options makes no sense.
This commmit fixes the behavior to match the one  documented on the
clang man page: the last -g... option wins.

<rdar://problem/27059770>

llvm-svn: 283810

8 years agoGlobalISel: select G_GLOBAL_VALUE uses on AArch64.
Tim Northover [Mon, 10 Oct 2016 21:50:00 +0000 (21:50 +0000)]
GlobalISel: select G_GLOBAL_VALUE uses on AArch64.

llvm-svn: 283809

8 years agoGlobalISel: allow G_GLOBAL_VALUEs in AArch64 legalization.
Tim Northover [Mon, 10 Oct 2016 21:49:53 +0000 (21:49 +0000)]
GlobalISel: allow G_GLOBAL_VALUEs in AArch64 legalization.

llvm-svn: 283808

8 years agoGlobalISel: support selecting G_GEP instructions.
Tim Northover [Mon, 10 Oct 2016 21:49:49 +0000 (21:49 +0000)]
GlobalISel: support selecting G_GEP instructions.

They're basically just an alias for G_ADD on AArch64.

llvm-svn: 283807

8 years agoGlobalISel: support selecting constants on AArch64.
Tim Northover [Mon, 10 Oct 2016 21:49:42 +0000 (21:49 +0000)]
GlobalISel: support selecting constants on AArch64.

llvm-svn: 283806

8 years agoRename isHotFunction/isColdFunction to isFunctionEntryHot/isFunctionEntryCold. (NFC)
Dehao Chen [Mon, 10 Oct 2016 21:47:28 +0000 (21:47 +0000)]
Rename isHotFunction/isColdFunction to isFunctionEntryHot/isFunctionEntryCold. (NFC)

This is in preparation for https://reviews.llvm.org/D25048

llvm-svn: 283805

8 years agoMark 2777 as complete
Marshall Clow [Mon, 10 Oct 2016 21:37:16 +0000 (21:37 +0000)]
Mark 2777 as complete

llvm-svn: 283804

8 years agoRevert "Disallow ArrayRef assignment from temporaries."
Zachary Turner [Mon, 10 Oct 2016 21:36:23 +0000 (21:36 +0000)]
Revert "Disallow ArrayRef assignment from temporaries."

This reverts commit r283798, as it causes static asserts on
MSVC 2015 with the following errors:

ArrayRefTest.cpp(38): error C2338: Assigning from single prvalue element
ArrayRefTest.cpp(41): error C2338: Assigning from single xvalue element
ArrayRefTest.cpp(47): error C2338: Assigning from an initializer list

llvm-svn: 283803

8 years agoChange Builtins name to be stored as StringRef instead of raw pointers (NFC)
Mehdi Amini [Mon, 10 Oct 2016 21:34:29 +0000 (21:34 +0000)]
Change Builtins name to be stored as StringRef instead of raw pointers (NFC)

llvm-svn: 283802

8 years agoAdd -fno-sanitize-address-use-after-scope flag
Vitaly Buka [Mon, 10 Oct 2016 21:31:50 +0000 (21:31 +0000)]
Add -fno-sanitize-address-use-after-scope flag

Reviewers: eugenis

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

llvm-svn: 283801

8 years agoRename llvm::apply -> llvm::apply_tuple.
Zachary Turner [Mon, 10 Oct 2016 21:24:34 +0000 (21:24 +0000)]
Rename llvm::apply -> llvm::apply_tuple.

llvm::cl already has a function called llvm::apply() so this is
causing an ODR violation.  The STLExtras version should win the
vote on which one gets to be called apply() since it is named
after the equivalent STL function, but since renaiming the cl
version is more difficult, let's do this for now to get the
bots green.

llvm-svn: 283800

8 years agoUpdate with the rest of the results from the 7-Oct Telecom
Marshall Clow [Mon, 10 Oct 2016 21:00:12 +0000 (21:00 +0000)]
Update with the rest of the results from the 7-Oct Telecom

llvm-svn: 283799

8 years agoDisallow ArrayRef assignment from temporaries.
Jordan Rose [Mon, 10 Oct 2016 20:57:33 +0000 (20:57 +0000)]
Disallow ArrayRef assignment from temporaries.

Without this, the following statements will create ArrayRefs that
refer to temporary storage that goes out of scope by the end of the
line:

  someArrayRef = getSingleElement();
  someArrayRef = {elem1, elem2};

Note that the constructor still has this problem:

  ArrayRef<Element> someArrayRef = getSingleElement();
  ArrayRef<Element> someArrayRef = {elem1, elem2};

but that's a little harder to get rid of because we want to be able to
use this in calls:

  takesArrayRef(getSingleElement());
  takesArrayRef({elem1, elem2});

Part of rdar://problem/16375365. Reviewed by Duncan Exon Smith.

llvm-svn: 283798

8 years ago[SelectionDAGBuilder] Support llvm.flt.rounds on targets where i32 is not legal
Hal Finkel [Mon, 10 Oct 2016 20:45:15 +0000 (20:45 +0000)]
[SelectionDAGBuilder] Support llvm.flt.rounds on targets where i32 is not legal

Add integer expansion for FLT_ROUNDS_ for targets where i32 is not a legal
type.

Patch by Edward Jones, thanks!

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

llvm-svn: 283797

8 years ago[ADT] Use () instead of {} in an attempt to work around MSVC 2012 ICEs.
Justin Lebar [Mon, 10 Oct 2016 20:18:02 +0000 (20:18 +0000)]
[ADT] Use () instead of {} in an attempt to work around MSVC 2012 ICEs.

llvm-svn: 283796

8 years agoMake the LValue created in EmitValueForIvarAtOffset have the same Qualifiers in the...
Nick Lewycky [Mon, 10 Oct 2016 20:07:13 +0000 (20:07 +0000)]
Make the LValue created in EmitValueForIvarAtOffset have the same Qualifiers in the LValue as the QualType in the LValue. No functionality change intended.

llvm-svn: 283795

8 years ago[ADT] Don't use make_pointee_iterator in IteratorTest.
Justin Lebar [Mon, 10 Oct 2016 19:56:52 +0000 (19:56 +0000)]
[ADT] Don't use make_pointee_iterator in IteratorTest.

llvm-svn: 283794

8 years agoImplement MS read/write barriers and __faststorefence intrinsic
Albert Gutowski [Mon, 10 Oct 2016 19:40:51 +0000 (19:40 +0000)]
Implement MS read/write barriers and __faststorefence intrinsic

Reviewers: hans, rnk, majnemer

Subscribers: cfe-commits

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

llvm-svn: 283793

8 years agoUse StringRef in TableGen generated Intrinsics.gen file (NFC)
Mehdi Amini [Mon, 10 Oct 2016 19:31:09 +0000 (19:31 +0000)]
Use StringRef in TableGen generated Intrinsics.gen file (NFC)

llvm-svn: 283792

8 years ago[ADT] Remove make_pointe{e,r}_iterator, because it seems to crash MSVC 2015.
Justin Lebar [Mon, 10 Oct 2016 19:29:37 +0000 (19:29 +0000)]
[ADT] Remove make_pointe{e,r}_iterator, because it seems to crash MSVC 2015.

llvm-svn: 283791

8 years ago[AST] Don't use make_pointee_iterator in VTableBuilder.
Justin Lebar [Mon, 10 Oct 2016 19:26:22 +0000 (19:26 +0000)]
[AST] Don't use make_pointee_iterator in VTableBuilder.

Our implementation of make_pointee_iterator seems to be causing MSVC
2015 to crash, so I'm going to remove it.

llvm-svn: 283790

8 years agoRe-commit r283722, reverted in r283750, with a fix for a CUDA-specific use of
Richard Smith [Mon, 10 Oct 2016 18:54:32 +0000 (18:54 +0000)]
Re-commit r283722, reverted in r283750, with a fix for a CUDA-specific use of
past-the-end iterator.

Original commit message:

P0035R4: Semantic analysis and code generation for C++17 overaligned
allocation.

llvm-svn: 283789

8 years ago[libcxx] Add support for Fuchsia
Petr Hosek [Mon, 10 Oct 2016 18:53:32 +0000 (18:53 +0000)]
[libcxx] Add support for Fuchsia

Fuchsia is a new operating system which uses musl as the standard
C library, libc++ and libc++abi as the C++ standard library.

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

llvm-svn: 283788

8 years ago[LTO/Thin] Make the number of threads to run in the BE configurable.
Davide Italiano [Mon, 10 Oct 2016 18:12:53 +0000 (18:12 +0000)]
[LTO/Thin] Make the number of threads to run in the BE configurable.

Before the default was whatever number hardware_concurrency() returned.
Users can specify the number of threads via --lto-jobs=X option.

llvm-svn: 283787

8 years agoRemove trailing whitespace.
Rui Ueyama [Mon, 10 Oct 2016 18:10:01 +0000 (18:10 +0000)]
Remove trailing whitespace.

llvm-svn: 283786

8 years agoImplement __emul, __emulu, _mul128 and _umul128 MS intrinsics
Albert Gutowski [Mon, 10 Oct 2016 18:09:27 +0000 (18:09 +0000)]
Implement __emul, __emulu, _mul128 and _umul128 MS intrinsics

Reviewers: rnk, thakis, majnemer, hans

Subscribers: cfe-commits

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

llvm-svn: 283785

8 years agoTeach llvm::StripDebugInfo() about global variable !dbg attachments.
Adrian Prantl [Mon, 10 Oct 2016 17:53:33 +0000 (17:53 +0000)]
Teach llvm::StripDebugInfo() about global variable !dbg attachments.
This is a regression introduced by the global variable ownership
reversal performed in r281284.

rdar://problem/28448075

llvm-svn: 283784

8 years ago[ADT] Attempt to fix MSVC 2015 ICE via judicious addition of std::decay to make_point...
Justin Lebar [Mon, 10 Oct 2016 17:18:45 +0000 (17:18 +0000)]
[ADT] Attempt to fix MSVC 2015 ICE via judicious addition of std::decay to make_pointe{r,e}_iterator.

llvm-svn: 283783

8 years agoUpdate documentation after r283671 ("Turn cl::values() (for enum) from a vararg funct...
Mehdi Amini [Mon, 10 Oct 2016 17:13:14 +0000 (17:13 +0000)]
Update documentation after r283671 ("Turn cl::values() (for enum) from a vararg function to using C++ variadic template")

llvm-svn: 283782

8 years agoUpdated notes about issues; marked 2062, 2223, 2394, 2460 and 2540 as complete.
Marshall Clow [Mon, 10 Oct 2016 17:11:37 +0000 (17:11 +0000)]
Updated notes about issues; marked 2062, 2223, 2394, 2460 and 2540 as complete.

llvm-svn: 283781

8 years agoAdd tests to check that swap(std::function, std::function) is noexcept. This is LWG...
Marshall Clow [Mon, 10 Oct 2016 16:47:48 +0000 (16:47 +0000)]
Add tests to check that swap(std::function, std::function) is noexcept. This is LWG#2062, but we already do this. No changes to the library, just adding tests.

llvm-svn: 283780

8 years agoAdd llvm::apply to STLExtras.
Zachary Turner [Mon, 10 Oct 2016 16:44:09 +0000 (16:44 +0000)]
Add llvm::apply to STLExtras.

This is equivalent to the C++14 std::apply().  Since we are not
using C++14 yet, this allows us to still make use of apply anyway.

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

llvm-svn: 283779

8 years ago[Examples] Fix use of sema.LateParsedTemplateMap in clang/examples.
Justin Lebar [Mon, 10 Oct 2016 16:41:00 +0000 (16:41 +0000)]
[Examples] Fix use of sema.LateParsedTemplateMap in clang/examples.

llvm-svn: 283778

8 years ago[clang-tidy] Add a whitelist option in google-runtime-references.
Haojian Wu [Mon, 10 Oct 2016 16:38:11 +0000 (16:38 +0000)]
[clang-tidy] Add a whitelist option in google-runtime-references.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 283777

8 years agoUse StringRef in LangOptions::isNoBuiltinFunc API (NFC)
Mehdi Amini [Mon, 10 Oct 2016 16:34:07 +0000 (16:34 +0000)]
Use StringRef in LangOptions::isNoBuiltinFunc API (NFC)

llvm-svn: 283776

8 years ago[Analysis] Use unique_ptr for CallGraph::FunctionMap.
Justin Lebar [Mon, 10 Oct 2016 16:26:48 +0000 (16:26 +0000)]
[Analysis] Use unique_ptr for CallGraph::FunctionMap.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283775

8 years ago[Analysis] Use unique_ptr in AnalyaisDeclContextManager's ContextMap.
Justin Lebar [Mon, 10 Oct 2016 16:26:44 +0000 (16:26 +0000)]
[Analysis] Use unique_ptr in AnalyaisDeclContextManager's ContextMap.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283774

8 years ago[AST] Convert Marshallers to use unique_ptr.
Justin Lebar [Mon, 10 Oct 2016 16:26:40 +0000 (16:26 +0000)]
[AST] Convert Marshallers to use unique_ptr.

Reviewers: timshen

Subscribers: cfe-commits, klimek

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

llvm-svn: 283773

8 years agoUse unique_ptr for VTableBuilder::VBaseInfo map.
Justin Lebar [Mon, 10 Oct 2016 16:26:36 +0000 (16:26 +0000)]
Use unique_ptr for VTableBuilder::VBaseInfo map.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283772

8 years agoUse unique_ptr for VTableBuilder::VFTableLayouts map.
Justin Lebar [Mon, 10 Oct 2016 16:26:33 +0000 (16:26 +0000)]
Use unique_ptr for VTableBuilder::VFTableLayouts map.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283771

8 years agoUse unique_ptr for VPtrLocationsMap and VPtrInfoVector.
Justin Lebar [Mon, 10 Oct 2016 16:26:29 +0000 (16:26 +0000)]
Use unique_ptr for VPtrLocationsMap and VPtrInfoVector.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283770

8 years ago[AST] Use unique_ptr for VTableLayout.
Justin Lebar [Mon, 10 Oct 2016 16:26:24 +0000 (16:26 +0000)]
[AST] Use unique_ptr for VTableLayout.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283769

8 years ago[AST] Convert MangleNumberingContext to a unique_ptr.
Justin Lebar [Mon, 10 Oct 2016 16:26:19 +0000 (16:26 +0000)]
[AST] Convert MangleNumberingContext to a unique_ptr.

Summary: It doesn't need to be refcounted anymore, either.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283768

8 years agoUse unique_ptr in LLVMContextImpl's constant maps.
Justin Lebar [Mon, 10 Oct 2016 16:26:13 +0000 (16:26 +0000)]
Use unique_ptr in LLVMContextImpl's constant maps.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283767

8 years ago[Sema] Use unique_ptr instead of raw pointers in the late-parsed templates map.
Justin Lebar [Mon, 10 Oct 2016 16:26:08 +0000 (16:26 +0000)]
[Sema] Use unique_ptr instead of raw pointers in the late-parsed templates map.

Summary:
This is possible now that MapVector supports move-only values.

Depends on D25404.

Reviewers: timshen

Subscribers: cfe-commits

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

llvm-svn: 283766

8 years ago[ADT] Add make_pointe{e,r}_iterator.
Justin Lebar [Mon, 10 Oct 2016 16:26:03 +0000 (16:26 +0000)]
[ADT] Add make_pointe{e,r}_iterator.

Reviewers: timshen

Subscribers: llvm-commits

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

llvm-svn: 283765

8 years ago[ADT] Let MapVector handle non-copyable values.
Justin Lebar [Mon, 10 Oct 2016 16:25:59 +0000 (16:25 +0000)]
[ADT] Let MapVector handle non-copyable values.

Summary: The keys must still be copyable, because we store two copies of them.

Reviewers: timshen

Subscribers: llvm-commits

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

llvm-svn: 283764

8 years ago[ARM] Fix invalid VLDM/VSTM access when targeting Big Endian with NEON
Alexandros Lamprineas [Mon, 10 Oct 2016 16:01:54 +0000 (16:01 +0000)]
[ARM] Fix invalid VLDM/VSTM access when targeting Big Endian with NEON

The instructions VLDM/VSTM can only access word-aligned memory
locations and produce alignment fault if the condition is not met.

The compiler currently generates VLDM/VSTM for v2f64 load/store
regardless the alignment of the memory access. Instead, if a v2f64
load/store is not word-aligned, the compiler should generate
VLD1/VST1. For each non double-word-aligned VLD1/VST1, a VREV
instruction should be generated when targeting Big Endian.

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

llvm-svn: 283763

8 years ago[libcxx] Fix gcc build.
Asiri Rathnayake [Mon, 10 Oct 2016 15:56:01 +0000 (15:56 +0000)]
[libcxx] Fix gcc build.

Attempt to fix a horrible gcc include order problem.

llvm-svn: 283762

8 years agoAdd return type for checkForValidSection parsing function. NFC Intended.
Nirav Dave [Mon, 10 Oct 2016 15:24:54 +0000 (15:24 +0000)]
Add return type for checkForValidSection parsing function. NFC Intended.

llvm-svn: 283761

8 years ago[ELF] Don't emit empty PT_LOAD segment
Eugene Leviant [Mon, 10 Oct 2016 15:09:44 +0000 (15:09 +0000)]
[ELF] Don't emit empty PT_LOAD segment

Sometimes the very first PT_LOAD segment, created by lld, can be empty.
This happens when (all conditions met):

- Linker script is used
- First section in ELF image is not RO
- Not enough space for program headers.

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

llvm-svn: 283760

8 years agoFix documentation mis-spelling.
Eric Fiselier [Mon, 10 Oct 2016 14:45:06 +0000 (14:45 +0000)]
Fix documentation mis-spelling.

I promise to stop misspelling things when the English language gains a program
that does strict semantic checking.

llvm-svn: 283759

8 years ago[X86] Prefer rotate by 1 over rotate by imm
Zvi Rackover [Mon, 10 Oct 2016 14:43:55 +0000 (14:43 +0000)]
[X86] Prefer rotate by 1 over rotate by imm

Summary:
Rotate by 1 is translated to 1 micro-op, while rotate with imm8 is translated to 2 micro-ops.

Fixes pr30644.

Reviewers: delena, igorb, craig.topper, spatel, RKSimon

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

llvm-svn: 283758

8 years agoAdd whitespace to make not_fn_impl more clear. NFC.
Marshall Clow [Mon, 10 Oct 2016 14:37:18 +0000 (14:37 +0000)]
Add whitespace to make not_fn_impl more clear. NFC.

llvm-svn: 283757

8 years ago[SLPVectorizer][X86] Add 512-bit sitofp/uitofp tests
Simon Pilgrim [Mon, 10 Oct 2016 14:28:06 +0000 (14:28 +0000)]
[SLPVectorizer][X86] Add 512-bit sitofp/uitofp tests

llvm-svn: 283756

8 years ago[Sema] Prevent using member declaration diagnostic if the base class is invalid.
Eric Fiselier [Mon, 10 Oct 2016 14:26:40 +0000 (14:26 +0000)]
[Sema] Prevent using member declaration diagnostic if the base class is invalid.

Summary:
Once a base class has been made invalid (by a static_assert for example) all using-member declarations in the derived classes will result in a "not a base class" diagnostic. This diagnostic is very misleading and should not be emitted.

This change is needed to help libc++ produce reasonable diagnostics in `std::optional` and `std::variant`.

Reviewers: rsmith, majnemer, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 283755

8 years ago[include-fixer] query-mode should be false by default.
Haojian Wu [Mon, 10 Oct 2016 14:21:55 +0000 (14:21 +0000)]
[include-fixer] query-mode should be false by default.

Makes it consistent with documentations.

llvm-svn: 283754

8 years agoRevert r283683 because r283680 got reverted.
Nico Weber [Mon, 10 Oct 2016 14:20:35 +0000 (14:20 +0000)]
Revert r283683 because r283680 got reverted.

llvm-svn: 283753

8 years agoMark issues 2544, 2567, 2569, 2686 and 2694 as ready/done.
Marshall Clow [Mon, 10 Oct 2016 14:15:56 +0000 (14:15 +0000)]
Mark issues 2544, 2567, 2569, 2686 and 2694 as ready/done.

llvm-svn: 283752

8 years ago[SLPVectorizer][X86] Add avx512 sitofp/uitofp tests
Simon Pilgrim [Mon, 10 Oct 2016 14:14:31 +0000 (14:14 +0000)]
[SLPVectorizer][X86] Add avx512 sitofp/uitofp tests

llvm-svn: 283751

8 years agoRevert "P0035R4: Semantic analysis and code generation for C++17 overaligned allocation."
Daniel Jasper [Mon, 10 Oct 2016 14:13:55 +0000 (14:13 +0000)]
Revert "P0035R4: Semantic analysis and code generation for C++17 overaligned allocation."

This reverts commit r283722. Breaks:
  Clang.SemaCUDA.device-var-init.cu
  Clang.CodeGenCUDA.device-var-init.cu

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/884/

llvm-svn: 283750

8 years agoAdd tests for LWG2544. We already implement this; just adding tests to make sure...
Marshall Clow [Mon, 10 Oct 2016 14:10:45 +0000 (14:10 +0000)]
Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.

llvm-svn: 283749

8 years ago[SLPVectorizer][X86] Fixed alignments of scalar loads in sitofp/uitofp tests
Simon Pilgrim [Mon, 10 Oct 2016 14:10:41 +0000 (14:10 +0000)]
[SLPVectorizer][X86] Fixed alignments of scalar loads in sitofp/uitofp tests

Fixed copy+paste vector alignment to correct for per-element scalar loads

Increased to 512-bit data sizes in preparation of avx512 tests

llvm-svn: 283748

8 years agoRevert r283680.
Nico Weber [Mon, 10 Oct 2016 14:10:00 +0000 (14:10 +0000)]
Revert r283680.

Breaks bootstrap builds on (at least) Windows:
In file included from D:\buildslave\clang-x64-ninja-win7\llvm\lib\Support\Allocator.cpp:14:
In file included from D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/Support/Allocator.h:24:
In file included from D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/ADT/SmallVector.h:20:
In file included from D:\buildslave\clang-x64-ninja-win7\llvm\include\llvm/Support/MathExtras.h:19:
D:\buildslave\clang-x64-ninja-win7\stage1.install\bin\..\lib\clang\4.0.0\include\algorithm(63,8) :
    error: unknown type name '__device__'
    inline __device__ const __T &

llvm-svn: 283747

8 years ago[Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Michal Gorny [Mon, 10 Oct 2016 12:23:40 +0000 (12:23 +0000)]
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

llvm-svn: 283746

8 years ago[DepInfo] Print -debug output outside of max-operations scope.
Michael Kruse [Mon, 10 Oct 2016 11:45:59 +0000 (11:45 +0000)]
[DepInfo] Print -debug output outside of max-operations scope.

ISL tries to simplify the polyhedral operations before printing its objects.
This increases the operations counter and therefore can contribute to hitting
the operations limit. Therefore the result could be different when -debug output
is enabled, making debugging harder.

llvm-svn: 283745

8 years ago[Support/DepInfo] Introduce IslMaxOperationsGuard and make DepInfo use it. NFC.
Michael Kruse [Mon, 10 Oct 2016 11:45:54 +0000 (11:45 +0000)]
[Support/DepInfo] Introduce IslMaxOperationsGuard and make DepInfo use it. NFC.

IslMaxOperationsGuard defines a scope where ISL may abort operations because if
it takes too many operations. Replace the call to the raw ISL interface by a
use of the guard.

IslMaxOperationsGuard provides a uniform way to define a maximal computation
time for a code region in C++ using RAII.

llvm-svn: 283744

8 years agoRevert "[x86][inline-asm][clang] accept 'v' constraint"
Daniel Jasper [Mon, 10 Oct 2016 11:40:28 +0000 (11:40 +0000)]
Revert "[x86][inline-asm][clang] accept 'v' constraint"

This reverts commit r283716.

Breaks buildbot:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/9155/testReport/junit/Clang/CodeGen/x86_inline_asm_v_constraint_c/

llvm-svn: 283743

8 years ago[ELF] Change argument type for findSections. NFC
Eugene Leviant [Mon, 10 Oct 2016 11:23:12 +0000 (11:23 +0000)]
[ELF] Change argument type for findSections. NFC

llvm-svn: 283742

8 years agoFixed windows stdout/stderr redirection in inline asm constraint tests
Simon Pilgrim [Mon, 10 Oct 2016 11:11:27 +0000 (11:11 +0000)]
Fixed windows stdout/stderr redirection in inline asm constraint tests

llvm-svn: 283741

8 years ago[Object/ELF] - Do not crash on invalid Header->e_shoff value.
George Rimar [Mon, 10 Oct 2016 10:51:38 +0000 (10:51 +0000)]
[Object/ELF] - Do not crash on invalid Header->e_shoff value.

sections_begin() may return unalignment pointer when Header->e_shoff isinvalid.
That may result in a crash in clients, for example we have one in LLD:

assert((PtrWord & ~PointerBitMask) == 0 &&
       "Pointer is not sufficiently aligned");
fails when trying to push_back Elf_Shdr* (unaligned) into TinyPtrVector.

Patch forces check for alignment of Header->e_shoff.

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

llvm-svn: 283740

8 years ago[LLDB][MIPS] All tests get errors in dotest after this test.
Nitesh Jain [Mon, 10 Oct 2016 10:47:53 +0000 (10:47 +0000)]
[LLDB][MIPS] All tests get errors in dotest after this test.

Subscribers: jaydeep, bhushan, slthakur, llvm-commits
llvm-svn: 283739

8 years agoRecommit r283733 "[ELF] - Do not crash if common symbol alignment set to value greate...
George Rimar [Mon, 10 Oct 2016 10:31:03 +0000 (10:31 +0000)]
Recommit r283733 "[ELF] - Do not crash if common symbol alignment set to value greater than UINT32_MAX.

With fix: commit changes from InputFiles.cpp too.

Original commit message:
We have following code in lld, that truncates the alignment value to 32 bit. Big alignment in this case
may give result 0 and crash later.

template <class ELFT>
CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms)
    : InputSection<ELFT>(nullptr, &Hdr, "") {
....
  for (DefinedCommon *Sym : Syms) {
    this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment);
...
  }
}

Patch fixes the issue.

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

llvm-svn: 283738

8 years agoRevert r283733 "[ELF] - Do not crash if common symbol alignment set to value greater...
George Rimar [Mon, 10 Oct 2016 10:27:38 +0000 (10:27 +0000)]
Revert r283733 "[ELF] - Do not crash if common symbol alignment set to value greater than UINT32_MAX."

Broke BB because forgot to commit source file.

llvm-svn: 283737

8 years agoUse `let' instead of `let*' in one place where `let*' isn't necessary
Manuel Klimek [Mon, 10 Oct 2016 10:22:40 +0000 (10:22 +0000)]
Use `let' instead of `let*' in one place where `let*' isn't necessary

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

Patch by Philipp Stephani.

llvm-svn: 283736

8 years ago[ELF][ARM] Fix formatting mistake, removed extra space before ) NFC.
Peter Smith [Mon, 10 Oct 2016 10:18:58 +0000 (10:18 +0000)]
[ELF][ARM] Fix formatting mistake, removed extra space before ) NFC.

llvm-svn: 283735

8 years ago[ELF][ARM] Garbage collection support for .ARM.exidx sections
Peter Smith [Mon, 10 Oct 2016 10:10:27 +0000 (10:10 +0000)]
[ELF][ARM] Garbage collection support for .ARM.exidx sections

.ARM.exidx sections have a reverse dependency on the section they have
a SHF_LINK_ORDER dependency on. In other words a .ARM.exidx section is
live only if the executable section it describes is live. We implement
this with a reverse dependency field in InputSection.

Adding the dependency to InputSection is the simplest implementation
but it could be moved out to a separate map if it were found to decrease
performance for non ARM targets.

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

llvm-svn: 283734