platform/upstream/llvm.git
8 years agoNFC: simplify code in BuildInstanceMessage.
Manman Ren [Thu, 7 Apr 2016 19:30:20 +0000 (19:30 +0000)]
NFC: simplify code in BuildInstanceMessage.

Instead of searching the global pool multiple times: in
LookupFactoryMethodInGlobalPool, LookupInstanceMethodInGlobalPool,
CollectMultipleMethodsInGlobalPool, and AreMultipleMethodsInGlobalPool,
we now collect the method candidates in CollectMultipleMethodsInGlobalPool
only, and other functions will use the collected method set.

This commit adds parameter "Methods" to AreMultipleMethodsInGlobalPool,
and SelectBestMethod. It also changes the implementation of
CollectMultipleMethodsInGlobalPool to collect the desired kind first, if none is
found, to collect the other kind. This avoids the need to call both
LookupFactoryMethodInGlobalPool and LookupInstanceMethodInGlobalPool.

llvm-svn: 265711

8 years agoELF: Implement --start-lib and --end-lib
Rui Ueyama [Thu, 7 Apr 2016 19:24:51 +0000 (19:24 +0000)]
ELF: Implement --start-lib and --end-lib

start-lib and end-lib are options to link object files in the same
semantics as archive files. If an object is in start-lib and end-lib,
the object is linked only when the file is needed to resolve
undefined symbols. That means, if an object is in start-lib and end-lib,
it behaves as if it were in an archive file.

In this patch, I introduced a new notion, LazyObjectFile. That is
analogous to Archive file type, but that works for a single object
file instead of for an archive file.

http://reviews.llvm.org/D18814

llvm-svn: 265710

8 years agoAMDGPU/SI: Implement atomic load/store for i32 and i64
Jan Vesely [Thu, 7 Apr 2016 19:23:11 +0000 (19:23 +0000)]
AMDGPU/SI: Implement atomic load/store for i32 and i64

Standard load/store instructions with GLC bit set.

Reviewers: tstellardAMD, arsenm

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

llvm-svn: 265709

8 years agoAMDGPU/SI: Add latency for export instructions
Tom Stellard [Thu, 7 Apr 2016 18:30:05 +0000 (18:30 +0000)]
AMDGPU/SI: Add latency for export instructions

Reviewers: arsenm, nhaehnle

Subscribers: nhaehnle, arsenm, llvm-commits

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

llvm-svn: 265708

8 years ago[RegBankSelect] Initial implementation for non-optimized output.
Quentin Colombet [Thu, 7 Apr 2016 18:19:27 +0000 (18:19 +0000)]
[RegBankSelect] Initial implementation for non-optimized output.
The pass walk through the machine function and assign the register banks
using the default mapping. In other words, there is no attempt to reduce
cross register copies.

llvm-svn: 265707

8 years agoRecommit r263036 with additional inlining, so that it will continue to work with...
Marshall Clow [Thu, 7 Apr 2016 18:13:41 +0000 (18:13 +0000)]
Recommit r263036 with additional inlining, so that it will continue to work with existing system dylibs. Implements LWG#2583

llvm-svn: 265706

8 years ago[sanitizer] Add early call handling to strlen interceptor
Derek Bruening [Thu, 7 Apr 2016 18:07:09 +0000 (18:07 +0000)]
[sanitizer] Add early call handling to strlen interceptor

Summary:
The strlen interceptor is sometimes invoked too early for REAL(strlen) to
be initialized.  A special check is added to use internal_strlen for this
situation.

Reviewers: dim

Subscribers: llvm-commits, samsonov

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

Change-Id: I3acc58f4abbae1904f25324abd84efea67aad0a2
llvm-svn: 265705

8 years ago[RegisterBankInfo] Add more details on the expectation of
Quentin Colombet [Thu, 7 Apr 2016 18:07:07 +0000 (18:07 +0000)]
[RegisterBankInfo] Add more details on the expectation of
getInstrMapping.

llvm-svn: 265704

8 years ago[RegisterBankInfo] Provide a target independent helper function to guess
Quentin Colombet [Thu, 7 Apr 2016 18:01:19 +0000 (18:01 +0000)]
[RegisterBankInfo] Provide a target independent helper function to guess
the mapping of an instruction on register bank.

For most instructions, it is possible to guess the mapping of the
instruciton by using the encoding constraints.
It remains instructions without encoding constraints.
For copy-like instructions, we try to propagate the information we get
from the other operands. Otherwise, the target has to give this
information.

llvm-svn: 265703

8 years agoBasic: move CodeGenOptions from Frontend
Saleem Abdulrasool [Thu, 7 Apr 2016 17:49:44 +0000 (17:49 +0000)]
Basic: move CodeGenOptions from Frontend

This is a mechanical move of CodeGenOptions from libFrontend to libBasic.  This
fixes the layering violation introduced earlier by threading CodeGenOptions into
TargetInfo.  It should also fix the modules based self-hosting builds.  NFC.

llvm-svn: 265702

8 years ago[RegisterBankInfo] Change the signature of getSizeInBits to factor out
Quentin Colombet [Thu, 7 Apr 2016 17:44:54 +0000 (17:44 +0000)]
[RegisterBankInfo] Change the signature of getSizeInBits to factor out
the access to MRI and TRI.

llvm-svn: 265701

