platform/upstream/llvm.git
8 years agoFix test submitted with r275115 (failed on ppc64 buildbots).
Wolfgang Pieb [Mon, 11 Jul 2016 23:20:28 +0000 (23:20 +0000)]
Fix test submitted with r275115 (failed on ppc64 buildbots).

llvm-svn: 275127

8 years agoAttempt to make buildbots happy.
George Burgess IV [Mon, 11 Jul 2016 23:18:32 +0000 (23:18 +0000)]
Attempt to make buildbots happy.

Woohoo, unused variable warnings in builds without asserts (as a result
of r275122).

llvm-svn: 275126

8 years agoAdd a libLTO API to query a memory buffer and check if it contains ObjC categories
Mehdi Amini [Mon, 11 Jul 2016 23:10:18 +0000 (23:10 +0000)]
Add a libLTO API to query a memory buffer and check if it contains ObjC categories

The linker supports a feature to force load an object from a static
archive if it defines an Objective-C category.
This API supports this feature by looking at every section in the
module to find if a category is defined in the module.

llvm-svn: 275125

8 years agomissing modifications for http://reviews.llvm.org/D21952
Etienne Bergeron [Mon, 11 Jul 2016 23:09:33 +0000 (23:09 +0000)]
missing modifications for reviews.llvm.org/D21952

llvm-svn: 275124

8 years ago[compiler-rt] Refactor the interception code on windows.
Etienne Bergeron [Mon, 11 Jul 2016 23:02:18 +0000 (23:02 +0000)]
[compiler-rt] Refactor the interception code on windows.

Summary:
This is a cleanup and refactoring of the interception code on windows

Enhancement:
  * Adding the support for 64-bits code
  * Adding several hooking technique:
    * Detour
    * JumpRedirect
    * HotPatch
    * Trampoline
  * Adding a trampoline memory pool (64-bits) and release the allocated memory in unittests

Cleanup:
  * Adding unittests for 64-bits hooking techniques
  * Enhancing the RoundUpInstruction by sharing common decoder

Reviewers: rnk

Subscribers: llvm-commits, wang0109, chrisha

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

llvm-svn: 275123

8 years ago[CFLAA] Simplify CFLGraphBuilder. NFC.
George Burgess IV [Mon, 11 Jul 2016 22:59:09 +0000 (22:59 +0000)]
[CFLAA] Simplify CFLGraphBuilder. NFC.

This patch simplifies the graph builder by encoding nodes as {Value,
Dereference Level} pairs. This lets us kill edge types, and allows us to
get rid of hacks in StratifiedSets (like addAttrsBelow/...). This
simplification also allows us to remove InstantiatedRelations and
InstantiatedAttrs.

Patch by Jia Chen.

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

llvm-svn: 275122

8 years ago[Coverage] Do not map regions from system headers
Vedant Kumar [Mon, 11 Jul 2016 22:57:46 +0000 (22:57 +0000)]
[Coverage] Do not map regions from system headers

Do not assign source regions located within system headers file ID's,
and do not construct counter mapping regions out of them.

This makes coverage reports less cluttered and less mysterious. E.g
using the "assert" macro doesn't cause assert.h to appear in reports,
and it no longer shows the "assertion failed" branch as an uncovered
region.

It also makes coverage mapping sections a bit smaller (e.g a 1%
reduction in a stage2 build of bin/llvm-as).

llvm-svn: 275121

8 years ago[Coverage] Move logic to skip decl's into a helper (NFC)
Vedant Kumar [Mon, 11 Jul 2016 22:57:44 +0000 (22:57 +0000)]
[Coverage] Move logic to skip decl's into a helper (NFC)

llvm-svn: 275120

8 years agoFixed a threading race condition where we could crash after calling Debugger::Termina...
Greg Clayton [Mon, 11 Jul 2016 22:50:18 +0000 (22:50 +0000)]
Fixed a threading race condition where we could crash after calling Debugger::Terminate().

The issue was we have two global variables: one that contains a DebuggerList pointer and one that contains a std::mutex pointer. These get initialized in Debugger::Initialize(), and everywhere that uses these does:

if (g_debugger_list_ptr && g_debugger_list_mutex_ptr)
{
    std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
    // do work while mutex is locked
}

Debugger::Terminate() was deleting and nulling out g_debugger_list_ptr which meant we had a race condition where someone might do the if statement and it evaluates to true, then another thread calls Debugger::Terminate() and deletes and nulls out g_debugger_list_ptr while holding the mutex, and another thread then locks the mutex and tries to use g_debugger_list_ptr. The fix is to just not delete and null out the g_debugger_list_ptr variable.

llvm-svn: 275119

8 years agoNew pass manager for LICM.
Dehao Chen [Mon, 11 Jul 2016 22:45:24 +0000 (22:45 +0000)]
New pass manager for LICM.

Summary: Port LICM to the new pass manager.

Reviewers: davidxl, silvas

Subscribers: silvas, davide, sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 275118

8 years agoCorrect ordering of loads/stores.
Alina Sbirlea [Mon, 11 Jul 2016 22:34:29 +0000 (22:34 +0000)]
Correct ordering of loads/stores.

Summary:
Aiming to correct the ordering of loads/stores. This patch changes the
insert point for loads to the position of the first load.
It updates the ordering method for loads to insert before, rather than after.

