platform/upstream/llvm.git
8 years agoAArch64: Avoid implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 20:29:42 +0000 (20:29 +0000)]
AArch64: Avoid implicit iterator conversions, NFC

Avoid implicit conversions from MachineInstrBundleInstr to MachineInstr*
in the AArch64 backend, mainly by preferring MachineInstr& over
MachineInstr* when a pointer isn't nullable.

llvm-svn: 274924

8 years ago[OpenCL] Add missing -cl-no-signed-zeros option into driver
Yaxun Liu [Fri, 8 Jul 2016 20:28:29 +0000 (20:28 +0000)]
[OpenCL] Add missing -cl-no-signed-zeros option into driver

Add OCL option -cl-no-signed-zeros to driver options.

Also added to opencl.cl testcases.

Patch by Aaron En Ye Shi.

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

llvm-svn: 274923

8 years agoadd tests for multi-use folding to select
Sanjay Patel [Fri, 8 Jul 2016 20:22:27 +0000 (20:22 +0000)]
add tests for multi-use folding to select

llvm-svn: 274922

8 years agoRemove duplicate inclusion /NFC
Xinliang David Li [Fri, 8 Jul 2016 20:21:32 +0000 (20:21 +0000)]
Remove duplicate inclusion /NFC

llvm-svn: 274921

8 years agoARM: Remove implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 20:21:17 +0000 (20:21 +0000)]
ARM: Remove implicit iterator conversions, NFC

Remove remaining implicit conversions from MachineInstrBundleIterator to
MachineInstr* from the ARM backend.  In most cases, I made them less attractive
by preferring MachineInstr& or using a ranged-based for loop.

Once all the backends are fixed I'll make the operator explicit so that this
doesn't bitrot back.

llvm-svn: 274920

8 years agoTableGen: Update style in CodeGenIntrinsics. NFC
Justin Bogner [Fri, 8 Jul 2016 20:14:27 +0000 (20:14 +0000)]
TableGen: Update style in CodeGenIntrinsics. NFC

Ran clang-format to remove the namespace indentation, and stopped
repeating names in doc comments since I was updating every line
anyway.

llvm-svn: 274919

8 years agoRemove inline hints computation from SampleProfile.cpp
Dehao Chen [Fri, 8 Jul 2016 20:12:44 +0000 (20:12 +0000)]
Remove inline hints computation from SampleProfile.cpp

Summary: As we will move to use uniformed hotness check in inliner, we do not need inline hints in SampleProfile pass any more.

Reviewers: dnovillo, davidxl

Subscribers: eraman, llvm-commits

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

llvm-svn: 274918

8 years agoAttempt to fix buildbots.
Rui Ueyama [Fri, 8 Jul 2016 19:59:11 +0000 (19:59 +0000)]
Attempt to fix buildbots.

llvm-svn: 274917

8 years agoRevert r274829, it caused PR28472.
Nico Weber [Fri, 8 Jul 2016 19:52:19 +0000 (19:52 +0000)]
Revert r274829, it caused PR28472.

llvm-svn: 274916

8 years ago[X86] Regenerated bitreverse tests to demonstrate what is going on.
Simon Pilgrim [Fri, 8 Jul 2016 19:51:08 +0000 (19:51 +0000)]
[X86] Regenerated bitreverse tests to demonstrate what is going on.

llvm-svn: 274915

8 years ago[X86] Added bitreverse tests for non-legal types
Simon Pilgrim [Fri, 8 Jul 2016 19:48:33 +0000 (19:48 +0000)]
[X86] Added bitreverse tests for non-legal types

Requested on D21578

llvm-svn: 274914

8 years agoSparc: Avoid implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:41:40 +0000 (19:41 +0000)]
Sparc: Avoid implicit iterator conversions, NFC

Remove the only implicit conversions from MachineInstrBundleIterator to
MachineInstr* in the Sparc backend.

llvm-svn: 274913

8 years agoWebAssembly: Avoid implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:36:40 +0000 (19:36 +0000)]
WebAssembly: Avoid implicit iterator conversions, NFC

Avoid implicit conversions from MachineInstrBundleIterator to
MachineInstr* in the WebAssembly backend by preferring MachineInstr&
over MachineInstr*.

llvm-svn: 274912

8 years agoAsmPrinter: Avoid implicit iterator conversions in DbgValueHistoryCalculator, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:31:47 +0000 (19:31 +0000)]
AsmPrinter: Avoid implicit iterator conversions in DbgValueHistoryCalculator, NFC

llvm-svn: 274911

8 years ago[CrossDSOCFI] Change the pass so that it doesn't require doInitialization()
Davide Italiano [Fri, 8 Jul 2016 19:30:06 +0000 (19:30 +0000)]
[CrossDSOCFI] Change the pass so that it doesn't require doInitialization()

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