8 years agoMinor Wdocumentation fix. NFCI.
Simon Pilgrim [Thu, 7 Apr 2016 17:38:24 +0000 (17:38 +0000)]
Minor Wdocumentation fix. NFCI.

llvm-svn: 265700

8 years ago[RegisterBankInfo] Provide a default constructor for InstructionMapping
Quentin Colombet [Thu, 7 Apr 2016 17:30:18 +0000 (17:30 +0000)]
[RegisterBankInfo] Provide a default constructor for InstructionMapping
helper class.

The default constructor creates invalid (isValid() == false) instances
and may be used to communicate that a mapping was not found.

llvm-svn: 265699

8 years agoMention readability-static-definition-in-anonymous-namespace in release notes.
Eugene Zelenko [Thu, 7 Apr 2016 17:28:35 +0000 (17:28 +0000)]
Mention readability-static-definition-in-anonymous-namespace in release notes.

Consistency in using ` and ``.

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

llvm-svn: 265698

8 years ago[X86][SSE] Added bitmask pattern shuffle tests
Simon Pilgrim [Thu, 7 Apr 2016 17:23:55 +0000 (17:23 +0000)]
[X86][SSE] Added bitmask pattern shuffle tests

Based on OR(AND(MASK,V0),AND(~MASK,V1)) style patterns

llvm-svn: 265697

8 years ago[MachineRegisterInfo] Track register bank for virtual registers.
Quentin Colombet [Thu, 7 Apr 2016 17:20:29 +0000 (17:20 +0000)]
[MachineRegisterInfo] Track register bank for virtual registers.
A virtual register may have either a register bank or a register class.
This is represented by a PointerUnion between the related classes.

Typically, a virtual register went through the following states
regarding register class and register bank:

1. Creation: None is set. Virtual registers are fully generic.
2. Register bank assignment: Register bank is set. Virtual registers
live into a register bank, but we do not know the constraints they need
to fulfil.
3. Instruction selection: Register class is set. Virtual registers are
bound by encoding constraints.

To map these states to GlobalISel, the IRTranslator implements #1,
RegBankSelect #2, and Select #3.

llvm-svn: 265696

8 years ago[RegisterBank] Rename RegisterBank::contains into RegisterBank::covers.
Quentin Colombet [Thu, 7 Apr 2016 17:09:39 +0000 (17:09 +0000)]
[RegisterBank] Rename RegisterBank::contains into RegisterBank::covers.

llvm-svn: 265695

8 years ago[PPC] Added a note to release notes
Ehsan Amiri [Thu, 7 Apr 2016 16:47:35 +0000 (16:47 +0000)]
[PPC] Added a note to release notes

A draft line added to release notes for PPC, to keep a record of changes.
This is just a draft and will be rewritten towards the end of release.

llvm-svn: 265694

8 years ago[SystemZ] Fix build break from r265689
Ulrich Weigand [Thu, 7 Apr 2016 16:33:25 +0000 (16:33 +0000)]
[SystemZ] Fix build break from r265689

Fix build error seen on some build bots due to:
error: default label in switch which covers all enumeration values

llvm-svn: 265693

8 years ago[sancov] updaing android test
Mike Aizatsky [Thu, 7 Apr 2016 16:22:34 +0000 (16:22 +0000)]
[sancov] updaing android test

llvm-svn: 265692

8 years ago[clang-tidy] add new checker for string literal with NUL character.
Etienne Bergeron [Thu, 7 Apr 2016 16:16:36 +0000 (16:16 +0000)]
[clang-tidy] add new checker for string literal with NUL character.

Summary:
This patch adds the support for detecting suspicious string
literals and their //incorrect// usage.

The following example shows a incorrect character escaping leading
to an embedded NUL character.
```
  std::string str = "\0x42";   // Should be "\x42".
