platform/upstream/llvm.git
8 years agoAdd a clang-tidy check that flags string-to-number conversion functions that have...
Aaron Ballman [Fri, 29 Apr 2016 20:56:48 +0000 (20:56 +0000)]
Add a clang-tidy check that flags string-to-number conversion functions that have insufficient error checking, suggesting a better alternative.

This check corresponds to: https://www.securecoding.cert.org/confluence/display/c/ERR34-C.+Detect+errors+when+converting+a+string+to+a+number

llvm-svn: 268100

8 years ago[InstCombine] clean up; NFC
Sanjay Patel [Fri, 29 Apr 2016 20:54:56 +0000 (20:54 +0000)]
[InstCombine] clean up; NFC

llvm-svn: 268099

8 years agoMake sure LLDB can deal with forward declarations to enums without crashing or asserting.
Greg Clayton [Fri, 29 Apr 2016 20:48:39 +0000 (20:48 +0000)]
Make sure LLDB can deal with forward declarations to enums without crashing or asserting.

<rdar://problem/23776428>

llvm-svn: 268098

8 years ago[asan] Assert in __sanitizer_ptr_{sub,cmp} if one of the pointers was freed.
Filipe Cabecinhas [Fri, 29 Apr 2016 20:37:34 +0000 (20:37 +0000)]
[asan] Assert in __sanitizer_ptr_{sub,cmp} if one of the pointers was freed.

Summary:
This (partially) implements the check mentioned at
http://kristerw.blogspot.co.uk/2016/04/dangling-pointers-and-undefined-behavior.html
(via John Regehr)

Quoting:
"That the behavior is undefined follows from C11 6.2.4 "Storage
durations of objects"
  The lifetime of an object is the portion of program execution during
  which storage is guaranteed to be reserved for it. An object exists, has
  a constant address, and retains its last-stored value throughout its
  lifetime. If an object is referred to outside of its lifetime, the
  behavior is undefined. The value of a pointer becomes indeterminate when
  the object it points to (or just past) reaches the end of its lifetime.
and 7.22.3 "Memory management functions" that says that free ends the
lifetime of objects
  The lifetime of an allocated object extends from the allocation until
  the deallocation.
"

We can probably implement this for stack variables too, but I think this
is a good start to see if there's interest in this check.
We can also hide this behind a flag, too.

Reviewers: samsonov, kcc, rsmith, regehr

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 268097

8 years ago[Docs] Add CMake Primer document
Chris Bieneman [Fri, 29 Apr 2016 20:34:54 +0000 (20:34 +0000)]
[Docs] Add CMake Primer document

This document is intended to provide a basic overview of the CMake scripting language for LLVM developers. It was unorthodoxly reviewed for accuracy and content on the CMake developer list:

http://public.kitware.com/pipermail/cmake-developers/2016-April/028300.html

llvm-svn: 268096

8 years agoAMDGPU/SI: Move post regalloc run of SIShrinkInstructions
Matt Arsenault [Fri, 29 Apr 2016 20:23:42 +0000 (20:23 +0000)]
AMDGPU/SI: Move post regalloc run of SIShrinkInstructions

Move to addPreEmitPass. This is so it runs after post-RA
scheduling so we can merge s_nops emitted by the scheduler
and hazard recognizer.

llvm-svn: 268095

8 years agoDAGCombiner: Reduce truncated shl width
Matt Arsenault [Fri, 29 Apr 2016 19:53:16 +0000 (19:53 +0000)]
DAGCombiner: Reduce truncated shl width

llvm-svn: 268094

8 years agoFix some Include What You Use warnings; other minor fixes.
Eugene Zelenko [Fri, 29 Apr 2016 19:47:09 +0000 (19:47 +0000)]
Fix some Include What You Use warnings; other minor fixes.

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

llvm-svn: 268093

8 years ago[libFuzzer] fix docs
Kostya Serebryany [Fri, 29 Apr 2016 19:28:24 +0000 (19:28 +0000)]
[libFuzzer] fix docs

llvm-svn: 268092

8 years agoMethod Pool in modules: we make sure that if a module contains an entry for
Manman Ren [Fri, 29 Apr 2016 19:04:05 +0000 (19:04 +0000)]
Method Pool in modules: we make sure that if a module contains an entry for
a selector, the entry should be complete, containing everything introduced by
that module and all modules it imports.

Before writing out the method pool of a module, we sync up the out of date
selectors by pulling in methods for the selectors, from all modules it imports.

In ReadMethodPool, after pulling in the method pool entry for module A, this
lets us skip the modules that module A imports.

rdar://problem/25900131

llvm-svn: 268091

8 years agoUse the new path for coverage related headers and update CMakeLists.txt
Easwaran Raman [Fri, 29 Apr 2016 18:53:16 +0000 (18:53 +0000)]
Use the new path for coverage related headers and update CMakeLists.txt

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

llvm-svn: 268090

8 years agoMove coverage related code into a separate library.
Easwaran Raman [Fri, 29 Apr 2016 18:53:05 +0000 (18:53 +0000)]
Move coverage related code into a separate library.

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

llvm-svn: 268089

8 years ago[libFuzzer] enable detect_leaks=1, add proper docs
Kostya Serebryany [Fri, 29 Apr 2016 18:49:55 +0000 (18:49 +0000)]
[libFuzzer] enable detect_leaks=1, add proper docs

