platform/upstream/llvm.git
7 years ago[clangd] Remove private vector fields from completion test.
Krasimir Georgiev [Tue, 4 Apr 2017 10:42:22 +0000 (10:42 +0000)]
[clangd] Remove private vector fields from completion test.

llvm-svn: 299426

7 years ago[X86] Add 64 bit pattern matching for PSADBW
Oren Ben Simhon [Tue, 4 Apr 2017 10:23:18 +0000 (10:23 +0000)]
[X86] Add 64 bit pattern matching for PSADBW

PSADBW pattern currently supports the 32 bit IR pattern and only GLT (greather than) comparison.
The patch extends the pattern to catch also 64 bit IR pattern and includes all other comparison types (not only GLT).

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

llvm-svn: 299425

7 years agoFix formatting in LoopGenerators
Philip Pfaffe [Tue, 4 Apr 2017 10:22:17 +0000 (10:22 +0000)]
Fix formatting in LoopGenerators

llvm-svn: 299424

7 years ago[Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers
Philip Pfaffe [Tue, 4 Apr 2017 10:01:53 +0000 (10:01 +0000)]
[Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers

Summary:
A couple of the utilities used to analyze or build IR make explicit use of the legacy PM on their interface, to access analysis results. This patch removes the legacy PM from the interface, and just passes the required results directly.

This shouldn't introduce any function changes, although the API technically allowed to obtain two different analysis results before, one passed by reference and one through the PM. I don't believe that was ever intended, however.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: nemanjai, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 299423

7 years agoFix windows buildbot error.
Haojian Wu [Tue, 4 Apr 2017 09:53:55 +0000 (09:53 +0000)]
Fix windows buildbot error.

llvm-svn: 299422

7 years ago[clangd] Add code completion support
Krasimir Georgiev [Tue, 4 Apr 2017 09:46:39 +0000 (09:46 +0000)]
[clangd] Add code completion support

Summary: Adds code completion support to clangd.

Reviewers: bkramer, malaperle-ericsson

Reviewed By: bkramer, malaperle-ericsson

Subscribers: stanionascu, malaperle-ericsson, cfe-commits

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

llvm-svn: 299421

7 years ago[ELF] Fail the link early if the map file path is invalid
James Henderson [Tue, 4 Apr 2017 09:42:24 +0000 (09:42 +0000)]
[ELF] Fail the link early if the map file path is invalid

As with the changes made in r297645, we do not want a potentially long link to
be run, if it will ultimately fail because the map file is not writable. This
change reuses the same functionality as the output file path check. See
https://reviews.llvm.org/D30449 for further justification and explanations.

Reviewers: ruiu

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

llvm-svn: 299420

7 years ago[clang-rename] Support renaming qualified symbol
Haojian Wu [Tue, 4 Apr 2017 09:30:06 +0000 (09:30 +0000)]
[clang-rename] Support renaming qualified symbol

Summary:
The patch adds a new feature for renaming qualified symbol references.
Unlike orginal clang-rename behavior, when renaming a qualified symbol to a new
qualified symbol (e.g "A::Foo" => "B::Bar"), this new rename behavior will
consider the prefix qualifiers of the symbol, and calculate the new prefix
qualifiers.  It aims to add as few additional qualifiers as possible.

As this is an early version (only supports renaming classes), I don't change
current clang-rename interfaces at the moment, and would like to keep its
(command-line tool) behavior. So I added new interfaces for the prototype.
In the long run, these interfaces should be unified.

No functionality changes in original clang-rename command-line tool.

This patch also contains a few bug fixes of clang-rename which are discovered by
the new unittest:

* fix a potential nullptr accessment when class declaration doesn't have definition.
* add USRs of nested declartaions in "getNamedDeclFor".

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: alexfh, cfe-commits, mgorny

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

llvm-svn: 299419

7 years ago[ELF] Rename ARM Thunks in anticipation of Range Thunks
Peter Smith [Tue, 4 Apr 2017 09:29:36 +0000 (09:29 +0000)]
[ELF] Rename ARM Thunks in anticipation of Range Thunks

The existing names for the ARM and Thumb Thunks highlight their current
use as interworking Thunks. These Thunks can also be used for range
extension Thunks where there is no state change. This change makes the name
more generic so it is suitable for range extension.

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

llvm-svn: 299418

7 years agoEnable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create...
Ilia K [Tue, 4 Apr 2017 08:00:28 +0000 (08:00 +0000)]
Enable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create to work only with variables in scope

Patch by ayuckhulk

Reviewers: abidh, lldb-commits, ki.stfu

Reviewed By: ki.stfu

Tags: #lldb

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

llvm-svn: 299417

7 years ago[X86] Remove some code that tries to disable HLE feature. This feature flag was remov...
Craig Topper [Tue, 4 Apr 2017 06:38:44 +0000 (06:38 +0000)]
[X86] Remove some code that tries to disable HLE feature. This feature flag was removed from the backend.

llvm-svn: 299416

7 years agoAlign all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR
Jonas Hahnfeld [Tue, 4 Apr 2017 06:02:32 +0000 (06:02 +0000)]
Align all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR

Otherwise, yamlize in YAMLTraits.h might be wrongly defined.
This makes some AMDGPU tests fail when LLVM_LINK_LLVM_DYLIB is set.

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

llvm-svn: 299415

7 years agoUses quote to include cxxabi.h to make sure the local one is included
Mehdi Amini [Tue, 4 Apr 2017 05:38:38 +0000 (05:38 +0000)]
Uses quote to include cxxabi.h to make sure the local one is included

llvm-svn: 299414

7 years ago[InstCombine] Use setAllBits in place of getAllOnesValue since we know the bitwidths...
Craig Topper [Tue, 4 Apr 2017 05:03:02 +0000 (05:03 +0000)]
[InstCombine] Use setAllBits in place of getAllOnesValue since we know the bitwidths are the same. NFCI

llvm-svn: 299413

7 years agoInstCombine: Use the InstSimplify hook for shufflevector
Zvi Rackover [Tue, 4 Apr 2017 04:47:57 +0000 (04:47 +0000)]
InstCombine: Use the InstSimplify hook for shufflevector

Summary: Start using the recently added InstSimplify hook for shuffles in the respective InstCombine visitor.

Reviewers: spatel, RKSimon, craig.topper, majnemer

Reviewed By: majnemer

Subscribers: majnemer, llvm-commits

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

llvm-svn: 299412

7 years agoFix more -Wshadow warnings introduced by recent Clang change
Eric Fiselier [Tue, 4 Apr 2017 02:54:27 +0000 (02:54 +0000)]
Fix more -Wshadow warnings introduced by recent Clang change

llvm-svn: 299411

7 years agoModules/builtins.m requires shell.
Galina Kistanova [Tue, 4 Apr 2017 02:50:40 +0000 (02:50 +0000)]
Modules/builtins.m requires shell.

llvm-svn: 299410

7 years agoSkip three test cases that are asserting on macosx as of r299199. A quick
Jason Molenda [Tue, 4 Apr 2017 01:09:20 +0000 (01:09 +0000)]
Skip three test cases that are asserting on macosx as of r299199.  A quick
look showed that the target's arch has no core / byte order and so when
AuxVector::AuxVector calls into a dataextractor and sets the byte size to 0,
it asserts.  e.g.

  m_arch = {
    m_triple = (Data = "x86_64--linux", Arch = x86_64, SubArch = NoSubArch, Vendor = UnknownVendor, OS = Linux, Environment = UnknownEnvironment, ObjectFormat = ELF)
    m_core = kCore_invalid
    m_byte_order = eByteOrderInvalid
    m_flags = 0x00000000
    m_distribution_id = <no value available>
  }

<rdar://problem/31380097>

llvm-svn: 299408

7 years agoWork around recent -Wshadow changes in Clang
Eric Fiselier [Tue, 4 Apr 2017 01:05:59 +0000 (01:05 +0000)]
Work around recent -Wshadow changes in Clang

llvm-svn: 299407

7 years ago[PDB] Save one type record copy
Reid Kleckner [Tue, 4 Apr 2017 00:56:34 +0000 (00:56 +0000)]
[PDB] Save one type record copy

Summary:
The TypeTableBuilder provides stable storage for type records. We don't
need to copy all of the bytes into a flat vector before adding it to the
TpiStreamBuilder.

This makes addTypeRecord take an ArrayRef<uint8_t> and a hash code to go
with it, which seems like a simplification.

Reviewers: ruiu, zturner, inglorion

Subscribers: llvm-commits

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

llvm-svn: 299406

7 years ago[codeview] Cope with unsorted streams in type merging
Reid Kleckner [Mon, 3 Apr 2017 23:58:15 +0000 (23:58 +0000)]
[codeview] Cope with unsorted streams in type merging

Summary:
MASM can produce type streams that are not topologically sorted. It can
even produce type streams with circular references, but those are not
common in practice.

Reviewers: inglorion, ruiu

Subscribers: llvm-commits

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

llvm-svn: 299403

7 years agoAdd CPlusPlusNameParser to the xcodeproj
Sean Callanan [Mon, 3 Apr 2017 23:56:41 +0000 (23:56 +0000)]
Add CPlusPlusNameParser to the xcodeproj

llvm-svn: 299402

7 years agoFix C++17 dylib build
Eric Fiselier [Mon, 3 Apr 2017 23:23:44 +0000 (23:23 +0000)]
Fix C++17 dylib build

llvm-svn: 299401

7 years ago[Fuzzer] Flush std::cout before aborting in CxxStringEqTest
Reid Kleckner [Mon, 3 Apr 2017 23:00:25 +0000 (23:00 +0000)]
[Fuzzer] Flush std::cout before aborting in CxxStringEqTest

On Windows, abort() does not appear to flush std::cout. Should fix red
sanitizer-windows bot.

llvm-svn: 299398

7 years agoRecommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnin...
Craig Topper [Mon, 3 Apr 2017 22:59:30 +0000 (22:59 +0000)]
Recommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.'

The bot didn't recover after the revert. So it looks like this wasn't the issue.

llvm-svn: 299397

7 years agoadd/move codegen tests for and/or of setcc; NFC
Sanjay Patel [Mon, 3 Apr 2017 22:45:46 +0000 (22:45 +0000)]
add/move codegen tests for and/or of setcc; NFC

llvm-svn: 299396

7 years agoUpdate stale doxygen links in ProgrammersManual.rst
Tim Northover [Mon, 3 Apr 2017 22:24:32 +0000 (22:24 +0000)]
Update stale doxygen links in ProgrammersManual.rst

Patch by Wei-Ren Chen.

llvm-svn: 299395

7 years agoThe LIBLLDB_LOG_TEMPORARY channel got lost at some point where
Jason Molenda [Mon, 3 Apr 2017 22:23:01 +0000 (22:23 +0000)]
The LIBLLDB_LOG_TEMPORARY channel got lost at some point where
Logging.cpp was being changed in the past.  Re-add it.

llvm-svn: 299394

7 years agoInstSimplify: Add a hook for shufflevector
Zvi Rackover [Mon, 3 Apr 2017 22:05:30 +0000 (22:05 +0000)]
InstSimplify: Add a hook for shufflevector

Summary:
Add a hook for simplification of shufflevector's with the following rules:
- Constant folding - NFC, as it was already being done by the default handler.
-  If only one of the operands is constant, constant fold the shuffle if the
    mask does not select elements from the variable operand -  to show the hook is firing and affecting the test-cases.

Reviewers: RKSimon, craig.topper, spatel, sanjoy, nlopes, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 299393

7 years agoReland r298901 with modifications (reverted in r298932)
Weiming Zhao [Mon, 3 Apr 2017 21:50:04 +0000 (21:50 +0000)]
Reland r298901 with modifications (reverted in r298932)

Dont emit Mapping symbols for sections that contain only data.

Summary:
Dont emit mapping symbols for sections that contain only data.

Reviewers: rengolin, weimingz, kparzysz, t.p.northover, peter.smith

Reviewed By: t.p.northover

Patched by Shankar Easwaran <shankare@codeaurora.org>

Subscribers: alekseyshl, t.p.northover, llvm-commits

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

llvm-svn: 299392

7 years agoAMDGPU: Remove llvm.SI.vs.load.input
Matt Arsenault [Mon, 3 Apr 2017 21:45:13 +0000 (21:45 +0000)]
AMDGPU: Remove llvm.SI.vs.load.input

llvm-svn: 299391

7 years agoChange the error message format for an incompatible relocation.
Rui Ueyama [Mon, 3 Apr 2017 21:36:31 +0000 (21:36 +0000)]
Change the error message format for an incompatible relocation.

Previous error message style:

  error: /home/alice/src/bar.c:12: relocation R_X86_64_PLT32 cannot refer to absolute symbol 'answer' defined in /home/alice/src/foo.o

New error message style:

  error: relocation R_X86_64_PLT32 cannot refer to absolute symbol: foo
  >>> defined in /home/alice/src/foo.o
  >>> referenced by bar.c:12 (/home/alice/src/bar.c:12)
  >>>               /home/alice/src/bar.o:(.text+0x1)

llvm-svn: 299390

7 years agoDAG: Fix missing legalization for any_extend_vector_inreg operands
Matt Arsenault [Mon, 3 Apr 2017 21:28:13 +0000 (21:28 +0000)]
DAG: Fix missing legalization for any_extend_vector_inreg operands

llvm-svn: 299389

7 years ago[codeview] Add support for label type records
Reid Kleckner [Mon, 3 Apr 2017 21:25:20 +0000 (21:25 +0000)]
[codeview] Add support for label type records

MASM can produce these type records.

llvm-svn: 299388

7 years ago[X86][SSE]] Lower BUILD_VECTOR with repeated elts as BUILD_VECTOR + VECTOR_SHUFFLE
Simon Pilgrim [Mon, 3 Apr 2017 21:06:51 +0000 (21:06 +0000)]
[X86][SSE]] Lower BUILD_VECTOR with repeated elts as BUILD_VECTOR + VECTOR_SHUFFLE