```

The patch also add detection of truncated literal when a literal
is passed to a string constructor.

Reviewers: hokein, alexfh

Subscribers: LegalizeAdulthood, bcraig, Eugene.Zelenko, bkramer, cfe-commits

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

llvm-svn: 265691

8 years ago[X86]: Fix for PR27251.
Kevin B. Smith [Thu, 7 Apr 2016 16:15:34 +0000 (16:15 +0000)]
[X86]: Fix for PR27251.
Differential Revision: http://reviews.llvm.org/D18850

llvm-svn: 265690

8 years ago[SystemZ] Implement conditional returns
Ulrich Weigand [Thu, 7 Apr 2016 16:11:44 +0000 (16:11 +0000)]
[SystemZ] Implement conditional returns

Return is now considered a predicable instruction, and is converted
to a newly-added CondReturn (which maps to BCR to %r14) instruction by
the if conversion pass.

Also, fused compare-and-branch transform knows about conditional
returns, emitting the proper fused instructions for them.

This transform triggers on a *lot* of tests, hence the huge diffstat.
The changes are mostly jX to br %r14 -> bXr %r14.

Author: koriakin

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

llvm-svn: 265689

8 years ago[IR/Verifier] Merge two ifs into one. NFC.
Davide Italiano [Thu, 7 Apr 2016 15:55:28 +0000 (15:55 +0000)]
[IR/Verifier] Merge two ifs into one. NFC.

llvm-svn: 265688

8 years ago[GVN] Address review comments for D18662
Ulrich Weigand [Thu, 7 Apr 2016 15:55:11 +0000 (15:55 +0000)]
[GVN] Address review comments for D18662

As suggested by Chandler in his review comments for D18662, this
follow-on patch renames some variables in GetLoadValueForLoad and
CoerceAvailableValueToLoadType to hopefully make it more obvious
which variables hold value sizes and which hold load/store sizes.

No functional change intended.

llvm-svn: 265687

8 years agoFix an use after free.
Rafael Espindola [Thu, 7 Apr 2016 15:50:23 +0000 (15:50 +0000)]
Fix an use after free.

Thanks to asan for pointing it out that OutputSections was being
resized.

llvm-svn: 265686

8 years agoNFC: disallow comparison of AtomicOrdering
JF Bastien [Thu, 7 Apr 2016 15:50:05 +0000 (15:50 +0000)]
NFC: disallow comparison of AtomicOrdering

Follow-up to D18775 and related clang change. AtomicOrdering is a lattice, 'stronger' is the right thing to do, direct comparison is fraught with peril.

llvm-svn: 265685

8 years ago[GVN] Fix handling of sub-byte types in big-endian mode
Ulrich Weigand [Thu, 7 Apr 2016 15:45:02 +0000 (15:45 +0000)]
[GVN] Fix handling of sub-byte types in big-endian mode

When GVN wants to re-interpret an already available value in a smaller
type, it needs to right-shift the value on big-endian systems to ensure
the correct bytes are accessed.  The shift value is the difference of
the sizes of the two types.

This is correct as long as both types occupy multiples of full bytes.
However, when one of them is a sub-byte type like i1, this no longer
holds true: we still need to shift, but only to access the correct
*byte*.  Accessing bits within the byte requires no shift in either
endianness; e.g. an i1 resides in the least-significant bit of its
containing byte on both big- and little-endian systems.

Therefore, the appropriate shift value to be used is the difference of
the *storage* sizes of the two types.  This is already handled correctly
in one place where such a shift takes place (GetStoreValueForLoad), but
is incorrect in two other places: GetLoadValueForLoad and
CoerceAvailableValueToLoadType.

This patch changes both places to use the storage size as well.

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

llvm-svn: 265684

8 years ago[PPC] Enable transformations in PPCPassConfig::addIRPasses at O2
Ehsan Amiri [Thu, 7 Apr 2016 15:30:55 +0000 (15:30 +0000)]
[PPC] Enable transformations in PPCPassConfig::addIRPasses at O2

http://reviews.llvm.org/D18562

A large number of testcases has been modified so they pass after this test.
One testcase is deleted, because I realized even after undoing the original
change that was committed with this testcase, the testcase still passes. So
I removed it. The change to one other testcase (test/CodeGen/PowerPC/pr25802.ll)
is an arbitrary change to keep it passing. Given the original intention of the
testcase, and the fact that fixing it will require some time to change the testcase,
we concluded that this quick change will be enough.

llvm-svn: 265683

8 years agoSimplify dynamic relocation creation.
Rafael Espindola [Thu, 7 Apr 2016 15:20:56 +0000 (15:20 +0000)]
Simplify dynamic relocation creation.

The position of a relocation can always be expressed as an offset in an
output section.

llvm-svn: 265682

8 years ago[clang-tidy] fix a crash with -fdelayed-template-parsing in UnnecessaryValueParamCheck.
Etienne Bergeron [Thu, 7 Apr 2016 14:58:13 +0000 (14:58 +0000)]
[clang-tidy] fix a crash with -fdelayed-template-parsing in UnnecessaryValueParamCheck.

Summary:
This is the same kind of bug than [[ http://reviews.llvm.org/D18238 | D18238 ]].

Fix crashes caused by deferencing null pointer when declarations parsing may be delayed.
The body of the declarations may be null.

The crashes were observed with a Windows build of clang-tidy and the following command-line.
```
command-line switches: -fms-compatibility-version=19 -fms-compatibility
```

Reviewers: alexfh

Subscribers: kimgr, LegalizeAdulthood, cfe-commits

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

llvm-svn: 265681

8 years ago[clang-tidy] Remove unnecessary getName() on Decls and Types feeding into a Diagnosti...
Benjamin Kramer [Thu, 7 Apr 2016 14:55:25 +0000 (14:55 +0000)]
[clang-tidy] Remove unnecessary getName() on Decls and Types feeding into a DiagnosticBuilder

Going through a string removes some of the smarts of the diagnosic printer
and makes the code more complicated. This change has some cosmetic impact
on the output but that's mostly minor.

llvm-svn: 265680

8 years ago[clang-tidy] Fix infinite loop in MisplacedWideningCastCheck.
Etienne Bergeron [Thu, 7 Apr 2016 14:52:52 +0000 (14:52 +0000)]
[clang-tidy] Fix infinite loop in MisplacedWideningCastCheck.

Summary:
In Release mode, the check was infinite looping over chromium code base.

It seems there is something strange with the creation of the Maps.
I believe the compiler is making some assumption with the implicit conversion from enum <-> int.

By moving the map to a standard switch/cases, we no longer allocate memory and we can keep the same behavior. For a small amount of elements, this is fine.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265679

8 years agoAMDGPU/SI: Add MachineBasicBlock parameter to SIInstrInfo::insertWaitStates
Tom Stellard [Thu, 7 Apr 2016 14:47:07 +0000 (14:47 +0000)]
AMDGPU/SI: Add MachineBasicBlock parameter to SIInstrInfo::insertWaitStates

Summary: This makes it possible to insert nops at the end of blocks.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 265678

8 years agoFixing duplicate declaration "_mm256 _mm_set_epi32" in revision 262177
Michael Zuckerman [Thu, 7 Apr 2016 14:44:08 +0000 (14:44 +0000)]
Fixing duplicate declaration "_mm256 _mm_set_epi32" in revision 262177

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

llvm-svn: 265677

8 years agoDelete Off_Bss.
Rafael Espindola [Thu, 7 Apr 2016 14:34:15 +0000 (14:34 +0000)]
Delete Off_Bss.

It is now just a special case of Off_Sec.

llvm-svn: 265676

8 years agomake __builtin_isfinite more efficient (PR27145)
Sanjay Patel [Thu, 7 Apr 2016 14:29:05 +0000 (14:29 +0000)]
make __builtin_isfinite more efficient (PR27145)

isinf (is infinite) and isfinite should be implemented with the same function
except we change the comparison operator.

See PR27145 for more details:
https://llvm.org/bugs/show_bug.cgi?id=27145

Ref: forked off of the discussion in D18513.

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

llvm-svn: 265675

8 years agoAdded a noexcept test
Marshall Clow [Thu, 7 Apr 2016 14:24:16 +0000 (14:24 +0000)]
Added a noexcept test

llvm-svn: 265674

8 years agoDon't create dynamic relocs for discarded .eh_frame entries.
Rafael Espindola [Thu, 7 Apr 2016 14:22:09 +0000 (14:22 +0000)]
Don't create dynamic relocs for discarded .eh_frame entries.

This requires knowing input section offsets in output sections before
scanRelocs. This is generally a good thing and should allow further
simplifications in the creation of dynamic relocations.

llvm-svn: 265673

8 years agoFix bug #27260 - add missing swap(reference, reference) to vector<bool>.
Marshall Clow [Thu, 7 Apr 2016 14:20:31 +0000 (14:20 +0000)]
Fix bug #27260 - add missing swap(reference, reference) to vector<bool>.

llvm-svn: 265672

8 years ago[clang-tidy] Fix FP with readability-redundant-string-init for default arguments
Etienne Bergeron [Thu, 7 Apr 2016 14:18:53 +0000 (14:18 +0000)]
[clang-tidy] Fix FP with readability-redundant-string-init for default arguments

Summary:
Clang-tidy is reporting a warning of redundant string initialisation
on a string parameter initialized with empty string.

See bug: 27087

The reported example is:
```
#include <string>
void fn(std::string a = "");
```

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265671

8 years ago[AMDGPU] fix readlane/readfirstlane src vgpr operand type.
Valery Pykhtin [Thu, 7 Apr 2016 13:41:51 +0000 (13:41 +0000)]
[AMDGPU] fix readlane/readfirstlane src vgpr operand type.

For VGPR_32 operand disassembler expects a VGPR register encoded as 0..255 (enum8 src operand).
readfirstlane/readline actually has enum9 operand and this change fixes VGPR_32 to VS_32 (enum9 encoding).

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

llvm-svn: 265670

8 years agoFix test/Assembler/ifunc-asm.ll test on hexagon-elf bots
Dmitry Polukhin [Thu, 7 Apr 2016 13:18:43 +0000 (13:18 +0000)]
Fix test/Assembler/ifunc-asm.ll test on hexagon-elf bots

Temporary disable llc test, it seems that such test should be in some
other directory.

llvm-svn: 265669

8 years ago[OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'
Alexey Bataev [Thu, 7 Apr 2016 12:45:37 +0000 (12:45 +0000)]
[OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'
construct.

OpenMP 4.0 defines '#pragma omp declare simd' construct that may have
associated 'simdlen' clause with constant positive expression as an
argument:
simdlen(<const_expr>)
Patch adds parsin and semantic analysis for simdlen clause.

llvm-svn: 265668

8 years ago[GCC] Attribute ifunc support in llvm
Dmitry Polukhin [Thu, 7 Apr 2016 12:32:19 +0000 (12:32 +0000)]
[GCC] Attribute ifunc support in llvm

This patch add support for GCC attribute((ifunc("resolver"))) for
targets that use ELF as object file format. In general ifunc is a
special kind of function alias with type @gnu_indirect_function. Patch
for Clang http://reviews.llvm.org/D15524

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

llvm-svn: 265667

8 years ago[tsan] Remove long sleeps from fork tests
Kuba Brecka [Thu, 7 Apr 2016 12:10:28 +0000 (12:10 +0000)]
[tsan] Remove long sleeps from fork tests

On one of our testing machines, we're running the tests under heavy load, and especially in the fork-based TSan tests, we're seeing timeouts when a test uses sleep(10), assuming that calling fork() on another thread will finish sooner than that. This patch removes a timeout and makes another one longer.

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

llvm-svn: 265666

8 years ago[tsan] Add support for OS X OSAtomic* functions
Kuba Brecka [Thu, 7 Apr 2016 12:05:09 +0000 (12:05 +0000)]
[tsan] Add support for OS X OSAtomic* functions

OS X provides atomic functions in libkern/OSAtomic.h. These provide atomic guarantees and they have alternatives which have barrier semantics. This patch adds proper TSan support for the functions from libkern/OSAtomic.h.

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

llvm-svn: 265665

8 years agoAdd a test for the offset of dynamic relocations.
Rafael Espindola [Thu, 7 Apr 2016 12:02:42 +0000 (12:02 +0000)]
Add a test for the offset of dynamic relocations.

I found that a patch I am working on would have broken this and no
existing test found it.

llvm-svn: 265664

8 years ago[tsan] Add TSan __tsan_atomic* functions to tsan_interface.h
Kuba Brecka [Thu, 7 Apr 2016 11:59:36 +0000 (11:59 +0000)]
[tsan] Add TSan __tsan_atomic* functions to tsan_interface.h

To avoid using the public header (tsan_interface_atomic.h), which has different data types, let's add all the __tsan_atomic* functions to tsan_interface.h.

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

llvm-svn: 265663

8 years ago[tsan] Add interceptors for dispatch_apply
Kuba Brecka [Thu, 7 Apr 2016 11:52:51 +0000 (11:52 +0000)]
[tsan] Add interceptors for dispatch_apply

Adding an interceptor with two more release+acquire pairs to avoid false positives with dispatch_apply.

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

llvm-svn: 265662

8 years ago[tsan] Add XPC support (OS X)
Kuba Brecka [Thu, 7 Apr 2016 11:47:11 +0000 (11:47 +0000)]
[tsan] Add XPC support (OS X)

XPC APIs have async callbacks, and we need some more happen-before edges to avoid false positives. This patch add them, plus a test case (sorry for the long boilerplate code, but XPC just needs all that).

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

llvm-svn: 265661

8 years ago[tsan] Add support for dispatch event sources
Kuba Brecka [Thu, 7 Apr 2016 11:38:53 +0000 (11:38 +0000)]
[tsan] Add support for dispatch event sources

GCD has APIs for event sources, we need some more release-acquire pairs to avoid false positives in TSan.

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

llvm-svn: 265660

8 years ago[tsan] Fix synchronization in dispatch_sync
Kuba Brecka [Thu, 7 Apr 2016 11:33:44 +0000 (11:33 +0000)]
[tsan] Fix synchronization in dispatch_sync

In the interceptor for dispatch_sync, we're currently missing synchronization between the callback and the code *after* the call to dispatch_sync. This patch fixes this by adding an extra release+acquire pair to dispatch_sync() and similar APIs. Added a testcase.

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

llvm-svn: 265659

8 years ago[tsan] Fix Darwin tests (missing FileCheck's)
Kuba Brecka [Thu, 7 Apr 2016 11:31:02 +0000 (11:31 +0000)]
[tsan] Fix Darwin tests (missing FileCheck's)

A little embarrassing, but we're missing the call to FileCheck in several Darwin tests. Let's fix this.

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

llvm-svn: 265658

8 years agoInlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]
NAKAMURA Takumi [Thu, 7 Apr 2016 11:30:06 +0000 (11:30 +0000)]
InlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]

llvm-svn: 265657

8 years agoEnabling AddressSanitizer tests, they should pass now (and this time I mean it).
Kuba Brecka [Thu, 7 Apr 2016 11:01:05 +0000 (11:01 +0000)]
Enabling AddressSanitizer tests, they should pass now (and this time I mean it).

llvm-svn: 265656

8 years ago[docs] Update version (http://llvm.org/PR27253)
Alexander Kornienko [Thu, 7 Apr 2016 10:17:23 +0000 (10:17 +0000)]
[docs] Update version (http://llvm.org/PR27253)

llvm-svn: 265655

8 years agoMove class into an anonymous namespace. NFC.
Benjamin Kramer [Thu, 7 Apr 2016 10:14:54 +0000 (10:14 +0000)]
Move class into an anonymous namespace. NFC.

llvm-svn: 265654

8 years agoMake helper functions static. NFC.
Benjamin Kramer [Thu, 7 Apr 2016 10:10:09 +0000 (10:10 +0000)]
Make helper functions static. NFC.

llvm-svn: 265653

8 years agoSimplify the ASan expression (follow-up for the previous commit, r265651).
Kuba Brecka [Thu, 7 Apr 2016 10:07:45 +0000 (10:07 +0000)]
Simplify the ASan expression (follow-up for the previous commit, r265651).

llvm-svn: 265652

8 years agoTentative fix (add `extern "C"` declarations to expression prefix) and printing evalu...
Kuba Brecka [Thu, 7 Apr 2016 10:02:43 +0000 (10:02 +0000)]
Tentative fix (add `extern "C"` declarations to expression prefix) and printing evaluation errors for AddressSanitizer (both MemoryHistoryASan.cpp and AddressSanitizerRuntime.cpp).  Hopefully this will make the ASan testcases pass or at least the failure should be easier to diagnose.

llvm-svn: 265651

8 years agoEnable TestDebugBreak on x86_64 as well
Pavel Labath [Thu, 7 Apr 2016 09:25:04 +0000 (09:25 +0000)]
Enable TestDebugBreak on x86_64 as well

Test passes there, and this would have helped me catch the snafu in the previous commit.

llvm-svn: 265650

8 years agofix r265645: target dependent printf formatting flags.
Valery Pykhtin [Thu, 7 Apr 2016 08:38:20 +0000 (08:38 +0000)]
fix r265645: target dependent printf formatting flags.

llvm-svn: 265649

8 years ago[CMake] Check for sys/types.h in config-ix.cmake
Jeroen Ketema [Thu, 7 Apr 2016 08:36:13 +0000 (08:36 +0000)]
[CMake] Check for sys/types.h in config-ix.cmake

`sys/types.h` has a related define in `config.h.cmake`, but was never
checked for in CMake. Sync this.

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

llvm-svn: 265648

8 years agoRevert "Reduce code duplication in ProcessGDBRemote"
Pavel Labath [Thu, 7 Apr 2016 08:16:10 +0000 (08:16 +0000)]
Revert "Reduce code duplication in ProcessGDBRemote"

In turns out this does make a functional change, in case when the inferior hits an int3 that was
not placed by the debugger. Backing out for now.

llvm-svn: 265647

8 years ago[X86][SSE] Add support for VZEXT constant folding
Simon Pilgrim [Thu, 7 Apr 2016 07:52:45 +0000 (07:52 +0000)]
[X86][SSE] Add support for VZEXT constant folding

llvm-svn: 265646

8 years ago[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Valery Pykhtin [Thu, 7 Apr 2016 07:24:01 +0000 (07:24 +0000)]
[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.

Reenable reverted r265550 with endianness issue fixed. Variables of
endian-aware types such as ulittle32_t should be explicitly casted
to their natural equivalent types before passing it as vararg to
printf like functions (format in my case). Added lit config file
depending on AMDGPU target as the testcase uses assembler.

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

llvm-svn: 265645

8 years agoSymbol: fix build
Saleem Abdulrasool [Thu, 7 Apr 2016 06:51:10 +0000 (06:51 +0000)]
Symbol: fix build

TargetOptions is ambiguous due to a definition in LLVM and in clang.  This was
exposed by SVN r265640.  Update to fix the build against the newer revision.

llvm-svn: 265644

8 years ago[BlockPlacement] Remove an unnecessary continue
Amaury Sechet [Thu, 7 Apr 2016 06:35:00 +0000 (06:35 +0000)]
[BlockPlacement] Remove an unnecessary continue

NFC.

llvm-svn: 265643

8 years ago[MBP] Remove an unused function parameter
Amaury Sechet [Thu, 7 Apr 2016 06:34:47 +0000 (06:34 +0000)]
[MBP] Remove an unused function parameter

NFC.

llvm-svn: 265642

8 years agoDo some refactoring in the LLVM C API echo test to remove duplication. NFC
Amaury Sechet [Thu, 7 Apr 2016 05:56:20 +0000 (05:56 +0000)]
Do some refactoring in the LLVM C API echo test to remove duplication. NFC

llvm-svn: 265641

8 years agoBasic: thread CodeGenOptions into TargetInfo
Saleem Abdulrasool [Thu, 7 Apr 2016 05:41:11 +0000 (05:41 +0000)]
Basic: thread CodeGenOptions into TargetInfo

This threads CodeGenOptions into the TargetInfo hierarchy.  This is motivated by
ARM which can change some target information based on the EABI selected
(-meabi).  Similar options exist for other platforms (e.g. MIPS) and thus is
generally useful.  NFC.

llvm-svn: 265640

8 years agoFix the sanitizer bootstrap error in r265547.
Wei Mi [Thu, 7 Apr 2016 05:27:17 +0000 (05:27 +0000)]
Fix the sanitizer bootstrap error in r265547.

The iterators of SmallPtrSet SpillsInSubTreeMap[Child].first may be
invalidated when SpillsInSubTreeMap grows. Rearrange the code to
ensure the grow of SpillsInSubTreeMap only happens before getting
the iterators of the SmallPtrSet.

llvm-svn: 265639

8 years agoRevert "[BlockPlacement] Remove an unnecessary continue" and "[MBP] Remove an unused...
Amaury Sechet [Thu, 7 Apr 2016 04:28:40 +0000 (04:28 +0000)]
Revert "[BlockPlacement] Remove an unnecessary continue" and "[MBP] Remove an unused function parameter"

llvm-svn: 265638

8 years agoRevert "ValueMapper: Make LocalAsMetadata match function-local Values"
Duncan P. N. Exon Smith [Thu, 7 Apr 2016 02:10:50 +0000 (02:10 +0000)]
Revert "ValueMapper: Make LocalAsMetadata match function-local Values"

This reverts commit r265631, since it caused bot failures:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3256
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/7272

Looks like something is depending on the old behaviour.  I'll try to
track it down and recommit.

llvm-svn: 265637

8 years ago[X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.
Ahmed Bougacha [Thu, 7 Apr 2016 02:07:10 +0000 (02:07 +0000)]
[X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.

Re-apply r265450 which caused PR27245 and was reverted in r265559
because of a wrong generalization: the fetch_and_add->add_and_fetch
combine only works in specific, but pretty common, cases:
  (icmp slt x, 0) -> (icmp sle (add x, 1), 0)
  (icmp sge x, 0) -> (icmp sgt (add x, 1), 0)
  (icmp sle x, 0) -> (icmp slt (sub x, 1), 0)
  (icmp sgt x, 0) -> (icmp sge (sub x, 1), 0)

Original Message:

We only generate LOCKed versions of add/sub when the result is unused.
It often happens that the result is used, but only by a comparison. We
can optimize those out by reusing EFLAGS, which lets us use the proper
instructions, instead of having to fallback to LXADD.

Instead of doing this as an MI peephole (as we do for the other
non-LOCKed (really, non-MR) forms), do it in ISel. It becomes quite
tricky later.

This also makes it eventually possible to stop expanding and/or/xor
if the only user is an icmp (also see D18141).

This uses the LOCK ISD opcodes added by r262244.

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

llvm-svn: 265636

8 years ago[X86] Refresh and tweak EFLAGS reuse tests. NFC.
Ahmed Bougacha [Thu, 7 Apr 2016 02:06:53 +0000 (02:06 +0000)]
[X86] Refresh and tweak EFLAGS reuse tests. NFC.

The non-1 and EQ/NE tests were misguided.

llvm-svn: 265635

8 years agoDon't use PATH_MAX.
Sean Silva [Thu, 7 Apr 2016 01:58:14 +0000 (01:58 +0000)]
Don't use PATH_MAX.

This is a SmallVector anyway, and so the exact size doesn't matter.

clang\lib\Frontend\ModuleDependencyCollector.cpp(83) : error C2065: 'PATH_MAX' : undeclared identifier
clang\lib\Frontend\ModuleDependencyCollector.cpp(83) : error C2975: 'InternalLen' : invalid template argument for 'llvm::SmallString', expected compile-time constant expression
        llvm\include\llvm/ADT/SmallString.h(24) : see declaration of 'InternalLen'

llvm-svn: 265634

8 years agoValueMapper: Allow RF_IgnoreMissingLocals and RF_NullMapMissingGlobalValues
Duncan P. N. Exon Smith [Thu, 7 Apr 2016 01:22:45 +0000 (01:22 +0000)]
ValueMapper: Allow RF_IgnoreMissingLocals and RF_NullMapMissingGlobalValues

Remove the assertion that disallowed the combination, since
RF_IgnoreMissingLocals should have no effect on globals.  As it happens,
RF_NullMapMissingGlobalValues asserted in MapValue(Constant*,...), so I
also changed a cast to a cast_or_null to get my test passing.

llvm-svn: 265633

8 years ago[CrashReproducer] Use toUppercase from include/clang/Basic/CharInfo.h
Bruno Cardoso Lopes [Thu, 7 Apr 2016 01:12:18 +0000 (01:12 +0000)]
[CrashReproducer] Use toUppercase from include/clang/Basic/CharInfo.h

Use toUppercase instead of ::toupper()

llvm-svn: 265632

8 years agoValueMapper: Make LocalAsMetadata match function-local Values
Duncan P. N. Exon Smith [Thu, 7 Apr 2016 01:08:39 +0000 (01:08 +0000)]
ValueMapper: Make LocalAsMetadata match function-local Values

Start treating LocalAsMetadata similarly to function-local members of
the Value hierarchy in MapValue and MapMetadata.

  - Don't memoize them.
  - Return nullptr if they are missing.

This also cleans up ConstantAsMetadata to stop listening to the
RF_IgnoreMissingLocals flag.

llvm-svn: 265631

8 years ago[CrashReproducer] Change std::toupper to ::toupper
Bruno Cardoso Lopes [Thu, 7 Apr 2016 01:04:09 +0000 (01:04 +0000)]
[CrashReproducer] Change std::toupper to ::toupper

Attempt to fix windows bots

llvm-svn: 265630

8 years ago[AArch64] Teach RegisterBankInfo about the CC register bank.
Quentin Colombet [Thu, 7 Apr 2016 00:39:29 +0000 (00:39 +0000)]
[AArch64] Teach RegisterBankInfo about the CC register bank.
We need to cover each register class with a register bank.

llvm-svn: 265629

8 years agoIR: RF_IgnoreMissingValues => RF_IgnoreMissingLocals, NFC
Duncan P. N. Exon Smith [Thu, 7 Apr 2016 00:26:43 +0000 (00:26 +0000)]
IR: RF_IgnoreMissingValues => RF_IgnoreMissingLocals, NFC

Clarify what this RemapFlag actually means.

  - Change the flag name to match its intended behaviour.
  - Clearly document that it's not supposed to affect globals.
  - Add a host of FIXMEs to indicate how to fix the behaviour to match
    the intent of the flag.

RF_IgnoreMissingLocals should only affect the behaviour of
RemapInstruction for function-local operands; namely, for operands of
type Argument, Instruction, and BasicBlock.  Currently, it is *only*
passed into RemapInstruction calls (and the transitive MapValue calls
that it makes).

When I split Metadata from Value I didn't understand the flag, and I
used it in a bunch of places for "global" metadata.

This commit doesn't have any functionality change, but prepares to
cleanup MapMetadata and MapValue.

llvm-svn: 265628

8 years ago[sancov] removing flaky test case (win)
Mike Aizatsky [Thu, 7 Apr 2016 00:23:02 +0000 (00:23 +0000)]
[sancov] removing flaky test case (win)

llvm-svn: 265627

8 years ago[AArch64] Teach RegisterBankInfo about the mapping of register classes
Quentin Colombet [Thu, 7 Apr 2016 00:14:30 +0000 (00:14 +0000)]
[AArch64] Teach RegisterBankInfo about the mapping of register classes
on register banks.

llvm-svn: 265626

8 years agoFollow-up for r265605: don't mutate vector we're iterating.
Michael Zolotukhin [Thu, 7 Apr 2016 00:09:42 +0000 (00:09 +0000)]
Follow-up for r265605: don't mutate vector we're iterating.

llvm-svn: 265625

8 years ago[RegisterBankInfo] Implement a target independent version of
Quentin Colombet [Thu, 7 Apr 2016 00:07:50 +0000 (00:07 +0000)]
[RegisterBankInfo] Implement a target independent version of
getInstrMapping.

This implementation requires that the target implemented
getRegBankFromRegClass.
Indeed, the implementation uses the register classes for the encoding
constraints for the instructions to deduce the mapping of a value.

llvm-svn: 265624

8 years agoRe-commit r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudo...
Hans Wennborg [Thu, 7 Apr 2016 00:05:49 +0000 (00:05 +0000)]
Re-commit r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudoInstr (PR27140)"

Third time's the charm? The previous attempt (r265345) caused ASan test
failures on X86, as broken CFI caused stack traces to not work.

This version of the patch makes sure not to merge with stack adjustments
that have CFI, and to not add merged instructions' offests to the CFI
about to be generated.

This is already covered by the lit tests; I just got the expectations
wrong previously.

llvm-svn: 265623

8 years ago[CrashReproducer] Setup 'case-sensitive' in YAML files.
Bruno Cardoso Lopes [Thu, 7 Apr 2016 00:00:57 +0000 (00:00 +0000)]
[CrashReproducer] Setup 'case-sensitive' in YAML files.

The crash reproducer was not setting up case sensitivity in the
VFS yaml files, which defaults to true. Make the crash reproducer
explicitly set that flag based on the case sensitivity of the .cache
path where vfs and modules are dumped.

llvm-svn: 265622

8 years ago[CrashReproducer] Move ModuleDependencyCollector method around. NFC
Bruno Cardoso Lopes [Thu, 7 Apr 2016 00:00:42 +0000 (00:00 +0000)]
[CrashReproducer] Move ModuleDependencyCollector method around. NFC

llvm-svn: 265621

8 years ago[RegisterBankInfo] Add an helper function to get the size of a register.
Quentin Colombet [Wed, 6 Apr 2016 23:59:53 +0000 (23:59 +0000)]
[RegisterBankInfo] Add an helper function to get the size of a register.
The previous method to get the size was too simple and could fail for
physical registers.

llvm-svn: 265620

8 years agoIgnore --warn-execstack.
Rui Ueyama [Wed, 6 Apr 2016 23:55:43 +0000 (23:55 +0000)]
Ignore --warn-execstack.

Stack is not executable by default in LLD-built executables unless
you pass -z execstack option. So --warn-execstack option does not make
sense to us.

llvm-svn: 265619

8 years agoFix a race condition in support library ThreadPool.
Justin Lebar [Wed, 6 Apr 2016 23:46:40 +0000 (23:46 +0000)]
Fix a race condition in support library ThreadPool.

By running TSAN on the ThreadPool unit tests it was discovered that the
threads in the pool can pop tasks off the queue at the same time the
"wait" routine is trying to check if the task queue is empty. This patch
fixes this problem by checking for active threads in the waiter before
checking whether the queue is empty.

Patch by Jason Henline.

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

Reviewers: joker.eph, jlebar
llvm-svn: 265618

8 years agoNFC: use AtomicOrdering isStrongerThan
JF Bastien [Wed, 6 Apr 2016 23:37:36 +0000 (23:37 +0000)]
NFC: use AtomicOrdering isStrongerThan

Summary: As discussed in D18775.

Reviewers: jyknight

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

llvm-svn: 265617

8 years agoKeep -fmodule-implementation-of as an alias of -fmodule-name.
Manman Ren [Wed, 6 Apr 2016 23:28:26 +0000 (23:28 +0000)]
Keep -fmodule-implementation-of as an alias of -fmodule-name.

This helps us transitioning to -fmodule-name. Once the transitioning is done,
we can remove this alias.

rdar://24800983

llvm-svn: 265616

8 years ago[sancov] enabling coverage edge pruning by default.
Mike Aizatsky [Wed, 6 Apr 2016 23:24:37 +0000 (23:24 +0000)]
[sancov] enabling coverage edge pruning by default.

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

llvm-svn: 265615

8 years ago[sancov] enabling coverage edge pruning by default.
Mike Aizatsky [Wed, 6 Apr 2016 23:24:16 +0000 (23:24 +0000)]
[sancov] enabling coverage edge pruning by default.

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

llvm-svn: 265614

8 years agoAnother place for CMAKE_HOST_UNIX
Sean Silva [Wed, 6 Apr 2016 23:18:09 +0000 (23:18 +0000)]
Another place for CMAKE_HOST_UNIX

If we don't create the target, don't try to add it as a dependency.

After r265595, we were only creating the SanitizerLintCheck when
`CMAKE_HOST_UNIX` was true.

CMake was emitting a warning:
  The dependency target "SanitizerLintCheck" of target "check-ubsan" does not
  exist.

llvm-svn: 265613

8 years agoValueMapper: clang-format ValueMapper.h, NFC
Duncan P. N. Exon Smith [Wed, 6 Apr 2016 22:37:30 +0000 (22:37 +0000)]
ValueMapper: clang-format ValueMapper.h, NFC

Also remove duplicated identifiers from comments.

llvm-svn: 265611