llvm-svn: 274910

8 years agofix use of uninitialized.
Rafael Espindola [Fri, 8 Jul 2016 19:28:55 +0000 (19:28 +0000)]
fix use of uninitialized.

llvm-svn: 274909

8 years ago[X86][AVX2] Add support for target shuffle combining to VPERMPD/VPERMQ
Simon Pilgrim [Fri, 8 Jul 2016 19:23:29 +0000 (19:23 +0000)]
[X86][AVX2] Add support for target shuffle combining to VPERMPD/VPERMQ

llvm-svn: 274908

8 years agoSelectionDAG: Avoid implicit iterator conversions in SelectionDAGBuilder, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:23:12 +0000 (19:23 +0000)]
SelectionDAG: Avoid implicit iterator conversions in SelectionDAGBuilder, NFC

llvm-svn: 274907

8 years agoAMDGPU: Remove implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:16:05 +0000 (19:16 +0000)]
AMDGPU: Remove implicit iterator conversions, NFC

Remove remaining implicit conversions from MachineInstrBundleIterator to
MachineInstr* from the AMDGPU backend.  In most cases, I made them less
attractive by preferring MachineInstr& or using a ranged-based for loop.

Once all the backends are fixed I'll make the operator explicit so that
this doesn't bitrot back.

llvm-svn: 274906

8 years ago[SCCP] Fold constants as we build them whne visiting cast instructions.
Davide Italiano [Fri, 8 Jul 2016 19:13:40 +0000 (19:13 +0000)]
[SCCP] Fold constants as we build them whne visiting cast instructions.

This should be slightly more efficient and could avoid spurious overdefined
markings, as Eli pointed out.

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

llvm-svn: 274905

8 years agoSelectionDAG: Avoid implicit iterator conversions in SelectionDAGISel, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:11:40 +0000 (19:11 +0000)]
SelectionDAG: Avoid implicit iterator conversions in SelectionDAGISel, NFC

llvm-svn: 274904

8 years agoSelectionDAG: Avoid implicit iterator conversions in ScheduleDAGSDNodes, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:07:09 +0000 (19:07 +0000)]
SelectionDAG: Avoid implicit iterator conversions in ScheduleDAGSDNodes, NFC

llvm-svn: 274903

8 years agoAMDGPU: Make infinite loop clear, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 19:00:17 +0000 (19:00 +0000)]
AMDGPU: Make infinite loop clear, NFC

Change a while loop that was checking for nullptr on an
iterator-to-pointer conversion to an infinite for loop.  Now it's clear
that the condition doesn't terminate.

The only change in behaviour is if an invalid iterator (holding nullptr)
was passed into AMDGPUCFGStructurizer::reversePredicateSetter.  There
are only two callers, and they both dereference the iterator before
sending it in, so rather than adding an early return to avoid the loop
I've just asserted (using a static_cast, to avoid an implicit conversion
to pointer).

llvm-svn: 274902

8 years agoMake IsSyntheticChildrenGenerated() virtual so that dynamic and synthetic values...
Enrico Granata [Fri, 8 Jul 2016 18:39:36 +0000 (18:39 +0000)]
Make IsSyntheticChildrenGenerated() virtual so that dynamic and synthetic values can refer back to their parents

llvm-svn: 274901

8 years agoCOFF: remove unused function (touchFile)
Saleem Abdulrasool [Fri, 8 Jul 2016 18:36:56 +0000 (18:36 +0000)]
COFF: remove unused function (touchFile)

Remove some dead code.  NFC.

llvm-svn: 274900

8 years agoSelectionDAG: Avoid implicit iterator conversions in FastISel, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 18:36:41 +0000 (18:36 +0000)]
SelectionDAG: Avoid implicit iterator conversions in FastISel, NFC

llvm-svn: 274899

8 years agoTarget: Avoid getFirstTerminator() => pointer, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 18:26:20 +0000 (18:26 +0000)]
Target: Avoid getFirstTerminator() => pointer, NFC

Stop using an implicit conversion from the return of
MachineBasicBlock::getFirstTerminator to MachineInstr*.  In two cases,
directly dereference to a MachineInstr& since later code assumes it's
valid.  In a third case, change to an iterator since later code checks
against MachineBasicBlock::end.

Although the fix for the third case avoids undefined behaviour, I expect
this doesn't cause a functionality change in practice (since the basic
block already has a terminator).

llvm-svn: 274898

8 years agoFix flag name in comment in cuda-version-check.cu.
Justin Lebar [Fri, 8 Jul 2016 17:59:24 +0000 (17:59 +0000)]
Fix flag name in comment in cuda-version-check.cu.

llvm-svn: 274897

8 years agoFix memory leak.
Rui Ueyama [Fri, 8 Jul 2016 17:58:54 +0000 (17:58 +0000)]
Fix memory leak.

