platform/upstream/llvm.git
7 years ago[InstCombine] auto-generate checks for min/max tests
Sanjay Patel [Thu, 27 Oct 2016 19:54:15 +0000 (19:54 +0000)]
[InstCombine] auto-generate checks for min/max tests

llvm-svn: 285336

7 years ago[PPC] Adding the removed testcase again
Ehsan Amiri [Thu, 27 Oct 2016 19:10:09 +0000 (19:10 +0000)]
[PPC] Adding the removed testcase again

This testcase was originally part of r284995, but I put it in a wrong directory.
So I removed it. Before adding it back I did some small enhancements. Also I
changed the assertions a little bit, to take into account the impact of some
changes performed since code review is done.

This is similar to changes done for another testcase in the original commit.
See: https://reviews.llvm.org/D23614#577749
Basically for instead of vxor we now generate xxlxor in some cases, which is
better.

llvm-svn: 285333

7 years agoAdd support for "type lookup" to find C and C++ types
Enrico Granata [Thu, 27 Oct 2016 18:44:45 +0000 (18:44 +0000)]
Add support for "type lookup" to find C and C++ types

This is an important first step in closing the functionality gap between "type lookup" and "images lookup -t"

rdar://28971388

llvm-svn: 285332

7 years ago[coroutines] Add diagnostics for copy/move assignment operators and functions with...
Eric Fiselier [Thu, 27 Oct 2016 18:43:28 +0000 (18:43 +0000)]
[coroutines] Add diagnostics for copy/move assignment operators and functions with deduced return types.

Summary: The title says it all. Additionally this patch refactors the diagnostic code into a separate function.

Reviewers: GorNishanov, rsmith

Subscribers: majnemer, mehdi_amini, cfe-commits

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

llvm-svn: 285331

7 years ago[LoopUnroll] Check partial unrolling is enabled before initialization. NFC.
Haicheng Wu [Thu, 27 Oct 2016 18:40:02 +0000 (18:40 +0000)]
[LoopUnroll] Check partial unrolling is enabled before initialization. NFC.

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

llvm-svn: 285330

7 years ago[X86][AVX512] Fix MUL v8i64 costs on non-AVX512DQ targets
Simon Pilgrim [Thu, 27 Oct 2016 18:32:06 +0000 (18:32 +0000)]
[X86][AVX512] Fix MUL v8i64 costs on non-AVX512DQ targets

llvm-svn: 285329

7 years agoUse -fopenmp=libomp in all OpenMP offloading tests.
Samuel Antao [Thu, 27 Oct 2016 18:29:57 +0000 (18:29 +0000)]
Use -fopenmp=libomp in all OpenMP offloading tests.

This will make sure the right features are being tested even for machines that default to libgomp.

llvm-svn: 285327

7 years ago[Driver][OpenMP] Add support to create jobs for unbundling actions.
Samuel Antao [Thu, 27 Oct 2016 18:14:55 +0000 (18:14 +0000)]
[Driver][OpenMP] Add support to create jobs for unbundling actions.

Summary:
This patch adds the support to create jobs for the `OffloadBundlingAction` which will invoke the `clang-offload-bundler` tool to unbundle input files.

Unlike other actions, unbundling actions have multiple outputs. Therefore, this patch adds the required changes to have a variant of `Tool::ConstructJob` with multiple outputs.

The way the naming of the results is implemented is also slightly modified so that the same action can use a different offloading prefix for each use by the different offloading actions.

With this patch, it is possible to compile a functional OpenMP binary with offloading support, even with separate compilation.

Reviewers: echristo, tra, jlebar, ABataev, hfinkel

Subscribers: mkuron, whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285326

7 years ago[Driver][OpenMP] Add support to create jobs for bundling actions.
Samuel Antao [Thu, 27 Oct 2016 18:04:42 +0000 (18:04 +0000)]
[Driver][OpenMP] Add support to create jobs for bundling actions.

Summary: This patch adds the support to create a job for the `OffloadBundlingAction` which will invoke the `clang-offload-bundler` tool.

Reviewers: echristo, tra, jlebar, ABataev, hfinkel

Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285325

7 years ago[Driver][OpenMP] Update actions builder to create unbundling action when necessary.
Samuel Antao [Thu, 27 Oct 2016 18:00:51 +0000 (18:00 +0000)]
[Driver][OpenMP] Update actions builder to create unbundling action when necessary.

Summary:
Each time that offloading support is requested by the user and the input file is not a source file, an action `OffloadUnbundlingAction` is created to signal that the input file may contain bundles, so that the proper tool is then invoked to attempt to extract the components of the bundle. This patch adds the logic to create that action in offload action builder.

The job creation for the new action will be proposed in a separate patch.

Reviewers: echristo, tra, jlebar, ABataev, hfinkel

Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285324

7 years ago[Driver][OpenMP] Update actions builder to create bundling action when necessary.
Samuel Antao [Thu, 27 Oct 2016 17:50:43 +0000 (17:50 +0000)]
[Driver][OpenMP] Update actions builder to create bundling action when necessary.

Summary:
In order to save the user from dealing with multiple output files (for host and device) while using separate compilation, a new action `OffloadBundlingAction` is used when the last phase is not linking. This action will then result in a job that uses the proposed bundling tool to create a single preprocessed/IR/ASM/Object file from multiple ones.

The job creation for the new action will be proposed in a separate patch.

Reviewers: echristo, tra, jlebar, ABataev, hfinkel

Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285323