It can be costly to transfer from the gprs to the xmm registers and can prevent loads merging.

This patch splits vXi16/vXi32/vXi64 BUILD_VECTORS that use the same operand in multiple elements into a BUILD_VECTOR with only a single insertion of each of those elements and then performs an unary shuffle to duplicate the values.

There are a couple of minor regressions this patch unearths due to some missing MOVDDUP/BROADCAST folds that I will address in a future patch.

Note: Now that vector shuffle lowering and combining is pretty good we should be reusing that instead of duplicating so much in LowerBUILD_VECTOR - this is the first of several patches to address this.

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

llvm-svn: 299387

7 years agoRevert r299355 "[ASTImporter] Fix for importing unnamed structs"
Gabor Horvath [Mon, 3 Apr 2017 21:06:45 +0000 (21:06 +0000)]
Revert r299355 "[ASTImporter] Fix for importing unnamed structs"

It breaks windows bots.

llvm-svn: 299386

7 years agosuppress GCC warning about noexcept functions changing mangling
Eric Fiselier [Mon, 3 Apr 2017 20:53:15 +0000 (20:53 +0000)]
suppress GCC warning about noexcept functions changing mangling

llvm-svn: 299385

7 years ago[InstCombine] Remove canonicalization for (X & C1) | C2 --> (X | C2) & (C1|C2) when...
Craig Topper [Mon, 3 Apr 2017 20:41:47 +0000 (20:41 +0000)]
[InstCombine] Remove canonicalization for (X & C1) | C2 --> (X | C2) & (C1|C2) when C1 & C2 have common bits.