Symbol's dtors are not called because they are allocated using
BumpPtrAllocators. So, members of std::unique_ptr type are not
freed when symbols are deallocated.

This patch is to allocate Thunks using BumpPtrAllocators.

llvm-svn: 274896

8 years agoUse shell cat command as a workaround if ADB stat cannot lookup a file.
Oleksiy Vyalov [Fri, 8 Jul 2016 17:45:37 +0000 (17:45 +0000)]
Use shell cat command as a workaround if ADB stat cannot lookup a file.

http://reviews.llvm.org/D22081

llvm-svn: 274895

8 years agoImproving EPCC performance when linking with hwloc
Jonathan Peyton [Fri, 8 Jul 2016 17:43:21 +0000 (17:43 +0000)]
Improving EPCC performance when linking with hwloc

When linking with libhwloc, the ORDERED EPCC test slows down on big
machines (> 48 cores). Performance analysis showed that a cache thrash
was occurring and this padding helps alleviate the problem.

Also, inside the main spin-wait loop in kmp_wait_release.h, we can eliminate
the references to the global shared variables by instead creating a local
variable, oversubscribed and instead checking that.

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

llvm-svn: 274894

8 years agoCodeGen: Avoid iterator conversions in TwoAddressInstructionPass, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 17:43:08 +0000 (17:43 +0000)]
CodeGen: Avoid iterator conversions in TwoAddressInstructionPass, NFC

Mostly through preferring MachineInstr&, avoid implicit conversions from
iterator to pointer.

Although this may bitrot (since there are other uses blocking me from
removing the implicit operator), this removes the last of the implicit
conversions from MachineInstrBundleIterator to MachineInstr* in the
LLVMCodeGen build target.

llvm-svn: 274893

8 years agoCodeGen: Use MachineInstr& in StackSlotColoring, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 17:28:40 +0000 (17:28 +0000)]
CodeGen: Use MachineInstr& in StackSlotColoring, NFC

Avoid implicit iterator to pointer conversions.

llvm-svn: 274892

8 years ago[InstCombine] check for one-use before turning simple logic op into a select
Sanjay Patel [Fri, 8 Jul 2016 17:26:47 +0000 (17:26 +0000)]
[InstCombine] check for one-use before turning simple logic op into a select

llvm-svn: 274891

8 years agoIR: Set a TargetPrefix for nvvm intrinsics
Justin Bogner [Fri, 8 Jul 2016 17:25:18 +0000 (17:25 +0000)]
IR: Set a TargetPrefix for nvvm intrinsics

Since these are named nvvm_* rather than nvptx_*, we also need to
update getArchTypePrefix. It's a bit unusual for getArchTypePrefix not
to match the backend name, but I think this fits the intent of the
function in this case.

llvm-svn: 274890

8 years ago[SLPVectorizer][X86] Added fma vectorization tests
Simon Pilgrim [Fri, 8 Jul 2016 17:19:13 +0000 (17:19 +0000)]
[SLPVectorizer][X86] Added fma vectorization tests

llvm-svn: 274889

8 years agoCodeGen: Use MachineInstr& in RegisterScavenging, NFC
Duncan P. N. Exon Smith [Fri, 8 Jul 2016 17:16:57 +0000 (17:16 +0000)]
CodeGen: Use MachineInstr& in RegisterScavenging, NFC

Prefer MachineInstr& in order to avoid implicit conversions from
MachineInstrBundleIterator to MachineInstr*.

llvm-svn: 274888

8 years agoadd test to show multi-use output
Sanjay Patel [Fri, 8 Jul 2016 17:12:27 +0000 (17:12 +0000)]
add test to show multi-use output

llvm-svn: 274887

8 years agoAMDGPU: Minor adjustment to r274817
Matt Arsenault [Fri, 8 Jul 2016 17:06:48 +0000 (17:06 +0000)]
AMDGPU: Minor adjustment to r274817

The commit message is inaccurate, modifiesRegister
will check for partial defs of exec.

We currently don't ever emit partial defs of exec,
so it doesn't really matter.

llvm-svn: 274886

8 years agoCFGTests: Update libdeps.
NAKAMURA Takumi [Fri, 8 Jul 2016 17:06:27 +0000 (17:06 +0000)]
CFGTests: Update libdeps.

llvm-svn: 274885

8 years ago[X86][AVX] Added combine test that should simplify to insertps
Simon Pilgrim [Fri, 8 Jul 2016 17:01:42 +0000 (17:01 +0000)]
[X86][AVX] Added combine test that should simplify to insertps

llvm-svn: 274884

8 years ago[InstCombine] allow or(sext(A), B) --> A ? -1 : B transform for vectors
Sanjay Patel [Fri, 8 Jul 2016 17:01:15 +0000 (17:01 +0000)]
[InstCombine] allow or(sext(A), B) --> A ? -1 : B transform for vectors