llvm-svn: 268088

8 years ago[MemorySSA] Fix bugs in walker; refactor unittests a bit.
George Burgess IV [Fri, 29 Apr 2016 18:42:55 +0000 (18:42 +0000)]
[MemorySSA] Fix bugs in walker; refactor unittests a bit.

This patch fixes two somewhat related bugs in MemorySSA's caching
walker. These bugs were found because D19695 brought up the problem
that we'd have defs cached to themselves, which is incorrect.

The bugs this fixes are:

- We would sometimes skip the nearest clobber of a MemoryAccess, because
  we would query our cache for a given potential clobber before
  checking if the potential clobber is the clobber we're looking for.
  The cache entry for the potential clobber would point to the nearest
  clobber *of the potential clobber*, so if that was a cache hit, we'd
  ignore the potential clobber entirely.

- There are times (sometimes in DFS, sometimes in the getClobbering...
  functions) where we would insert cache entries that say a def
  clobbers itself.

There's a bit of common code between the fixes for the bugs, so they
aren't split out into multiple commits.

This patch also adds a few unit tests, and refactors existing tests a
bit to reduce the duplication of setup code.

llvm-svn: 268087

8 years ago[ValueTracking] matchSelectPattern needs to be more careful around FP
David Majnemer [Fri, 29 Apr 2016 18:40:34 +0000 (18:40 +0000)]
[ValueTracking] matchSelectPattern needs to be more careful around FP

matchSelectPattern attempts to see through casts which mask min/max
patterns from being more obvious.  Under certain circumstances, it would
misidentify a sequence of instructions as a min/max because it assumed
that folding casts would preserve the result.  This is not the case for
floating point <-> integer casts.

This fixes PR27575.

llvm-svn: 268086

8 years ago[MS] Make #pragma pack use PragmaStack<> class.
Denis Zobnin [Fri, 29 Apr 2016 18:17:40 +0000 (18:17 +0000)]
[MS] Make #pragma pack use PragmaStack<> class.

Make implementation of #pragma pack consistent with other "stack" pragmas.
Use PragmaStack<> class instead of old representation of internal stack.
Don't change compiler's behavior.

TODO:
  1. Introduce diagnostics on popping named slots from pragma stacks.

Reviewer: rnk

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

llvm-svn: 268085

8 years agoFix crash in PDB when loading corrupt file.
Zachary Turner [Fri, 29 Apr 2016 18:09:19 +0000 (18:09 +0000)]
Fix crash in PDB when loading corrupt file.

There are probably hundreds of crashers we can find by fuzzing
more.  For now we do the simplest possible validation of the
block size.  Later, more complicated validations can verify that
other fields of the super block such as directory size, number
of blocks, agree with the size of the file etc.

llvm-svn: 268084