7 years agoDon't create a dummy ELF to process a binary file.
Rafael Espindola [Thu, 27 Oct 2016 17:45:40 +0000 (17:45 +0000)]
Don't create a dummy ELF to process a binary file.

Now that it is easy to create input section and symbols, this is
simple.

llvm-svn: 285322

7 years agoFix build breakage on buildbots that was due to 285309.
Greg Clayton [Thu, 27 Oct 2016 17:43:39 +0000 (17:43 +0000)]
Fix build breakage on buildbots that was due to 285309.

llvm-svn: 285321

7 years ago[Driver][OpenMP] Add logic for offloading-specific argument translation.
Samuel Antao [Thu, 27 Oct 2016 17:39:44 +0000 (17:39 +0000)]
[Driver][OpenMP] Add logic for offloading-specific argument translation.

Summary:
This patch includes support for argument translation that is specific of a given offloading kind. Additionally, it implements the translation for OpenMP device kinds in the gcc tool chain.

With this patch, it is possible to compile a functional OpenMP application with offloading capabilities with no separate compilation.

Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel

Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285320

7 years ago[Driver][OpenMP] Build jobs for OpenMP offloading actions for targets using gcc tool...
Samuel Antao [Thu, 27 Oct 2016 17:31:22 +0000 (17:31 +0000)]
[Driver][OpenMP] Build jobs for OpenMP offloading actions for targets using gcc tool chains.

Summary:
This patch adds logic to create jobs for OpenMP offloading actions by:
 - tuning the jobs result information to use the offloading prefix even for (device) linking actions.
 - replacing the device inputs of the host linking jobs by a linker script that embed them in the right sections.

Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel

Subscribers: mkuron, whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285319

7 years ago[InstCombine] handle simple vector integer constants in IsFreeToInvert
Sanjay Patel [Thu, 27 Oct 2016 17:30:50 +0000 (17:30 +0000)]
[InstCombine] handle simple vector integer constants in IsFreeToInvert

llvm-svn: 285318

7 years agoBe less aggressive at relaxing got access in this case.
Rafael Espindola [Thu, 27 Oct 2016 17:28:56 +0000 (17:28 +0000)]
Be less aggressive at relaxing got access in this case.

This fixes pr30803 by not relaxing that particular access. We could
also let adjustRelaxExpr know that the target is absolute so that it
uses R_RELAX_GOT_PC_NOPIC, but it is not clear if it is worth it.

llvm-svn: 285317

7 years ago[CodeGen] Provide an appropriate alignment for dynamic allocas
David Majnemer [Thu, 27 Oct 2016 17:18:24 +0000 (17:18 +0000)]
[CodeGen] Provide an appropriate alignment for dynamic allocas

GCC documents __builtin_alloca as aligning the storage to at least
__BIGGEST_ALIGNMENT__.

MSVC documents essentially the same for the x64 ABI:
https://msdn.microsoft.com/en-us/library/x9sx5da1.aspx

The 32-bit ABI follows the same rule: it emits a call to _alloca_probe_16

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

llvm-svn: 285316

7 years ago[MS ABI] Reuse getVFPtrOffsets instead of using getClassAtVTableLocation
David Majnemer [Thu, 27 Oct 2016 17:11:51 +0000 (17:11 +0000)]
[MS ABI] Reuse getVFPtrOffsets instead of using getClassAtVTableLocation

getClassAtVTableLocation hunts through virtual bases without using the
MDC layout which is indicative of a bug.

Instead, reuse the getVFPtrOffsets machinery to calculate which
subobject within the MDC is responsible for the vfptr.

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

llvm-svn: 285315

7 years ago[Driver][OpenMP] Add specialized action builder for OpenMP offloading actions.
Samuel Antao [Thu, 27 Oct 2016 17:08:03 +0000 (17:08 +0000)]
[Driver][OpenMP] Add specialized action builder for OpenMP offloading actions.

Summary:
This patch adds a new specialized action builder to create OpenMP offloading actions. The specialized builder is added to the action builder already containing the CUDA specialized builder.

OpenMP offloading dependences between host and device actions (expressed with OffloadActions) are different that what is used for CUDA:
 - Device compile action depends on the host compile action - the device frontend extracts the information about the declarations that have to be emitted by looking into the metadata produced by the host frontend.
 - The host link action depends on the device link actions - the device images are embedded in the host binary at link time.

Reviewers: echristo, tra, rsmith, jlebar, ABataev, hfinkel

Subscribers: mkuron, whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285314

7 years ago[X86][AVX512DQ] Move v2i64 and v4i64 MUL lowering to tablegen
Simon Pilgrim [Thu, 27 Oct 2016 17:07:40 +0000 (17:07 +0000)]
[X86][AVX512DQ] Move v2i64 and v4i64 MUL lowering to tablegen

As suggested by @igorb on D26011

llvm-svn: 285313

7 years agoARM: ensure that the Windows DBZ check is in range
Saleem Abdulrasool [Thu, 27 Oct 2016 16:59:22 +0000 (16:59 +0000)]
ARM: ensure that the Windows DBZ check is in range

The Windows ARM target expects the compiler to emit a division-by-zero check.
The check would use the form of:

    cmp r?, #0
    cbz .Ltrap
    b .Lbody
  .Lbody:
    ...
  .Ltrap:
    udf #249 @ __brkdiv0

This works great most of the time.  However, if the body of the function is
greater than 127 bytes, the branch target limitation of cbz becomes an issue.
This occurs in the unoptimized code generation cases sometimes (like in
compiler-rt).

Since this is a matter of correctness, possibly pay a small penalty instead.  We
now form this slightly differently:

    cbnz .Lbody
    udf #249 @ __brkdiv0
  .Lbody:
    ...