llvm-svn: 274883

8 years agoFix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.
Marshall Clow [Fri, 8 Jul 2016 16:59:54 +0000 (16:59 +0000)]
Fix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.

llvm-svn: 274882

8 years agoTry to fix compilation error in DebugInfoPDBTests.
Zachary Turner [Fri, 8 Jul 2016 16:57:14 +0000 (16:57 +0000)]
Try to fix compilation error in DebugInfoPDBTests.

llvm-svn: 274881

8 years agoImplement LWG685 (which is from C++11!). Fixes PR#28421. Note: this (subtly) changes...
Marshall Clow [Fri, 8 Jul 2016 16:54:47 +0000 (16:54 +0000)]
Implement LWG685 (which is from C++11!). Fixes PR#28421.  Note: this (subtly) changes the return type of operator-(Iter1, Iter2) where Iter1 is a reverse iterator or a move_iterator, and Iter2 is some other move/reverse iterator type. In practice, I believe that almost every time the second param will be const_XXX and this will mean that the return type will be the same as it was before.

llvm-svn: 274880

8 years agoclang/unittests/Analysis/CFGTest.cpp: Appease msc targets with -fno-delayed-template...
NAKAMURA Takumi [Fri, 8 Jul 2016 16:52:36 +0000 (16:52 +0000)]
clang/unittests/Analysis/CFGTest.cpp: Appease msc targets with -fno-delayed-template-parsing.

llvm-svn: 274879

8 years ago[SystemZ] Add support for the .word directive.
Zhan Jun Liau [Fri, 8 Jul 2016 16:50:02 +0000 (16:50 +0000)]
[SystemZ] Add support for the .word directive.

Summary: Branch off the work to add support for the .word directive,
using addAliasForDirective.

Reviewers: koriakin

Subscribers: llvm-commits

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

llvm-svn: 274878

8 years ago[DSE] Minor refactor based on D21007. NFC.
Chad Rosier [Fri, 8 Jul 2016 16:48:40 +0000 (16:48 +0000)]
[DSE] Minor refactor based on D21007. NFC.

llvm-svn: 274877

8 years agoadd vector tests to show missing transform
Sanjay Patel [Fri, 8 Jul 2016 16:39:53 +0000 (16:39 +0000)]
add vector tests to show missing transform

llvm-svn: 274876

8 years ago[CodeGen, TargetPassConfig] Remove a race from createRegAllocPass
David Majnemer [Fri, 8 Jul 2016 16:39:00 +0000 (16:39 +0000)]
[CodeGen, TargetPassConfig] Remove a race from createRegAllocPass

The createRegAllocPass reads and writes to a global variable 'Registry'
via calls to getDefault and setDefault.  Run this under a call_once to
avoid races.

llvm-svn: 274875

8 years agoPeepholeOptimizer: Make pass name match DEBUG_TYPE
Matt Arsenault [Fri, 8 Jul 2016 16:29:11 +0000 (16:29 +0000)]
PeepholeOptimizer: Make pass name match DEBUG_TYPE

llvm-svn: 274874

8 years agoAdd runtime support for __cpu_model (__builtin_cpu_supports)
Alina Sbirlea [Fri, 8 Jul 2016 16:28:54 +0000 (16:28 +0000)]
Add runtime support for __cpu_model (__builtin_cpu_supports)

Summary:
This aims to add support for __cpu_model and address Bug 25510. It uses
the code from lib/Support/Host.cpp for cpu detection, and creates
__cpu_model with that info.

Tested on OSX, it builts successfully, but the current version does
*not* resolve Bug 25510. The __cpu_model symbol is present in the
library but it only gets loaded with -all_load. This patch will not land
until this issue is clarified.

Built on Linux as well (though libgcc is the default). The use of "asm"
required -std=gnu99, hence the cmake change. Corrections on better
addressing this are welcome.

Note: See additional comments on D20988 (committed as r271921).

Reviewers: llvm-commits, joerg, echristo, mehdi_amini

Subscribers: mehdi_amini

Differential revision: http://reviews.llvm.org/D21033

llvm-svn: 274873

8 years agoRevert r274865-r274870
Alina Sbirlea [Fri, 8 Jul 2016 16:28:52 +0000 (16:28 +0000)]
Revert r274865-r274870

llvm-svn: 274872

8 years agoExplicitly export symbols from the sample analyzer plugin
John Brawn [Fri, 8 Jul 2016 16:20:57 +0000 (16:20 +0000)]
Explicitly export symbols from the sample analyzer plugin

This is done so that it will work when built using MSVC if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON.

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

llvm-svn: 274871