Before this patch the following sequence:
"load a[1], store a[1], store a[0], load a[2]"
Would incorrectly vectorize to "store a[0,1], load a[1,2]".
The correctness check was assuming the insertion point for loads is at
the position of the first load, when in practice it was at the last
load. An alternative fix would have been to invert the correctness check.
The current fix changes insert position but also requires reordering of
instructions before the vectorized load.

Updated testcases to reflect the changes.

Reviewers: tstellarAMD, llvm-commits, jlebar, arsenm

Subscribers: mzolotukhin

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

llvm-svn: 275117

8 years agoARM: validate immediate branch targets in AsmParser.
Tim Northover [Mon, 11 Jul 2016 22:29:37 +0000 (22:29 +0000)]
ARM: validate immediate branch targets in AsmParser.

Immediate branch targets aren't commonly used, but if they are we should make
sure they can actually be encoded. This means they must be divisible by 2 when
targeting Thumb mode, and by 4 when targeting ARM mode.

Also do a little naming cleanup while I was changing everything around anyway.

llvm-svn: 275116

8 years agoPrevent the creation of empty (forwarding) blocks resulting from nested ifs.
Wolfgang Pieb [Mon, 11 Jul 2016 22:22:23 +0000 (22:22 +0000)]
Prevent the creation of empty (forwarding) blocks resulting from nested ifs.

Summary:
Nested if statements can generate empty BBs whose terminator branches
unconditionally to its successor. These branches are not eliminated
to help generate better line number information in some cases, but there
is no reason to keep the empty blocks that result from nested ifs.

Reviewers: mehdi_amini, dblaikie, echristo

Subscribers: mehdi_amini, cfe-commits

Differential review: http://reviews.llvm.org/D11360

llvm-svn: 275115

8 years agoDon't compute modulus of hash if it is smaller than the bucket count.
Eric Fiselier [Mon, 11 Jul 2016 22:02:02 +0000 (22:02 +0000)]
Don't compute modulus of hash if it is smaller than the bucket count.

This cleans up a previous optimization attempt in hash, and results in
additional performance improvements over that previous attempt. Additionally
this new optimization does not hinder the power of 2 bucket count optimization.

llvm-svn: 275114

8 years agoAMDGPU: Treat texture gather instructions more like other MIMG instructions
Nicolai Haehnle [Mon, 11 Jul 2016 21:59:43 +0000 (21:59 +0000)]
AMDGPU: Treat texture gather instructions more like other MIMG instructions

Summary:
Setting MIMG to 0 has a bunch of unexpected side effects, including that
isVMEM returns false which leads to incorrect treatment in the hazard
recognizer. The reason I noticed it is that it also leads to incorrect
treatment in VGPR-to-SGPR copies, which is one cause of the referenced bug.

The only reason why MIMG was set to 0 is to signal the special handling of
dmasks, but that can be checked differently.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96877

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, kzhuravl, llvm-commits

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

llvm-svn: 275113

8 years agoremove empty lines
Etienne Bergeron [Mon, 11 Jul 2016 21:57:11 +0000 (21:57 +0000)]
remove empty lines

llvm-svn: 275112

8 years ago[compiler-rt] Fix VisualStudio virtual folders layout
Etienne Bergeron [Mon, 11 Jul 2016 21:51:56 +0000 (21:51 +0000)]
[compiler-rt] Fix VisualStudio virtual folders layout

Summary:
This patch is a refactoring of the way cmake 'targets' are grouped.
It won't affect non-UI cmake-generators.

Clang/LLVM are using a structured way to group targets which ease
navigation through Visual Studio UI. The Compiler-RT projects
differ from the way Clang/LLVM are grouping targets.

This patch doesn't contain behavior changes.

Reviewers: kubabrecka, rnk

Subscribers: wang0109, llvm-commits, kubabrecka, chrisha

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

llvm-svn: 275111

8 years agoRefactor the PDB writing to use a builder approach
Zachary Turner [Mon, 11 Jul 2016 21:45:26 +0000 (21:45 +0000)]
Refactor the PDB writing to use a builder approach

llvm-svn: 275110

8 years ago[pdb] Add a pdb2yaml option to not dump file headers.
Zachary Turner [Mon, 11 Jul 2016 21:45:09 +0000 (21:45 +0000)]
[pdb] Add a pdb2yaml option to not dump file headers.

This will be useful once we start adding the ability to dump type
records and symbol records, since it will allow us to generate
mergeable information instead of information that specifies an
entire file.

llvm-svn: 275109

8 years agoAMDGPU: fix local stack slot allocation bugs
Nicolai Haehnle [Mon, 11 Jul 2016 21:44:40 +0000 (21:44 +0000)]
AMDGPU: fix local stack slot allocation bugs

Summary:
The main bug fix here is using the 32-bit encoding of V_ADD_I32 in
materializeFrameBaseRegister and resolveFrameIndex, so that arbitrary
immediates work.

The second part is that we may now require the SegmentWaveByteOffset
even when there are initially no stack objects and VGPR spilling isn't
enabled, for stack slots that are allocated later. This means that some
bits become effectively dead and can be cleaned up.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96602
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 275108

8 years ago[asan] Add exception handler to map memory on demand on Win64.
Etienne Bergeron [Mon, 11 Jul 2016 21:40:59 +0000 (21:40 +0000)]
[asan] Add exception handler to map memory on demand on Win64.
Memory will be committed on demand when exception happens while accessing
shadow memeory region.

Patch by: Wei Wang
Differential Revision: http://reviews.llvm.org/D21942

llvm-svn: 275107

8 years ago[X86] Make some cast costs more precise
Michael Kuperstein [Mon, 11 Jul 2016 21:39:44 +0000 (21:39 +0000)]
[X86] Make some cast costs more precise