It turns out that SimplifyDemandedInstructionBits will get called earlier and remove bits from C1 first. Effectively doing (X & (C1&C2)) | C2. So by the time it got to this check there could be no common bits.

I think the DAGCombiner has the same check but its check can be executed because it handles demanded bits later. I'll look at it next.

llvm-svn: 299384

7 years agox86 interrupt calling convention: re-align stack pointer on 64-bit if an error code...
Amjad Aboud [Mon, 3 Apr 2017 20:28:45 +0000 (20:28 +0000)]
x86 interrupt calling convention: re-align stack pointer on 64-bit if an error code was pushed

The x86_64 ABI requires that the stack is 16 byte aligned on function calls. Thus, the 8-byte error code, which is pushed by the CPU for certain exceptions, leads to a misaligned stack. This results in bugs such as Bug 26413, where misaligned movaps instructions are generated.

This commit fixes the misalignment by adjusting the stack pointer in these cases. The adjustment is done at the beginning of the prologue generation by subtracting another 8 bytes from the stack pointer. These additional bytes are popped again in the function epilogue.

Fixes Bug 26413

Patch by Philipp Oppermann.

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

llvm-svn: 299383

7 years agoRevert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings...
Craig Topper [Mon, 3 Apr 2017 19:43:47 +0000 (19:43 +0000)]
Revert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.' to see if recovers a fuzzer bot.