The positive case is through the branch instead of being the next instruction.
However, because of the basic block layout, the negated branch is going to be
a short distance always (2 bytes away, after the inserted __brkdiv0).

The new t__brkdiv0 instruction is required to explicitly mark the instruction as
a terminator as the generic UDF instruction is not a terminator.

Addresses PR30532!

llvm-svn: 285312

7 years ago[Driver][OpenMP] Create tool chains for OpenMP offloading kind.
Samuel Antao [Thu, 27 Oct 2016 16:38:05 +0000 (16:38 +0000)]
[Driver][OpenMP] Create tool chains for OpenMP offloading kind.

Summary: This patch adds new logic to create the necessary tool chains to support offloading for OpenMP. The OpenMP related options are checked and the tool chains created accordingly. Diagnostics are emitted in case the options are illegal or express unknown targets.

Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel

Subscribers: whchung, mkuron, mehdi_amini, cfe-commits, Hahnfeld, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 285311

7 years agoExpand -Wlogical-not-parentheses to also fire on `!x & A`.
Nico Weber [Thu, 27 Oct 2016 16:32:06 +0000 (16:32 +0000)]
Expand -Wlogical-not-parentheses to also fire on `!x & A`.

This is a misspelling of the intended !(x & A) negated bit test that happens in
practice every now and then.

I ran this on Chromium and all its dependencies, and it fired 0 times -- no
false or true positives, but it would've caught a bug in an in-progress change
that had to be caught by a Visual Studio warning instead.

https://reviews.llvm.org/D26035

llvm-svn: 285310

7 years agoSwitch all DWARF variables for tags, attributes and forms over to use the llvm::dwarf...
Greg Clayton [Thu, 27 Oct 2016 16:32:04 +0000 (16:32 +0000)]
Switch all DWARF variables for tags, attributes and forms over to use the llvm::dwarf enumerations instead of using raw uint16_t values. This allows easier debugging as users can see the values of the enumerations in the variables view that will show the enumeration string instead of just a number.

https://reviews.llvm.org/D26013

llvm-svn: 285309

7 years agoAdd Loop Sink pass to reverse the LICM based of basic block frequency.
Dehao Chen [Thu, 27 Oct 2016 16:30:08 +0000 (16:30 +0000)]
Add Loop Sink pass to reverse the LICM based of basic block frequency.

Summary: LICM may hoist instructions to preheader speculatively. Before code generation, we need to sink down the hoisted instructions inside to loop if it's beneficial. This pass is a reverse of LICM: looking at instructions in preheader and sinks the instruction to basic blocks inside the loop body if basic block frequency is smaller than the preheader frequency.

Reviewers: hfinkel, davidxl, chandlerc

Subscribers: anna, modocache, mgorny, beanz, reames, dberlin, chandlerc, mcrosier, junbuml, sanjoy, mzolotukhin, llvm-commits

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

llvm-svn: 285308

7 years ago[Driver][CUDA][OpenMP] Reimplement tool selection in the driver.
Samuel Antao [Thu, 27 Oct 2016 16:29:20 +0000 (16:29 +0000)]
[Driver][CUDA][OpenMP] Reimplement tool selection in the driver.

Summary:
This creates a tool selector in the driver that replaces the existing one. The goal is to better organize the code and make the selector easier to scale, in particular in the presence of offload actions that can be collapsed.

The current implementation became more confusing when the support for offloading actions was added. This concern was expressed by Eric in http://reviews.llvm.org/D9888.

This patch does not add new testing, it preserves the existing functionality.

Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel

Subscribers: whchung, guansong, mkuron, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, caomhin, arpith-jacob, carlo.bertolli

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

llvm-svn: 285307

7 years ago[coroutines] Add allocation and deallocation substatements.
Gor Nishanov [Thu, 27 Oct 2016 16:28:31 +0000 (16:28 +0000)]
[coroutines] Add allocation and deallocation substatements.

Summary:
SemaCoroutine: Add allocation / deallocation substatements.
CGCoroutine/Test: Emit allocation and deallocation + test.

Reviewers: rsmith

Subscribers: ABataev, EricWF, llvm-commits, mehdi_amini

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

llvm-svn: 285306

7 years ago[mips] Do not allow -opt-bisect-limit to skip the PIC call optimization pass.
Vasileios Kalintiris [Thu, 27 Oct 2016 15:50:36 +0000 (15:50 +0000)]
[mips] Do not allow -opt-bisect-limit to skip the PIC call optimization pass.

r282428 added the MipsOptimizePICCall as an opt-in pass that can be
skipped when using the -opt-bisect-limit option. However, this pass is
needed because it generates code that conforms to the o32 ABI
specification by using the $t9 register for PIC calls with JALR
instructions.

This bug was exposed by the fact that skipFunction() also checks for
the "optnone" attribute. This caused functions with that attribute to
break the requirements of the o32 ABI.

llvm-svn: 285305

7 years ago[X86][AVX512DQ] Improve lowering of MUL v2i64 and v4i64
Simon Pilgrim [Thu, 27 Oct 2016 15:27:00 +0000 (15:27 +0000)]
[X86][AVX512DQ] Improve lowering of MUL v2i64 and v4i64

With DQI but without VLX, lower v2i64 and v4i64 MUL operations with v8i64 MUL (vpmullq).

Updated cost table accordingly.

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

llvm-svn: 285304