8 years agoAdded comments identifing code source
Alina Sbirlea [Fri, 8 Jul 2016 16:18:41 +0000 (16:18 +0000)]
Added comments identifing code source

llvm-svn: 274870

8 years ago[SystemZ] Add support for missing instructions
Zhan Jun Liau [Fri, 8 Jul 2016 16:18:40 +0000 (16:18 +0000)]
[SystemZ] Add support for missing instructions

Summary:
Add support to allow clang integrated assembler to recognize some
missing instructions, for openssl.

Instructions are:
LM, LMH, LMY, STM, STMH, STMY, ICM, ICMH, ICMY, SLA, SLAK, TML, TMH, EX, EXRL.

Reviewers: uweigand

Subscribers: koriakin, llvm-commits

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

llvm-svn: 274869

8 years agoCheck cpuid supported for i386.
Alina Sbirlea [Fri, 8 Jul 2016 16:18:39 +0000 (16:18 +0000)]
Check cpuid supported for i386.

Summary:

Reviewers:

Subscribers:

llvm-svn: 274868

8 years agoAdd default initialization. Add unit test.
Alina Sbirlea [Fri, 8 Jul 2016 16:18:38 +0000 (16:18 +0000)]
Add default initialization. Add unit test.

llvm-svn: 274867

8 years agoclang-format it
Alina Sbirlea [Fri, 8 Jul 2016 16:18:36 +0000 (16:18 +0000)]
clang-format it

llvm-svn: 274866

8 years agoAdd runtime support for __cpu_model (__builtin_cpu_supports)
Alina Sbirlea [Fri, 8 Jul 2016 16:18:34 +0000 (16:18 +0000)]
Add runtime support for __cpu_model (__builtin_cpu_supports)

Summary:
This aims to add support for __cpu_model and address Bug 25510. It uses the code from lib/Support/Host.cpp for cpu detection, and creates __cpu_model with that info.

Tested on OSX, it builts successfully, but the current version does *not* resolve Bug 25510. The __cpu_model symbol is present in the library but it only gets loaded with -all_load. This patch will not land until this issue is clarified.

Built on Linux as well (though libgcc is the default). The use of "asm" required -std=gnu99, hence the cmake change. Corrections on better addressing this are welcome.

Note: See additional comments on D20988 (committed as r271921).

Reviewers: llvm-commits, joerg, echristo, mehdi_amini

Subscribers: mehdi_amini

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

llvm-svn: 274865

8 years agominimize tests
Sanjay Patel [Fri, 8 Jul 2016 16:11:48 +0000 (16:11 +0000)]
minimize tests

The cmp and load aren't required.

llvm-svn: 274864

8 years agoRecommit R274836 Add Thunk support framework for ARM and Mips
Peter Smith [Fri, 8 Jul 2016 16:10:27 +0000 (16:10 +0000)]
Recommit R274836 Add Thunk support framework for ARM and Mips

The TinyPtrVector of const Thunk<ELFT>* in InputSections.h can cause
build failures on certain compiler/library combinations when Thunk<ELFT>
is not a complete type or is an abstract class. Fixed by making Thunk<ELFT>
non Abstract.

type or is an abstract class

llvm-svn: 274863

8 years agoMove setName after accessing Name
Eric Liu [Fri, 8 Jul 2016 16:09:51 +0000 (16:09 +0000)]
Move setName after accessing Name

llvm-svn: 274862

8 years agoMake a std::string copy of StringRef Name so that it remains valid when the original...
Eric Liu [Fri, 8 Jul 2016 16:09:48 +0000 (16:09 +0000)]
Make a std::string copy of StringRef Name so that it remains valid when the original Name is overridden.

Summary: lib/IR/AutoUpgrade.cpp:348 and lib/IR/AutoUpgrade.cpp:350 upset sanitizer.

Reviewers: bkramer

Subscribers: llvm-commits

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

llvm-svn: 274861

8 years agoregenerate checks
Sanjay Patel [Fri, 8 Jul 2016 16:06:38 +0000 (16:06 +0000)]
regenerate checks

llvm-svn: 274860

8 years agoDon't crash when printing auto variables.
Vassil Vassilev [Fri, 8 Jul 2016 16:04:22 +0000 (16:04 +0000)]
Don't crash when printing auto variables.

Patch by Axel Naumann!

llvm-svn: 274859

8 years ago[OpenCL] Fix access qualifiers handling for typedefs
Alexey Bader [Fri, 8 Jul 2016 15:34:59 +0000 (15:34 +0000)]
[OpenCL] Fix access qualifiers handling for typedefs

OpenCL s6.6: "Access qualifier must be used with image object arguments
of kernels and of user-defined functions [...] If no qualifier is
provided, read_only is assumed".

This does not define the behavior for image types used in typedef
declaration, but following the spec logic, we should allow access
qualifiers specification in typedefs, e.g.:

  typedef write_only image1d_t img1d_wo;