llvm-svn: 299382

7 years agoTry to trigger the new docs builder. NFC
Jonathan Roelofs [Mon, 3 Apr 2017 19:23:11 +0000 (19:23 +0000)]
Try to trigger the new docs builder. NFC

llvm-svn: 299381

7 years ago[coroutines] Fix rebuilding of implicit and dependent coroutine statements.
Eric Fiselier [Mon, 3 Apr 2017 19:21:00 +0000 (19:21 +0000)]
[coroutines] Fix rebuilding of implicit and dependent coroutine statements.

Summary:
Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed.

This patch fixes an issue where these statements would never be built for coroutine templates.

It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed.

Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 299380

7 years ago[CodeGenPrep] move aarch64-type-promotion to CGP
Jun Bum Lim [Mon, 3 Apr 2017 19:20:07 +0000 (19:20 +0000)]
[CodeGenPrep] move aarch64-type-promotion to CGP

Summary:
Move the aarch64-type-promotion pass within the existing type promotion framework in CGP.
This change also support forking sexts when a new sext is required for promotion.
Note that change is based on D27853 and I am submitting this out early to provide a better idea on D27853.

Reviewers: jmolloy, mcrosier, javed.absar, qcolombet

Reviewed By: qcolombet

Subscribers: llvm-commits, aemerson, rengolin, mcrosier

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

llvm-svn: 299379

7 years ago[DAGCombine][InstCombine] Fix inverted if condition in equivalent comments in DAGComb...
Craig Topper [Mon, 3 Apr 2017 19:18:48 +0000 (19:18 +0000)]
[DAGCombine][InstCombine] Fix inverted if condition in equivalent comments in DAGCombine and InstCombine. NFC

llvm-svn: 299378

7 years agoMake a helper function file-local.
Rui Ueyama [Mon, 3 Apr 2017 19:14:35 +0000 (19:14 +0000)]
Make a helper function file-local.

llvm-svn: 299377

7 years agobenchcomp: Add a mode for analyzing file sizes.
Peter Collingbourne [Mon, 3 Apr 2017 19:13:12 +0000 (19:13 +0000)]
benchcomp: Add a mode for analyzing file sizes.

llvm-svn: 299376

7 years agoRemove InputFiles::LogName.
Rui Ueyama [Mon, 3 Apr 2017 19:11:23 +0000 (19:11 +0000)]
Remove InputFiles::LogName.

LogName member was added to construct input file names for logging
only once. This patch does this in a different way. Now toString
caches its results.

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

llvm-svn: 299375

7 years agoNew C++ function name parsing logic
Eugene Zemtsov [Mon, 3 Apr 2017 18:59:34 +0000 (18:59 +0000)]
New C++ function name parsing logic

Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

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

llvm-svn: 299374

