platform/upstream/llvm.git
8 years agoMake this header include the header it depends on, rather than trying to include...
Richard Smith [Fri, 15 Apr 2016 23:30:57 +0000 (23:30 +0000)]
Make this header include the header it depends on, rather than trying to include itself. Found by C++ modules build.

llvm-svn: 266492

8 years agoExtract key to avoid preemptive mallocs in insert/emplace in associative containers
Eric Fiselier [Fri, 15 Apr 2016 23:27:27 +0000 (23:27 +0000)]
Extract key to avoid preemptive mallocs in insert/emplace in associative containers

Summary: This patch applies Duncan's work on __hash_table to __tree.

Reviewers: mclow.lists, dexonsmith

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 266491

8 years agoValueMapper: Hide Mapper::VM behind an accessor, NFC
Duncan P. N. Exon Smith [Fri, 15 Apr 2016 23:18:43 +0000 (23:18 +0000)]
ValueMapper: Hide Mapper::VM behind an accessor, NFC

Change Mapper::VM to a pointer and add a `getVM()` accessor for it.
While this has no functionality change, it minimizes the diff on an
upcoming patch that allows switching between instances of
ValueToValueMapTy on a single Mapper instance.

llvm-svn: 266490

8 years agoDon't skip splitSeparateComponents in eliminateDeadDefs for HoistSpillHelper::hoistAl...
Wei Mi [Fri, 15 Apr 2016 23:16:44 +0000 (23:16 +0000)]
Don't skip splitSeparateComponents in eliminateDeadDefs for HoistSpillHelper::hoistAllSpills.

Because HoistSpillHelper::hoistAllSpills is called in postOptimization, before the
patch we didn't want LiveRangeEdit::eliminateDeadDefs to call splitSeparateComponents
and generate unassigned new vregs. However, skipping splitSeparateComponents will make
verify-machineinstrs unhappy, so I remove the early return, and use
HoistSpillHelper::LRE_DidCloneVirtReg to assign physreg/stackslot for those new vregs.

In addition, some code reorganization to make class HoistSpillHelper privately inheriting
from LiveRangeEdit::Delegate possible. This is to be consistent with class RAGreedy and
class RegisterCoalescer.

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

llvm-svn: 266489

8 years agoAdd ProfileData to required_libraries
Easwaran Raman [Fri, 15 Apr 2016 23:08:52 +0000 (23:08 +0000)]
Add ProfileData to required_libraries

This should fix ppc64be build breakage due to r266477

llvm-svn: 266488

8 years ago[LTO] Add datalayout to test to prevent an assertion in Debug mode.
Davide Italiano [Fri, 15 Apr 2016 22:58:57 +0000 (22:58 +0000)]
[LTO] Add datalayout to test to prevent an assertion in Debug mode.

While here, run this test only on x86.

llvm-svn: 266487

8 years ago[cfi] Support explicit sections for functions in cfi-icall.
Evgeniy Stepanov [Fri, 15 Apr 2016 22:55:38 +0000 (22:55 +0000)]
[cfi] Support explicit sections for functions in cfi-icall.

Allow explicit section for indirectly called functions in cfi-icall.
Jumptables for functions in the same type class must be contiguous, so they
always go to the default text section.

Fixes PR25079.

llvm-svn: 266486

8 years agoRevert r266457: "[ELF] - Implemented basic location counter support."
Rui Ueyama [Fri, 15 Apr 2016 22:39:27 +0000 (22:39 +0000)]
Revert r266457: "[ELF] - Implemented basic location counter support."

This reverts commit r266457 as it breaks "hello world" both on
Linux and FreeBSD.

llvm-svn: 266485

8 years ago[LTO] Implement parallel Codegen for LTO using splitCodeGen.
Davide Italiano [Fri, 15 Apr 2016 22:38:10 +0000 (22:38 +0000)]
[LTO] Implement parallel Codegen for LTO using splitCodeGen.

Parallelism level can be chosen using the new --lto-jobs=K option
where K is the number of threads used for CodeGen. It currently
defaults to 1.

llvm-svn: 266484

8 years ago[sanitizer] [SystemZ] Enable UBSan.
Marcin Koscielnicki [Fri, 15 Apr 2016 22:25:04 +0000 (22:25 +0000)]
[sanitizer] [SystemZ] Enable UBSan.

sanitizer_common is now in good enough shape on s390x to support UBSan
- all tests passing.  Let's enable it.

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

llvm-svn: 266483

8 years ago[sanitizers] [SystemZ] Introduce sanitizer_linux_s390.cc.
Marcin Koscielnicki [Fri, 15 Apr 2016 22:11:10 +0000 (22:11 +0000)]
[sanitizers] [SystemZ] Introduce sanitizer_linux_s390.cc.

This file will contain s390-specific code.  For now, let's move the s390
version of internal_mmap here.

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

llvm-svn: 266482

8 years agoConvert this sample-based-profiling testcase to use a NoDebug CU.
Adrian Prantl [Fri, 15 Apr 2016 22:05:38 +0000 (22:05 +0000)]
Convert this sample-based-profiling testcase to use a NoDebug CU.

llvm-svn: 266481

8 years ago[libFuzzer] add a better warning for command line flags with -- (two dashes)
Kostya Serebryany [Fri, 15 Apr 2016 21:56:29 +0000 (21:56 +0000)]
[libFuzzer] add a better warning for command line flags with -- (two dashes)