Unlike cv-qualifiers, user cannot add access qualifier to a typedef
type, i.e. this is not allowed:

  typedef image1d_t img1d; // note: previously declared 'read_only' here
  void foo(write_only img1d im) {} // error: multiple access qualifier

Patch by Andrew Savonichev.
Reviewers: Anastasia Stulova.

Differential revision: http://reviews.llvm.org/D20948

llvm-svn: 274858

8 years ago[libc++] Check hash before calling __hash_table key_eq function
Kwasi Mensah [Fri, 8 Jul 2016 15:34:28 +0000 (15:34 +0000)]
[libc++] Check hash before calling __hash_table key_eq function

Summary: The current implementations of __hash_table::find used by std::unordered_set/unordered_map call key_eq on each key that lands in the same bucket as the key you're looking for. However, since equal objects mush hash to the same value, you can short-circuit the possibly expensive call to key_eq by checking the hashes first.

Reviewers: EricWF

Subscribers: kmensah, cfe-commits

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

llvm-svn: 274857

8 years ago[Sparc] Leon errata fix passes.
Chris Dewhurst [Fri, 8 Jul 2016 15:33:56 +0000 (15:33 +0000)]
[Sparc] Leon errata fix passes.

Errata fixes for various errata in different versions of the Leon variants of the Sparc 32 bit processor.

The nature of the errata are listed in the comments preceding the errata fix passes. Relevant unit tests are implemented for each of these.

Note: Running clang-format has changed a few other lines too, unrelated to the implemented errata fixes. These have been left in as this keeps the code formatting consistent.

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

llvm-svn: 274856

8 years agoDo not expand SDIV when compiling for minimum code size
Sjoerd Meijer [Fri, 8 Jul 2016 15:32:01 +0000 (15:32 +0000)]
Do not expand SDIV when compiling for minimum code size

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

llvm-svn: 274855

8 years agoD22138: Added more Intel compiler versions as allowed build compilers
Andrey Churbanov [Fri, 8 Jul 2016 15:23:35 +0000 (15:23 +0000)]
D22138: Added more Intel compiler versions as allowed build compilers

llvm-svn: 274854

8 years agoInstCombine rule to fold truncs whose value is available
Anna Thomas [Fri, 8 Jul 2016 15:18:56 +0000 (15:18 +0000)]
InstCombine rule to fold truncs whose value is available

We can fold truncs whose operand feeds from a load, if the trunc value
is available through a prior load/store.

This change is from: http://reviews.llvm.org/D21246, which folded the
trunc but missed the bitcast or ptrtoint/inttoptr required in the RAUW
call, when the load type didnt match the prior load/store type.

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

llvm-svn: 274853

8 years ago[AMDGPU] fix ds_swizzle_b32 opcode for VI (bz 28371)
Valery Pykhtin [Fri, 8 Jul 2016 15:12:46 +0000 (15:12 +0000)]
[AMDGPU] fix ds_swizzle_b32 opcode for VI (bz 28371)

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

llvm-svn: 274852

8 years agoD22137: Memory leak fixed by adding missed cleanup of single level array of hot teams...
Andrey Churbanov [Fri, 8 Jul 2016 14:53:24 +0000 (14:53 +0000)]
D22137: Memory leak fixed by adding missed cleanup of single level array of hot teams info

llvm-svn: 274851

8 years agoD22136: Memory leaks fixed by adding missed __kmp_free() calls
Andrey Churbanov [Fri, 8 Jul 2016 14:40:20 +0000 (14:40 +0000)]
D22136: Memory leaks fixed by adding missed __kmp_free() calls

llvm-svn: 274850

8 years agoD22135: formatting change
Andrey Churbanov [Fri, 8 Jul 2016 14:35:41 +0000 (14:35 +0000)]
D22135: formatting change

llvm-svn: 274849

8 years ago[include-fixer] Don't add qualifiers to symbols which have global scope operator.
Haojian Wu [Fri, 8 Jul 2016 14:28:43 +0000 (14:28 +0000)]
[include-fixer] Don't add qualifiers to symbols which have global scope operator.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 274848

8 years agoAddressing post-commit comments regarding not expanding UDIV;
Sjoerd Meijer [Fri, 8 Jul 2016 14:17:09 +0000 (14:17 +0000)]
Addressing post-commit comments regarding not expanding UDIV;
we don't expand only when compiling for minimum code size.

llvm-svn: 274847

8 years ago[X86][SSE] Improve constant folding tests for CVTSD/CVTSS/CVTTSD/CVTTSS
Simon Pilgrim [Fri, 8 Jul 2016 13:28:34 +0000 (13:28 +0000)]
[X86][SSE] Improve constant folding tests for CVTSD/CVTSS/CVTTSD/CVTTSS