7 years agoFix LLVMBuild.txt typo. NFC
Joel Jones [Mon, 3 Apr 2017 18:21:50 +0000 (18:21 +0000)]
Fix LLVMBuild.txt typo. NFC

llvm-svn: 299373

7 years agoAMDGPU: Remove legacy bfe intrinsics
Matt Arsenault [Mon, 3 Apr 2017 18:08:08 +0000 (18:08 +0000)]
AMDGPU: Remove legacy bfe intrinsics

llvm-svn: 299372

7 years ago[Support] Make printAllJSONValues public, for custom output.
Graydon Hoare [Mon, 3 Apr 2017 18:04:15 +0000 (18:04 +0000)]
[Support] Make printAllJSONValues public, for custom output.

Summary:
This changes the static method TimerGroup::printAllJSONValues from private to
public, to match the static method TimerGroup::printAll. When trying to drive
the reporting machinery by hand, the existing API is _almost_ flexible enough,
but this entrypoint is required to intermix printing timers with other
non-timer output.

The underlying motive here is a Swift change to consolidate the collection of
timers, LLVM statistics and other (non-assert-dependent) counters into JSON
files, which requires a bit of manual intervention in LLVM's stat and timer
output routines. See https://github.com/apple/swift/pull/8477 for details.

Reviewers: MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 299371

7 years agoBitcode: Remove reader support for MODULE_CODE_PURGEVALS.
Peter Collingbourne [Mon, 3 Apr 2017 17:58:48 +0000 (17:58 +0000)]
Bitcode: Remove reader support for MODULE_CODE_PURGEVALS.

Support for writing this module code was removed in r73220, which was well
before the LLVM 3.0 release, so we do not need to be able to understand it
for backwards compatibility.

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

llvm-svn: 299370

7 years ago[InstCombine] Add test cases showing how we fail to fold vector constants into select...
Craig Topper [Mon, 3 Apr 2017 17:49:15 +0000 (17:49 +0000)]
[InstCombine] Add test cases showing how we fail to fold vector constants into selects the way we do with scalars.

llvm-svn: 299369

7 years agoRevert "[DAGCombine] A shuffle of a splat is always the splat itself"
Zvi Rackover [Mon, 3 Apr 2017 17:41:19 +0000 (17:41 +0000)]
Revert "[DAGCombine]  A shuffle of a splat is always the splat itself"

This reverts commit r299047 which is incorrect because the
simplification may result in incorrect propogation of undefs to users of
the folded shuffle.

Thanks to Andrea Di Biagio for pointing this out.

llvm-svn: 299368

7 years ago[Hexagon] Factor out some common code in HexagonEarlyIfConv.cpp, NFC
Krzysztof Parzyszek [Mon, 3 Apr 2017 17:26:40 +0000 (17:26 +0000)]
[Hexagon] Factor out some common code in HexagonEarlyIfConv.cpp, NFC

llvm-svn: 299367

7 years agoRevert r299337 "[InstCombine] Remove redundant combine from visitAnd"
Craig Topper [Mon, 3 Apr 2017 17:22:23 +0000 (17:22 +0000)]
Revert r299337 "[InstCombine] Remove redundant combine from visitAnd"

One of the tsan bots started failing at this commit. I don't see anything obviously wrong with the commit so trying this to see if it recovers.

Failing log: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/6792

llvm-svn: 299366

7 years ago[InstCombine] fix formatting for foldLogOpOfMaskedICmps and related bits; NFCI
Sanjay Patel [Mon, 3 Apr 2017 16:53:12 +0000 (16:53 +0000)]
[InstCombine] fix formatting for foldLogOpOfMaskedICmps and related bits; NFCI

1. Improve enum, function, and variable names.
2. Improve comments.
3. Fix variable capitalization.
4. Run clang-format.

As an existing code comment suggests, this should work with vector types / splat constants too,
so making this look right first will reduce the diffs needed for that change.

llvm-svn: 299365