7 years ago[ValueTracking] fix matchSelectPattern to allow vector splat folds of min/max/abs...
Sanjay Patel [Thu, 27 Oct 2016 15:26:10 +0000 (15:26 +0000)]
[ValueTracking] fix matchSelectPattern to allow vector splat folds of min/max/abs/nabs

llvm-svn: 285303

7 years agoRemove duplicated default move ctors/move assign. No functional change.
Benjamin Kramer [Thu, 27 Oct 2016 15:23:44 +0000 (15:23 +0000)]
Remove duplicated default move ctors/move assign. No functional change.

llvm-svn: 285302

7 years agoAttempt to make clang-format.py python 3 - compatible.
Alexander Kornienko [Thu, 27 Oct 2016 15:15:23 +0000 (15:15 +0000)]
Attempt to make clang-format.py python 3 - compatible.

llvm-svn: 285301

7 years agoMove 'quoted' for string_view from <string_view> to <iomanip> (where the other versio...
Marshall Clow [Thu, 27 Oct 2016 15:10:07 +0000 (15:10 +0000)]
Move 'quoted' for string_view from <string_view> to <iomanip> (where the other versions of 'quoted' live. No functional change.

llvm-svn: 285300

7 years ago[InstCombine] add tests for missing folds of vector abs/nabs/min/max
Sanjay Patel [Thu, 27 Oct 2016 15:02:45 +0000 (15:02 +0000)]
[InstCombine] add tests for missing folds of vector abs/nabs/min/max

llvm-svn: 285299

7 years agoFix memory issue in AttrBuilder::removeAttribute uses.
Bjorn Pettersson [Thu, 27 Oct 2016 14:48:09 +0000 (14:48 +0000)]
Fix memory issue in AttrBuilder::removeAttribute uses.

Summary:
Found when running Valgrind.

This removes two unnecessary assignments when using
AttrBuilder::removeAttribute.

AttrBuilder::removeAttribute returns a reference to the object.
As the LHSes were the same as the callees, the assignments
resulted in memcpy calls where dst = src.

Commited on behalf-of: dstenb (David Stenberg)

Reviewers: mkuper, rnk

Subscribers: llvm-commits

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

llvm-svn: 285298

7 years ago[Hexagon] Do not expand ISD::SELECT for HVX vectors
Krzysztof Parzyszek [Thu, 27 Oct 2016 14:30:16 +0000 (14:30 +0000)]
[Hexagon] Do not expand ISD::SELECT for HVX vectors

llvm-svn: 285297

7 years ago[DAGCombiner] Add vector demanded elements support to computeKnownBits
Simon Pilgrim [Thu, 27 Oct 2016 14:29:28 +0000 (14:29 +0000)]
[DAGCombiner] Add vector demanded elements support to computeKnownBits

Currently computeKnownBits returns the common known zero/one bits for all elements of vector data, when we may only be interested in one/some of the elements.

This patch adds a DemandedElts argument that allows us to specify the elements we actually care about. The original computeKnownBits implementation calls with a DemandedElts demanding all elements to match current behaviour. Scalar types set this to 1.

The approach was found to be easier than trying to add a per-element known bits solution, for a similar usefulness given the combines where computeKnownBits is typically used.

I've only added support for a few opcodes so far (the ones that have proven straightforward to test), all others will default to demanding all elements but can be updated in due course.

DemandedElts support could similarly be added to computeKnownBitsForTargetNode in a future commit.

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

llvm-svn: 285296

7 years agoDo not print include_next/pragma once warnings when input is a header.
Erik Verbruggen [Thu, 27 Oct 2016 14:17:10 +0000 (14:17 +0000)]
Do not print include_next/pragma once warnings when input is a header.

r276653 suppressed the pragma once warning when generating a PCH file.
This patch extends that to any main file for which clang is told (with
the -x option) that it's a header file. It will also suppress the
warning "#include_next in primary source file".

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

llvm-svn: 285295

7 years agoStore OSABI in Config.
Rafael Espindola [Thu, 27 Oct 2016 14:00:51 +0000 (14:00 +0000)]
Store OSABI in Config.

This allows us to set a value for it based on -m.

llvm-svn: 285294

7 years ago[InstCombine] auto-generate better checks; NFC
Sanjay Patel [Thu, 27 Oct 2016 13:55:37 +0000 (13:55 +0000)]
[InstCombine] auto-generate better checks; NFC

llvm-svn: 285293

7 years agoAdd documentation for the transparent_union attribute
Alex Lorenz [Thu, 27 Oct 2016 13:51:30 +0000 (13:51 +0000)]
Add documentation for the transparent_union attribute

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

llvm-svn: 285292

7 years agoFix warnings from python difflib.
Alexander Kornienko [Thu, 27 Oct 2016 13:46:49 +0000 (13:46 +0000)]
Fix warnings from python difflib.

llvm-svn: 285291

7 years agoUse fewer allocators.
Rafael Espindola [Thu, 27 Oct 2016 13:32:32 +0000 (13:32 +0000)]
Use fewer allocators.

Instead of having 3 section allocators per file, have 3 for all files.

This is a substantial performance improvement for some cases. Linking
chromium without gc speeds up by 1.065x.

This requires using _exit in fatal since we have to avoid destructing
an InputSection if fatal is called from the constructor.

Thanks to Rui for the suggestion.

llvm-svn: 285290

7 years ago[Sema] -Wunused-variable warning for array variables should behave
Alex Lorenz [Thu, 27 Oct 2016 13:30:51 +0000 (13:30 +0000)]
[Sema] -Wunused-variable warning for array variables should behave
similarly to scalar variables.

This commit makes the -Wunused-variable warning behaviour more consistent:
Now clang won't warn for array variables where it doesn't warn for scalar
variables.

rdar://24158862

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

llvm-svn: 285289

7 years agoRevert r285285 "[Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is...
George Rimar [Thu, 27 Oct 2016 12:18:50 +0000 (12:18 +0000)]
Revert r285285 "[Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is too large."
It broke BB.

llvm-svn: 285288

7 years agoAdd const versions of Expr::getInits() and Expr::inits()
Erik Verbruggen [Thu, 27 Oct 2016 12:12:08 +0000 (12:12 +0000)]
Add const versions of Expr::getInits() and Expr::inits()

llvm-svn: 285287

7 years ago[SLP] Fix for PR30626: Compiler crash inside SLP Vectorizer.
Alexey Bataev [Thu, 27 Oct 2016 12:02:28 +0000 (12:02 +0000)]
[SLP] Fix for PR30626: Compiler crash inside SLP Vectorizer.

After successfull horizontal reduction vectorization attempt for PHI node
vectorizer tries to update root binary op by combining vectorized tree
and the ReductionPHI node. But during vectorization this ReductionPHI
can be vectorized itself and replaced by the `undef` value, while the
instruction itself is marked for deletion. This 'marked for deletion'
PHI node then can be used in new binary operation, causing "Use still
stuck around after Def is destroyed" crash upon PHI node deletion.

Also the test is fixed to make it perform actual testing.

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

llvm-svn: 285286

7 years ago[Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is too large.
George Rimar [Thu, 27 Oct 2016 11:50:04 +0000 (11:50 +0000)]
[Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is too large.

Elf.h already has code checking that section table does not go past end of file.
Problem is that this check may not work on values greater than UINT64_MAX / Header->e_shentsize
because of calculation overflow.

Parch fixes the issue.

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

llvm-svn: 285285

7 years ago[Object/ELF] - Do not allow overflow when checking section size/offset.
George Rimar [Thu, 27 Oct 2016 11:44:56 +0000 (11:44 +0000)]
[Object/ELF] - Do not allow overflow when checking section size/offset.

Overflow was the reason of incorrect passing the check,
patch fixes the case.

Differentail revision: https://reviews.llvm.org/D25514

llvm-svn: 285284

7 years agoFixed a memory leak related to task dependencies.
Andrey Churbanov [Thu, 27 Oct 2016 11:43:07 +0000 (11:43 +0000)]
Fixed a memory leak related to task dependencies.

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

Patch by Alex Duran.

llvm-svn: 285283

7 years ago[Object/ELF] - Do not crash if string table sh_size is equal to zero.
George Rimar [Thu, 27 Oct 2016 11:41:57 +0000 (11:41 +0000)]
[Object/ELF] - Do not crash if string table sh_size is equal to zero.

Revealed using "id_000038,sig_11,src_000015,op_havoc,rep_16" from PR30540,
when sh_size was 0, crash happened.

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

llvm-svn: 285282

7 years agoFix MSVC warning about missing 'this' from lambda default capture mode
Simon Pilgrim [Thu, 27 Oct 2016 10:51:29 +0000 (10:51 +0000)]
Fix MSVC warning about missing 'this' from lambda default capture mode

llvm-svn: 285281

7 years ago[ARM] Add newline char to test.
Sam Parker [Thu, 27 Oct 2016 10:43:02 +0000 (10:43 +0000)]
[ARM] Add newline char to test.

Missed a newline in the previous commit.

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

llvm-svn: 285280

7 years ago[ELF] Synthetic symbol definitions for ARM static linking
Peter Smith [Thu, 27 Oct 2016 10:28:53 +0000 (10:28 +0000)]
[ELF] Synthetic symbol definitions for ARM static linking

When static linking in ARM (like Mips) __tls_get_addr is defined by
the library so we should not define it as a synthetic.

We also need to add __exidx_start and __exidx_end for the .ARM.exidx
section as the static libc library startup code is expecting them to
be defined by the default linker script for static linking on ARM.

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

llvm-svn: 285279

7 years ago[ARM] Predicate UMAAL selection on hasDSP.
Sam Parker [Thu, 27 Oct 2016 09:47:10 +0000 (09:47 +0000)]
[ARM] Predicate UMAAL selection on hasDSP.

UMAAL is a DSP instruction and it is not available on thumbv7m
(Cortex-M3) and thumbv6m (Cortex-M0+1) targets. Also fix wrong
CHECK prefix in longMAC.ll test.

Patch by Vadzim Dambrouski.

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

llvm-svn: 285278

7 years agoEmpty the CtorLists/DtorLists once emitted.
Vassil Vassilev [Thu, 27 Oct 2016 09:12:20 +0000 (09:12 +0000)]
Empty the CtorLists/DtorLists once emitted.

This is essential when clang is running in incremental processing mode because
we don't want to reemit the 'tors over and over again.

Patch by Axel Naumann!

Reviewed by Richard Smith and me. (https://reviews.llvm.org/D25605)

llvm-svn: 285277

7 years ago[Xray] Don't generate output for xray tests
Benjamin Kramer [Thu, 27 Oct 2016 08:49:18 +0000 (08:49 +0000)]
[Xray] Don't generate output for xray tests

Patch by Sam McCall!

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

llvm-svn: 285276

7 years agoMark invalid RecordDecls as completed.
Erik Verbruggen [Thu, 27 Oct 2016 08:37:14 +0000 (08:37 +0000)]
Mark invalid RecordDecls as completed.

Sema::ActOnTag creates TagDecls for records. However, if those record
declarations are invalid, and the parser is in C++ mode, it would
silently drop the TagDecl (and leave it as "beingDefined"). The problem
is that other code (e.g. the ASTWriter) will serialize all types, and
expects them to be complete. So, leaving them open would result in
failing asserts.

Fixes PR20320

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

llvm-svn: 285275

7 years ago[AVR] Generate all of the TableGen files we need
Dylan McKay [Thu, 27 Oct 2016 08:20:47 +0000 (08:20 +0000)]
[AVR] Generate all of the TableGen files we need

This enables generation of all of the TableGen files that are used
downstream.

llvm-svn: 285274

7 years agoAMDGPU: Fix SILoadStoreOptimizer when writes cannot be merged due register dependencies
Nicolai Haehnle [Thu, 27 Oct 2016 08:15:07 +0000 (08:15 +0000)]
AMDGPU: Fix SILoadStoreOptimizer when writes cannot be merged due register dependencies

Summary:
When finding a match for a merge and collecting the instructions that must
be moved, keep in mind that the instruction we merge might actually use one
of the defs that are being moved.

Fixes piglit spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-load-output[-indirect].

The fact that the ds_read in the test case is not eliminated suggests that
there might be another problem related to alias analysis, but that's a
separate problem: this pass should still work correctly even when earlier
optimization passes missed something or were disabled.

Reviewers: tstellarAMD, arsenm

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 285273

7 years ago[AVR] Compile the disassembler
Dylan McKay [Thu, 27 Oct 2016 08:09:15 +0000 (08:09 +0000)]
[AVR] Compile the disassembler

This also updates references of 'TheAVRTarget' to the new
'getTheAVRTarget()' method.

llvm-svn: 285272

7 years ago[coroutines] Build fallthrough and set_exception statements.
Eric Fiselier [Thu, 27 Oct 2016 07:30:31 +0000 (07:30 +0000)]
[coroutines] Build fallthrough and set_exception statements.

Summary:
This patch adds semantic checking and building of the fall-through `co_return;` statement as well as the `p.set_exception(std::current_exception())` call for handling uncaught exceptions.

The fall-through statement is built and checked according to:
> [dcl.fct.def.coroutine]/4
> The unqualified-ids return_void and return_value are looked up in the scope of class P. If
> both are found, the program is ill-formed. If the unqualified-id return_void is found, flowing
> off the end of a coroutine is equivalent to a co_return with no operand. Otherwise, flowing off
> the end of a coroutine results in undefined behavior.

Similarly the `set_exception` call is only built when that unqualified-id is found in the scope of class P.

Additionally this patch adds fall-through warnings for non-void returning coroutines. Since it's surprising undefined behavior I thought it would be important to add the warning right away.

Reviewers: majnemer, GorNishanov, rsmith

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 285271

7 years ago[AVR] Add AVRISelDAGToDAG.cpp
Dylan McKay [Thu, 27 Oct 2016 07:03:47 +0000 (07:03 +0000)]
[AVR] Add AVRISelDAGToDAG.cpp

Summary: This pulls the AVR instruction selector in-tree.

Reviewers: arsenm, kparzysz

Subscribers: llvm-commits, wdng, beanz, japaric, mgorny

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

llvm-svn: 285270

7 years ago[AVR] Add the machine code emitter
Dylan McKay [Thu, 27 Oct 2016 06:56:46 +0000 (06:56 +0000)]
[AVR] Add the machine code emitter

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, japaric, llvm-commits, mgorny

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

llvm-svn: 285269

7 years ago[PPC] add vector byte reverse functions to altivec.h
Nemanja Ivanovic [Thu, 27 Oct 2016 06:23:57 +0000 (06:23 +0000)]
[PPC] add vector byte reverse functions to altivec.h

This patch corresponds to review https://reviews.llvm.org/D25915.
Committing on behalf of Sean Fertile.

llvm-svn: 285268

7 years ago[PowerPC] - No SExt/ZExt needed for count trailing zeros
Nemanja Ivanovic [Thu, 27 Oct 2016 05:17:58 +0000 (05:17 +0000)]
[PowerPC] - No SExt/ZExt needed for count trailing zeros

This patch corresponds to review:
https://reviews.llvm.org/D25896

It just eliminates the redundant ZExt after a count trailing zeros instruction.

llvm-svn: 285267

7 years ago[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is...
Dean Michael Berris [Thu, 27 Oct 2016 04:56:14 +0000 (04:56 +0000)]
[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

Summary:
Added the code which explicitly emits an error in Clang in case
`-fxray-instrument` is passed, but XRay is not supported for the
selected target.

Reviewers: rsmith, aaron.ballman, rnk, dberris

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

llvm-svn: 285266

7 years agoAtomics library: provide operations for __int128 when it is available.
Richard Smith [Thu, 27 Oct 2016 01:46:24 +0000 (01:46 +0000)]
Atomics library: provide operations for __int128 when it is available.

llvm-svn: 285265

7 years agoRemove check for -o option in offloading actions builder.
Samuel Antao [Thu, 27 Oct 2016 01:08:58 +0000 (01:08 +0000)]
Remove check for -o option in offloading actions builder.

This check is also present when jobs are built, so the offloading builder check is not needed anymore.

llvm-svn: 285264

7 years agoFix bug when compiling CUDA code with -emit-llvm and -o.
Samuel Antao [Thu, 27 Oct 2016 00:53:34 +0000 (00:53 +0000)]
Fix bug when compiling CUDA code with -emit-llvm and -o.

In this case the device code is not injected into an host action and therefore the
user should get an error as -o can't be used when generating two outputs.

llvm-svn: 285263

7 years ago[libFuzzer] speculatively trying to fix the Mac build; second attempt
Kostya Serebryany [Thu, 27 Oct 2016 00:36:38 +0000 (00:36 +0000)]
[libFuzzer] speculatively trying to fix the Mac build; second attempt

llvm-svn: 285262

7 years agoxray-extract.cc: Quick fix for mingw, to avoid errc::protocol_error.
NAKAMURA Takumi [Thu, 27 Oct 2016 00:34:24 +0000 (00:34 +0000)]
xray-extract.cc: Quick fix for mingw, to avoid errc::protocol_error.

errc::protocol_error is winsock-oriented and mingw doesn't include it. (MS does, though)

llvm-svn: 285261

7 years ago[libFuzzer] revert 285259 -- hit commit too soon
Kostya Serebryany [Thu, 27 Oct 2016 00:24:34 +0000 (00:24 +0000)]
[libFuzzer] revert 285259 -- hit commit too soon

llvm-svn: 285260

7 years ago[libFuzzer] speculatively trying to fix the Mac build
Kostya Serebryany [Thu, 27 Oct 2016 00:22:39 +0000 (00:22 +0000)]
[libFuzzer] speculatively trying to fix the Mac build

llvm-svn: 285259

7 years agoRefactor call emission to package the function pointer together with
John McCall [Wed, 26 Oct 2016 23:46:34 +0000 (23:46 +0000)]
Refactor call emission to package the function pointer together with
abstract information about the callee.  NFC.

The goal here is to make it easier to recognize indirect calls and
trigger additional logic in certain cases.  That logic will come in
a later patch; in the meantime, I felt that this was a significant
improvement to the code.

llvm-svn: 285258

7 years ago[IR] Retire unused getGEPReturnType overload. NFCI.
Davide Italiano [Wed, 26 Oct 2016 23:46:16 +0000 (23:46 +0000)]
[IR] Retire unused getGEPReturnType overload. NFCI.

llvm-svn: 285257

7 years ago[APFloat] Fix APFloat::getExactInverse when the input is nullptr. This is a regressio...
Tim Shen [Wed, 26 Oct 2016 23:31:41 +0000 (23:31 +0000)]
[APFloat] Fix APFloat::getExactInverse when the input is nullptr. This is a regression introduced by r285105.

Reviewers: kbarton, echristo, iteratee, eugenis

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 285256

7 years ago[sanitizers] Set Darwin specific linker and compiler flags for all tests
Anna Zaks [Wed, 26 Oct 2016 23:23:38 +0000 (23:23 +0000)]
[sanitizers] Set Darwin specific linker and compiler flags for all tests

Looks like we are missing these flags only in tsan and sanitizer-common.

This results in linker warnings in some settings as it can cause the Unit
tests to be built with a different SDK version than that was used to build
the runtime. For example, we are not setting the minimal deployment target
on the tests but are setting the minimal deployment target for the sanitizer
library, which leads to the following warning on some bots: ld: warning:
object file (sanitizer_posix_test.cc.i386.o) was built for newer OSX version
(10.12) than being linked (10.11).

Differential Revision: https://reviews.llvm.org/D25860  https://reviews.llvm.org/D25352

llvm-svn: 285255

7 years agoUnconditionally pass `-lto_library` to the linker on Darwin
Mehdi Amini [Wed, 26 Oct 2016 23:23:08 +0000 (23:23 +0000)]
Unconditionally pass `-lto_library` to the linker on Darwin

We're only doing it with -flto currently, however it never "hurt"
to pass it, and users that are linking without -flto can get in
trouble if one of the dependency (a static library for instance)
contains bitcode.

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

llvm-svn: 285254

7 years ago[analyzer] Report CFNumberGetValue API misuse
Anna Zaks [Wed, 26 Oct 2016 22:51:47 +0000 (22:51 +0000)]
[analyzer] Report CFNumberGetValue API misuse

This patch contains 2 improvements to the CFNumber checker:
 - Checking of CFNumberGetValue misuse.
 - Treating all CFNumber API misuse errors as non-fatal. (Previously we treated errors that could cause uninitialized memory as syncs and the truncation errors as non-fatal.)

This implements a subset of functionality from https://reviews.llvm.org/D17954.

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

llvm-svn: 285253

7 years agollvm-objdump: Make some error messages more consistent
Justin Bogner [Wed, 26 Oct 2016 22:37:52 +0000 (22:37 +0000)]
llvm-objdump: Make some error messages more consistent

Most of the version of report_error were quoting the filename and
printing a colon between the file name and the error message, but this
one wasn't doing either of those. Fix the output to be more
consistent.

llvm-svn: 285252

7 years ago[CUDA] Move device placement new definitions into a wrapper header.
Justin Lebar [Wed, 26 Oct 2016 22:13:26 +0000 (22:13 +0000)]
[CUDA] Move device placement new definitions into a wrapper header.

Previously, these were always included -- after this change, you have to
 #include <new>, which is consistent with how things ought to work.

llvm-svn: 285251

7 years ago[CUDA] Switch cuda_wrappers/complex to use a proper include guard instead of #pragma...
Justin Lebar [Wed, 26 Oct 2016 22:13:20 +0000 (22:13 +0000)]
[CUDA] Switch cuda_wrappers/complex to use a proper include guard instead of #pragma once.

This is consistent with the rest of our internal headers.

llvm-svn: 285250

7 years ago[utils] Add a '--unified-report' option to the code coverage prep script
Vedant Kumar [Wed, 26 Oct 2016 22:07:39 +0000 (22:07 +0000)]
[utils] Add a '--unified-report' option to the code coverage prep script

In --unified-report mode, a single coverage report is prepared for all
specified binaries and written to *report_dir*. This mode is compatible
with all existing script options, including the --restrict mode which is
used to limit coverage reporting to certain files or directories.

This should not break any existing users of the script.

llvm-svn: 285249

7 years ago[utils] Use print_function in the code coverage prep script, NFC.
Vedant Kumar [Wed, 26 Oct 2016 22:07:37 +0000 (22:07 +0000)]
[utils] Use print_function in the code coverage prep script, NFC.

llvm-svn: 285248

7 years ago[utils] Add an '--only-merge' option to the code coverage prep script
Vedant Kumar [Wed, 26 Oct 2016 22:07:35 +0000 (22:07 +0000)]
[utils] Add an '--only-merge' option to the code coverage prep script

In --only-merge mode, the script terminates after the profile merging
step.  This makes the script less stateful: it's more natural to split
the merge out into a separate step instead of relying on the first
invocation of the script to do it.

This should not break any existing users of the script.

llvm-svn: 285247

7 years ago[AArch64] Create feature set for Samsung Exynos-M2
Evandro Menezes [Wed, 26 Oct 2016 22:06:20 +0000 (22:06 +0000)]
[AArch64] Create feature set for Samsung Exynos-M2

Since Exynos-M2 improved the FP square root unit a bit over the one in
Exynos-M1, it does not benefit from using the Newton series for such
operations.

llvm-svn: 285246

7 years agoFixing typos in __kmp_release_deps trace outputs
Jonathan Peyton [Wed, 26 Oct 2016 21:46:43 +0000 (21:46 +0000)]
Fixing typos in __kmp_release_deps trace outputs

Patch by Victor Campos

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

llvm-svn: 285244

7 years agoUse getpagesize() instead of PAGE_SIZE macro when KMP_OS_LINUX is true
Jonathan Peyton [Wed, 26 Oct 2016 21:42:48 +0000 (21:42 +0000)]
Use getpagesize() instead of PAGE_SIZE macro when KMP_OS_LINUX is true

Patch by Victor Campos

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

llvm-svn: 285243

7 years agoDebugInfo: fix incorrect alignment type (NFC)
Victor Leschuk [Wed, 26 Oct 2016 21:32:29 +0000 (21:32 +0000)]
DebugInfo: fix incorrect alignment type (NFC)

Change type of some missed DebugInfo-related alignment variables,
that are still uint64_t, to uint32_t.

Original change introduced in r284482.

llvm-svn: 285242

7 years agoHave on addRegular forward to another. NFC.
Rafael Espindola [Wed, 26 Oct 2016 20:57:14 +0000 (20:57 +0000)]
Have on addRegular forward to another. NFC.

Another step in making it easier to create symbols without an ELf_Sym.

llvm-svn: 285241

7 years agoRemove a constructor to simplify.
Rui Ueyama [Wed, 26 Oct 2016 20:44:32 +0000 (20:44 +0000)]
Remove a constructor to simplify.

llvm-svn: 285240

7 years ago[RecursiveASTVisitor] Visit the implicit expression of a CXXDefaultArgExpr
Malcolm Parsons [Wed, 26 Oct 2016 20:39:54 +0000 (20:39 +0000)]
[RecursiveASTVisitor] Visit the implicit expression of a CXXDefaultArgExpr

Summary:
The matcher
varDecl(hasDescendant(
    callExpr(hasDeclaration(functionDecl(unless(isNoThrow()))))))
didn't match calls from default arguments because the expression
for a CXXDefaultArgExpr was not visited.

Reviewers: klimek, jdennett, alexfh, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 285239

7 years agoMake the DefinedRegular constructors more regular. NFC.
Rafael Espindola [Wed, 26 Oct 2016 20:34:59 +0000 (20:34 +0000)]
Make the DefinedRegular constructors more regular. NFC.

All the global ones now just forward to the same constructor. This
makes it easier to construct them without creating a Elf_Sym.

llvm-svn: 285238

7 years ago[lit] Work around Windows MSys command line tokenization bug
Reid Kleckner [Wed, 26 Oct 2016 20:29:27 +0000 (20:29 +0000)]
[lit] Work around Windows MSys command line tokenization bug

Summary:
This will allow us to revert LLD r284768, which added spaces to get MSys
echo to print what we want.

Reviewers: ruiu, inglorion, rafael

Subscribers: modocache, llvm-commits

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

llvm-svn: 285237

7 years agoFix build breakage.
Rui Ueyama [Wed, 26 Oct 2016 20:27:38 +0000 (20:27 +0000)]
Fix build breakage.

llvm-svn: 285236

7 years agoAdd comments.
Rui Ueyama [Wed, 26 Oct 2016 20:26:29 +0000 (20:26 +0000)]
Add comments.

llvm-svn: 285235

7 years agoCleanup nonportable behavior in tests for std::any
Casey Carter [Wed, 26 Oct 2016 20:18:13 +0000 (20:18 +0000)]
Cleanup nonportable behavior in tests for std::any

Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

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

llvm-svn: 285234

7 years ago[PPC] Remove testcase from incorrect directory
Ehsan Amiri [Wed, 26 Oct 2016 20:16:59 +0000 (20:16 +0000)]
[PPC] Remove testcase from incorrect directory

During my last commit this testcase was put in an incorrect directory. Removing
it. Will put it in the right directory when I can verify everything is correct.

llvm-svn: 285233