As discussed on D22106, improve the testing for constant folding sse scalar conversion intrinsics to ensure we are correctly handling special/out of range cases

llvm-svn: 274846

8 years ago[include-fixer] Pull out Context implementation code to a cpp file.
Haojian Wu [Fri, 8 Jul 2016 13:11:38 +0000 (13:11 +0000)]
[include-fixer] Pull out Context implementation code to a cpp file.

llvm-svn: 274845

8 years agoCode size optimisation: don't expand a div to a mul and and a shift sequence.
Sjoerd Meijer [Fri, 8 Jul 2016 12:54:43 +0000 (12:54 +0000)]
Code size optimisation: don't expand a div to a mul and and a shift sequence.
As a result, the urem instruction will not be expanded to a sequence of umull,
lsrs, muls and sub instructions, but just a call to __aeabi_uidivmod.

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

llvm-svn: 274843

8 years agoFix assertion due to buildMemoryAccess.
Michael Kruse [Fri, 8 Jul 2016 12:38:28 +0000 (12:38 +0000)]
Fix assertion due to buildMemoryAccess.

For llvm the memory accesses from nonaffine loops should be visible,
however for polly those nonaffine loops should be invisible/boxed.

This fixes llvm.org/PR28245

Cointributed-by: Huihui Zhang <huihuiz@codeaurora.org>
Differential Revision: http://reviews.llvm.org/D21591

llvm-svn: 274842

8 years agoRevert R274836 Add Thunk support framework for ARM and Mips
Peter Smith [Fri, 8 Jul 2016 12:25:50 +0000 (12:25 +0000)]
Revert R274836 Add Thunk support framework for ARM and Mips

This seems to be causing a buildbot failure on lld-x86_64-freebsd. Will
reproduce locally and fix.

llvm-svn: 274841

8 years ago[PATCH] [libunwind][ehabi] Use early returns where possible.
Asiri Rathnayake [Fri, 8 Jul 2016 12:13:31 +0000 (12:13 +0000)]
[PATCH] [libunwind][ehabi] Use early returns where possible.

Just a minor code cleanup. NFC.

llvm-svn: 274840

8 years ago[clang-rename] fix typo in Python script for Vim integration
Haojian Wu [Fri, 8 Jul 2016 12:05:06 +0000 (12:05 +0000)]
[clang-rename] fix typo in Python script for Vim integration

Patch by Kirill Bobyrev!

Reviewers: kimgr, alexfh, bkramer, ioeric, hokein

Subscribers: cfe-commits

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

llvm-svn: 274839

8 years ago[modules] Add missing includes.
Vassil Vassilev [Fri, 8 Jul 2016 12:00:08 +0000 (12:00 +0000)]
[modules] Add missing includes.

Patch by Cristina Cristescu!

Reviewed by Adrian Prantl (D21985)

llvm-svn: 274838

8 years ago[AArch64] Macro fusion of simple ALU ops with branches for Broadcom's Vulcan
Pankaj Gode [Fri, 8 Jul 2016 11:13:59 +0000 (11:13 +0000)]
[AArch64] Macro fusion of simple ALU ops with branches for Broadcom's Vulcan

Support for the macro fusion of simple ALU ops with branches for the Vulcan sub-target.

Patch by Meador Inge <meadori@gmail.com>

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

llvm-svn: 274837

8 years ago Add Thunk support framework for ARM and Mips
Peter Smith [Fri, 8 Jul 2016 11:13:40 +0000 (11:13 +0000)]
Add Thunk support framework for ARM and Mips

    Generalise the Mips LA25 Thunk code and implement ARM and Thumb
    interworking Thunks.

    - Introduce a new module Thunks.cpp to store the Target Specific Thunk
      implementations.
    - DefinedRegular and Shared have a ThunkData field to record Thunk.
    - A Target can have more than one type of Thunk.
    - Support PC-relative calls to Thunks.
    - Support Thunks to PLT entries.
    - Existing Mips LA25 Thunk code integrated.
    - Support for ARMv7A interworking Thunks.

    Limitations:
    - Only one Thunk per SymbolBody, this is sufficient for all currently
      implemented Thunks.
    - ARM thunks assume presence of V6T2 MOVT and MOVW instructions.

    Differential revision: http://reviews.llvm.org/D21891

llvm-svn: 274836

8 years ago[ASTMatchers] Add missing forEachArgumentWithParam() to code sample
Alexander Kornienko [Fri, 8 Jul 2016 10:51:00 +0000 (10:51 +0000)]
[ASTMatchers] Add missing forEachArgumentWithParam() to code sample

Reviewers: klimek

Subscribers: cfe-commits, klimek

Patch by Martin Boehme!

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

llvm-svn: 274835