7 years ago[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.
Davide Italiano [Mon, 3 Apr 2017 16:51:39 +0000 (16:51 +0000)]
[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.

llvm-svn: 299364

7 years agoEnhance -Wshadow to warn when shadowing typedefs or type aliases
Alex Lorenz [Mon, 3 Apr 2017 16:43:21 +0000 (16:43 +0000)]
Enhance -Wshadow to warn when shadowing typedefs or type aliases

Enhance -Wshadow to emit a warning when typedefs or type aliases are shadowed.

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

Patch by Ahmed Asadi.

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

llvm-svn: 299363

7 years ago[APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Imple...
Craig Topper [Mon, 3 Apr 2017 16:34:59 +0000 (16:34 +0000)]
[APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Implement them without memory allocation for multiword

This moves the isMask and isShiftedMask functions to be class methods. They now use the MathExtras.h function for single word size and leading/trailing zeros/ones or countPopulation for the multiword size. The previous implementation made multiple temorary memory allocations to do the bitwise arithmetic operations to match the MathExtras.h implementation.

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

llvm-svn: 299362

7 years ago[DAGCombiner] Check limits before accessing array element (PR32502)
Simon Pilgrim [Mon, 3 Apr 2017 15:27:49 +0000 (15:27 +0000)]
[DAGCombiner] Check limits before accessing array element (PR32502)

llvm-svn: 299361

7 years ago[PerfMonitor] Use Intrinsics::getDeclaration
Tobias Grosser [Mon, 3 Apr 2017 15:23:08 +0000 (15:23 +0000)]
[PerfMonitor] Use Intrinsics::getDeclaration

Instead of creating the declaration ourselves, we obtain it directly from the
LLVM intrinsic definitions. This addresses a post-review comment for r299359.

Suggested-by: Hongzing Zheng <etherzhhb@gmail.com>
llvm-svn: 299360

7 years ago[CodeGen] Add Performance Monitor
Tobias Grosser [Mon, 3 Apr 2017 14:55:37 +0000 (14:55 +0000)]
[CodeGen] Add Performance Monitor

Add support for -polly-codegen-perf-monitoring. When performance monitoring
is enabled, we emit performance monitoring code during code generation that
prints after program exit statistics about the total number of cycles executed
as well as the number of cycles spent in scops. This gives an estimate on how
useful polyhedral optimizations might be for a given program.

Example output:

  Polly runtime information
  -------------------------
  Total: 783110081637
  Scops: 663718949365

In the future, we might also add functionality to measure how much time is spent
in optimized scops and how many cycles are spent in the fallback code.

Reviewers: bollu,sebpop

Tags: #polly

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

llvm-svn: 299359

7 years agoARMAsmParser: clean up of isImmediate functions
Sjoerd Meijer [Mon, 3 Apr 2017 14:50:04 +0000 (14:50 +0000)]
ARMAsmParser: clean up of isImmediate functions

- we are now using immediate AsmOperands so that the range check functions are
  tablegen'ed.
- Big bonus is that error messages become much more accurate, i.e. instead of a
  useless "invalid operand" error message it will not say that the immediate
  operand must in range [x,y], which is why regression tests needed updating.

More tablegen operand descriptions could probably benefit from using
immediateAsmOperand, but this is a first good step to get rid of most of the
nearly identical range check functions. I will address the remaining immediate
operands in next clean ups.

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

llvm-svn: 299358

7 years ago[test] Fix two testcases. NFC.
Michael Kruse [Mon, 3 Apr 2017 12:37:10 +0000 (12:37 +0000)]
[test] Fix two testcases. NFC.

Trivial fix for two testcases. When Polly isn't linked into opt,
independent of whether it's built in-tree or not, these testcases forget
to load the appropriate library.

Contributed-by: Philip Pfaffe <philip.pfaffe@gmail.com>
Differential Revision: https://reviews.llvm.org/D31596

llvm-svn: 299357

7 years ago[ScopInfo] Fix typos in option description.
Michael Kruse [Mon, 3 Apr 2017 12:03:38 +0000 (12:03 +0000)]
[ScopInfo] Fix typos in option description.

llvm-svn: 299356

7 years ago[ASTImporter] Fix for importing unnamed structs
Gabor Horvath [Mon, 3 Apr 2017 11:57:11 +0000 (11:57 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

llvm-svn: 299355

7 years ago[ASTImporter] Lookup SearchName instead of Name
Gabor Horvath [Mon, 3 Apr 2017 09:30:20 +0000 (09:30 +0000)]
[ASTImporter] Lookup SearchName instead of Name

When the SearchName is already calculated we should use that for the lookup.

Patch by Peter Szecsi!

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

llvm-svn: 299354

7 years agoAdd test case for r299352.
Tobias Grosser [Mon, 3 Apr 2017 07:44:23 +0000 (07:44 +0000)]
Add test case for r299352.

llvm-svn: 299353

7 years ago[PollyIRBuilder] Bound size of alias metadata
Tobias Grosser [Mon, 3 Apr 2017 07:42:50 +0000 (07:42 +0000)]
[PollyIRBuilder] Bound size of alias metadata

No-alias metadata grows quadratic in the size of arrays involved, which can
become very costly for large programs. This commit bounds the number of arrays
for which we construct no-alias information to ten. This is conservatively
correct, as we just provide less information to LLVM and speeds up the compile
time of one of my internal test cases from 'does-not-terminate' to
'finishes-in-less-than-a-minute'. In the future we might try to be more clever
here, but this change should provide a good baseline.

llvm-svn: 299352

7 years ago[InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of...
Craig Topper [Mon, 3 Apr 2017 07:08:08 +0000 (07:08 +0000)]
[InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of a generic Instruction.

It blindly assumes there are two operands so make it explicit.

llvm-svn: 299351

7 years agoUpdate to isl-0.18-410-gc253447
Tobias Grosser [Mon, 3 Apr 2017 06:46:16 +0000 (06:46 +0000)]
Update to isl-0.18-410-gc253447

This is a regular maintenance update to ensure latest isl changes are tested
in our buildbots.

llvm-svn: 299350

7 years ago[InstCombine] Remove a And transform that should be handled by SimplifyDemandedInstru...
Craig Topper [Mon, 3 Apr 2017 06:02:09 +0000 (06:02 +0000)]
[InstCombine] Remove a And transform that should be handled by SimplifyDemandedInstructionBits. NFCI

llvm-svn: 299349

7 years ago[libc++] Explicitly mark specializations as dllexport
Shoaib Meenai [Mon, 3 Apr 2017 04:04:24 +0000 (04:04 +0000)]
[libc++] Explicitly mark specializations as dllexport

Method specializations don't get exported even if there's an exported
extern template instantiation on Windows. Explicitly mark the methods
for export. They're already exported on Linux and Darwin, so there's no
ABI change on those platforms.

llvm-svn: 299348

7 years ago[AVX-512] Fix a couple more intrinsic macros I missed in r299346.
Craig Topper [Mon, 3 Apr 2017 03:51:57 +0000 (03:51 +0000)]
[AVX-512] Fix a couple more intrinsic macros I missed in r299346.

llvm-svn: 299347

7 years ago[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and...
Craig Topper [Mon, 3 Apr 2017 03:41:29 +0000 (03:41 +0000)]
[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and don't have parentheses around them.

Thanks to Matthew Barr for reporting this issue.

llvm-svn: 299346

7 years agoBack out temporary masking of EXC_SYSCALL mach exceptions.
Jason Molenda [Mon, 3 Apr 2017 00:59:47 +0000 (00:59 +0000)]
Back out temporary masking of EXC_SYSCALL mach exceptions.
<rdar://problem/31359720>

llvm-svn: 299345

7 years agoTrailing whitespace.
NAKAMURA Takumi [Sun, 2 Apr 2017 23:57:17 +0000 (23:57 +0000)]
Trailing whitespace.

llvm-svn: 299344

7 years agoReformat.
NAKAMURA Takumi [Sun, 2 Apr 2017 23:57:10 +0000 (23:57 +0000)]
Reformat.

llvm-svn: 299343

7 years ago[APInt] Make use of whichWord and maskBit to simplify some code. NFC
Craig Topper [Sun, 2 Apr 2017 19:35:18 +0000 (19:35 +0000)]
[APInt] Make use of whichWord and maskBit to simplify some code. NFC

llvm-svn: 299342

7 years ago[APInt] Add a public typedef for the internal type of APInt use it instead of integer...
Craig Topper [Sun, 2 Apr 2017 19:17:22 +0000 (19:17 +0000)]
[APInt] Add a public typedef for the internal type of APInt use it instead of integerPart. Make APINT_BITS_PER_WORD and APINT_WORD_SIZE public.

This patch is one step to attempt to unify the main APInt interface and the tc functions used by APFloat.

This patch adds a WordType to APInt and uses that in all the tc functions. I've added temporary typedefs to APFloat to alias it to integerPart to keep the patch size down. I'll work on removing that in a future patch.

In future patches I hope to reuse the tc functions to implement some of the main APInt functionality.

I may remove APINT_ from BITS_PER_WORD and WORD_SIZE constants so that we don't have the repetitive APInt::APINT_ externally.

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

llvm-svn: 299341

7 years agoFixes for modernize-use-using check:
Krystyna Gajczyk [Sun, 2 Apr 2017 19:12:20 +0000 (19:12 +0000)]
Fixes for modernize-use-using check:
- removed unnessacary namespaces
- added option to print warning in macros
- no fix for typedef with array
- removed "void" word from functions with 0 parameters

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

llvm-svn: 299340

7 years ago[InstCombine] Make InstCombiner::OptAndOp take a BinaryOperator instead of an Instruc...
Craig Topper [Sun, 2 Apr 2017 17:57:30 +0000 (17:57 +0000)]
[InstCombine] Make InstCombiner::OptAndOp take a BinaryOperator instead of an Instruction.

The callers have already performed the necessary cast before calling. This allows us to remove a comment that says the instruction must be a BinaryOperator and make it explicit in the argument type.

Had to add a default case to the switch because BinaryOperator::getOpcode() returns a BinaryOps enum.

llvm-svn: 299339

7 years ago[X86][MMX] Improve support for folding fptosi from XMM to MMX
Simon Pilgrim [Sun, 2 Apr 2017 17:45:41 +0000 (17:45 +0000)]
[X86][MMX] Improve support for folding fptosi from XMM to MMX

llvm-svn: 299338

7 years ago[InstCombine] Remove redundant combine from visitAnd
Craig Topper [Sun, 2 Apr 2017 17:34:30 +0000 (17:34 +0000)]
[InstCombine] Remove redundant combine from visitAnd

As far as I can tell this combine is fully handled by SimplifyDemandedInstructionBits.

I was only looking at this because it is the only user of APIntOps::isShiftedMask which is itself broken. As demonstrated by r299187. I was going to fix isShiftedMask and needed to make sure we had coverage for the new cases it would expose to this combine. But looks like we can nuke it instead.

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

llvm-svn: 299337

7 years ago[X86][MMX] Simplify tablegen patterns by always combining MOVDQ2Q from v2i64
Simon Pilgrim [Sun, 2 Apr 2017 16:20:34 +0000 (16:20 +0000)]
[X86][MMX] Simplify tablegen patterns by always combining MOVDQ2Q from v2i64

llvm-svn: 299336

7 years ago[X86][MMX] Added support for subvector extraction to MMX register
Simon Pilgrim [Sun, 2 Apr 2017 15:52:28 +0000 (15:52 +0000)]
[X86][MMX] Added support for subvector extraction to MMX register

llvm-svn: 299335

7 years agoAPInt.h: Prune \param(s) in \returns. [-Wdocumentation]
NAKAMURA Takumi [Sun, 2 Apr 2017 15:05:18 +0000 (15:05 +0000)]
APInt.h: Prune \param(s) in \returns. [-Wdocumentation]

llvm-svn: 299334

7 years agoRegenerate test with codegen. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 14:21:14 +0000 (14:21 +0000)]
Regenerate test with codegen. NFCI.

llvm-svn: 299333

7 years agoRegenerate test with codegen. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 13:59:37 +0000 (13:59 +0000)]
Regenerate test with codegen. NFCI.

llvm-svn: 299332

7 years agoRegenerate test. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 13:50:44 +0000 (13:50 +0000)]
Regenerate test. NFCI.

llvm-svn: 299331

7 years agoNewGVN: Handle coercion of constant stores, loads, memory insts.
Daniel Berlin [Sun, 2 Apr 2017 13:23:44 +0000 (13:23 +0000)]
NewGVN: Handle coercion of constant stores, loads, memory insts.

Summary:
Depends on D30928.

This adds support for coercion of stores and memory instructions that do not require insertion to process.
Another few tests down.
I added the relevant tests from rle.ll

Reviewers: davide

Subscribers: llvm-commits, Prazek

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

llvm-svn: 299330

7 years ago[BypassSlowDivision] Do not bypass division of hash-like values
Nikolai Bozhenov [Sun, 2 Apr 2017 13:14:30 +0000 (13:14 +0000)]
[BypassSlowDivision] Do not bypass division of hash-like values

Disable bypassing if one of the operands looks like a hash value. Slow
division often occurs in hashtable implementations and fast division is
never taken there because a hash value is extremely unlikely to have
enough upper bits set to zero.

A value is considered to be hash-like if it is produced by

1) XOR operation
2) Multiplication by a constant wider than the shorter type
3) PHI node with all incoming values being hash-like

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

llvm-svn: 299329

7 years ago[X86][MMX] Add generic fptosi 4f32-4i32 test
Simon Pilgrim [Sun, 2 Apr 2017 13:10:20 +0000 (13:10 +0000)]
[X86][MMX] Add generic fptosi 4f32-4i32 test

llvm-svn: 299328

7 years agoAdd another interesting shufflevector test case for InstSimplify. NFC.
Zvi Rackover [Sun, 2 Apr 2017 10:42:21 +0000 (10:42 +0000)]
Add another interesting shufflevector test case for InstSimplify. NFC.

Test case shows opportunity to constant fold a shuffle with one variable
input vector operand.

llvm-svn: 299327

7 years ago[X86] Use tcAdd/tcSubtract to implement the slow case of operator+=/operator-=.
Craig Topper [Sun, 2 Apr 2017 06:59:43 +0000 (06:59 +0000)]
[X86] Use tcAdd/tcSubtract to implement the slow case of operator+=/operator-=.

llvm-svn: 299326

7 years ago[APInt] Combine declaration and initialization. NFC
Craig Topper [Sun, 2 Apr 2017 06:59:41 +0000 (06:59 +0000)]
[APInt] Combine declaration and initialization. NFC

llvm-svn: 299325

7 years ago[APInt] Simplify some code by using operator+=(uint64_t) instead of doing a more...
Craig Topper [Sun, 2 Apr 2017 06:59:38 +0000 (06:59 +0000)]
[APInt] Simplify some code by using operator+=(uint64_t) instead of doing a more complex assignment into a temporary APInt just to use the APInt operator+=.

llvm-svn: 299324

7 years ago[APInt] Fix typo in comment. NFC
Craig Topper [Sun, 2 Apr 2017 06:59:36 +0000 (06:59 +0000)]
[APInt] Fix typo in comment. NFC

llvm-svn: 299323

7 years agoMemorySSA: Add support for caching clobbering access in stores
Daniel Berlin [Sun, 2 Apr 2017 05:09:15 +0000 (05:09 +0000)]
MemorySSA: Add support for caching clobbering access in stores

Summary:
This enables us to cache the clobbering access for stores, despite the
fact that we can't rewrite the use-def chains themselves.

Early testing shows that, after this change, for larger testcases, it will be a significant net positive (memory and time) to remove the walker caching.

Reviewers: george.burgess.iv, davide

Subscribers: Prazek, llvm-commits

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

llvm-svn: 299322