Make some AVX and AVX512 cast costs more precise.
Based on part of a patch by Elena Demikhovsky (D15604).

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

llvm-svn: 275106

8 years agoAlways use the allocator to construct/destruct elements of a deque/vector. Fixes...
Marshall Clow [Mon, 11 Jul 2016 21:38:08 +0000 (21:38 +0000)]
Always use the allocator to construct/destruct elements of a deque/vector. Fixes PR#28412. Thanks to Jonathan Wakely for the report.

llvm-svn: 275105

8 years agoCodegen: Fix comment in BranchFolding.cpp
Kyle Butt [Mon, 11 Jul 2016 21:37:03 +0000 (21:37 +0000)]
Codegen: Fix comment in BranchFolding.cpp

Blocks to be tail-merged may share more than one successor. Correct the
comment to state that they share a specific successor, SuccBB, rather
than a single successor, which is not true.

llvm-svn: 275104

8 years ago[X86] Fix tailcall return address clobber bug.
Quentin Colombet [Mon, 11 Jul 2016 21:03:03 +0000 (21:03 +0000)]
[X86] Fix tailcall return address clobber bug.

This bug (llvm.org/PR28124) was introduced by r237977, which refactored
the tail call  sequence to be generated in two passes instead of one.

Unfortunately, the stack adjustment produced by the first pass was not
recognized by X86FrameLowering::mergeSPUpdates() in all cases, causing
code such as the following, which clobbers the return address, to be
generated:

popl    %edi
popl    %edi
pushl   %eax
jmp     tailcallee              # TAILCALL

To fix the problem, the entire stack adjustment is performed in
X86ExpandPseudo::ExpandMI() for tail calls.

Patch by Magnus Lång <margnus1@gmail.com>

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

llvm-svn: 275103

8 years agofix documentation comments; NFC
Sanjay Patel [Mon, 11 Jul 2016 20:50:39 +0000 (20:50 +0000)]
fix documentation comments; NFC

llvm-svn: 275101

8 years agoAdd TLI.allowsMisalignedMemoryAccesses to LoadStoreVectorizer
Alina Sbirlea [Mon, 11 Jul 2016 20:46:17 +0000 (20:46 +0000)]
Add TLI.allowsMisalignedMemoryAccesses to LoadStoreVectorizer

Summary: Extend TTI to access TLI.allowsMisalignedMemoryAccesses(). Check condition when vectorizing load and store chains.
Add additional parameters: AddressSpace, Alignment, Fast.

Reviewers: llvm-commits, jlebar

Subscribers: arsenm, mzolotukhin

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

llvm-svn: 275100

8 years ago[X86] Disable FixupSetCC for CodeGenOpt::None
Michael Kuperstein [Mon, 11 Jul 2016 20:40:44 +0000 (20:40 +0000)]
[X86] Disable FixupSetCC for CodeGenOpt::None

It is an optimization pass, and should not run at -O0. Especially since Fast RA
will not do the required register coalescing anyway, so it's a loss even from
the optimization standpoint.