llvm-svn: 266480

8 years agoSwitch lowering: don't add incoming PHI values from skipped bit test MBB's (PR27135)
Hans Wennborg [Fri, 15 Apr 2016 21:45:30 +0000 (21:45 +0000)]
Switch lowering: don't add incoming PHI values from skipped bit test MBB's (PR27135)

After r245976, LLVM will skip the last bit test case if knows it will always be
true. However, we would still erroneously update PHI nodes with incoming values
from the MBB that would perform the final bit test, causing -verify-machineinstrs
to fail.

llvm-svn: 266479

8 years agoSelectionDAGISel: rangeify a loop
Hans Wennborg [Fri, 15 Apr 2016 21:45:09 +0000 (21:45 +0000)]
SelectionDAGISel: rangeify a loop

llvm-svn: 266478

8 years agoReplace the use of MaxFunctionCount module flag
Easwaran Raman [Fri, 15 Apr 2016 21:39:58 +0000 (21:39 +0000)]
Replace the use of MaxFunctionCount module flag

Adds an interface to get ProfileSummary for a module and makes InlineCost use ProfileSummary to get max function count.

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

llvm-svn: 266477

8 years ago[libFuzzer] menion the git mirror in the docs
Kostya Serebryany [Fri, 15 Apr 2016 21:10:27 +0000 (21:10 +0000)]
[libFuzzer] menion the git mirror in the docs

llvm-svn: 266476

8 years agoUpdate two more test cases for r266445+r266446 II
Tobias Grosser [Fri, 15 Apr 2016 21:02:35 +0000 (21:02 +0000)]
Update two more test cases for r266445+r266446 II

llvm-svn: 266475

8 years agoUpdate two more test cases for r266445+r266446
Tobias Grosser [Fri, 15 Apr 2016 20:56:17 +0000 (20:56 +0000)]
Update two more test cases for r266445+r266446

llvm-svn: 266474

8 years agoUpdate debug metadata after LLVM commits r266445+r266446
Tobias Grosser [Fri, 15 Apr 2016 20:51:27 +0000 (20:51 +0000)]
Update debug metadata after LLVM commits r266445+r266446

llvm-svn: 266473

8 years ago[mips] More range-based for loops. NFC.
Vasileios Kalintiris [Fri, 15 Apr 2016 20:43:17 +0000 (20:43 +0000)]
[mips] More range-based for loops. NFC.

There are still a couple more inside the MIPS target. I opted for a single
commit in order to avoid spamming the list.

llvm-svn: 266472

8 years ago[mips] Use range-based for loops and simplify slightly the code. NFC.
Vasileios Kalintiris [Fri, 15 Apr 2016 20:18:48 +0000 (20:18 +0000)]
[mips] Use range-based for loops and simplify slightly the code. NFC.

llvm-svn: 266471

8 years agoRevert "[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016...
Marcin Koscielnicki [Fri, 15 Apr 2016 20:00:12 +0000 (20:00 +0000)]
Revert "[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143."

This reverts commit r266297.

llvm-svn: 266470

8 years ago[SystemZ] Call tryAddingSymbolicOperand in the disassembler
Ulrich Weigand [Fri, 15 Apr 2016 19:55:58 +0000 (19:55 +0000)]
[SystemZ] Call tryAddingSymbolicOperand in the disassembler

Use the tryAddingSymbolicOperand callback to attempt to present immediate
values in symbolic form when disassembling.  This is currently only used
for PC-relative immediates (which are most likely to be symbolic in the
SystemZ ISA).  Add new DecodeMethod types to allow distinguishing between
branch and non-branch instructions.

llvm-svn: 266469

8 years agoLet the DISubprogram in this test point to the right compile unit.
Adrian Prantl [Fri, 15 Apr 2016 19:38:14 +0000 (19:38 +0000)]
Let the DISubprogram in this test point to the right compile unit.

llvm-svn: 266468

8 years agoUpdate testcase to new debug metadata format.
Adrian Prantl [Fri, 15 Apr 2016 19:32:22 +0000 (19:32 +0000)]
Update testcase to new debug metadata format.

llvm-svn: 266467

8 years agoSimplify got handling.
Rafael Espindola [Fri, 15 Apr 2016 19:14:18 +0000 (19:14 +0000)]
Simplify got handling.

Each getRelExpr is now expected to return the correct got expression
instead of having Writer patch it up with needsGot.

llvm-svn: 266466

8 years ago[codeview] Dump char16_t and char32_t simple types
Reid Kleckner [Fri, 15 Apr 2016 18:26:45 +0000 (18:26 +0000)]
[codeview] Dump char16_t and char32_t simple types

llvm-svn: 266465

8 years agoARM: don't try to hoist constant RHS out of a division.
Tim Northover [Fri, 15 Apr 2016 18:17:18 +0000 (18:17 +0000)]
ARM: don't try to hoist constant RHS out of a division.

Divisions by a constant can be converted into multiplies which are usually
cheaper, but this isn't possible if the constant gets separated (particularly
in loops). Fix this by telling ConstantHoisting that the immediate in a DIV is
cheap.

I considered making the check generic, but neither AArch64 (strangely) nor x86
showed any benefit on the tests I had.

llvm-svn: 266464