8 years ago[fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.
Sean Callanan [Fri, 29 Apr 2016 18:09:03 +0000 (18:09 +0000)]
[fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.

In templated const functions, trying to run an expression would produce the
error

error: out-of-line definition of '$__lldb_expr' does not match any declaration
in 'foo' member declaration does not match because it is const qualified
error: 1 error parsing expression

which is no good.  It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."

Also added a test case.

<rdar://problem/24985958>

llvm-svn: 268083

8 years agoFix crash in BuildCXXDefaultInitExpr.
Reid Kleckner [Fri, 29 Apr 2016 18:06:53 +0000 (18:06 +0000)]
Fix crash in BuildCXXDefaultInitExpr.

Fix crash in BuildCXXDefaultInitExpr when member of template class has
same name as the class itself.

Based on patch by Raphael "Teemperor" Isemann!

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

llvm-svn: 268082

8 years ago[Concepts] Pass requires-clause to ActOnTemplateParameterList; NFC
Hubert Tong [Fri, 29 Apr 2016 18:05:37 +0000 (18:05 +0000)]
[Concepts] Pass requires-clause to ActOnTemplateParameterList; NFC

Summary:
Prepare to store requires-clause expression for access via
TemplateParameterList.

Reviewers: aaron.ballman, faisalv, rsmith

Subscribers: cfe-commits, nwilson

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

llvm-svn: 268081

8 years agoFix typo in test.
Rui Ueyama [Fri, 29 Apr 2016 17:58:48 +0000 (17:58 +0000)]
Fix typo in test.

llvm-svn: 268080

8 years agoAdd boost-use-to-string
Piotr Padlewski [Fri, 29 Apr 2016 17:58:29 +0000 (17:58 +0000)]
Add boost-use-to-string

http://reviews.llvm.org/D18136

llvm-svn: 268079

8 years ago[Clang][Darwin] Define __ARM_DWARF_EH__ for WatchABI
Chris Bieneman [Fri, 29 Apr 2016 17:53:00 +0000 (17:53 +0000)]
[Clang][Darwin] Define __ARM_DWARF_EH__ for WatchABI

Summary: The Darwin armv7k ABI uses Dwarf EH, so we need to set the OS define correctly. Without this the gcc_personality fails to build.

Reviewers: t.p.northover

Subscribers: aemerson, cfe-commits, rengolin

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

llvm-svn: 268078

8 years agoBe sure to always increment the Versym pointer.
Rafael Espindola [Fri, 29 Apr 2016 17:46:07 +0000 (17:46 +0000)]
Be sure to always increment the Versym pointer.

It was getting out of sync if we had undefined symbols at the start of
the symbol table.

llvm-svn: 268077

8 years agosmall reformat to test access
Piotr Padlewski [Fri, 29 Apr 2016 17:45:20 +0000 (17:45 +0000)]
small reformat to test access

llvm-svn: 268076

8 years agoImprove test coverage of -Wdouble-promotion
Robert Lougher [Fri, 29 Apr 2016 17:44:29 +0000 (17:44 +0000)]
Improve test coverage of -Wdouble-promotion

This patch adds coverage for additional cases where implicit conversion can
occur (assignment and return).  It also adds tests for some cases where a
warning should occur but none is produced.  These are marked as FIXME.

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

llvm-svn: 268075

8 years agoUse SelectionDAG::getTargetConstant* helper functions. NFC.
Simon Pilgrim [Fri, 29 Apr 2016 17:42:45 +0000 (17:42 +0000)]
Use SelectionDAG::getTargetConstant* helper functions. NFC.

Instead of SelectionDAG::getConstant directly to make it more obvious that we're creating target constants.

llvm-svn: 268074

8 years ago[AMDGPU][llvm-mc] Add some missing testcases to trap.s
Artem Tamazov [Fri, 29 Apr 2016 17:41:44 +0000 (17:41 +0000)]
[AMDGPU][llvm-mc] Add some missing testcases to trap.s

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

llvm-svn: 268073

8 years agoPut PDB parsing code into a pdb namespace.
Zachary Turner [Fri, 29 Apr 2016 17:28:47 +0000 (17:28 +0000)]
Put PDB parsing code into a pdb namespace.

llvm-svn: 268072

8 years agoRefactor the PDB Stream reading interface.
Zachary Turner [Fri, 29 Apr 2016 17:22:58 +0000 (17:22 +0000)]
Refactor the PDB Stream reading interface.

The motivation for this change is that PDB has the notion of
streams and substreams.  Substreams often consist of variable
length structures that are convenient to be able to treat as
guaranteed, contiguous byte arrays, whereas the streams they
are contained in are not necessarily so, as a single stream
could be spread across many discontiguous blocks.

So, when processing data from a substream, we want to be able
to assume that we have a contiguous byte array so that we can
cast pointers to variable length arrays and such.

This leads to the question of how to be able to read the same
data structure from either a stream or a substream using the
same interface, which is where this patch comes in.

We separate out the stream's read state from the underlying
representation, and introduce a `StreamReader` class.  Then
we change the name of `PDBStream` to `MappedBlockStream`, and
introduce a second kind of stream called a `ByteStream` which is
simply a sequence of contiguous bytes.  Finally, we update all
of the std::vectors in `PDBDbiStream` to use `ByteStream` instead
as a proof of concept.

llvm-svn: 268071

8 years agoFix the alignment of the version info.
Rafael Espindola [Fri, 29 Apr 2016 17:19:45 +0000 (17:19 +0000)]
Fix the alignment of the version info.

llvm-svn: 268070

8 years agoDo not read callee name when matching IR to profile as it is not used.
Dehao Chen [Fri, 29 Apr 2016 17:19:10 +0000 (17:19 +0000)]
Do not read callee name when matching IR to profile as it is not used.

Summary: Callee name is not used to identify a callsite now, so do not read it during annotation.

Reviewers: davidxl, dnovillo

Subscribers: dnovillo, danielcdh, llvm-commits

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

llvm-svn: 268069

8 years ago[BasicAA] Treat llvm.assume as not accessing memory in getModRefBehavior(Function)
Geoff Berry [Fri, 29 Apr 2016 17:18:28 +0000 (17:18 +0000)]
[BasicAA] Treat llvm.assume as not accessing memory in getModRefBehavior(Function)

Reviewers: dberlin, chandlerc, hfinkel, reames, sanjoy

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 268068

8 years ago[MBP] Split placement and alignment into two functions. NFC.
Haicheng Wu [Fri, 29 Apr 2016 17:06:44 +0000 (17:06 +0000)]
[MBP] Split placement and alignment into two functions. NFC.

Cut and Paste.

llvm-svn: 268067

8 years agoFixed/Recommitted r267733 "[AMDGPU][llvm-mc] Add support of TTMP quads. Rework M0...
Artem Tamazov [Fri, 29 Apr 2016 17:04:50 +0000 (17:04 +0000)]
Fixed/Recommitted r267733 "[AMDGPU][llvm-mc] Add support of TTMP quads. Rework M0 exclusion for SMRD."

Previously reverted by r267752.

r267733 review:
Differential Revision: http://reviews.llvm.org/D19342

llvm-svn: 268066

8 years agoAdd a Subjects line to NoDebugAttr [NFC].
Paul Robinson [Fri, 29 Apr 2016 17:03:34 +0000 (17:03 +0000)]
Add a Subjects line to NoDebugAttr [NFC].

The 'nodebug' attribute had hand-coded constraints; replace those with
a Subjects line in Attr.td.
Also add a missing test to verify the attribute is okay on an
Objective-C method.

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

llvm-svn: 268065

8 years ago[PPC] Enable shuffling of VSX vectors
Guozhi Wei [Fri, 29 Apr 2016 17:00:54 +0000 (17:00 +0000)]
[PPC] Enable shuffling of VSX vectors

This patch fixes PR27078 by enabling shuffling of vectors if VSX is available.

llvm-svn: 268064

8 years agoFixed LIT tests that was broken after change in r268054.
Amjad Aboud [Fri, 29 Apr 2016 16:54:18 +0000 (16:54 +0000)]
Fixed LIT tests that was broken after change in r268054.

llvm-svn: 268063

8 years agoAdd operator- to Path's reverse_iterator. Needed for D19666
Filipe Cabecinhas [Fri, 29 Apr 2016 16:48:07 +0000 (16:48 +0000)]
Add operator- to Path's reverse_iterator. Needed for D19666

Reviewers: rafael, craig.topper, bogner

Subscribers: llvm-commits

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

llvm-svn: 268062

8 years agoauto-generate checks
Sanjay Patel [Fri, 29 Apr 2016 16:39:37 +0000 (16:39 +0000)]
auto-generate checks

llvm-svn: 268061

8 years agoFix producing undefined reference to __progname.
Rafael Espindola [Fri, 29 Apr 2016 16:23:31 +0000 (16:23 +0000)]
Fix producing undefined reference to __progname.

We were not producing them if the library had version info.

llvm-svn: 268060

8 years ago[InstCombine] add helper function for ICmp with constant canonicalization; NFCI
Sanjay Patel [Fri, 29 Apr 2016 16:22:25 +0000 (16:22 +0000)]
[InstCombine] add helper function for ICmp with constant canonicalization; NFCI

As suggested in http://reviews.llvm.org/D17859 , we should enhance this
to support vectors.

llvm-svn: 268059

8 years ago[mips][ias] Move createCpRestoreMemOp to MipsTargetStreamer. NFC.
Daniel Sanders [Fri, 29 Apr 2016 16:16:49 +0000 (16:16 +0000)]
[mips][ias] Move createCpRestoreMemOp to MipsTargetStreamer. NFC.

Summary:
This removes the temporary call to isIntegratedAssemblerRequired() which was
added recently. It's effect is now acheived directly in the MipsTargetStreamer
hierarchy.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

llvm-svn: 268058

8 years agoFix NDEBUG build: variables used only in debug code causing compile error
Krzysztof Parzyszek [Fri, 29 Apr 2016 16:14:00 +0000 (16:14 +0000)]
Fix NDEBUG build: variables used only in debug code causing compile error

llvm-svn: 268057

8 years agoELF: Add -O0 (produce output as fast as possible) mode.
Rui Ueyama [Fri, 29 Apr 2016 16:12:29 +0000 (16:12 +0000)]
ELF: Add -O0 (produce output as fast as possible) mode.

This patch redefines the default optimization level as 1 and adds
new level 0. In the command line, it is -O0. The flag disables
costly but optional features so that the linker produces semantically
correct but larger output quickly. Currently it only disables
section merging.

This flag is not intended to be used for final production linking.
It is intended to be used in compile-link-test cycle.

Time to link clang with debug info is about 2x faster with the flag.

  Head:
  13.24 seconds
  Output size: 1227189664 bytes

  With this patch:
  7.41 seconds
  Output size: 2490281784 bytes

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

llvm-svn: 268056

8 years agoRecommitted r264281 "Supporting all entities declared in lexical scope in LLVM debug...
Amjad Aboud [Fri, 29 Apr 2016 16:08:08 +0000 (16:08 +0000)]
Recommitted r264281 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26942 in r267004.

llvm-svn: 268055

8 years agoRecommitted r264280 "Supporting all entities declared in lexical scope in LLVM debug...
Amjad Aboud [Fri, 29 Apr 2016 16:07:55 +0000 (16:07 +0000)]
Recommitted r264280 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26942 in r267004.

llvm-svn: 268054

8 years ago[mips][FastISel] A store is not a load.
Simon Dardis [Fri, 29 Apr 2016 16:07:47 +0000 (16:07 +0000)]
[mips][FastISel] A store is not a load.

Correct trivial error. One of the failing tests from PR/27458.

Reviewers: dsanders, vkalintiris, mcrosier

Differential Review: http://reviews.llvm.org/D19726

llvm-svn: 268053

8 years ago[PATCH] [mips] Fix forbidden slot hazard handling
Simon Dardis [Fri, 29 Apr 2016 16:04:18 +0000 (16:04 +0000)]
[PATCH] [mips] Fix forbidden slot hazard handling

MipsHazardSchedule has to determine what the next physical machine instruction
is to decide whether to insert a nop. In case where a branch with a forbidden
slot appears at the end of a basic block, first *real* instruction of the next
physical basic block was determined using getFirstNonDebugInstr().

Unfortunately this only considers DBG_VALUEs and not other transient opcodes
such as EHLABEL. As EHLABEL passes the SafeInForbiddenSlot predicate and the
instruction after the EHLABEL can be a CTI, we observed test failures in the
LNT testsuite.

Reviewers: dsanders

Differential Review: http://reviews.llvm.org/D19051

llvm-svn: 268052

8 years ago[Hexagon] Optimize addressing modes for load/store
Krzysztof Parzyszek [Fri, 29 Apr 2016 15:49:13 +0000 (15:49 +0000)]
[Hexagon] Optimize addressing modes for load/store

Patch by Jyotsna Verma.

llvm-svn: 268051

8 years agoUnify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake...
Filipe Cabecinhas [Fri, 29 Apr 2016 15:22:48 +0000 (15:22 +0000)]
Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.

Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

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

llvm-svn: 268050

8 years agoRemove leftover
Tobias Grosser [Fri, 29 Apr 2016 15:08:05 +0000 (15:08 +0000)]
Remove leftover

llvm-svn: 268049

8 years agocmake: Set LINK_POLLY_INTO_TOOLS to ON (v2)
Tobias Grosser [Fri, 29 Apr 2016 15:07:22 +0000 (15:07 +0000)]
cmake: Set LINK_POLLY_INTO_TOOLS to ON (v2)

This is the second try. This time we disable this feature if no Polly checkout
is available. For this to work we need to check if tools/polly is present
early enough that our decision is known before cmake generates Config/config.h.

With Polly checked into LLVM it was since a long time possible to compile
clang/opt/bugpoint with Polly support directly linked in, instead of only
providing Polly as a separate loadable module. This commit switches the
default from providing Polly as a module to linking Polly into tools, such
that it becomes unnecessary to load the Polly module when playing with Polly.
Such configuration has shown a lot more convenient for day-to-day Polly use.

This change does not impact the default behavior of any tool, if Polly is not
explicitly enabled when calling clang/opt/bugpoint Polly does not affect
compilation.

This change also does not impact normal LLVM/clang checkouts that do not
contain Polly.

Reviewers: jdoerfert, Meinersbur

Subscribers: pollydev, llvm-commits

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

llvm-svn: 268048

8 years ago[ARM] Guard the declarations of f16 to f32 vcvt intrinsics in arm_neon.h by testing...
Silviu Baranga [Fri, 29 Apr 2016 15:03:32 +0000 (15:03 +0000)]
[ARM] Guard the declarations of f16 to f32 vcvt intrinsics in arm_neon.h by testing __ARM_FP

Summary:
Conversions between float and half are only available when the
taraget has the half-precision extension. Guard these intrinsics
so that they don't cause crashes in the backend.

Fixes PR27550.

Reviewers: rengolin, t.p.northover

Subscribers: cfe-commits, aemerson, t.p.northover, rengolin

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

llvm-svn: 268047

8 years ago[sanitizers] [SystemZ] Mark kernel 3.12.58+ as safe from CVE-2016-2143.
Marcin Koscielnicki [Fri, 29 Apr 2016 14:59:19 +0000 (14:59 +0000)]
[sanitizers] [SystemZ] Mark kernel 3.12.58+ as safe from CVE-2016-2143.

llvm-svn: 268046

8 years agofix typo; NFC
Sanjay Patel [Fri, 29 Apr 2016 14:53:54 +0000 (14:53 +0000)]
fix typo; NFC

llvm-svn: 268045

8 years agoAdd credit [Test commit]
Piotr Padlewski [Fri, 29 Apr 2016 14:52:12 +0000 (14:52 +0000)]
Add credit [Test commit]

llvm-svn: 268044

8 years agoAMDGPU/SI: Add offset field to ds_permute/ds_bpermute instructions
Tom Stellard [Fri, 29 Apr 2016 14:34:26 +0000 (14:34 +0000)]
AMDGPU/SI: Add offset field to ds_permute/ds_bpermute instructions

Summary:
These instructions can add an immediate offset to the address, like other
ds instructions.

Reviewers: arsenm

Subscribers: arsenm, scchan

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

llvm-svn: 268043

8 years ago[mips][ias] Split expandMemInst between MipsAsmParser and MipsTargetStreamer. Almost...
Daniel Sanders [Fri, 29 Apr 2016 13:43:45 +0000 (13:43 +0000)]
[mips][ias] Split expandMemInst between MipsAsmParser and MipsTargetStreamer. Almost NFC.

Summary:
The portion in MipsAsmParser is responsible for figuring out which expansion to
use, while the portion in MipsTargetStreamer is responsible for emitting it.

This allows us to remove the call to isIntegratedAssemblerRequired() which is
currently ensuring the effect of .cprestore only occurs when writing objects.

The small functional change is that the memory offsets are now correctly
printed as signed values.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

llvm-svn: 268042

8 years ago[mips][ias] Moved most instruction emission helpers to MipsTargetStreamer. NFC.
Daniel Sanders [Fri, 29 Apr 2016 13:33:12 +0000 (13:33 +0000)]
[mips][ias] Moved most instruction emission helpers to MipsTargetStreamer. NFC.

Summary:
* Moved all the emit*() helpers to MipsTargetStreamer.
* Moved createNop() to MipsTargetStreamer as emitNop() and emitEmptyDelaySlot().
  This instruction has been split to distinguish between the 'nop' instruction
  and the nop used in delay slots which is sometimes a different nop to the
  'nop' instruction (e.g. for short delay slots on microMIPS).
* Moved createAddu() to MipsTargetStreamer as emitAddu().
* Moved createAppropriateDSLL() to MipsTargetStreamer as emitDSLL().

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

llvm-svn: 268041

8 years ago[ELF] Fixed warning. NFC.
George Rimar [Fri, 29 Apr 2016 13:32:30 +0000 (13:32 +0000)]
[ELF] Fixed warning. NFC.

SymbolTable.cpp:298:36: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
     Sym->Binding = New->isShared() ? STB_GLOBAL : New->Binding;
                                    ^

llvm-svn: 268040

8 years ago[mips] Update tests to account for section size rounding change in r268036.
Daniel Sanders [Fri, 29 Apr 2016 13:21:26 +0000 (13:21 +0000)]
[mips] Update tests to account for section size rounding change in r268036.

llvm-svn: 268039

8 years agocmake: Fix grammar
Tobias Grosser [Fri, 29 Apr 2016 13:03:40 +0000 (13:03 +0000)]
cmake: Fix grammar

llvm-svn: 268038

8 years ago[find-all-symbols] Parallelize the merge step.
Benjamin Kramer [Fri, 29 Apr 2016 12:46:27 +0000 (12:46 +0000)]
[find-all-symbols] Parallelize the merge step.

There is still more parallelism to get here because we synchonize on the
actual uniquing but just doing YAML parsing in parallel already gives a
significant speedup.

Merging all symbols in LLVM+clang+compiler-rt+lld+libc++, 48 cores.
before: 201.55s user 1.47s system 99% cpu 3:23.04 total
after:  276.99s user 7.63s system 838% cpu 33.947 total

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

llvm-svn: 268037

8 years ago[mips][ias] Make section sizes a multiple of the alignment.
Daniel Sanders [Fri, 29 Apr 2016 12:44:07 +0000 (12:44 +0000)]
[mips][ias] Make section sizes a multiple of the alignment.

Reviewers: sdardis

Subscribers: dsanders, llvm-commits, sdardis

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

llvm-svn: 268036

8 years agoRevert "cmake: Set LINK_POLLY_INTO_TOOLS to ON"
Tobias Grosser [Fri, 29 Apr 2016 12:38:24 +0000 (12:38 +0000)]
Revert "cmake: Set LINK_POLLY_INTO_TOOLS to ON"

This reverts commit r268033 as it breaks some buildbots.

llvm-svn: 268035

8 years agodoc: A source code with Polly does not use a separate module (by default)
Tobias Grosser [Fri, 29 Apr 2016 12:35:46 +0000 (12:35 +0000)]
doc: A source code with Polly does not use a separate module (by default)

llvm-svn: 268034

8 years agocmake: Set LINK_POLLY_INTO_TOOLS to ON
Tobias Grosser [Fri, 29 Apr 2016 12:23:11 +0000 (12:23 +0000)]
cmake: Set LINK_POLLY_INTO_TOOLS to ON

With Polly checked into LLVM it was since a long time possible to compile
clang/opt/bugpoint with Polly support directly linked in, instead of only
providing Polly as a separate loadable module. This commit switches the
default from providing Polly as a module to linking Polly into tools, such
that it becomes unnecessary to load the Polly module when playing with Polly.
Such configuration has shown a lot more convenient for day-to-day Polly use.

This change does not impact the default behavior of any tool, if Polly is not
explicitly enabled when calling clang/opt/bugpoint Polly does not affect
compilation.

This change also does not impact normal LLVM/clang checkouts that do not
contain Polly.

Reviewers: jdoerfert, Meinersbur, sebpop, etherzhhb, zinob, hiraditya

Subscribers: pollydev, llvm-commits

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

llvm-svn: 268033

8 years agoAllow unsigned divisions
Johannes Doerfert [Fri, 29 Apr 2016 11:53:35 +0000 (11:53 +0000)]
Allow unsigned divisions

  After zero-extend operations and unsigned comparisons we now allow
  unsigned divisions. The handling is basically the same as for signed
  division, except the interpretation of the operands. As the divisor
  has to be constant in both cases we can simply interpret it as an
  unsigned value without additional complexity in the representation.
  For the dividend we could choose from the different representation
  schemes introduced for zero-extend operations but for now we will
  simply use an assumption.

llvm-svn: 268032

8 years agoRefactor SCEVAffinator [NFC]
Johannes Doerfert [Fri, 29 Apr 2016 11:52:30 +0000 (11:52 +0000)]
Refactor SCEVAffinator [NFC]

llvm-svn: 268031

8 years agoScopInfo: Add option to control abort on isl errors
Tobias Grosser [Fri, 29 Apr 2016 11:43:20 +0000 (11:43 +0000)]
ScopInfo: Add option to control abort on isl errors

For debugging it is often convenient to not abort at the very first memory
management error. This option allows to control this behavior at run-time.

llvm-svn: 268030

8 years agoRecommit "[MS] Improved implementation of stack pragmas (vtordisp, *_seg)"
Denis Zobnin [Fri, 29 Apr 2016 11:27:00 +0000 (11:27 +0000)]
Recommit "[MS] Improved implementation of stack pragmas (vtordisp, *_seg)"

Slightly updated version, double-checked build and tests.
Improve implementation of MS pragmas that use stack + compatibility fixes.
This patch:
  1. Changes implementation of #pragma vtordisp to use PragmaStack class
     that other stack pragmas use;
  2. Fixes "#pragma vtordisp()" behavior - it shouldn't affect the stack;
  3. Supports "save-restore" of pragma stacks on enter / exit a C++ method
     body, as MSVC does.

TODO:
  1. Change implementation of #pragma pack to use the same approach;
  2. Introduce diagnostics on popping named stack slots, as MSVC does.

Reviewers:
  rnk, thakis

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

llvm-svn: 268029

8 years ago[clang][BuiltIn][AVX512]Adding intrinsics for cmp{ss|sd} instruction set.
Michael Zuckerman [Fri, 29 Apr 2016 11:01:16 +0000 (11:01 +0000)]
[clang][BuiltIn][AVX512]Adding intrinsics for cmp{ss|sd} instruction set.

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

llvm-svn: 268028

8 years ago[FIX] Typo
Johannes Doerfert [Fri, 29 Apr 2016 10:47:07 +0000 (10:47 +0000)]
[FIX] Typo

llvm-svn: 268027

8 years ago[FIX] Prevent division/modulo by zero in parameters -- test case
Johannes Doerfert [Fri, 29 Apr 2016 10:45:39 +0000 (10:45 +0000)]
[FIX] Prevent division/modulo by zero in parameters -- test case

  This commits a test case for r268023.

llvm-svn: 268026

8 years ago[FIX] Unsigned comparisons change invalid domain
Johannes Doerfert [Fri, 29 Apr 2016 10:44:41 +0000 (10:44 +0000)]
[FIX] Unsigned comparisons change invalid domain

  It does not suffice to take a global assumptions for unsigned comparisons but
  we also need to adjust the invalid domain of the statements guarded by such
  an assumption. To this end we allow to specialize the getPwAff call now in
  order to indicate unsigned interpretation.

llvm-svn: 268025

8 years ago[ELF][MIPS] Accept MIPS 64-bit binaries
Simon Atanasyan [Fri, 29 Apr 2016 10:39:17 +0000 (10:39 +0000)]
[ELF][MIPS] Accept MIPS 64-bit binaries

LLD accepts MIPS 64-bit binaries, supports corresponding eulation (-m)
arguments and emits 64-bit specific ELF flags.

llvm-svn: 268024

8 years ago[FIX] Prevent division/modulo by zero in parameters
Johannes Doerfert [Fri, 29 Apr 2016 10:36:58 +0000 (10:36 +0000)]
[FIX] Prevent division/modulo by zero in parameters

  When we materialize parameter SCEVs we did so without considering the
  side effects they might have, e.g., both division and modulo are
  undefined if the right hand side is zero. This is a problem because we
  potentially extended the domain under which we evaluate parameters,
  thus we might have introduced such undefined behaviour. To prevent
  that from happening we will now guard divisions and modulo operations
  in the parameters with a compare and select.

llvm-svn: 268023

8 years agoMake run-find-all-symbols executable.
Benjamin Kramer [Fri, 29 Apr 2016 10:33:11 +0000 (10:33 +0000)]
Make run-find-all-symbols executable.

llvm-svn: 268022

8 years ago[find-all-symbols] Fix racy yaml file writing.
Benjamin Kramer [Fri, 29 Apr 2016 10:16:28 +0000 (10:16 +0000)]
[find-all-symbols] Fix racy yaml file writing.

If multiple find-all-symbols processes access the temporary directory
simultaneously with two files with the same name they would collide and
create a broken yaml file. Fix this by using the safe createUniqueFile
API from LLVM instead.

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

llvm-svn: 268021

8 years ago[OPENMP] Fix detection of explicit data-sharing attributes in templates.
Alexey Bataev [Fri, 29 Apr 2016 09:56:11 +0000 (09:56 +0000)]
[OPENMP] Fix detection of explicit data-sharing attributes in templates.

Fixes a bug with analysis of data-sharing attributes in templates.

llvm-svn: 268020

8 years ago[find-all-symbols] Save absolute file path instead of relative file path in SymbolInfo.
Haojian Wu [Fri, 29 Apr 2016 09:45:09 +0000 (09:45 +0000)]
[find-all-symbols] Save absolute file path instead of relative file path in SymbolInfo.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 268019

8 years agoImplementation of VlA of GNU C++ extension, by Vladimir Yakovlev.
Alexey Bataev [Fri, 29 Apr 2016 09:39:50 +0000 (09:39 +0000)]
Implementation of VlA of GNU C++ extension, by Vladimir Yakovlev.

This enables GNU C++ extension "Variable length array" by default.
Differential Revision: http://reviews.llvm.org/D18823

llvm-svn: 268018

8 years ago[include-fixer] Add Yaml database integration.
Haojian Wu [Fri, 29 Apr 2016 09:23:38 +0000 (09:23 +0000)]
[include-fixer] Add Yaml database integration.

Reviewers: bkramer

Subscribers: cfe-commits, klimek, djasper

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

llvm-svn: 268017

8 years ago[InstCombine][SSE] Added x86 pshufb undef mask tests
Simon Pilgrim [Fri, 29 Apr 2016 09:13:53 +0000 (09:13 +0000)]
[InstCombine][SSE] Added x86 pshufb undef mask tests

FIXME: We currently don't support folding constant pshufb shuffle masks containing undef elements.
llvm-svn: 268016

8 years agoAMDGPU/SI: Assembler: Unify parsing/printing of operands.
Nikolay Haustov [Fri, 29 Apr 2016 09:02:30 +0000 (09:02 +0000)]
AMDGPU/SI: Assembler: Unify parsing/printing of operands.

Summary:
The goal is for each operand type to have its own parse function and
at the same time share common code for tracking state as different
instruction types share operand types (e.g. glc/glc_flat, etc).

Introduce parseAMDGPUOperand which can parse any optional operand.
DPP and Clamp/OMod have custom handling for now. Sam also suggested
to have class hierarchy for operand types instead of table. This
can be done in separate change.

Remove parseVOP3OptionalOps, parseDS*OptionalOps, parseFlatOptionalOps,
parseMubufOptionalOps, parseDPPOptionalOps.
Reduce number of definitions of AsmOperand's and MatchClasses' by using common base class.
Rename AsmMatcher/InstPrinter methods accordingly.
Print immediate type when printing parsed immediate operand.
Use 'off' if offset/index register is unused instead of skipping it to make it more readable (also agreed with SP3).
Update tests.

Reviewers: tstellarAMD, SamWot, artem.tamazov

Subscribers: qcolombet, arsenm, llvm-commits

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

llvm-svn: 268015

8 years ago[InstCombine][SSE] Regenerated x86 pshufb tests
Simon Pilgrim [Fri, 29 Apr 2016 08:53:35 +0000 (08:53 +0000)]
[InstCombine][SSE] Regenerated x86 pshufb tests

llvm-svn: 268014

8 years ago[Clang][AVX512][Builtin] Adding intrinsics for compress instruction set
Michael Zuckerman [Fri, 29 Apr 2016 08:52:02 +0000 (08:52 +0000)]
[Clang][AVX512][Builtin] Adding intrinsics for compress instruction set

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

llvm-svn: 268013

8 years ago[mips][microMIPS] Fix offsets for LLE, LWE, SBE, SCE and SHE instructions
Zlatko Buljan [Fri, 29 Apr 2016 08:36:54 +0000 (08:36 +0000)]
[mips][microMIPS] Fix offsets for LLE, LWE, SBE, SCE and SHE instructions
Differential Revision: http://reviews.llvm.org/D18645

llvm-svn: 268012

8 years ago[GlobalOpt] Propagate operand bundles
David Majnemer [Fri, 29 Apr 2016 08:07:22 +0000 (08:07 +0000)]
[GlobalOpt] Propagate operand bundles

We neglected to transfer operand bundles for some transforms.  These
were found via inspection, I'll try to come up with some test cases.

llvm-svn: 268011

8 years ago[InstCombine] Propagate operand bundles
David Majnemer [Fri, 29 Apr 2016 08:07:20 +0000 (08:07 +0000)]
[InstCombine] Propagate operand bundles

We neglected to transfer operand bundles for some transforms.  These
were found via inspection, I'll try to come up with some test cases.

llvm-svn: 268010

8 years agoFix PR21428 for long. Buffer was one byte too small in octal formatting case. Rename...
Eric Fiselier [Fri, 29 Apr 2016 07:23:20 +0000 (07:23 +0000)]
Fix PR21428 for long. Buffer was one byte too small in octal formatting case. Rename previously added test

llvm-svn: 268009

8 years ago[DeadArgumentElimination] Propagate operand bundles to promoted call sites
David Majnemer [Fri, 29 Apr 2016 07:22:36 +0000 (07:22 +0000)]
[DeadArgumentElimination] Propagate operand bundles to promoted call sites

We neglected to transfer operand bundles when performing argument
promotion.

llvm-svn: 268008

8 years ago[LoopDist] Add missing RUN line in test from r268006
Adam Nemet [Fri, 29 Apr 2016 07:16:00 +0000 (07:16 +0000)]
[LoopDist] Add missing RUN line in test from r268006

llvm-svn: 268007

8 years ago[LoopDist] Also emit optimization remark on success (-Rpass=)
Adam Nemet [Fri, 29 Apr 2016 07:10:46 +0000 (07:10 +0000)]
[LoopDist] Also emit optimization remark on success (-Rpass=)

The option -Rpass=loop-distribute now reports the loops that were
distributed.

llvm-svn: 268006

8 years ago[LoopDist] Pass 'Function' to main class. NFC
Adam Nemet [Fri, 29 Apr 2016 07:10:39 +0000 (07:10 +0000)]
[LoopDist] Pass 'Function' to main class. NFC

Next patch will add another use for 'Function' inside the class.

llvm-svn: 268005

8 years ago[SLPVectorizer] Add operand bundles to vectorized functions
David Majnemer [Fri, 29 Apr 2016 07:09:51 +0000 (07:09 +0000)]
[SLPVectorizer] Add operand bundles to vectorized functions

SLPVectorizing a call site should result in further propagation of its
bundles.

llvm-svn: 268004

8 years ago[LoopVectorize] Add operand bundles to vectorized functions
David Majnemer [Fri, 29 Apr 2016 07:09:48 +0000 (07:09 +0000)]
[LoopVectorize] Add operand bundles to vectorized functions

Also, do not crash when calculating a cost model for loop-invariant
token values.

llvm-svn: 268003

8 years agoAMDGPU: Stop reporting an addressing mode for unknown addrspace
Matt Arsenault [Fri, 29 Apr 2016 06:25:10 +0000 (06:25 +0000)]
AMDGPU: Stop reporting an addressing mode for unknown addrspace

This was being treated the same as private, which has an immediate
offset. For unknown, it probably means it's for a computation not
actually being used for accessing memory, so it should not have a
nontrivial addressing mode.

llvm-svn: 268002

8 years agoDivergenceAnalysis: Fix crash with unreachable blocks
Matt Arsenault [Fri, 29 Apr 2016 06:17:47 +0000 (06:17 +0000)]
DivergenceAnalysis: Fix crash with unreachable blocks

Unreachable blocks may not be in the dominator tree,
so don't crash on them.

llvm-svn: 268001