This also works around (but doesn't quite fix) PR28489.

llvm-svn: 275099

8 years ago[compiler-rt] Refactor the interception code on windows.
Etienne Bergeron [Mon, 11 Jul 2016 20:37:12 +0000 (20:37 +0000)]
[compiler-rt] Refactor the interception code on windows.

[asan] Fix unittest Asan-x86_64-inline-Test crashing on Windows64

REAL(memcpy) was used in several places in Asan, while REAL(memmove) was not used.
This CL chooses to patch memcpy() first, solving the crash for unittest.

The crash looks like this:

projects\compiler-rt\lib\asan\tests\default\Asan-x86_64-inline-Test.exe
=================================================================
==22680==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000000 (pc 0x000000000000 bp 0x0029d555f590 sp 0x0029d555f438 T0)
==22680==Hint: pc points to the zero page.

AddressSanitizer can not provide additional info.
 SUMMARY: AddressSanitizer: access-violation (<unknown module>)
==22680==ABORTING

Patch by: Wei Wang
Differential Revision: http://reviews.llvm.org/D22232

llvm-svn: 275098

8 years ago[NFC] Reorder fields of VersionTuple to reduce size
Erik Pilkington [Mon, 11 Jul 2016 20:00:48 +0000 (20:00 +0000)]
[NFC] Reorder fields of VersionTuple to reduce size

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

llvm-svn: 275095

8 years agoAllow is_swappable to SFINAE on deleted/ambiguous swap functions
Eric Fiselier [Mon, 11 Jul 2016 19:57:13 +0000 (19:57 +0000)]
Allow is_swappable to SFINAE on deleted/ambiguous swap functions

llvm-svn: 275094

8 years agoHide some internal symbols for memory resource.
Eric Fiselier [Mon, 11 Jul 2016 19:22:09 +0000 (19:22 +0000)]
Hide some internal symbols for memory resource.

llvm-svn: 275089

8 years ago[IPRA] Properly compute register usage at call sites.
Chad Rosier [Mon, 11 Jul 2016 18:45:49 +0000 (18:45 +0000)]
[IPRA] Properly compute register usage at call sites.

Differential Revision: http://reviews.llvm.org/D21395
Patch by Vivek Pandya.
PR28144

llvm-svn: 275087

8 years ago[SystemZ] Recognize Load On Condition Immediate (LOCHI/LOGHI) opportunities
Zhan Jun Liau [Mon, 11 Jul 2016 18:45:03 +0000 (18:45 +0000)]
[SystemZ] Recognize Load On Condition Immediate (LOCHI/LOGHI) opportunities

Summary: Add support for the z13 instructions LOCHI and LOCGHI which
conditionally load immediate values.  Add target instruction info hooks so
that if conversion will allow predication of LHI/LGHI.

Author: RolandF

Reviewers: uweigand

Subscribers: zhanjunl

Commiting on behalf of Roland.

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

llvm-svn: 275086

8 years agoFix a build warning of unhandled enum in switch
Weiming Zhao [Mon, 11 Jul 2016 18:27:52 +0000 (18:27 +0000)]
Fix a build warning of unhandled enum in switch

Summary: LLVM adds a new value FMRB_DoesNotReadMemory in the enumeration.

Reviewers: andrew.w.kaylor, chrisj, zinob, grosser, jdoerfert

Subscribers: Meinersbur, pollydev

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

llvm-svn: 275085

8 years ago[SCCP] Try to follow the DRY principle, use `OpSt`.
Davide Italiano [Mon, 11 Jul 2016 18:21:29 +0000 (18:21 +0000)]
[SCCP] Try to follow the DRY principle, use `OpSt`.

Thanks to Eli Friedman for pointing out in his post-commit review!

llvm-svn: 275084

8 years ago[SLSR] Call getPointerSizeInBits with the correct address space.
Jingyue Wu [Mon, 11 Jul 2016 18:13:28 +0000 (18:13 +0000)]
[SLSR] Call getPointerSizeInBits with the correct address space.

llvm-svn: 275083

8 years ago[PM/IPO] Port LowerTypeTests to the new PassManager.
Davide Italiano [Mon, 11 Jul 2016 18:10:06 +0000 (18:10 +0000)]
[PM/IPO] Port LowerTypeTests to the new PassManager.

There's a little bit of churn in this patch because the initialization
mechanism is now shared between the old and the new PM. Other than
that, it's just a pretty mechanical translation.

llvm-svn: 275082

8 years ago[lanai] Add more tests for assembly of conditional ALU ops
Jacques Pienaar [Mon, 11 Jul 2016 17:58:16 +0000 (17:58 +0000)]
[lanai] Add more tests for assembly of conditional ALU ops

llvm-svn: 275081

8 years agoFix an issue where one could not define a Python command with the same name as an...
Enrico Granata [Mon, 11 Jul 2016 17:36:55 +0000 (17:36 +0000)]
Fix an issue where one could not define a Python command with the same name as an existing alias (or rather, one could but the results of invoking the command were far from satisfactory)

llvm-svn: 275080

8 years agoFix the assertion failure caused by http://reviews.llvm.org/D22118
Dehao Chen [Mon, 11 Jul 2016 17:36:02 +0000 (17:36 +0000)]
Fix the assertion failure caused by reviews.llvm.org/D22118

Summary: http://reviews.llvm.org/D22118 uses metadata to store the call count, which makes it possible to have branch weight to have only one elements. Also fix the assertion failure in inliner when checking the instruction type to include "invoke" instruction.

Reviewers: mkuper, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 275079

8 years ago[Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument
David Majnemer [Mon, 11 Jul 2016 17:09:56 +0000 (17:09 +0000)]
[Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument

After thinking about it, we don't really need to forbid
BuiltinTemplateDecls explicitly.  The restriction doesn't really buy us
anything.

llvm-svn: 275078

8 years ago[IR] Stop a -Wsign-compare warning from firing
David Majnemer [Mon, 11 Jul 2016 17:09:06 +0000 (17:09 +0000)]
[IR] Stop a -Wsign-compare warning from firing

llvm-svn: 275077

8 years ago[man page] Document -gline-tables-only in the clang man page.
Adrian Prantl [Mon, 11 Jul 2016 17:03:16 +0000 (17:03 +0000)]
[man page] Document -gline-tables-only in the clang man page.

llvm-svn: 275076

8 years ago[man page] Fix two sphinx build errors.
Adrian Prantl [Mon, 11 Jul 2016 17:03:13 +0000 (17:03 +0000)]
[man page] Fix two sphinx build errors.
These options were referenced by other paragraphs, but never specified.

llvm-svn: 275075

8 years ago[LowerTypeTests] Don't rely on doInitialization().
Davide Italiano [Mon, 11 Jul 2016 17:00:31 +0000 (17:00 +0000)]
[LowerTypeTests] Don't rely on doInitialization().

In preparation for porting this pass to the new PM (which has no
doInitialization()).

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

llvm-svn: 275074

8 years agoImplement callsite-hotness based inline cost for Sample-based PGO
Dehao Chen [Mon, 11 Jul 2016 16:48:54 +0000 (16:48 +0000)]
Implement callsite-hotness based inline cost for Sample-based PGO

Summary:
For sample-based PGO, using BFI to calculate callsite count is sometime not accurate. This is because with sampling based approach, if a callsite resides in a hot loop deeply nested in a bunch of cold branches, the callsite's BFI frequency would be inaccurately calculated due to lack of samples in the cold branch.

E.g.

if (A1 && A2 && A3 && ..... && A10) {
  for (i=0; i < 100000000; i++) {
    callsite();
  }
}

Assume that A1 to A100 are all 100% taken, and callsite has 1000 samples and thus is considerred hot. Because the loop's trip count is huge, it's normal that all branches outside the loop has no sample at all. As a result, we can only use static branch probability to derive the the frequency of the loop header. Assuming that static heuristic thinks each branch is 50% taken, then the count calculated from BFI will be 1/(2^10) of the actual value.

In order to get more accurate callsite count, we directly annotate the weight on the call instruction, and directly use it when checking callsite hotness.

Note that this mechanism can also be shared by instrumentation based callsite hotness analysis. The side benefit is that it breaks the dependency from Inliner to BFI as call count is embedded in the IR.

Reviewers: davidxl, eraman, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 275073

8 years agoTune the weight propagation algorithm for sample profile.
Dehao Chen [Mon, 11 Jul 2016 16:40:17 +0000 (16:40 +0000)]
Tune the weight propagation algorithm for sample profile.

Summary: Handle the case when there is only one incoming/outgoing edge for a visited basic block: use the block weight to adjust edge weight even when the edge has been visited before. This can help reduce inaccuracies introduced by incorrect basic block profile, as shown in the updated unittest.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 275072

8 years ago[tsan] Add support for GCD IO channels on Darwin
Kuba Brecka [Mon, 11 Jul 2016 15:57:50 +0000 (15:57 +0000)]
[tsan] Add support for GCD IO channels on Darwin

This patch adds interceptors for dispatch_io_*, dispatch_read and dispatch_write functions. This avoids false positives when using GCD IO. Adding several test cases.

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

llvm-svn: 275071

8 years ago[x86] make some of the tests 256-bit for testing diversity
Sanjay Patel [Mon, 11 Jul 2016 15:08:37 +0000 (15:08 +0000)]
[x86] make some of the tests 256-bit for testing diversity

llvm-svn: 275070

8 years agoAdd missing include from previous commit
Nirav Dave [Mon, 11 Jul 2016 14:32:57 +0000 (14:32 +0000)]
Add missing include from previous commit

llvm-svn: 275069

8 years agoFix branch relaxation in 16-bit mode.
Nirav Dave [Mon, 11 Jul 2016 14:23:53 +0000 (14:23 +0000)]
Fix branch relaxation in 16-bit mode.

Thread through MCSubtargetInfo to relaxInstruction function allowing relaxation
to generate jumps with 16-bit sized immediates in 16-bit mode.

This fixes PR22097.

Reviewers: dwmw2, tstellarAMD, craig.topper, jyknight

Subscribers: jfb, arsenm, jyknight, llvm-commits, dsanders

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

llvm-svn: 275068

8 years ago[x86] specify triple to avoid bot failures
Sanjay Patel [Mon, 11 Jul 2016 14:17:54 +0000 (14:17 +0000)]
[x86] specify triple to avoid bot failures

llvm-svn: 275067

8 years ago[Sink] Don't move calls to readonly functions across stores
Nicolai Haehnle [Mon, 11 Jul 2016 14:11:51 +0000 (14:11 +0000)]
[Sink] Don't move calls to readonly functions across stores

Summary:

Reviewers: hfinkel, majnemer, tstellarAMD, sunfish

Subscribers: llvm-commits

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

llvm-svn: 275066

8 years agoAliasAnalysis: unify getModRefInfo(I, CS) semantics with other overloads
Nicolai Haehnle [Mon, 11 Jul 2016 14:11:45 +0000 (14:11 +0000)]
AliasAnalysis: unify getModRefInfo(I, CS) semantics with other overloads

This subtle change to getModRefInfo(Instruction, ImmutableCallSite) is to
ensure that the semantics are equal to that of getModRefInfo(CS1, CS2) when
the Instruction is a call-site.

This is now more in line with getModRefInfo generally: it returns Mod when
I modifies a memory location that is accessed (read or written) by CS and
Ref when I reads a memory location that is written by CS.

From a grep of the code, the only uses of this particular getModRefInfo
overload are in MemorySSA and MemCpyOptimizer, and they only care about
where the result is MR_NoModRef or not. Therefore, this change should have
no visible effect.

Separated out from D17279 upon request.

llvm-svn: 275065

8 years ago[x86] update checks
Sanjay Patel [Mon, 11 Jul 2016 14:07:31 +0000 (14:07 +0000)]
[x86] update checks

llvm-svn: 275064

8 years agoChanges related to tooling::applyAllReplacements interface change in D21601.
Eric Liu [Mon, 11 Jul 2016 13:53:21 +0000 (13:53 +0000)]
Changes related to tooling::applyAllReplacements interface change in D21601.

Summary:
this patch contains changes related to the interface change from
http://reviews.llvm.org/D21601. Only submit this patch after D21601 is
submitted.

Reviewers: djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 275063

8 years agoMake tooling::applyAllReplacements return llvm::Expected<string> instead of empty...
Eric Liu [Mon, 11 Jul 2016 13:53:12 +0000 (13:53 +0000)]
Make tooling::applyAllReplacements return llvm::Expected<string> instead of empty string to indicate potential error.

Summary:
return llvm::Expected<> to carry error status and error information.
This is the first step towards introducing "Error" into tooling::Replacements.

Reviewers: djasper, klimek

Subscribers: ioeric, klimek, cfe-commits

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

llvm-svn: 275062

8 years ago[OpenCL] Improved diagnostics of OpenCL types.
Anastasia Stulova [Mon, 11 Jul 2016 13:46:02 +0000 (13:46 +0000)]
[OpenCL] Improved diagnostics of OpenCL types.

 - Changes diagnostics for Blocks to be implicitly
const qualified OpenCL v2.0 s6.12.5.

 - Added and unified diagnostics of some OpenCL special types:
blocks, images, samplers, pipes. These types are intended for use
with the OpenCL builtin functions only and, therefore, most regular
uses are not allowed including assignments, arithmetic operations,
pointer dereferencing, etc.

Review: http://reviews.llvm.org/D21989
llvm-svn: 275061

8 years agoChange the /proc/<pid>/maps to not assert on incorrect input
Tamas Berghammer [Mon, 11 Jul 2016 13:43:27 +0000 (13:43 +0000)]
Change the /proc/<pid>/maps to not assert on incorrect input

If LLDB reads some incorrect input form /proc/<pid>/maps then it
should report an error instead of assert-ing as we don't want to
crash in case of an incorrect maps file.

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

llvm-svn: 275060

8 years ago[X86][SSE] Generalise target shuffle combine of shuffles using variable masks
Simon Pilgrim [Mon, 11 Jul 2016 12:49:35 +0000 (12:49 +0000)]
[X86][SSE] Generalise target shuffle combine of shuffles using variable masks

At present the only shuffle with a variable mask we recognise is PSHUFB, which influences if its worth the cost of mask creation/loading of a combined target shuffle with a variable mask. This change sets up the infrastructure to support other shuffles in the future but has no effect yet.

llvm-svn: 275059

8 years agoProvide support for preserving assembly comments
Nirav Dave [Mon, 11 Jul 2016 12:42:14 +0000 (12:42 +0000)]
Provide support for preserving assembly comments

Preserve assembly comments from input in output assembly and flags to
toggle property. This is on by default for inline assembly and off in
llvm-mc.

Parsed comments are emitted immediately before an EOL which generally
places them on the expected line.

Reviewers: rtrieu, dwmw2, rnk, majnemer

Subscribers: llvm-commits

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

llvm-svn: 275058

8 years agoFix gcc compile failure
Tobias Grosser [Mon, 11 Jul 2016 12:27:04 +0000 (12:27 +0000)]
Fix gcc compile failure

Commit r275056 introduced a gcc compile failure due to us using two
types named 'Type', the first being the newly introduced member variable
'Type' the second being llvm::Type. We resolve this issue by renaming
the newly introduced member variable to AccessType.

llvm-svn: 275057

8 years agoInvariantEquivClassTy: Use struct instead of 4-tuple to increase readability
Tobias Grosser [Mon, 11 Jul 2016 12:15:10 +0000 (12:15 +0000)]
InvariantEquivClassTy: Use struct instead of 4-tuple to increase readability

Summary:
With a struct we can use named accessors instead of generic std::get<3>()
calls. This increases readability of the source code.

Reviewers: jdoerfert

Subscribers: pollydev, llvm-commits

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

llvm-svn: 275056

8 years agoAdd test case forgotten in r275053
Tobias Grosser [Mon, 11 Jul 2016 12:15:06 +0000 (12:15 +0000)]
Add test case forgotten in r275053

llvm-svn: 275055

8 years ago[AMDGPU][llvm-mc] Quickfix for r272748 to enable labels in branch instructions.
Artem Tamazov [Mon, 11 Jul 2016 12:07:18 +0000 (12:07 +0000)]
[AMDGPU][llvm-mc] Quickfix for r272748 to enable labels in branch instructions.

Fixes issue mentioned at:
  https://github.com/RadeonOpenCompute/LLVM-AMDGPU-Assembler-Extra/issues/13.
Lit tests added.

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

llvm-svn: 275054

8 years agoload hoisting: compute memory access invalid context only for domain
Tobias Grosser [Mon, 11 Jul 2016 12:01:26 +0000 (12:01 +0000)]
load hoisting: compute memory access invalid context only for domain

We now compute the invalid context of memory accesses only for the domain under
which the memory access is executed. Without limiting ourselves to this
restricted domain, invalid accesses outside of the domain of actually executed
statement instances may result in the execution domain of the statement to
become empty despite the fact that the statement will actually be executed. As a
result, such scops would use unitialized values for their computations which
results in incorrect computations.

This fixes http://llvm.org/PR27944 and unbreaks the
-polly-position=before-vectorizer buildbots.

llvm-svn: 275053

8 years agohttp://reviews.llvm.org/D22134: Implementation of OpenMP 4.5 nonmonotonic schedule...
Andrey Churbanov [Mon, 11 Jul 2016 10:44:57 +0000 (10:44 +0000)]
reviews.llvm.org/D22134: Implementation of OpenMP 4.5 nonmonotonic schedule modifier

llvm-svn: 275052

8 years ago[clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions.
Haojian Wu [Mon, 11 Jul 2016 07:47:04 +0000 (07:47 +0000)]
[clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions.

Summary:
Although there is no guarantee of getOptions/getRawOptions receiving an
absolute path, we try to make it if possible. So FileOptionProvider subclasses
don't have to convert the path to an absolute path.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 275051

8 years ago[mips][microMIPS] Implement LDC1, SDC1, LDC2, SDC2, LWC1, SWC1, LWC2 and SWC2 instruc...
Zlatko Buljan [Mon, 11 Jul 2016 07:41:56 +0000 (07:41 +0000)]
[mips][microMIPS] Implement LDC1, SDC1, LDC2, SDC2, LWC1, SWC1, LWC2 and SWC2 instructions and add CodeGen support
Differential Revision: http://reviews.llvm.org/D18824

llvm-svn: 275050

8 years ago[AVX512] Replace masked AND/OR/XOR intrinsics with native code and remove the builtins.
Craig Topper [Mon, 11 Jul 2016 06:14:18 +0000 (06:14 +0000)]
[AVX512] Replace masked AND/OR/XOR intrinsics with native code and remove the builtins.

llvm-svn: 275049

8 years agoAVX-512: DAG lowering for scalar MIN/MAX commutable ops
Elena Demikhovsky [Mon, 11 Jul 2016 06:08:06 +0000 (06:08 +0000)]
AVX-512: DAG lowering for scalar MIN/MAX commutable ops

DAG lowering was missing for the scalar FMINC, FMAXC nodes.
The nodes are generated only in the "unsafe-fp-math" mode.
Added tests.

llvm-svn: 275048

8 years ago[Sema] Disallow __make_integer_seq from showing up in __make_integer_seq
David Majnemer [Mon, 11 Jul 2016 05:59:24 +0000 (05:59 +0000)]
[Sema] Disallow __make_integer_seq from showing up in __make_integer_seq

We hit over stringent asserts when trying to diagnose.  Loosen them as
appropriate.

This fixes PR28494.

llvm-svn: 275047

8 years ago[AVX512] Add support for 512-bit ANDN now that all ones build vectors survive long...
Craig Topper [Mon, 11 Jul 2016 05:36:53 +0000 (05:36 +0000)]
[AVX512] Add support for 512-bit ANDN now that all ones build vectors survive long enough to allow the matching.

llvm-svn: 275046

8 years ago[AVX512] Use vpternlog with an immediate of 0xff to create 512-bit all one vectors.
Craig Topper [Mon, 11 Jul 2016 05:36:48 +0000 (05:36 +0000)]
[AVX512] Use vpternlog with an immediate of 0xff to create 512-bit all one vectors.

llvm-svn: 275045

8 years ago[X86] Add the AVX512 SET0 pseudos to foldMemoryOperandImpl since they are marked...
Craig Topper [Mon, 11 Jul 2016 05:36:41 +0000 (05:36 +0000)]
[X86] Add the AVX512 SET0 pseudos to foldMemoryOperandImpl since they are marked for CanFoldAsLoad.

I don't really know how to test this.

llvm-svn: 275044

8 years agoRevert r275029 - Update Clang tests after adding inference for the returned argument...
Hal Finkel [Mon, 11 Jul 2016 04:52:07 +0000 (04:52 +0000)]
Revert r275029 - Update Clang tests after adding inference for the returned argument attribute

The associated backend change is causing miscompiles from the AArch64 backend.

llvm-svn: 275043

8 years agoRevert r275027 - Let FuncAttrs infer the 'returned' argument attribute
Hal Finkel [Mon, 11 Jul 2016 04:51:23 +0000 (04:51 +0000)]
Revert r275027 - Let FuncAttrs infer the 'returned' argument attribute

Reverting r275027 and r275033. These seem to cause miscompiles on the AArch64 buildbot.

llvm-svn: 275042

8 years agoAllow BasicBlockEdge to be used in DenseMap
Daniel Berlin [Mon, 11 Jul 2016 04:37:53 +0000 (04:37 +0000)]
Allow BasicBlockEdge to be used in DenseMap

Summary: Add a DenseMapInfo specialization for BasicBlockEdge

Reviewers: hfinkel, chandlerc, majnemer

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

llvm-svn: 275041

8 years ago[CodeGen] Treat imported static local variables as declarations
David Majnemer [Mon, 11 Jul 2016 04:28:21 +0000 (04:28 +0000)]
[CodeGen] Treat imported static local variables as declarations

Imported variables cannot really be definitions for the purposes of
IR generation.

llvm-svn: 275040

8 years agoPointer-comparison folding should look through returned-argument functions
Hal Finkel [Mon, 11 Jul 2016 03:37:59 +0000 (03:37 +0000)]
Pointer-comparison folding should look through returned-argument functions

For functions which are known to return a specific argument, pointer-comparison
folding can look through the function calls as part of its analysis.

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

llvm-svn: 275039

8 years agoTeach isDereferenceablePointer to look through returned-argument functions
Hal Finkel [Mon, 11 Jul 2016 03:08:49 +0000 (03:08 +0000)]
Teach isDereferenceablePointer to look through returned-argument functions

For functions which are known to return their argument,
isDereferenceableAndAlignedPointer can examine the argument value.

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

llvm-svn: 275038

8 years agoTeach SCEV to look through returned-argument functions
Hal Finkel [Mon, 11 Jul 2016 02:48:23 +0000 (02:48 +0000)]
Teach SCEV to look through returned-argument functions

When building SCEVs, if a function is known to return its argument, then we can
build the SCEV using the corresponding argument value.

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

llvm-svn: 275037

8 years agoTeach computeKnownBits to look through returned-argument functions
Hal Finkel [Mon, 11 Jul 2016 02:25:14 +0000 (02:25 +0000)]
Teach computeKnownBits to look through returned-argument functions

If a function is known to return one of its arguments, we can use that in order
to compute known bits of the return value.

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

llvm-svn: 275036

8 years agoBasicAA should look through functions with returned arguments
Hal Finkel [Mon, 11 Jul 2016 01:32:20 +0000 (01:32 +0000)]
BasicAA should look through functions with returned arguments

Motivated by the work on the llvm.noalias intrinsic, teach BasicAA to look
through returned-argument functions when answering queries. This is essential
so that we don't loose all other AA information when supplementing with
llvm.noalias.

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

llvm-svn: 275035

8 years agoAdd a 'Returned' intrinsic property corresponding to the 'returned' argument attribute
Hal Finkel [Mon, 11 Jul 2016 01:28:42 +0000 (01:28 +0000)]
Add a 'Returned' intrinsic property corresponding to the 'returned' argument attribute

This will be used by the upcoming llvm.noalias intrinsic.

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

llvm-svn: 275034

8 years agoDon't use a SmallSet for returned attribute inference
Hal Finkel [Mon, 11 Jul 2016 01:14:21 +0000 (01:14 +0000)]
Don't use a SmallSet for returned attribute inference

Suggested post-commit by David Majnemer on IRC (following-up on a pre-commit
review comment).

llvm-svn: 275033

8 years agoReapply SVN r274797.
Saleem Abdulrasool [Sun, 10 Jul 2016 23:24:36 +0000 (23:24 +0000)]
Reapply SVN r274797.

Original Commit Message

    Driver: Stop linking to C++ when using sanitizers on Darwin

    Sanitizers on Darwin are built as dynamic libraries, not static libraries.
    Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB)
    in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static,
    linking against C++ when enabling a sanitizer becomes over linkage.

    Patch by Dave Lee!

llvm-svn: 275032

8 years agoAdd getReturnedArgOperand to Call/InvokeInst, CallSite
Hal Finkel [Sun, 10 Jul 2016 23:01:32 +0000 (23:01 +0000)]
Add getReturnedArgOperand to Call/InvokeInst, CallSite

In order to make the optimizer smarter about using the 'returned' argument
attribute (generally, but motivated by my llvm.noalias intrinsic work), add a
utility function to Call/InvokeInst, and CallSite, to make it easy to get the
returned call argument (when one exists).

P.S. There is already an unfortunate amount of code duplication between
CallInst and InvokeInst, and this adds to it. We should probably clean that up
separately.

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

llvm-svn: 275031

8 years agoAMDGPU: Export workitem builtins
Jan Vesely [Sun, 10 Jul 2016 22:38:04 +0000 (22:38 +0000)]
AMDGPU: Export workitem builtins

Reviewers: tstellardAMD

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

llvm-svn: 275030

8 years agoUpdate Clang tests after adding inference for the returned argument attribute
Hal Finkel [Sun, 10 Jul 2016 22:26:52 +0000 (22:26 +0000)]
Update Clang tests after adding inference for the returned argument attribute

Adjusting tests after r275027.

llvm-svn: 275029

8 years ago[X86][SSE] Relax type assertions for matchVectorShuffleAsInsertPS
Simon Pilgrim [Sun, 10 Jul 2016 22:26:05 +0000 (22:26 +0000)]
[X86][SSE] Relax type assertions for matchVectorShuffleAsInsertPS

Calls to matchVectorShuffleAsInsertPS only need to ensure the inputs are 128-bit vectors. Only lowerVectorShuffleAsInsertPS needs to ensure that they are v4f32.

llvm-svn: 275028

8 years agoLet FuncAttrs infer the 'returned' argument attribute
Hal Finkel [Sun, 10 Jul 2016 22:02:55 +0000 (22:02 +0000)]
Let FuncAttrs infer the 'returned' argument attribute

A function can have one argument with the 'returned' attribute, indicating that
the associated argument is always the return value of the function. Add
FuncAttrs inference logic.

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

llvm-svn: 275027

8 years agoUpdate the LangRef description of the 'returned' attribute
Hal Finkel [Sun, 10 Jul 2016 21:52:39 +0000 (21:52 +0000)]
Update the LangRef description of the 'returned' attribute

The description of the 'returned' attribute says that it is only used when
code-generating the caller. I'd like to make the optimizer smarter about
looking through functions with returned arguments (generally, but motivated by
my llvm.noalias work). As David pointed out in the review of D22202, the
LangRef should be updated to make its expanded uses clearer.

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

llvm-svn: 275026

8 years ago[DAG] make isConstantSplatVector() available to the rest of lowering
Sanjay Patel [Sun, 10 Jul 2016 21:27:06 +0000 (21:27 +0000)]
[DAG] make isConstantSplatVector() available to the rest of lowering

llvm-svn: 275025

8 years agoAMDGPU/R600: Add implicitarg.ptr intrinsic
Jan Vesely [Sun, 10 Jul 2016 21:20:29 +0000 (21:20 +0000)]
AMDGPU/R600: Add implicitarg.ptr intrinsic

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

llvm-svn: 275024

8 years agowhitespaces + re-indent
Etienne Bergeron [Sun, 10 Jul 2016 21:06:06 +0000 (21:06 +0000)]
whitespaces + re-indent

llvm-svn: 275023

8 years ago[X86][SSE] Add support for target shuffle combining to PSHUFLW/PSHUFHW
Simon Pilgrim [Sun, 10 Jul 2016 21:02:47 +0000 (21:02 +0000)]
[X86][SSE] Add support for target shuffle combining to PSHUFLW/PSHUFHW

llvm-svn: 275022

8 years agofix documentation comments; NFC
Sanjay Patel [Sun, 10 Jul 2016 21:02:16 +0000 (21:02 +0000)]
fix documentation comments; NFC

llvm-svn: 275021

8 years ago[x86, SSE, AVX] add tests for icmp+zext (PR28484)
Sanjay Patel [Sun, 10 Jul 2016 20:45:14 +0000 (20:45 +0000)]
[x86, SSE, AVX] add tests for icmp+zext (PR28484)

Note the inconsistent vpbroadcast generation for AVX2; another bug.

llvm-svn: 275020