8 years ago[clang-tidy] Add more detection rules for redundant c_str calls.
Etienne Bergeron [Fri, 15 Apr 2016 18:12:06 +0000 (18:12 +0000)]
[clang-tidy] Add more detection rules for redundant c_str calls.

Summary:
The string class contains methods which support receiving either a string literal or a string object.

For example, calls to append can receive either a char* or a string.
```
  string& append (const string& str);
  string& append (const char* s);
```

Which make these cases equivalent, and the .c_str() useless:
```
  std::string s = "123";
  str.append(s);
  str.append(s.c_str());
```

In these cases, removing .c_str()  doesn't provide any size or speed improvement.
It's only a readability issue.

If the string contains embedded NUL characters,  the string literal and the string
object won't produce the same semantic.

Reviewers: alexfh, sbenza

Subscribers: LegalizeAdulthood, aaron.ballman, chapuni, Eugene.Zelenko, cfe-commits

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

llvm-svn: 266463

8 years ago[AArch64] Add load/store pair instructions to getMemOpBaseRegImmOfsWidth().
Chad Rosier [Fri, 15 Apr 2016 18:09:10 +0000 (18:09 +0000)]
[AArch64] Add load/store pair instructions to getMemOpBaseRegImmOfsWidth().

This improves AA in the MI schduler when reason about paired instructions.

Phabricator Revision: http://reviews.llvm.org/D17098
PR26358

llvm-svn: 266462

8 years agoCleanup and guard tuple's constructor SFINAE. Fixes PR22806 and PR23256.
Eric Fiselier [Fri, 15 Apr 2016 18:05:59 +0000 (18:05 +0000)]
Cleanup and guard tuple's constructor SFINAE.  Fixes PR22806 and PR23256.

There are two main fixes in this patch.