8 years agoCFGBuilder: Fix crash when visiting a range-based for over a dependent type
Alexander Kornienko [Fri, 8 Jul 2016 10:50:51 +0000 (10:50 +0000)]
CFGBuilder: Fix crash when visiting a range-based for over a dependent type

Summary:
CFG generation is expected to fail in this case, but it should not crash.

Also added a test that reproduces the crash.

Reviewers: klimek

Subscribers: cfe-commits

Patch by Martin Boehme!

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

llvm-svn: 274834

8 years ago[X86][SSE] Accept any shuffle mask that is all zeroes
Simon Pilgrim [Fri, 8 Jul 2016 10:39:12 +0000 (10:39 +0000)]
[X86][SSE] Accept any shuffle mask that is all zeroes

Until we have a better way to extract constants through bitcasted build vectors (and how to handle undefs of partial lanes etc.) at least accept build vectors that are all zeroes.

llvm-svn: 274833

8 years ago[include-fixer] Add missing namespace qualifiers after inserting a missing header.
Haojian Wu [Fri, 8 Jul 2016 09:10:29 +0000 (09:10 +0000)]
[include-fixer] Add missing namespace qualifiers after inserting a missing header.

Summary:
This is an initial version of fixing namespace issues by adding missing
namespace qualifiers to an unidentified symbol.

This version only fixes the first discovered unidentified symbol.
In the long run, include-fixer should fix all unidentified symbols
with a same name at one run.

Currently, it works on command-line tool. The vim integration is not
implemented yet.

Reviewers: klimek, bkramer, djasper

Subscribers: bkramer, ioeric, cfe-commits

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

llvm-svn: 274832

8 years agoRecommit r274348 and r274349. The Windows failures should be fixed.
Vassil Vassilev [Fri, 8 Jul 2016 08:33:56 +0000 (08:33 +0000)]
Recommit r274348 and r274349. The Windows failures should be fixed.

Original commit message:
"Add postorder traversal support to the RecursiveASTVisitor.

This feature needs to be explicitly enabled by overriding shouldTraversePostOrder()
as it has performance drawbacks for the iterative Stmt-traversal.

Patch by Raphael Isemann!

Reviewed by Richard Smith and Benjamin Kramer."

llvm-svn: 274830

8 years agoBug 28444: Fix assertion when extract_vector_elt has mismatched type
Matt Arsenault [Fri, 8 Jul 2016 07:05:00 +0000 (07:05 +0000)]
Bug 28444: Fix assertion when extract_vector_elt has mismatched type

For some reason extract_vector_elt is sometimes allowed to have
a different result type than the vector element type.

llvm-svn: 274829

8 years ago[ELF] - Do not error out when version declaration not found when building executable.
George Rimar [Fri, 8 Jul 2016 06:47:28 +0000 (06:47 +0000)]
[ELF] - Do not error out when version declaration not found when building executable.

  When building executable usually version script is absent.
Before this patch error was shown in the case when
symbol name contained version and there was no script to match it.
  Instead of error out patch allows
to create new version declaration in this case and use it.
gnu linkers do the same.

That is PR28359.

Differential revision: http://reviews.llvm.org/D21890

llvm-svn: 274828

8 years ago[AVX512] Remove and autoupgrade a duplicate set of 512-bit masked shift intrinsics.
Craig Topper [Fri, 8 Jul 2016 06:14:47 +0000 (06:14 +0000)]
[AVX512] Remove and autoupgrade a duplicate set of 512-bit masked shift intrinsics.

I'm not sure if clang ever used these builtin names or not.

llvm-svn: 274827

8 years ago[X86] Remove intrinsics that already have autoupgrade support.
Craig Topper [Fri, 8 Jul 2016 06:14:41 +0000 (06:14 +0000)]
[X86] Remove intrinsics that already have autoupgrade support.

llvm-svn: 274826

8 years ago[X86] Remove dead builtins that don't exist in the backend intrinsic file and don...
Craig Topper [Fri, 8 Jul 2016 05:11:47 +0000 (05:11 +0000)]
[X86] Remove dead builtins that don't exist in the backend intrinsic file and don't have custom handling in CGBuiltins.cpp either.

llvm-svn: 274825

8 years ago[PM] Port UnreachableBlockElim to the new Pass Manager
Wei Mi [Fri, 8 Jul 2016 03:32:49 +0000 (03:32 +0000)]
[PM] Port UnreachableBlockElim to the new Pass Manager

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

llvm-svn: 274824

8 years ago[CodeGen] Use llvm::Type::getVectorNumElements instead of casting to llvm::VectorType...
Craig Topper [Fri, 8 Jul 2016 02:17:35 +0000 (02:17 +0000)]
[CodeGen] Use llvm::Type::getVectorNumElements instead of casting to llvm::VectorType and calling getNumElements. This is equivalent and shorter.

llvm-svn: 274823