platform/upstream/llvm.git
7 years ago[Sparc] Don't overlap variable-sized allocas with other stack variables.
James Y Knight [Tue, 25 Oct 2016 22:13:28 +0000 (22:13 +0000)]
[Sparc] Don't overlap variable-sized allocas with other stack variables.

On SparcV8, it was previously the case that a variable-sized alloca
might overlap by 4-bytes the last fixed stack variable, effectively
because 92 (the number of bytes reserved for the register spill area) !=
96 (the offset added to SP for where to start a DYNAMIC_STACKALLOC).

It's not as simple as changing 96 to 92, because variables that should
be 8-byte aligned would then be misaligned.

For now, simply increase the allocation size by 8 bytes for each dynamic
allocation -- wastes space, but at least doesn't overlap. As the large
comment says, doing this more efficiently will require larger changes in
llvm.

Also adds some test cases showing that we continue to not support
dynamic stack allocation and over-alignment in the same function.

llvm-svn: 285131

7 years ago[codeview] support emitting indirect virtual base class information
Bob Haarman [Tue, 25 Oct 2016 22:11:52 +0000 (22:11 +0000)]
[codeview] support emitting indirect virtual base class information

Summary:
Fixes PR28281.

MSVC lists indirect virtual base classes in the field list of a class,
using LF_IVBCLASS records. This change makes LLVM emit such records
when processing DW_TAG_inheritance tags with the DIFlagVirtual and
(newly introduced) DIFlagIndirect tags.

Reviewers: rnk, ruiu, zturner

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

llvm-svn: 285130

7 years ago[DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1))...
Simon Pilgrim [Tue, 25 Oct 2016 22:01:09 +0000 (22:01 +0000)]
[DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1)) combine for splatted vectors

llvm-svn: 285129

7 years ago[PGO] Fix select instruction annotation
Rong Xu [Tue, 25 Oct 2016 21:47:24 +0000 (21:47 +0000)]
[PGO] Fix select instruction annotation

Summary:
Select instruction annotation in IR PGO uses the edge count to infer the
branch count. It's currently placed in setInstrumentedCounts() where
no all the BB counts have been computed. This leads to wrong branch weights.
Move the annotation after all BB counts are populated.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 285128

7 years agoUse linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.
Stephen Hines [Tue, 25 Oct 2016 21:44:35 +0000 (21:44 +0000)]
Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

Summary:
This is only forced on if there is no non-Cortex-A53 CPU specified as
well. Android's platform and NDK builds need to assume that the code can
be run on Cortex-A53 devices, so we always enable the fix unless we know
specifically that the code is only running on a different kind of CPU.

Reviewers: cfe-commits

Subscribers: aemerson, rengolin, tberghammer, pirama, danalbert

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

llvm-svn: 285127

7 years agoCodeGen: be more conservative about setting section
Saleem Abdulrasool [Tue, 25 Oct 2016 21:43:28 +0000 (21:43 +0000)]
CodeGen: be more conservative about setting section

The section names currently are MachO specific.  Only set the section on the
variables if the file format is MachO.

llvm-svn: 285126

7 years ago[OpenCL] Add missing atom_xor for 64 bit to opencl-c.h
Yaxun Liu [Tue, 25 Oct 2016 21:37:05 +0000 (21:37 +0000)]
[OpenCL] Add missing atom_xor for 64 bit to opencl-c.h

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

llvm-svn: 285125

7 years ago[X86][SSE] Regenerated known-bits test with srem->urem fix
Simon Pilgrim [Tue, 25 Oct 2016 21:24:33 +0000 (21:24 +0000)]
[X86][SSE] Regenerated known-bits test with srem->urem fix

llvm-svn: 285124

7 years ago[DAGCombiner] Enable srem(x.y) -> urem(x,y) combine for vectors
Simon Pilgrim [Tue, 25 Oct 2016 21:20:18 +0000 (21:20 +0000)]
[DAGCombiner] Enable srem(x.y) -> urem(x,y) combine for vectors

SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

llvm-svn: 285123

7 years ago[docs] Add more Error documentation to the Programmer's Manual.
Lang Hames [Tue, 25 Oct 2016 21:19:30 +0000 (21:19 +0000)]
[docs] Add more Error documentation to the Programmer's Manual.

This patch updates some of the existing Error examples, expands on the
documentation for handleErrors, and includes new sections that cover
a number of helpful utilities and common error usage idioms.

llvm-svn: 285122

7 years ago[X86][SSE] Added vector srem combine tests
Simon Pilgrim [Tue, 25 Oct 2016 21:14:11 +0000 (21:14 +0000)]
[X86][SSE] Added vector srem combine tests

llvm-svn: 285121

7 years ago[index] Fixes for locations and relations in Objective C categories and getters/setters
Argyrios Kyrtzidis [Tue, 25 Oct 2016 21:11:22 +0000 (21:11 +0000)]
[index] Fixes for locations and relations in Objective C categories and getters/setters

- Add entries for protocols on categories
- Add relation between categories and class they extend
- Add relation between getters/setters and their corresponding property
- Use category name location as the location of category decls/defs if it has one

llvm-svn: 285120

7 years ago[X86][SSE] Added vector urem combine tests
Simon Pilgrim [Tue, 25 Oct 2016 21:10:12 +0000 (21:10 +0000)]
[X86][SSE] Added vector urem combine tests

llvm-svn: 285119