First the constructor SFINAE was changed so that it's evaluated in two stages
where the first stage evaluates the "safe" SFINAE conditions and the second
evaluates the "dangerous" ones. The key is that the second stage is lazily
evaluated only if the first stage passes. This helps fix PR23256
(https://llvm.org/bugs/show_bug.cgi?id=23256).

The second fix is for PR22806 and LWG issue 2549. This fix applies
the suggested resolution to the LWG issue in order to prevent the construction
of dangling references. The SFINAE for this check is contained within
the _PreferTupleLikeConstructor alias template. The tuple-like constructors
are disabled whenever that trait returns false.

(https://llvm.org/bugs/show_bug.cgi?id=22806)
(http://cplusplus.github.io/LWG/lwg-active.html#2549)

llvm-svn: 266461

8 years agoRevert 266186 as it breaks anything that includes type_traits on some platforms
Nemanja Ivanovic [Fri, 15 Apr 2016 18:04:13 +0000 (18:04 +0000)]
Revert 266186 as it breaks anything that includes type_traits on some platforms

Since this patch provided support for the __float128 type but disabled it
on all platforms by default, some platforms can't compile type_traits with
-std=gnu++11 since there is a specialization with __float128.
This reverts the patch until D19125 is approved (i.e. we know which platforms
need this support enabled).

llvm-svn: 266460

8 years agoMerge duplicated cases. NFC.
Rafael Espindola [Fri, 15 Apr 2016 17:57:27 +0000 (17:57 +0000)]
Merge duplicated cases. NFC.

llvm-svn: 266459

8 years agoRevert "[Coverage] Prevent detection of false instantiations in case of macro expansion."
Igor Kudrin [Fri, 15 Apr 2016 17:53:48 +0000 (17:53 +0000)]
Revert "[Coverage] Prevent detection of false instantiations in case of macro expansion."

This reverts commit r266436 as it broke buildbot.

llvm-svn: 266458

8 years ago[ELF] - Implemented basic location counter support.
George Rimar [Fri, 15 Apr 2016 17:44:19 +0000 (17:44 +0000)]
[ELF] - Implemented basic location counter support.

This patch implements location counter support.
It also separates assign addresses for sections to assignAddressesScript() if it scipt exists.

Main testcase is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter. It is basic now.
Implemented location counter assignment and '+' operations.

Patch by myself with LOTS of comments and design suggestions from Rui Ueyama.

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

llvm-svn: 266457

8 years ago[ParallelCG] Add a new splitCodeGen() API which takes a TargetMachineFactory.
Davide Italiano [Fri, 15 Apr 2016 17:34:32 +0000 (17:34 +0000)]
[ParallelCG] Add a new splitCodeGen() API which takes a TargetMachineFactory.

This is a recommit of r266390 with a fix that will allow tests to pass
(hopefully). Before we got a StringRef to M->getTargetTriple() and right
after we moved the Module so we were referencing a dangling object.

llvm-svn: 266456

8 years ago[Release Notes] mention Clang-tidy misc-multiple-statement-macro check.
Eugene Zelenko [Fri, 15 Apr 2016 17:32:19 +0000 (17:32 +0000)]
[Release Notes] mention Clang-tidy misc-multiple-statement-macro check.

llvm-svn: 266455

8 years ago[SystemZ] Fix large tests broken by conditional returns.
Marcin Koscielnicki [Fri, 15 Apr 2016 17:24:40 +0000 (17:24 +0000)]
[SystemZ] Fix large tests broken by conditional returns.

These were broken by D17339.

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

llvm-svn: 266454

8 years ago[LLD] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Mandeep Singh Grang [Fri, 15 Apr 2016 17:21:29 +0000 (17:21 +0000)]
[LLD] Remove unwanted --check-prefix=CHECK from unit tests. NFC.

Summary:
Removed unwanted --check-prefix=CHECK from the following unit tests:
      ELF/aarch64-gnu-ifunc.s
      ELF/gnu-ifunc-i386.s
      ELF/gnu-ifunc.s
      ELF/plt-i686.s

Patch by: Mandeep Singh Grang (mgrang)

Reviewers: rafael

Subscribers: aemerson

Projects: #lld

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

llvm-svn: 266453

8 years ago[InstCombine] Don't transform compares of calls to functions named fabs{f,l,}
David Majnemer [Fri, 15 Apr 2016 17:21:03 +0000 (17:21 +0000)]
[InstCombine] Don't transform compares of calls to functions named fabs{f,l,}

InstCombine wants to optimize compares of calls to fabs with zero.
However, we didn't have the necessary legality checking to verify that
the function call had the same behavior as fabs.

llvm-svn: 266452

8 years ago[clang-tidy] Add new checker for suspicious sizeof expressions
Etienne Bergeron [Fri, 15 Apr 2016 16:36:00 +0000 (16:36 +0000)]
[clang-tidy] Add new checker for suspicious sizeof expressions

Summary:
This check is finding suspicious cases of sizeof expression.

Sizeof expression is returning the size (in bytes) of a type or an
expression. Programmers often abuse or misuse this expression.

This checker is adding common set of patterns to detect some
of these bad constructs.

Some examples found by this checker:

R/packages/ifultools/ifultools/src/fra_neig.c
```
        /* free buffer memory */
        (void) mutil_free( dist_buff, sizeof( ctr * sizeof( double ) ) );
        (void) mutil_free( nidx_buff, sizeof( ctr * sizeof( sint32 ) ) );
```

graphviz/v2_20_2/lib/common/utils.c
```
static Dtdisc_t mapDisc = {
    offsetof(item, p),
    sizeof(2 * sizeof(void *)),
    offsetof(item, link),
    (Dtmake_f) newItem,
    (Dtfree_f) freeItem,
    (Dtcompar_f) cmpItem,
    NIL(Dthash_f),
    NIL(Dtmemory_f),
    NIL(Dtevent_f)
};
```

mDNSResponder/mDNSShared/dnsextd.c
```
context = ( TCPContext* ) malloc( sizeof( TCPContext ) );
require_action( context, exit, err = mStatus_NoMemoryErr; LogErr( "AcceptTCPConnection", "malloc" ) );
mDNSPlatformMemZero( context, sizeof( sizeof( TCPContext ) ) );
context->d  = self;
```

Reviewers: alexfh

Subscribers: malcolm.parsons, Eugene.Zelenko, cfe-commits

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

llvm-svn: 266451

8 years ago[clang-tidy] Add checker for operations between integrals and pointers
Etienne Bergeron [Fri, 15 Apr 2016 16:31:15 +0000 (16:31 +0000)]
[clang-tidy] Add checker for operations between integrals and pointers

Summary:
This check is finding suspicious operations involving pointers and integral types; which are most likely bugs.

Examples:
subversion/v1_6/subversion/libsvn_subr/utf.c
```
static const char *
fuzzy_escape(const char *src, apr_size_t len, apr_pool_t *pool)
{
  [...]
   while (src_orig < src_end)
    {
      if (! svn_ctype_isascii(*src_orig) || src_orig == '\0')   // Should be *src_orig
        {
```

apache2/v2_2_23/modules/metadata/mod_headers.c
```
static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
{
  [...]
    tag->arg = '\0';   // ERROR: tag->arg has type char*

    /* grab the argument if there is one */
    if (*s == '{') {
        ++s;
        tag->arg = ap_getword(p,&s,'}');
    }
```

Reviewers: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 266450

8 years agoFix testcase for MSVC targets where the output ordering is different.
Adrian Prantl [Fri, 15 Apr 2016 16:21:23 +0000 (16:21 +0000)]
Fix testcase for MSVC targets where the output ordering is different.

llvm-svn: 266449

8 years agoFix test to require Asserts since it uses debug output.
Geoff Berry [Fri, 15 Apr 2016 16:09:00 +0000 (16:09 +0000)]
Fix test to require Asserts since it uses debug output.

llvm-svn: 266448

8 years agoUpdate testcase to new debug info metadata format.
Adrian Prantl [Fri, 15 Apr 2016 16:05:13 +0000 (16:05 +0000)]
Update testcase to new debug info metadata format.

llvm-svn: 266447

8 years ago[PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Adrian Prantl [Fri, 15 Apr 2016 15:57:41 +0000 (15:57 +0000)]
[PR27284] Reverse the ownership between DICompileUnit and DISubprogram.

Currently each Function points to a DISubprogram and DISubprogram has a
scope field. For member functions the scope is a DICompositeType. DIScopes
point to the DICompileUnit to facilitate type uniquing.

Distinct DISubprograms (with isDefinition: true) are not part of the type
hierarchy and cannot be uniqued. This change removes the subprograms
list from DICompileUnit and instead adds a pointer to the owning compile
unit to distinct DISubprograms. This would make it easy for ThinLTO to
strip unneeded DISubprograms and their transitively referenced debug info.

Motivation
----------

Materializing DISubprograms is currently the most expensive operation when
doing a ThinLTO build of clang.

We want the DISubprogram to be stored in a separate Bitcode block (or the
same block as the function body) so we can avoid having to expensively
deserialize all DISubprograms together with the global metadata. If a
function has been inlined into another subprogram we need to store a
reference the block containing the inlined subprogram.

Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
that updates LLVM IR testcases to the new format.

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

llvm-svn: 266446

8 years agoUpdate to match LLVM changes for PR27284.
Adrian Prantl [Fri, 15 Apr 2016 15:55:45 +0000 (15:55 +0000)]
Update to match LLVM changes for PR27284.
(Reverse the ownership between DICompileUnit and DISubprogram.)

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

llvm-svn: 266445

8 years agoASTMatchers.h: Fix formatting. [-Wdocumentation]
NAKAMURA Takumi [Fri, 15 Apr 2016 15:42:27 +0000 (15:42 +0000)]
ASTMatchers.h: Fix formatting. [-Wdocumentation]

llvm-svn: 266444

8 years agollvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll requires +Asserts.
NAKAMURA Takumi [Fri, 15 Apr 2016 15:37:27 +0000 (15:37 +0000)]
llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll requires +Asserts.

llvm-svn: 266443

8 years ago[SimplifyCFG] propagate branch metadata when creating select (PR27344)
Sanjay Patel [Fri, 15 Apr 2016 15:32:12 +0000 (15:32 +0000)]
[SimplifyCFG] propagate branch metadata when creating select (PR27344)

This is almost identical to:
http://reviews.llvm.org/rL264527

This doesn't solve PR27344; it just allows the profile weights to survive.
To solve the bug, we need to use the profile weights in the backend.

llvm-svn: 266442

8 years agolli.cpp: Appease some builders. There might be ownership issues between LLVMContext...
NAKAMURA Takumi [Fri, 15 Apr 2016 15:31:28 +0000 (15:31 +0000)]
lli.cpp: Appease some builders. There might be ownership issues between LLVMContext and ExecutionEngine. Investigating.

llvm-svn: 266441

8 years agoAdd an interesting GC testcase.
Rafael Espindola [Fri, 15 Apr 2016 15:26:52 +0000 (15:26 +0000)]
Add an interesting GC testcase.

It shows that we correctly look at liveness based on the final symbol
resolution.

llvm-svn: 266440

8 years ago[AArch64] Add MMOs to callee-save load/store instructions.
Geoff Berry [Fri, 15 Apr 2016 15:16:19 +0000 (15:16 +0000)]
[AArch64] Add MMOs to callee-save load/store instructions.

Summary:
Without MMOs, the callee-save load/store instructions were treated as
volatile by the MI post-RA scheduler and AArch64LoadStoreOptimizer.

Reviewers: t.p.northover, mcrosier

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 266439

8 years agoFix typing on generated LXV2DX/STXV2DX instructions
Nirav Dave [Fri, 15 Apr 2016 15:01:38 +0000 (15:01 +0000)]
Fix typing on generated LXV2DX/STXV2DX instructions

[PPC] Previously when casting generic loads to LXV2DX/ST instructions we
would leave the original load return type in place allowing for an
assertion failure when we merge two equivalent LXV2DX nodes with
different types.

This fixes PR27350.

Reviewers: nemanjai

Subscribers: llvm-commits

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

llvm-svn: 266438

8 years ago[MachineScheduler]Add support for store clustering
Jun Bum Lim [Fri, 15 Apr 2016 14:58:38 +0000 (14:58 +0000)]
[MachineScheduler]Add support for store clustering

Perform store clustering just like load clustering. This change add
StoreClusterMutation in machine-scheduler. To control StoreClusterMutation,
added enableClusterStores() in TargetInstrInfo.h. This is enabled only on
AArch64 for now.

This change also add support for unscaled stores which were not handled in
getMemOpBaseRegImmOfs().

llvm-svn: 266437

8 years ago[Coverage] Prevent detection of false instantiations in case of macro expansion.
Igor Kudrin [Fri, 15 Apr 2016 14:56:50 +0000 (14:56 +0000)]
[Coverage] Prevent detection of false instantiations in case of macro expansion.

The root of the problem was that findMainViewFileID(File, Function)
could return some ID for any given file, even though that file
was not the main file for that function.

This patch ensures that the result of this function is conformed
with the result of findMainViewFileID(Function).

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

llvm-svn: 266436

8 years ago[SimplifyCFG] add metadata to show failure to propagate (PR27344)
Sanjay Patel [Fri, 15 Apr 2016 14:53:35 +0000 (14:53 +0000)]
[SimplifyCFG] add metadata to show failure to propagate (PR27344)

llvm-svn: 266435

8 years ago[Coverage] Add support for making test data for more than one function.
Igor Kudrin [Fri, 15 Apr 2016 14:46:31 +0000 (14:46 +0000)]
[Coverage] Add support for making test data for more than one function.

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

llvm-svn: 266434

8 years agoAMDGPU/SI: Fix regression with no-return atomics
Nicolai Haehnle [Fri, 15 Apr 2016 14:42:36 +0000 (14:42 +0000)]
AMDGPU/SI: Fix regression with no-return atomics

Summary:
In the added test-case, the atomic instruction feeds into a non-machine
CopyToReg node which hasn't been selected yet, so guard against
non-machine opcodes here.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

llvm-svn: 266433

8 years agoStore a Symbol for EntrySym.
Rafael Espindola [Fri, 15 Apr 2016 14:41:56 +0000 (14:41 +0000)]
Store a Symbol for EntrySym.

This makes it impossible to forget to call repl on the SymbolBody.

llvm-svn: 266432

8 years agoRevert r266415, it broke parsing SDK headers (PR27367).
Nico Weber [Fri, 15 Apr 2016 14:35:06 +0000 (14:35 +0000)]
Revert r266415, it broke parsing SDK headers (PR27367).

llvm-svn: 266431

8 years agoprepare-builtins: Remove call to getGlobalContext()
Tom Stellard [Fri, 15 Apr 2016 14:18:58 +0000 (14:18 +0000)]
prepare-builtins: Remove call to getGlobalContext()

This function has been removed from LLVM.

Patch By: Laurent Carlier

llvm-svn: 266430

8 years agoAdd a testcase for symbol resolution with -r.
Rafael Espindola [Fri, 15 Apr 2016 14:11:36 +0000 (14:11 +0000)]
Add a testcase for symbol resolution with -r.

llvm-svn: 266429

8 years agoRemove include duplicate. NFC.
Alexey Bader [Fri, 15 Apr 2016 13:23:26 +0000 (13:23 +0000)]
Remove include duplicate. NFC.

llvm-svn: 266428

8 years agoDon't create relocations for absolute got entries.
Rafael Espindola [Fri, 15 Apr 2016 12:44:43 +0000 (12:44 +0000)]
Don't create relocations for absolute got entries.

llvm-svn: 266427

8 years ago[TSAN] Make tsan tests more portable (take 3)
Renato Golin [Fri, 15 Apr 2016 12:34:00 +0000 (12:34 +0000)]
[TSAN] Make tsan tests more portable (take 3)

Some tests didn't merge stderr with stdout.

Patch by Maxim Kuvyrkov.

llvm-svn: 266426

8 years agoDon't create relocations for non preemptable absolute symbols.
Rafael Espindola [Fri, 15 Apr 2016 12:22:22 +0000 (12:22 +0000)]
Don't create relocations for non preemptable absolute symbols.

llvm-svn: 266425

8 years agoTwo small related fixes.
Rafael Espindola [Fri, 15 Apr 2016 11:57:07 +0000 (11:57 +0000)]
Two small related fixes.

* A hidden undefined is not preemptable.
* It is always zero, so we don't need a dynamic reloc for it.

llvm-svn: 266424

8 years agoWork around a linux libc bug causing a crash in TaskPool
Pavel Labath [Fri, 15 Apr 2016 10:49:07 +0000 (10:49 +0000)]
Work around a linux libc bug causing a crash in TaskPool

Summary:
Doing a pthread_detach while the thread is exiting can cause crashes or other mischief, so we
make sure the thread stays around long enough. The performance impact of the added
synchronization should be minimal, as the parent thread is already holding a mutex, so I am just
making sure it holds it for a little while longer. It's possible the new thread will block on
this mutex immediately after startup, but it should be unblocked really quickly and some
blocking is unavoidable if we actually want to have this synchronization.

Reviewers: tberghammer

Subscribers: lldb-commits

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

llvm-svn: 266423

8 years agoFix usage of APInt.getRawData for big-endian systems
Ulrich Weigand [Fri, 15 Apr 2016 09:55:52 +0000 (09:55 +0000)]
Fix usage of APInt.getRawData for big-endian systems

Recommit modified version of r266311 including build bot regression fix.

This differs from the original r266311 by:

- Fixing Scalar::Promote to correctly zero- or sign-extend value depending
  on signedness of the *source* type, not the target type.

- Omitting a few stand-alone fixes that were already committed separately.

llvm-svn: 266422

8 years ago[ELF] Remove redundant empty line. NFC
Simon Atanasyan [Fri, 15 Apr 2016 09:47:36 +0000 (09:47 +0000)]
[ELF] Remove redundant empty line. NFC

llvm-svn: 266421

8 years agoMake Scalar::SChar return an explicit signed type
Ulrich Weigand [Fri, 15 Apr 2016 09:15:47 +0000 (09:15 +0000)]
Make Scalar::SChar return an explicit signed type

This is needed for platforms where the default "char" type is unsigned.

Originally committed as part of (now reverted) r266311.

llvm-svn: 266420

8 years agoFix Scalar::MakeSigned for 128- and 256-bit types.
Ulrich Weigand [Fri, 15 Apr 2016 09:15:22 +0000 (09:15 +0000)]
Fix Scalar::MakeSigned for 128- and 256-bit types.

Obvious fix for incorrect result types of the operation.

Originally committed as part of (now reverted) r266311.

llvm-svn: 266419

8 years agoFix Scalar::SetValueFromData for 128- and 256-bit types
Ulrich Weigand [Fri, 15 Apr 2016 09:14:59 +0000 (09:14 +0000)]
Fix Scalar::SetValueFromData for 128- and 256-bit types

Obvious fix for incorrect use of GetU64 offset pointer.

Originally committed as part of (now reverted) r266311.

llvm-svn: 266418

8 years agoFix ABISysV_s390x::GetArgumentValues
Ulrich Weigand [Fri, 15 Apr 2016 09:14:32 +0000 (09:14 +0000)]
Fix ABISysV_s390x::GetArgumentValues

This routine contained a stray "return false;" making part of the code
never executed.  Also, the stack offset where to find on-stack arguments
was incorrect.

llvm-svn: 266417

8 years agoMake destructor breakpoint location test more resilient
Pavel Labath [Fri, 15 Apr 2016 09:11:22 +0000 (09:11 +0000)]
Make destructor breakpoint location test more resilient

Summary:
The original breakpoint location test was failing for linux, because the compilers here tend to
merge the full-object and subobject destructors even at -O0 (as a result, we are getting only 2
breakpoint locations, and not 4 as the test expected. The fixup in r266164 substantially weakened
the test, as it now did not check whether both kinds of destructors were being found.

Because of these contraints, I have altered the logic of the test. It sets the
breakpoint by name, and then independently verifies that the breakpoint is set on the correct
demangled symbol name (which is not very meaningful since both kinds of destructors demangle to
the same name) *and* the correct symbol address (which is obtained by looking up the mangled
symbol name).

Reviewers: clayborg

Subscribers: ovyalov, zturner, lldb-commits

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

llvm-svn: 266416

8 years ago[MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifier
Andrey Bokhanko [Fri, 15 Apr 2016 08:03:51 +0000 (08:03 +0000)]
[MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifier

This patch implements __unaligned as a type qualifier; before that, it was
modeled as an attribute. Proper mangling of __unaligned is implemented as well.
Some OpenCL code/tests are tangenially affected, as they relied on existing
number and sizes of type qualifiers.

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

llvm-svn: 266415

8 years agoUse MVT instead of EVT to remove a bunch of unnecessary calls to getSimpleVT.
Craig Topper [Fri, 15 Apr 2016 06:20:21 +0000 (06:20 +0000)]
Use MVT instead of EVT to remove a bunch of unnecessary calls to getSimpleVT.

llvm-svn: 266414

8 years agoAdd a setOperationPromotedToType convenience method that sets an operation to promote...
Craig Topper [Fri, 15 Apr 2016 06:20:18 +0000 (06:20 +0000)]
Add a setOperationPromotedToType convenience method that sets an operation to promoted and set the type in one call. Use it so save code in X86.

llvm-svn: 266413

8 years ago[X86] AND, OR, and XOR of vectors are always legal no need to set them legal explicitly.
Craig Topper [Fri, 15 Apr 2016 06:20:14 +0000 (06:20 +0000)]
[X86] AND, OR, and XOR of vectors are always legal no need to set them legal explicitly.

llvm-svn: 266412

8 years ago[Polly] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Mandeep Singh Grang [Fri, 15 Apr 2016 06:12:29 +0000 (06:12 +0000)]
[Polly] Remove unwanted --check-prefix=CHECK from unit tests. NFC.

Summary:
Removed unwanted --check-prefix=CHECK from the following unit tests:
      DeadCodeElimination/dead_iteration_elimination.ll
      Isl/CodeGen/simple_vec_cast.ll

Patch by: Mandeep Singh Grang (mgrang)

Reviewers: jdoerfert, zinob, spop, grosser

Projects: #polly

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

llvm-svn: 266411

8 years ago[X86] Combine an if and else block that had the same set of calls to setOperationActi...
Craig Topper [Fri, 15 Apr 2016 04:57:09 +0000 (04:57 +0000)]
[X86] Combine an if and else block that had the same set of calls to setOperationAction that only varied in Legal/Custom. Use the ternary operator on that argument instead. NFC

llvm-svn: 266410

8 years ago[libcxx] Remove the "reduced-arity-initialization" extension from the uses-allocator...
Eric Fiselier [Fri, 15 Apr 2016 03:29:40 +0000 (03:29 +0000)]
[libcxx] Remove the "reduced-arity-initialization" extension from the uses-allocator constructors

Summary:
A default uses-allocator constructor has been added since that overload was previously provided by the extended constructor.

Since Clang does implicit conversion checking after substitution this constructor has to deduce the allocator_arg_t parameter so that it can prevent the evaluation of "is_default_constructible" if the first argument doesn't match. See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1391 for more information.

This patch fixes PR24779 (https://llvm.org/bugs/show_bug.cgi?id=24779)

Subscribers: cfe-commits

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

llvm-svn: 266409

8 years agoRevert "[LTO] Add a new splitCodeGen() API which takes a TargetMachineFactory."
Davide Italiano [Fri, 15 Apr 2016 02:07:03 +0000 (02:07 +0000)]
Revert "[LTO] Add a new splitCodeGen() API which takes a TargetMachineFactory."

This reverts commits r266390 and r266396 as they broke some bots.

llvm-svn: 266408

8 years agoAdd the PDBParser.{cpp,h} files to the Xcode project.
Jim Ingham [Fri, 15 Apr 2016 01:42:30 +0000 (01:42 +0000)]
Add the PDBParser.{cpp,h} files to the Xcode project.

llvm-svn: 266407

8 years ago[NVPTX] Set NVPTXTTI::getInliningThresholdMultiplier to 5.
Justin Lebar [Fri, 15 Apr 2016 01:38:50 +0000 (01:38 +0000)]
[NVPTX] Set NVPTXTTI::getInliningThresholdMultiplier to 5.

Summary:
Calls on NVPTX are unusually expensive (for one thing, lots of state
needs to be saved to memory, which is slow), so make the inlininer much
more aggressive.

Reviewers: chandlerc

Subscribers: jholewinski, llvm-commits, tra

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

llvm-svn: 266406

8 years ago[TTI] Add getInliningThresholdMultiplier.
Justin Lebar [Fri, 15 Apr 2016 01:38:48 +0000 (01:38 +0000)]
[TTI] Add getInliningThresholdMultiplier.

Summary:
InlineCost's threshold is multiplied by this value.  This lets us adjust
the inlining threshold up or down on a per-target basis.  For example,
we might want to increase the threshold on targets where calls are
unusually expensive.

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 266405

8 years ago[ifcnv] Don't duplicate blocks that contain convergent instructions.
Justin Lebar [Fri, 15 Apr 2016 01:38:41 +0000 (01:38 +0000)]
[ifcnv] Don't duplicate blocks that contain convergent instructions.

It's unsafe to duplicate blocks that contain convergent instructions
during ifcnv.  See the patch for details.

Reviewers: hfinkel

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

llvm-svn: 266404

8 years agoMove divergent-target test into CodeGen/NVPTX because it requires an NVPTX target.
Justin Lebar [Fri, 15 Apr 2016 01:20:52 +0000 (01:20 +0000)]
Move divergent-target test into CodeGen/NVPTX because it requires an NVPTX target.

llvm-svn: 266403

8 years agoclang-cl: Don't check for existence of linker inputs when /link is used
Hans Wennborg [Fri, 15 Apr 2016 01:12:32 +0000 (01:12 +0000)]
clang-cl: Don't check for existence of linker inputs when /link is used

There might be flags passed to the linker (e.g. /libpath), causing it
to search in paths the Clang driver doesn't know about.

PR27234

llvm-svn: 266402

8 years agoRename out->std_out in AppleObjCRuntimeV2.cpp.
Oleksiy Vyalov [Fri, 15 Apr 2016 00:56:11 +0000 (00:56 +0000)]
Rename out->std_out in AppleObjCRuntimeV2.cpp.

llvm-svn: 266401

8 years agoBlocks are only reliably supported on Darwin. Disable the test otherwise.
Sean Callanan [Fri, 15 Apr 2016 00:44:59 +0000 (00:44 +0000)]
Blocks are only reliably supported on Darwin.  Disable the test otherwise.

llvm-svn: 266400

8 years ago[PM] Add a SpeculativeExecution pass for targets with divergent branches.
Justin Lebar [Fri, 15 Apr 2016 00:32:12 +0000 (00:32 +0000)]
[PM] Add a SpeculativeExecution pass for targets with divergent branches.

Summary:
This IR pass is helpful for GPUs, and other targets with divergent
branches.  It's a nop on targets without divergent branches.

Reviewers: chandlerc

Subscribers: llvm-commits, jingyue, rnk, joker.eph, tra

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

llvm-svn: 266399

8 years ago[Speculation] Add a SpeculativeExecution mode where the pass does nothing unless...
Justin Lebar [Fri, 15 Apr 2016 00:32:09 +0000 (00:32 +0000)]
[Speculation] Add a SpeculativeExecution mode where the pass does nothing unless TTI::hasBranchDivergence() is true.

Summary:
This lets us add this pass to the IR pass manager unconditionally; it
will simply not do anything on targets without branch divergence.

Reviewers: tra

Subscribers: llvm-commits, jingyue, rnk, chandlerc

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

llvm-svn: 266398

8 years agoAdded a testcase for defining and using lambdas in the expression parser.
Sean Callanan [Fri, 15 Apr 2016 00:26:32 +0000 (00:26 +0000)]
Added a testcase for defining and using lambdas in the expression parser.

<rdar://problem/25739133>

llvm-svn: 266397

8 years ago[ParallelCG] Attempt to placate MSVC.
Davide Italiano [Fri, 15 Apr 2016 00:25:19 +0000 (00:25 +0000)]
[ParallelCG] Attempt to placate MSVC.

llvm-svn: 266396

8 years agoclang-cl: Make /link accept an optional joined argument.
Hans Wennborg [Fri, 15 Apr 2016 00:24:15 +0000 (00:24 +0000)]
clang-cl: Make /link accept an optional joined argument.

For example, "cl.exe a.c /linkfoo bar" is a valid invocation and
forwards "foo" and "bar" to link.exe. This makes clang-cl handle
that kind of invocation.

Depends on LLVM r266394.

llvm-svn: 266395

8 years agoOption parser: class for consuming a joined arg in addition to all remaining args
Hans Wennborg [Fri, 15 Apr 2016 00:23:30 +0000 (00:23 +0000)]
Option parser: class for consuming a joined arg in addition to all remaining args

llvm-svn: 266394

8 years agoOptionParsingTest.cpp: reorder EXPECT_EQs to put expectation on the left. NFC.
Hans Wennborg [Fri, 15 Apr 2016 00:23:15 +0000 (00:23 +0000)]
OptionParsingTest.cpp: reorder EXPECT_EQs to put expectation on the left. NFC.

This provides for better error messages from the framework when the expected
and actual values don't match.

llvm-svn: 266393