7 years ago[DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors
Simon Pilgrim [Tue, 25 Oct 2016 20:56:42 +0000 (20:56 +0000)]
[DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors

SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

llvm-svn: 285118

7 years agoFix nullptr tests
Eric Fiselier [Tue, 25 Oct 2016 20:45:17 +0000 (20:45 +0000)]
Fix nullptr tests

llvm-svn: 285117

7 years ago[InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996
Guozhi Wei [Tue, 25 Oct 2016 20:43:42 +0000 (20:43 +0000)]
[InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996

The original patch of the A->B->A BitCast optimization was reverted by r274094 because it may cause infinite loop inside compiler https://llvm.org/bugs/show_bug.cgi?id=27996.

The problem is with following code

xB = load (type B);
xA = load (type A);
+yA = (A)xB; B -> A
+zAn = PHI[yA, xA]; PHI
+zBn = (B)zAn; // A -> B
store zAn;
store zBn;

optimizeBitCastFromPhi generates

+zBn = (B)zAn; // A -> B

and expects it will be combined with the following store instruction to another

store zAn

Unfortunately before combineStoreToValueType is called on the store instruction, optimizeBitCastFromPhi is called on the new BitCast again, and this pattern repeats indefinitely.

optimizeBitCastFromPhi only generates BitCast for load/store instructions, only the BitCast before store can cause the reexecution of optimizeBitCastFromPhi, and BitCast before store can easily be handled by InstCombineLoadStoreAlloca.cpp. So the solution to the problem is if all users of a CI are store instructions, we should not do optimizeBitCastFromPhi on it. Then optimizeBitCastFromPhi will not be called on the new BitCast instructions.

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

llvm-svn: 285116

7 years ago[SE] Remove StreamExecutor
Jason Henline [Tue, 25 Oct 2016 20:38:08 +0000 (20:38 +0000)]
[SE] Remove StreamExecutor

Summary:
The project has been renamed to Acxxel, so this old directory needs to
be deleted.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, parallel_libs-commits, modocache

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

llvm-svn: 285115

7 years agoFix a race condition between the "ephemeral watchpoint disabling" and commands the...
Jim Ingham [Tue, 25 Oct 2016 20:34:32 +0000 (20:34 +0000)]
Fix a race condition between the "ephemeral watchpoint disabling" and commands the continue the process.

This closes https://reviews.llvm.org/D25875.

llvm-svn: 285114

7 years agoFixing up the project file for the removal of LibStdcppSmartPointer.cpp.
Jim Ingham [Tue, 25 Oct 2016 20:32:26 +0000 (20:32 +0000)]
Fixing up the project file for the removal of LibStdcppSmartPointer.cpp.

llvm-svn: 285113

7 years ago[X86][SSE] Added vector sdiv combine tests
Simon Pilgrim [Tue, 25 Oct 2016 20:25:47 +0000 (20:25 +0000)]
[X86][SSE] Added vector sdiv combine tests

llvm-svn: 285112

7 years agoInitial check-in of Acxxel (StreamExecutor renamed)
Jason Henline [Tue, 25 Oct 2016 20:18:56 +0000 (20:18 +0000)]
Initial check-in of Acxxel (StreamExecutor renamed)

Summary:
Acxxel is basically a simplified redesign of StreamExecutor.

Here are the major points where Acxxel differs from the current
StreamExecutor design:

* Acxxel doesn't support the kernel and kernel loader types designed for
  emission by the compiler to support type-safe kernel launches. For
  CUDA, kernels in Acxxel can be seamlessly launched using the standard
  CUDA triple-chevron kernel launch syntax that is available with clang
  and nvcc. For CUDA and OpenCL, kernel arguments can be passed in the
  old-fashioned way, as one array of pointers to arguments and another
  array of argument sizes. Although OpenCL doesn't get a type-safe
  kernel launch method, it does still get the benefit of all the memory
  management wrappers. In the future, clang may add support for
  triple-chevron OpenCL kernel launchs, or some other type-safe OpenCL
  kernel launch method.
* Acxxel does not depend on any other code in LLVM, so it builds
  completely independently from LLVM.

The goal will be to check in Acxxel and remove StreamExecutor, or
perhaps to remove the old StreamExecutor and rename Acxxel to
StreamExecutor, so I think Acxxel should be thought of as a new version
of StreamExecutor, not as a separate project.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, modocache, parallel_libs-commits

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

llvm-svn: 285111

7 years agorevert: "Remove debug location from common tail when tail-merging"
Robert Lougher [Tue, 25 Oct 2016 20:17:58 +0000 (20:17 +0000)]
revert: "Remove debug location from common tail when tail-merging"

This reverts r285093, as it caused unexpected buildbot failures on
clang-ppc64le-linux, clang-ppc64be-linux, clang-ppc64be-linux-multistage
and clang-ppc64be-linux-lnt.  Failing test ubsan/TestCases/TypeCheck/vptr.cpp.

llvm-svn: 285110

7 years ago[libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired...
Kostya Serebryany [Tue, 25 Oct 2016 20:15:15 +0000 (20:15 +0000)]
[libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired bytes. Add another test for use_cmp

llvm-svn: 285109

7 years ago[InstCombine] Ensure that truncated int types are legal.
Sanjay Patel [Tue, 25 Oct 2016 20:11:47 +0000 (20:11 +0000)]
[InstCombine] Ensure that truncated int types are legal.

Fixes the FIXMEs in D25952 and rL285075.

Patch by bryant!

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

llvm-svn: 285108

7 years agoGet libc++abi building with LLVM_ENABLE_MODULES
Eric Fiselier [Tue, 25 Oct 2016 20:07:49 +0000 (20:07 +0000)]
Get libc++abi building with LLVM_ENABLE_MODULES

llvm-svn: 285107

7 years ago[AArch64] Adjust the cost model for Exynos M1.
Evandro Menezes [Tue, 25 Oct 2016 20:05:42 +0000 (20:05 +0000)]
[AArch64] Adjust the cost model for Exynos M1.

Modify the maximum jump table size.

llvm-svn: 285106

7 years ago[APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC.
Tim Shen [Tue, 25 Oct 2016 19:55:59 +0000 (19:55 +0000)]
[APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC.

Summary:
The intention is to make APFloat an interface class, so that later I can add a second implementation class DoubleAPFloat to correctly implement PPCDoubleDouble semantic. The interface of IEEEFloat is not public, and can be simplified (currently it's exactly the same as the old APFloat), but that belongs to a separate patch.

DoubleAPFloat should look like:
class DoubleAPFloat {
  const fltSemantics *Semantics;
  std::unique_ptr<APFloat> APFloats;  // Two heap-allocated APFloats.
};

There is no functional change, nor public interface change.

Reviewers: hfinkel, chandlerc, iteratee, echristo, kbarton

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 285105

7 years agoAdd option to specify minimum number of entries for jump tables
Evandro Menezes [Tue, 25 Oct 2016 19:53:51 +0000 (19:53 +0000)]
Add option to specify minimum number of entries for jump tables

Add an option to allow easier experimentation by target maintainers with the
minimum number of entries to create jump tables.  Also clarify the name of
the other existing option governing the creation of jump tables.

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

llvm-svn: 285104

7 years ago[llvm-cov] Don't use colored output until we know it's supported
Vedant Kumar [Tue, 25 Oct 2016 19:52:57 +0000 (19:52 +0000)]
[llvm-cov] Don't use colored output until we know it's supported

CodeCoverageTool::error() depends on CoverageViewOptions::Colors being
initialized. Should fix:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/56

llvm-svn: 285103

7 years agoUpdate revision number in CHANGELOG.TXT
Eric Fiselier [Tue, 25 Oct 2016 19:44:38 +0000 (19:44 +0000)]
Update revision number in CHANGELOG.TXT

llvm-svn: 285102

7 years ago[libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from...
Eric Fiselier [Tue, 25 Oct 2016 19:43:44 +0000 (19:43 +0000)]
[libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib

Summary:
This patch turns on `-fvisibility-inlines-hidden` when building  the dylib. This is important so that libc++.dylib doesn't accidentally export inline-functions which are ODR used somewhere in the dylib.

On OS X this change has no effect on the current ABI of the dylib. Unfortunately on Linux there are already ~20 inline functions which are unintentionally exported by the dylib. Almost all of these are implicitly generated destructors. I believe removing these function definitions is safe because every "linkage unit" which uses these functions has its own definition, and therefore shouldn't be dependent on libc++.dylib to provide them.

Also could a FreeBSD maintainer comment on the ABI compatibility of this patch?

Reviewers: mclow.lists, emaste, dexonsmith, joker-eph-DISABLED, jroelofs, danalbert, mehdi_amini, compnerd, dim

Subscribers: beanz, mgorny, cfe-commits, modocache

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

llvm-svn: 285101

7 years ago[libc++] Fix modules build - Rework __refstring definition
Eric Fiselier [Tue, 25 Oct 2016 19:33:14 +0000 (19:33 +0000)]
[libc++] Fix modules build - Rework __refstring definition

Summary:
`__libcpp_refstring` currently has two different definitions. First there is the complete definition in `<__refstring>` but there is also a second in  `<stdexcept>`.  The historical reason for this split is because both libc++ and libc++abi need to see the inline definitions of __libcpp_refstrings methods, but the `<stdexcept>` header doesn't.  However this is an ODR violation and breaks the modules build.

This patch fixes the issue by creating a single class definition in `<stdexcept>` and changing `<__refstring>` to contain only the inline method definitions. This way both `libcxx/src/stdexcept.cpp` and `libcxxabi/src/stdexcept.cpp` see the same declaration in `<stdexcept>` and definitions in `<__refstring>`

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 285100

7 years agoSwitch lowering: improve partitioning of jump tables
Evandro Menezes [Tue, 25 Oct 2016 19:11:43 +0000 (19:11 +0000)]
Switch lowering: improve partitioning of jump tables

When there's a tie between partitionings of jump tables, consider also cases
that result in no jump tables, but in one or a few cases.  The motivation is
that many contemporary processors typically perform case switches fairly
quickly.

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

llvm-svn: 285099

7 years agoReapply r284265: "[Sema] Refactor context checking for availability diagnostics"
Erik Pilkington [Tue, 25 Oct 2016 19:05:50 +0000 (19:05 +0000)]
Reapply r284265: "[Sema] Refactor context checking for availability diagnostics"

The problem with the original commit was that some of Apple's headers depended
on an incorrect behaviour, this commit adds a temporary workaround until those
headers are fixed.

llvm-svn: 285098

7 years ago[LV] Sink scalar operands of predicated instructions
Matthew Simpson [Tue, 25 Oct 2016 18:59:45 +0000 (18:59 +0000)]
[LV] Sink scalar operands of predicated instructions

When we predicate an instruction (div, rem, store) we place the instruction in
its own basic block within the vectorized loop. If a predicated instruction has
scalar operands, it's possible to recursively sink these scalar expressions
into the predicated block so that they might avoid execution. This patch sinks
as much scalar computation as possible into predicated blocks. We previously
were able to sink such operands only if they were extractelement instructions.

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

llvm-svn: 285097

7 years agoRemove a VS 2012 workaround, we require 2015 now.
Nico Weber [Tue, 25 Oct 2016 18:48:43 +0000 (18:48 +0000)]
Remove a VS 2012 workaround, we require 2015 now.

llvm-svn: 285096

7 years ago[InstCombine] add tests for missing icmp + shl nuw fold
Sanjay Patel [Tue, 25 Oct 2016 18:47:56 +0000 (18:47 +0000)]
[InstCombine] add tests for missing icmp + shl nuw fold

Patch by bryant!

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

llvm-svn: 285095

7 years agoAdd -strip-nonlinetable-debuginfo capability
Michael Ilseman [Tue, 25 Oct 2016 18:44:13 +0000 (18:44 +0000)]
Add -strip-nonlinetable-debuginfo capability

This adds a new function to DebugInfo.cpp that takes an llvm::Module
as input and removes all debug info metadata that is not directly
needed for line tables, thus effectively stripping all type and
variable information from the module.

The primary motivation for this feature was the bitcode work flow
(cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html
for more background). This is not wired up yet, but will be in
subsequent patches.  For testing, the new functionality is exposed to
opt with a -strip-nonlinetable-debuginfo option.

The secondary use-case (and one that works right now!) is as a
reduction pass in bugpoint. I added two new bugpoint options
(-disable-strip-debuginfo and -disable-strip-debug-types) to control
the new features. By default it will first attempt to remove all debug
information, then only the type info, and then proceed to hack at any
remaining MDNodes.

Thanks to Adrian Prantl for stewarding this patch!

llvm-svn: 285094

7 years agoRemove debug location from common tail when tail-merging
Robert Lougher [Tue, 25 Oct 2016 18:44:07 +0000 (18:44 +0000)]
Remove debug location from common tail when tail-merging

The branch folding pass tail merges blocks into a common-tail.  However, the
tail retains the debug information from one of the original inputs to the
merge (chosen randomly).  This is a problem for sampled-based PGO, as hits
on the common-tail will be attributed to whichever block was chosen,
irrespective of which path was actually taken to the common-tail.

This patch fixes the issue by nulling the debug location for the common-tail.

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

llvm-svn: 285093

7 years agoFix 80-char violations. NFC.
Michael Kuperstein [Tue, 25 Oct 2016 18:31:23 +0000 (18:31 +0000)]
Fix 80-char violations. NFC.

llvm-svn: 285092

7 years ago[unittests] STLExtrasTest: Remove an MSVC 2013 workaround, NFCI.
Vedant Kumar [Tue, 25 Oct 2016 18:11:17 +0000 (18:11 +0000)]
[unittests] STLExtrasTest: Remove an MSVC 2013 workaround, NFCI.

Let's see what the bots have to say about this...

llvm-svn: 285091

7 years ago[unittests] Remove an MSVC 2013 workaround, NFCI.
Vedant Kumar [Tue, 25 Oct 2016 17:58:25 +0000 (17:58 +0000)]
[unittests] Remove an MSVC 2013 workaround, NFCI.

Let's see what the bots have to say about this...

llvm-svn: 285090

7 years agoRevert 285087.
Nico Weber [Tue, 25 Oct 2016 17:46:29 +0000 (17:46 +0000)]
Revert 285087.

The sanitizer-windows bot turned red with:

FAILED: utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/IntrinsicEmitter.cpp.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe ... -c
    C:\...\llvm\utils\TableGen\IntrinsicEmitter.cpp
c:\...\llvm\utils\tablegen\intrinsicemitter.cpp(254) :
  fatal error C1001: An internal error has occurred in the compiler.
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/114/steps/build%20clang%20lld/logs/stdio

llvm-svn: 285089

7 years ago[llvm-cov] Add support for loading coverage from multiple objects
Vedant Kumar [Tue, 25 Oct 2016 17:40:55 +0000 (17:40 +0000)]
[llvm-cov] Add support for loading coverage from multiple objects

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

llvm-svn: 285088

7 years agoTry removing an MSVC2010 workaround.
Nico Weber [Tue, 25 Oct 2016 17:35:00 +0000 (17:35 +0000)]
Try removing an MSVC2010 workaround.

Things seem to build fine locally without this, so let's
see what the bots think.

llvm-svn: 285087

7 years agoFix Clang-tidy readability-redundant-member-init warnings; other minor fixes
Eugene Zelenko [Tue, 25 Oct 2016 16:57:35 +0000 (16:57 +0000)]
Fix Clang-tidy readability-redundant-member-init warnings; other minor fixes

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

llvm-svn: 285086

7 years ago[WebAssembly] Add immediate fields to call_indirect and memory operators.
Dan Gohman [Tue, 25 Oct 2016 16:55:52 +0000 (16:55 +0000)]
[WebAssembly] Add immediate fields to call_indirect and memory operators.

call_indirect, grow_memory, and current_memory now have immediate
operands in the 0xd binary encoding.

llvm-svn: 285085

7 years agoMove discriminator assignment to where it is used. (NFC)
Dehao Chen [Tue, 25 Oct 2016 16:50:27 +0000 (16:50 +0000)]
Move discriminator assignment to where it is used. (NFC)

llvm-svn: 285084

7 years ago[IndVarSimplify][Dwarf] When widening the IV increment, correctly set the debug loc.
Andrea Di Biagio [Tue, 25 Oct 2016 16:45:17 +0000 (16:45 +0000)]
[IndVarSimplify][Dwarf] When widening the IV increment, correctly set the debug loc.

When indvars widened an induction variable, the debug location for the loop
increment computation was incorrectly set equal to the debug loc of the loop
latch terminator.

This patch fixes the issue by propagating the correct location from the
original loop increment instruction to the new widened increment.

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

llvm-svn: 285083

7 years agoBe a bit more consistent about using getters. NFC.
Rafael Espindola [Tue, 25 Oct 2016 16:42:46 +0000 (16:42 +0000)]
Be a bit more consistent about using getters. NFC.

llvm-svn: 285082

7 years agoReplace TimeValue by TimePoint in LegacyPassManager. NFC.
Pavel Labath [Tue, 25 Oct 2016 16:20:07 +0000 (16:20 +0000)]
Replace TimeValue by TimePoint in LegacyPassManager. NFC.

llvm-svn: 285081

7 years ago[EarlyCSE] Make MemorySSA memory dependency check more aggressive.
Geoff Berry [Tue, 25 Oct 2016 16:18:47 +0000 (16:18 +0000)]
[EarlyCSE] Make MemorySSA memory dependency check more aggressive.

Now that MemorySSA keeps track of whether MemoryUses are optimized, use
getClobberingMemoryAccess() to check MemoryUse memory dependencies since
it should no longer be so expensive.

This is a follow-up change to https://reviews.llvm.org/D25881

llvm-svn: 285080

7 years agoDelete getSectionHdr.
Rafael Espindola [Tue, 25 Oct 2016 16:14:25 +0000 (16:14 +0000)]
Delete getSectionHdr.

We were fairly inconsistent as to what information should be accessed
with getSectionHdr and what information (like alignment) was stored
elsewhere.

Now all section info has a dedicated getter. The code is also a bit
more compact.

llvm-svn: 285079

7 years agofix formatting; NFC
Sanjay Patel [Tue, 25 Oct 2016 16:12:31 +0000 (16:12 +0000)]
fix formatting; NFC

llvm-svn: 285078

7 years ago[SystemZ] Do not use LOC(G) for volatile loads
Ulrich Weigand [Tue, 25 Oct 2016 15:39:15 +0000 (15:39 +0000)]
[SystemZ] Do not use LOC(G) for volatile loads

It is not safe to use LOAD ON CONDITION to implement access to a memory
location marked "volatile", since the architecture leaves it unspecified
whether or not an access happens if the condition is false.

The current code already appears to care about that:
  def LOC  : CondUnaryRSY<"loc",  0xEBF2, nonvolatile_load, GR32, 4>;

Unfortunately, that "nonvolatile_load" operator is simply ignored
by the CondUnaryRSY class, and there was no test to catch it.

llvm-svn: 285077

7 years ago[Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
Michal Gorny [Tue, 25 Oct 2016 15:33:32 +0000 (15:33 +0000)]
[Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older

Disable the OpenSUSE rules for OpenSUSE versions older than 11 as they
are incompatible with the old binutils on that distribution.

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

llvm-svn: 285076

7 years ago[InstCombine] add test and code comment to show potentially misguided icmp trunc...
Sanjay Patel [Tue, 25 Oct 2016 15:16:39 +0000 (15:16 +0000)]
[InstCombine] add test and code comment to show potentially misguided icmp trunc transform

llvm-svn: 285075

7 years ago[Driver] Support obtaining active toolchain from gcc-config on Gentoo
Michal Gorny [Tue, 25 Oct 2016 15:07:41 +0000 (15:07 +0000)]
[Driver] Support obtaining active toolchain from gcc-config on Gentoo

Support using gcc-config to determine the correct GCC toolchain location
on Gentoo. In order to do that, attempt to read gcc-config configuration
form [[sysroot]]/etc/env.d/gcc, if no custom toolchain location is
provided.

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

llvm-svn: 285074

7 years agoCodeGen: mark protocols as common data
Saleem Abdulrasool [Tue, 25 Oct 2016 14:50:44 +0000 (14:50 +0000)]
CodeGen: mark protocols as common data

This allows for the coalescing of the protocol declarations.  When the protocols
are declared in headers, multiple definitions of the protocol would be emitted.
Marking them as common data indicates that any one can be selected.

llvm-svn: 285073

7 years ago[X86][SSE] Add support for (V)PMOVSX* constant folding
Simon Pilgrim [Tue, 25 Oct 2016 14:29:25 +0000 (14:29 +0000)]
[X86][SSE] Add support for (V)PMOVSX* constant folding

We already have (V)PMOVZX* combining support, this is the beginning of handling (V)PMOVSX* similarly - other combines in combineVSZext can be generalized in future patches.

This unearthed an interesting bug in that we were generating illegal build vectors on 32-bit targets - it was proving difficult to create a test for it from PMOVZX, but it fired immediately with PMOVSX. I've created a more general form of the existing getConstVector to handle these cases - ideally this should be handled in non-target-specific code but I couldn't find an equivalent.

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

llvm-svn: 285072

7 years ago[ScopInfo] Fix: use raw source pointer.
Michael Kruse [Tue, 25 Oct 2016 13:37:43 +0000 (13:37 +0000)]
[ScopInfo] Fix: use raw source pointer.

When adding an llvm.memcpy instruction to AliasSetTracker, it uses the raw
source and target pointers which preserve bitcasts.
MemAccInst::getPointerOperand() also returns the raw target pointers, but
Scop::buildAliasGroups() did not for the source pointer. This lead to mismatches
between AliasSetTracker and ScopInfo on which pointer to use.

Fixed by also using raw pointers in Scop::buildAliasGroups().

llvm-svn: 285071

7 years ago[InstCombine] fix checks for previous commit (r285069)
Sanjay Patel [Tue, 25 Oct 2016 13:30:19 +0000 (13:30 +0000)]
[InstCombine] fix checks for previous commit (r285069)

Accidentally put in the hoped-for checks ahead of the transform!

llvm-svn: 285070

7 years ago[InstCombine] add tests for bitcast interference with min/max (PR28001)
Sanjay Patel [Tue, 25 Oct 2016 13:27:56 +0000 (13:27 +0000)]
[InstCombine] add tests for bitcast interference with min/max (PR28001)

llvm-svn: 285069

7 years agoRevert "Improve the libstdc++ smart pointer formatters"
Pavel Labath [Tue, 25 Oct 2016 13:24:53 +0000 (13:24 +0000)]
Revert "Improve the libstdc++ smart pointer formatters"

This reverts commit r284828, as it causes an infinite loop in
TestPrintStackTraces (funnily enough, only when logging is enabled).

llvm-svn: 285068

7 years agoFix MSVC unused variable warning.
Simon Pilgrim [Tue, 25 Oct 2016 12:59:15 +0000 (12:59 +0000)]
Fix MSVC unused variable warning.

LLVM_ATTRIBUTE_UNUSED doesn't work for non-gcc style compilers.

llvm-svn: 285067

7 years agoRe-apply patch r279045.
Kelvin Li [Tue, 25 Oct 2016 12:50:55 +0000 (12:50 +0000)]
Re-apply patch r279045.

llvm-svn: 285066

7 years agoFix diagnostic format string for err_os_log_argument_to_big
Benjamin Kramer [Tue, 25 Oct 2016 12:39:28 +0000 (12:39 +0000)]
Fix diagnostic format string for err_os_log_argument_to_big

Patch by Sam McCall, test case by me.

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

llvm-svn: 285065

7 years agofix warning
Rafael Espindola [Tue, 25 Oct 2016 12:28:26 +0000 (12:28 +0000)]
fix warning

llvm-svn: 285064

7 years ago[DAGCombine] Preserve shuffles when one of the vector operands is constant
Zvi Rackover [Tue, 25 Oct 2016 12:14:19 +0000 (12:14 +0000)]
[DAGCombine] Preserve shuffles when one of the vector operands is constant

Summary:
Do *not* perform combines such as:

    vector_shuffle<4,1,2,3>(build_vector(Ud, C0, C1 C2), scalar_to_vector(X))
    ->
    build_vector(X, C0, C1, C2)

Keeping the shuffle allows lowering the constant build_vector to a materialized
constant vector (such as a vector-load from the constant-pool or some other idiom).

Reviewers: delena, igorb, spatel, mkuper, andreadb, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 285063

7 years agoUpdate for llvm change.
Rafael Espindola [Tue, 25 Oct 2016 12:02:31 +0000 (12:02 +0000)]
Update for llvm change.

llvm-svn: 285062

7 years agoMake the LTO comdat api more symbol table friendly.
Rafael Espindola [Tue, 25 Oct 2016 12:02:03 +0000 (12:02 +0000)]
Make the LTO comdat api more symbol table friendly.

In an IR symbol table I would expect the comdats to be represented as:

- A table of strings, one for each comdat name.
- Each symbol has an optional index into that table.

The natural api for accessing that would be

InputFile:
ArrayRef<StringRef> getComdatTable() const;

Symbol:
int getComdatIndex() const;

This patch implements an API as close to that as possible.  The
implementation on top of the current IRObjectFile is a bit hackish,
but should map just fine over a symbol table and is very convenient to
use.

llvm-svn: 285061

7 years agoinclude-fixer: Don't overwrite buffer changes
Manuel Klimek [Tue, 25 Oct 2016 11:31:22 +0000 (11:31 +0000)]
include-fixer: Don't overwrite buffer changes

Raise a signal if the buffer has been modified before replacing it, to
avoid overwriting users' changes.

Patch by Philipp Stephani.

llvm-svn: 285060

7 years agoLoad clang-include-fixer.el from the unit test suite so that the unit tests can run...
Manuel Klimek [Tue, 25 Oct 2016 11:30:28 +0000 (11:30 +0000)]
Load clang-include-fixer.el from the unit test suite so that the unit tests can run in batch mode.

Patch by Philipp Stephani.

llvm-svn: 285059

7 years agoInclude full filename range for missing includes
Erik Verbruggen [Tue, 25 Oct 2016 10:13:10 +0000 (10:13 +0000)]
Include full filename range for missing includes

For the purpose of highlighting in an IDE.

llvm-svn: 285057

7 years agoFix 'unknown documentation command' warning ranges
Erik Verbruggen [Tue, 25 Oct 2016 10:06:11 +0000 (10:06 +0000)]
Fix 'unknown documentation command' warning ranges

Warnings generated by -Wdocumentation-unknown-command did only have a
start location, not a full source range. This resulted in only the
"carret" being show in messages, and IDEs highlighting only the single
initial character.

llvm-svn: 285056

7 years agoFix an unused warning in WebAssemblyInstPrinter with NDEBUG.
Benjamin Kramer [Tue, 25 Oct 2016 09:08:50 +0000 (09:08 +0000)]
Fix an unused warning in WebAssemblyInstPrinter with NDEBUG.

Patch by Sam McCall!

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

llvm-svn: 285055

7 years ago[X86][AVX512][Clang][Intrinsics][reduce] Adding missing reduce (Operators: +,*,&...
Michael Zuckerman [Tue, 25 Oct 2016 07:56:04 +0000 (07:56 +0000)]
[X86][AVX512][Clang][Intrinsics][reduce] Adding missing reduce (Operators: +,*,&&,||) intrinsics to Clang

Committed after LGTM and check-all

Vector-reduction arithmetic accepts vectors as inputs and produces scalars as outputs.
This class of vector operation forms the basis of many scientific computations.
In vector-reduction arithmetic, the evaluation off is independent of the order of the input elements of V.

Used bisection method. At each step, we partition the vector with previous
step in half, and the operation is performed on its two halves.
This takes log2(n) steps where n is the number of elements in the vector.

Reviwer: 1. igorb
         2. craig.topper
Differential Revision: https://reviews.llvm.org/D25527

llvm-svn: 285054

7 years ago[AVX-512] Add support for creating SIGN_EXTEND_VECTOR_INREG and ZERO_EXTEND_VECTOR_IN...
Craig Topper [Tue, 25 Oct 2016 04:00:29 +0000 (04:00 +0000)]
[AVX-512] Add support for creating SIGN_EXTEND_VECTOR_INREG and ZERO_EXTEND_VECTOR_INREG for 512-bit vectors to support vpmovzxbq and vpmovsxbq.

Summary: The one tricky thing about this is that the sign/zero_extend_inreg uses v64i8 as an input type which isn't legal without BWI support. Though the vpmovsxbq and vpmovzxbq instructions themselves don't require BWI. To support this we need to add custom lowering for ZERO_EXTEND_VECTOR_INREG with v64i8 input. This can mostly reuse the existing sign extend code with a couple checks for sign extend vs zero extend added.

Reviewers: delena, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 285053

7 years agoGlobalDCE: Restore a statement accidentally removed in r285048.
Peter Collingbourne [Tue, 25 Oct 2016 02:57:27 +0000 (02:57 +0000)]
GlobalDCE: Restore a statement accidentally removed in r285048.

llvm-svn: 285052

7 years agoMachineInstrBundle: Pass iterators to getBundle(Start|End); NFC
Matthias Braun [Tue, 25 Oct 2016 02:55:17 +0000 (02:55 +0000)]
MachineInstrBundle: Pass iterators to getBundle(Start|End); NFC

This is a function to go backwards in a block to find the first
instruction in a bundle, so iterator is a more natural choice for
parameter/return rather than a reference to a MachineInstruction.

llvm-svn: 285051

7 years agoIR: Deduplicate getParent() functions on derived classes of GlobalValue into the...
Peter Collingbourne [Tue, 25 Oct 2016 02:54:08 +0000 (02:54 +0000)]
IR: Deduplicate getParent() functions on derived classes of GlobalValue into the base class. NFCI.

llvm-svn: 285050

7 years ago[libFuzzer] simplify the code for use_cmp, also use the position hint when available...
Kostya Serebryany [Tue, 25 Oct 2016 02:04:43 +0000 (02:04 +0000)]
[libFuzzer] simplify the code for use_cmp, also use the position hint when available, add a test

llvm-svn: 285049

7 years agoGlobalDCE: Deduplicate code. NFCI.
Peter Collingbourne [Tue, 25 Oct 2016 01:58:26 +0000 (01:58 +0000)]
GlobalDCE: Deduplicate code. NFCI.

llvm-svn: 285048

7 years agoFix handling of %% format specifier in os_log builtins.
Mehdi Amini [Tue, 25 Oct 2016 00:48:48 +0000 (00:48 +0000)]
Fix handling of %% format specifier in os_log builtins.

Returning `false` was stopping the parsing of further arguments,
which wasn't intended.

llvm-svn: 285047

7 years ago[InstCombine] auto-generate checks
Sanjay Patel [Tue, 25 Oct 2016 00:44:02 +0000 (00:44 +0000)]
[InstCombine] auto-generate checks

llvm-svn: 285046

7 years ago[InstCombine] auto-generate checks
Sanjay Patel [Tue, 25 Oct 2016 00:41:00 +0000 (00:41 +0000)]
[InstCombine] auto-generate checks

llvm-svn: 285045

7 years ago[WebAssembly] Reorder load/store operands to match binary encoding.
Dan Gohman [Tue, 25 Oct 2016 00:17:11 +0000 (00:17 +0000)]
[WebAssembly] Reorder load/store operands to match binary encoding.

The p2align operand of a load/store is encoded before the offset
operand; reorder the MachineInstr operands accordingly.

llvm-svn: 285044

7 years ago[llvm-cov] Do not print out the filename of the object file
Vedant Kumar [Tue, 25 Oct 2016 00:08:33 +0000 (00:08 +0000)]
[llvm-cov] Do not print out the filename of the object file

When we load coverage data from multiple objects, we don't have a way to
attribute a source object to a function record. Printing out the object
filename next to the source filename is already not very useful: soon,
it'll actually become misleading. Stop printing out the filename now.

llvm-svn: 285043

7 years agoAdd dependency from clangCodeGen to clangAnalysis
Mehdi Amini [Mon, 24 Oct 2016 23:38:32 +0000 (23:38 +0000)]
Add dependency from clangCodeGen to clangAnalysis

This is unbreaking the build with shared library after r285019.

llvm-svn: 285042

7 years agotest/CodeGen/builtins.c: reinstate #ifdef __x86_64__ around __builtin_longjmp
Mehdi Amini [Mon, 24 Oct 2016 23:38:24 +0000 (23:38 +0000)]
test/CodeGen/builtins.c: reinstate #ifdef __x86_64__ around __builtin_longjmp

Unadvertently removed in r285019

llvm-svn: 285041

7 years ago[WebAssembly] Implement more WebAssembly binary encoding.
Dan Gohman [Mon, 24 Oct 2016 23:27:49 +0000 (23:27 +0000)]
[WebAssembly] Implement more WebAssembly binary encoding.

This changes locals from being declared by the emitLocal hook in
WebAssemblyTargetStreamer, rather than with an instruction. After exploring
the infastructure in LLVM more, this seems to make more sense since
declaring locals doesn't use an encoded opcode.

This also adds more 0xd opcodes, type encodings, and miscellaneous
binary encoding bits.

llvm-svn: 285040

7 years agoCodeGen/Passes: Pass MachineFunction as functor arg; NFC
Matthias Braun [Mon, 24 Oct 2016 23:23:02 +0000 (23:23 +0000)]
CodeGen/Passes: Pass MachineFunction as functor arg; NFC

Passing a MachineFunction as argument is more natural and avoids an
unnecessary round-trip through the logic determining the correct
Subtarget because MachineFunction already has a reference anyway.

llvm-svn: 285039

7 years ago[Basic] Support 32-bit x86 and ARM targets for Fuchsia
Petr Hosek [Mon, 24 Oct 2016 22:55:57 +0000 (22:55 +0000)]
[Basic] Support 32-bit x86 and ARM targets for Fuchsia

Fuchsia has experimental support for 32-bit x86 and ARM targets, add
them to the list of supported targets.

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

llvm-svn: 285038

7 years agoLink clangCodeGen with clangAnalysis required after r284990.
Artem Belevich [Mon, 24 Oct 2016 22:52:39 +0000 (22:52 +0000)]
Link clangCodeGen with clangAnalysis required after r284990.

Fixes build break for configurations that use shared libraries.

llvm-svn: 285037

7 years ago[InstCombine] regenerate some checks
Sanjay Patel [Mon, 24 Oct 2016 22:50:26 +0000 (22:50 +0000)]
[InstCombine] regenerate some checks

llvm-svn: 285036

7 years agocmake: Rename installhdrs to install-llvm-headers and fix the dependencies
Justin Bogner [Mon, 24 Oct 2016 21:58:58 +0000 (21:58 +0000)]
cmake: Rename installhdrs to install-llvm-headers and fix the dependencies

The installhdrs target was inconsistently named and would behave
differently depending on whether or not you ran a build first. This
renames it to install-llvm-headers to match other target names and
adds a dependency on intrinsics_gen so that it will always install the
same set of things.

llvm-svn: 285035

7 years agoFix regression from my recent GlobalsAA fix.
Eli Friedman [Mon, 24 Oct 2016 21:47:44 +0000 (21:47 +0000)]
Fix regression from my recent GlobalsAA fix.

There are two fixes here: one, AnalyzeUsesOfPointer can't return
false until it has checked all the uses of the pointer. Two, if a
global uses another global, we have to assume the address of the
first global escapes.

Fixes https://llvm.org/bugs/show_bug.cgi?id=30707 .

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

llvm-svn: 285034

7 years ago[SelectionDAG] Update ComputeNumSignBits SRA/SHL handlers to accept scalar or vector...
Simon Pilgrim [Mon, 24 Oct 2016 21:47:19 +0000 (21:47 +0000)]
[SelectionDAG] Update ComputeNumSignBits SRA/SHL handlers to accept scalar or vector splats

Use isConstOrConstSplat helper.

Also use APInt instead of getZExtValue directly to avoid out of range issues.

llvm-svn: 285033

7 years agoremove xfail from TestObjCNewSyntax.py test_expr_gmodules()
Todd Fiala [Mon, 24 Oct 2016 21:46:46 +0000 (21:46 +0000)]
remove xfail from TestObjCNewSyntax.py test_expr_gmodules()

Fixes:
rdar://27792848

llvm-svn: 285032

7 years ago[Sema][ObjC] Warn about implicitly autoreleasing out-parameters captured
Akira Hatanaka [Mon, 24 Oct 2016 21:45:54 +0000 (21:45 +0000)]
[Sema][ObjC] Warn about implicitly autoreleasing out-parameters captured
by blocks.

Add a new warning "-Wblock-capture-autoreleasing". The warning warns
about implicitly autoreleasing out-parameters captured by blocks which
can introduce use-after-free bugs that are hard to debug.

rdar://problem/15377548

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

llvm-svn: 285031