platform/upstream/llvm.git
7 years ago[Sema] Remove dead typedef
Bruno Cardoso Lopes [Fri, 20 Jan 2017 19:04:01 +0000 (19:04 +0000)]
[Sema] Remove dead typedef

llvm-svn: 292635

7 years ago[DWARF] [ObjectYAML] Adding APIs for unittesting
Chris Bieneman [Fri, 20 Jan 2017 19:03:14 +0000 (19:03 +0000)]
[DWARF] [ObjectYAML] Adding APIs for unittesting

Summary: This patch adds some new APIs to enable using the YAML DWARF representation in unit tests. The most basic new API is DWARFYAML::EmitDebugSections which converts a YAML string into a series of owned MemoryBuffer objects stored in a StringMap. The string map can then be used to construct a DWARFContext for parsing in place of an ObjectFile.

Reviewers: dblaikie, clayborg

Subscribers: mgorny, fhahn, jgosnell, aprantl, llvm-commits

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

llvm-svn: 292634

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free." #3
Haicheng Wu [Fri, 20 Jan 2017 18:51:22 +0000 (18:51 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free." #3

This is the third attemp to recommit r292526.

The original summary:

Currently, a GEP is considered free only if its indices are all constant.
TTI::getGEPCost() can give target-specific more accurate analysis. TTI is
already used for the cost of many other instructions.

llvm-svn: 292633

7 years agoFix actually-reachable llvm_unreachable.
Richard Smith [Fri, 20 Jan 2017 18:50:12 +0000 (18:50 +0000)]
Fix actually-reachable llvm_unreachable.

llvm-svn: 292632

7 years ago[SLP] Initial test for fix of PR31690.
Alexey Bataev [Fri, 20 Jan 2017 18:40:21 +0000 (18:40 +0000)]
[SLP] Initial test for fix of PR31690.

llvm-svn: 292631

7 years ago[scudo] Replacing std::atomic with Sanitizer's atomics
Kostya Kortchinsky [Fri, 20 Jan 2017 18:32:18 +0000 (18:32 +0000)]
[scudo] Replacing std::atomic with Sanitizer's atomics

Summary:
In an effort to getting rid of dependencies to external libraries, we are
replacing atomic PackedHeader use of std::atomic with Sanitizer's
atomic_uint64_t, which allows us to avoid -latomic.

Reviewers: kcc, phosek, alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 292630

7 years agoARM: tLDR_postidx should be marked mayLoad
Matthias Braun [Fri, 20 Jan 2017 18:30:28 +0000 (18:30 +0000)]
ARM: tLDR_postidx should be marked mayLoad

This fixes -verify-machineinstrs complaints.

llvm-svn: 292629

7 years agoSimplify. NFC.
Rafael Espindola [Fri, 20 Jan 2017 18:20:37 +0000 (18:20 +0000)]
Simplify. NFC.

addIgnored already creates the symbol only if there is a reference to
it.

llvm-svn: 292628

7 years ago[InstCombine][X86] Add MULDQ/MULUDQ undef handling
Simon Pilgrim [Fri, 20 Jan 2017 18:20:30 +0000 (18:20 +0000)]
[InstCombine][X86] Add MULDQ/MULUDQ undef handling

llvm-svn: 292627

7 years ago[SLP] A new test for horizontal vectorization for non-power-of-2
Alexey Bataev [Fri, 20 Jan 2017 18:04:29 +0000 (18:04 +0000)]
[SLP] A new test for horizontal vectorization for non-power-of-2
instructions.

llvm-svn: 292626

7 years agoAArch64LoadStoreOptimizer: Update kill flags when merging stores
Matthias Braun [Fri, 20 Jan 2017 18:04:27 +0000 (18:04 +0000)]
AArch64LoadStoreOptimizer: Update kill flags when merging stores

Kill flags need to be updated correctly when moving stores up/down to
form store pair instructions.
Those invalid flags have been ignored before but as of r290014 they are
recognized when using -mllvm -verify-machineinstrs.

Also simplifies test/CodeGen/AArch64/ldst-opt-dbg-limit.mir, renames it
to ldst-opt.mir test and adds a new tests for this change.

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

llvm-svn: 292625

7 years ago[mips] Fix debug information for __thread variable
Petar Jovanovic [Fri, 20 Jan 2017 17:53:30 +0000 (17:53 +0000)]
[mips] Fix debug information for __thread variable

This patch fixes debug information for __thread variable on Mips
using .dtprelword and .dtpreldword directives.

Patch by Aleksandar Beserminji.

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

llvm-svn: 292624

7 years ago[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 20 Jan 2017 17:52:16 +0000 (17:52 +0000)]
[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 292623

7 years ago[RegisterCoalescing] Recommit the patch "Remove partial redundent copy".
Wei Mi [Fri, 20 Jan 2017 17:38:54 +0000 (17:38 +0000)]
[RegisterCoalescing] Recommit the patch "Remove partial redundent copy".

The recommit fixes a bug related with live interval update after the partial
redundent copy is moved.

The original patch is to solve the performance problem described in PR27827.
Register coalescing sometimes cannot remove a copy because of interference.
But if we can find a reverse copy in one of the predecessor block of the copy,
the copy is partially redundent and we may remove the copy partially by moving
it to the predecessor block without the reverse copy.

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

llvm-svn: 292621

7 years ago[InstCombine][SSE] Tests showing missed opportunities to handle muldq/muludq with...
Simon Pilgrim [Fri, 20 Jan 2017 17:06:38 +0000 (17:06 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to handle muldq/muludq with undef arguments

Fixed a typo in existing test names at the same time

llvm-svn: 292619

7 years agoRevert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"
Haicheng Wu [Fri, 20 Jan 2017 16:52:22 +0000 (16:52 +0000)]
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"

This reverts commit r292616 because the test case still has problem.

llvm-svn: 292618

7 years ago[Frontend] The macro that describes the Objective-C bool type should
Alex Lorenz [Fri, 20 Jan 2017 16:48:25 +0000 (16:48 +0000)]
[Frontend] The macro that describes the Objective-C bool type should
be defined for non Objective-C code as well

rdar://29794915

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

llvm-svn: 292617

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free." #2
Haicheng Wu [Fri, 20 Jan 2017 16:36:34 +0000 (16:36 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free." #2

This is the second attemp to recommit r292526.

The original summary:

Currently, a GEP is considered free only if its indices are all constant.
TTI::getGEPCost() can give target-specific more accurate analysis. TTI is
already used for the cost of many other instructions.

llvm-svn: 292616

7 years ago[Sema] Improve the error diagnostic for dot destructor calls on pointer objects
Alex Lorenz [Fri, 20 Jan 2017 15:38:58 +0000 (15:38 +0000)]
[Sema] Improve the error diagnostic for dot destructor calls on pointer objects

This commit improves the mismatched destructor type error by detecting when the
destructor call has used a '.' instead of a '->' on a pointer to the destructed
type. The diagnostic now suggests to use '->' instead of '.', and adds a fixit
where appropriate.

rdar://28766702

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

llvm-svn: 292615

7 years ago[ELF] Cleanup createThunks() NFC.
Peter Smith [Fri, 20 Jan 2017 15:25:45 +0000 (15:25 +0000)]
[ELF] Cleanup createThunks() NFC.

Include removal of call to getThunkExpr() as it has already been
called and recorded by scanRelocs()

Cleanup suggestions by Rafael.

llvm-svn: 292614

7 years agoRemove trailing whitespace. NFCI.
Simon Pilgrim [Fri, 20 Jan 2017 15:15:59 +0000 (15:15 +0000)]
Remove trailing whitespace. NFCI.

llvm-svn: 292613

7 years ago[CostModel][X86] Removed unused cost. NFCI.
Simon Pilgrim [Fri, 20 Jan 2017 15:14:38 +0000 (15:14 +0000)]
[CostModel][X86] Removed unused cost. NFCI.

SHL v8i32 is already handled in the SSE41 cost table

llvm-svn: 292612

7 years agoPrevent client from querying each thread's PC at each stop.
Pavel Labath [Fri, 20 Jan 2017 14:17:16 +0000 (14:17 +0000)]
Prevent client from querying each thread's PC at each stop.

Summary:
The server was no longer sending the thread PCs the way the client
expected them.
I changed the server to send them back as a threadstop info field,
similar to the Apple version of the server.
I also changed the client to look for them there, before querying the
server.
I added a test to ensure the server doesn't stop sending them.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D28880
Author: Jason Majors

llvm-svn: 292611

7 years ago[InstCombine][SSE] Tests showing missed opportunities to constant fold packss/packus
Simon Pilgrim [Fri, 20 Jan 2017 13:21:30 +0000 (13:21 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to constant fold packss/packus

llvm-svn: 292609

7 years ago[Thumb] Add support for tMUL in the compare instruction peephole optimizer.
Sjoerd Meijer [Fri, 20 Jan 2017 13:10:12 +0000 (13:10 +0000)]
[Thumb] Add support for tMUL in the compare instruction peephole optimizer.

We also want to optimise tests like this: return a*b == 0.  The MULS
instruction is flag setting, so we don't need the CMP instruction but can
instead branch on the result of the MULS. The generated instructions sequence
for this example was: MULS, MOVS, MOVS, CMP. The MOVS instruction load the
boolean values resulting from the select instruction, but these MOVS
instructions are flag setting and were thus preventing this optimisation. Now
we first reorder and move the MULS to before the CMP and generate sequence
MOVS, MOVS, MULS, CMP so that the optimisation could trigger. Reordering of the
MULS and MOVS is safe to do because the subsequent MOVS instructions just set
the CPSR register and don't use it, i.e. the CPSR is dead.

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

llvm-svn: 292608

7 years agoDon't default older GCC's to C++17, but C++14 or C++11 instead
Eric Fiselier [Fri, 20 Jan 2017 12:54:45 +0000 (12:54 +0000)]
Don't default older GCC's to C++17, but C++14 or C++11 instead

llvm-svn: 292607

7 years agoRevert "Don't default older GCC's to C++17, but C++14 or C++11 instead"
Eric Fiselier [Fri, 20 Jan 2017 12:52:59 +0000 (12:52 +0000)]
Revert "Don't default older GCC's to C++17, but C++14 or C++11 instead"

The commit isn't quite right, and I want to only have to merge one
commit into 4.0

llvm-svn: 292606

7 years agoDon't default older GCC's to C++17, but C++14 or C++11 instead
Eric Fiselier [Fri, 20 Jan 2017 12:46:57 +0000 (12:46 +0000)]
Don't default older GCC's to C++17, but C++14 or C++11 instead

llvm-svn: 292605

7 years ago[clang-format] Remove redundant test in style-on-command-line.cpp
Krasimir Georgiev [Fri, 20 Jan 2017 12:39:05 +0000 (12:39 +0000)]
[clang-format] Remove redundant test in style-on-command-line.cpp

Summary:
rL292562 added a fix to always format if the fallback style is set to "none".
In test/Format/style-on-command-line.cpp:19 is redundant, since -fallback-style
has a default value of LLVM set in ClangFormat.cpp:72.

@amaiorano: I believe that the rest of the test cases still cover your change in
case the fallback style is explicitly set to "none". Please, if this is not the
case, initiate a discussion.

Reviewers: ioeric, bkramer

Reviewed By: ioeric

Subscribers: cfe-commits, klimek, amaiorano

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

llvm-svn: 292604

7 years ago[InstCombine][SSE] Tests showing missed opportunities to handle packss/packus with...
Simon Pilgrim [Fri, 20 Jan 2017 11:28:07 +0000 (11:28 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to handle packss/packus with undef arguments

llvm-svn: 292601

7 years agoRemove 'RUN: false' from Driver/response-file.c
Krasimir Georgiev [Fri, 20 Jan 2017 11:06:58 +0000 (11:06 +0000)]
Remove 'RUN: false' from Driver/response-file.c

Summary:
It seems that rL292518 introduced a RUN: false, but the continuation rL292545
forgot to remove it back.

This has flown under the radar, because it's a long test and doesn't get
executed by default during sanity testing.

To test:
$ cd llvm_build
$ ./bin/llvm-lit --param run_long_tests=true tools/clang/test/Driver/response-file.c

@rsmith: have a look if this change is OK please.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, rsmith

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

llvm-svn: 292600

7 years agoPacify -Wreorder.
Benjamin Kramer [Fri, 20 Jan 2017 10:37:53 +0000 (10:37 +0000)]
Pacify -Wreorder.

llvm-svn: 292599

7 years agoFix more unused variable warnings when asserts are disabled.
Hafiz Abid Qadeer [Fri, 20 Jan 2017 10:24:03 +0000 (10:24 +0000)]
Fix more unused variable warnings when asserts are disabled.

llvm-svn: 292598

7 years agoAdd an assertion to PlaceholderQueue destructor, ensuring it has been flushed
Mehdi Amini [Fri, 20 Jan 2017 10:18:32 +0000 (10:18 +0000)]
Add an assertion to PlaceholderQueue destructor, ensuring it has been flushed

llvm-svn: 292597

7 years ago[AMDGPU] Add subtarget features for SDWA/DPP
Sam Kolton [Fri, 20 Jan 2017 10:01:25 +0000 (10:01 +0000)]
[AMDGPU] Add subtarget features for SDWA/DPP

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 292596

7 years agoFix documentation typo.
Malcolm Parsons [Fri, 20 Jan 2017 09:54:26 +0000 (09:54 +0000)]
Fix documentation typo.

llvm-svn: 292595

7 years ago[ELF] - Do not crash when assign common symbol's values in script
George Rimar [Fri, 20 Jan 2017 09:45:36 +0000 (09:45 +0000)]
[ELF] - Do not crash when assign common symbol's values in script

Found that during attempts of linking linux kernel,
previously we partially duplicated code from getOutputSection(),
and it missed commons symbol case.

Differential revision: https://reviews.llvm.org/D28903

llvm-svn: 292594

7 years agoUse UTF-8 for all communication with clang-format
Philipp Stephani [Fri, 20 Jan 2017 09:37:50 +0000 (09:37 +0000)]
Use UTF-8 for all communication with clang-format

Summary: Instead of picking the buffer file coding system, always use utf-8-unix for communicating with clang-format.  This is fine because clang-format never actually reads the file to be formatted, only standard input.  This is a bit simpler (process coding system is now a constant) and potentially faster, as utf-8-unix is Emacs's internal coding system.  Also add an end-to-end test that actually invokes clang-format.

Reviewers: klimek

Reviewed By: klimek

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

llvm-svn: 292593

7 years ago[PM] Tidy up the spacing of this new, much nicer test file.
Chandler Carruth [Fri, 20 Jan 2017 09:30:03 +0000 (09:30 +0000)]
[PM] Tidy up the spacing of this new, much nicer test file.

llvm-svn: 292592

7 years ago[InstCombine][SSE] Add DemandedElts support for PACKSS/PACKUS instructions
Simon Pilgrim [Fri, 20 Jan 2017 09:28:21 +0000 (09:28 +0000)]
[InstCombine][SSE] Add DemandedElts support for PACKSS/PACKUS instructions

Simplify a packss/packus truncation based on the elements of the mask that are actually demanded.

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

llvm-svn: 292591

7 years ago[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
Alexey Bataev [Fri, 20 Jan 2017 08:57:28 +0000 (08:57 +0000)]
[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
with SEH and openmp

In some cituations (during codegen for Windows SEH constructs)
CodeGenFunction instance may have CurFn equal to nullptr. OpenMP related
code does not expect such situation during cleanup.

llvm-svn: 292590

7 years ago[PM] Port LoopSink to the new pass manager.
Chandler Carruth [Fri, 20 Jan 2017 08:42:19 +0000 (08:42 +0000)]
[PM] Port LoopSink to the new pass manager.

Like several other loop passes (the vectorizer, etc) this pass doesn't
really fit the model of a loop pass. The critical distinction is that it
isn't intended to be pipelined together with other loop passes. I plan
to add some documentation to the loop pass manager to make this more
clear on that side.

LoopSink is also different because it doesn't really need a lot of the
infrastructure of our loop passes. For example, if there aren't loop
invariant instructions causing a preheader to exist, there is no need to
form a preheader. It also doesn't need LCSSA because this pass is
only involved in sinking invariant instructions from a preheader into
the loop, not reasoning about live-outs.

This allows some nice simplifications to the pass in the new PM where we
can directly walk the loops once without restructuring them.

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

llvm-svn: 292589

7 years ago[LoopSink] Trivial comment cleanup.
Chandler Carruth [Fri, 20 Jan 2017 08:42:14 +0000 (08:42 +0000)]
[LoopSink] Trivial comment cleanup.

llvm-svn: 292588

7 years ago[ARM] Use helpers for adding pred / CC operands. NFC
Diana Picus [Fri, 20 Jan 2017 08:15:24 +0000 (08:15 +0000)]
[ARM] Use helpers for adding pred / CC operands. NFC

Hunt down some of the places where we use bare addReg(0) or addImm(AL).addReg(0)
and replace with add(condCodeOp()) and add(predOps()). This should make it
easier to understand what those operands represent (without having to look at
the definition of the instruction that we're adding to).

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

llvm-svn: 292587

7 years ago[AVX-512] Fix a couple test cases to not pass an undef mask to gather intrinsic....
Craig Topper [Fri, 20 Jan 2017 07:12:30 +0000 (07:12 +0000)]
[AVX-512] Fix a couple test cases to not pass an undef mask to gather intrinsic. This could break if any future optimizations taken advantage of the undef.

llvm-svn: 292585

7 years ago[TargetLowering] Improve comment for setOperationAction().
Jonas Paulsson [Fri, 20 Jan 2017 06:48:47 +0000 (06:48 +0000)]
[TargetLowering] Improve comment for setOperationAction().

Add a sentence that says that the type argument can refer to
either the type of a result, or that of an operand.

Review: Eli Friedman.
llvm-svn: 292584

7 years agoNewGVN: Fix PR 31682, an overactive assert.
Daniel Berlin [Fri, 20 Jan 2017 06:38:41 +0000 (06:38 +0000)]
NewGVN: Fix PR 31682, an overactive assert.
Part of the assert has been left active for further debugging.
The other part has been turned into a stat for tracking for the
moment.

llvm-svn: 292583

7 years agoStill expose std::align_val_t in C++17 even if we don't have aligned new/delete.
Eric Fiselier [Fri, 20 Jan 2017 06:27:34 +0000 (06:27 +0000)]
Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.

r292564 disabled the aligned new/delete overloads on platforms without
posix_memalign. Unfortunately that patch also disabled the  align_val_t
definition in C++17 as well.

This patch causes align_val_t to be exposed in C++17 regardless
of if we have the new/delete overloads.

llvm-svn: 292582

7 years ago[SLP] Add a base test for jumbled store
Mohammad Shahid [Fri, 20 Jan 2017 06:05:33 +0000 (06:05 +0000)]
[SLP] Add a base test for jumbled store

Change-Id: I905ce08a02c76a6896dcfd9629547417c99adc4a
llvm-svn: 292581

7 years agollvm-cxxfilt: add missing includes from previous change
Saleem Abdulrasool [Fri, 20 Jan 2017 05:33:22 +0000 (05:33 +0000)]
llvm-cxxfilt: add missing includes from previous change

llvm-svn: 292580

7 years agollvm-cxxfilt: fix program description
Saleem Abdulrasool [Fri, 20 Jan 2017 05:27:09 +0000 (05:27 +0000)]
llvm-cxxfilt: fix program description

Fix a silly copy-paste error in the tool description.  Take the
opportunity to add crash stack printing which will hopefully never be
needed.

llvm-svn: 292579

7 years agoELF: Fix ICF crash on absolute symbol relocations.
Peter Collingbourne [Fri, 20 Jan 2017 04:58:12 +0000 (04:58 +0000)]
ELF: Fix ICF crash on absolute symbol relocations.

If two sections contained relocations to absolute symbols with the same
value we would crash when trying to access their sections. Add a check that
both symbols point to sections before accessing their sections, and treat
absolute symbols as equal if their values are equal.

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

llvm-svn: 292578

7 years agoRefactor unique_ptr/shared_ptr deleter test types into single header.
Eric Fiselier [Fri, 20 Jan 2017 04:39:17 +0000 (04:39 +0000)]
Refactor unique_ptr/shared_ptr deleter test types into single header.

llvm-svn: 292577

7 years agollvm-cxxfilt: support `-t` to demangle types
Saleem Abdulrasool [Fri, 20 Jan 2017 04:25:26 +0000 (04:25 +0000)]
llvm-cxxfilt: support `-t` to demangle types

By default c++filt demangles functions, though you can optionally pass
`-t` to have it decode types as well, behaving nearly identical to
`__cxa_demangle`.  Add support for this mode.

llvm-svn: 292576

7 years agoBitVector: Fix undefined behaviour
Matthias Braun [Fri, 20 Jan 2017 04:23:08 +0000 (04:23 +0000)]
BitVector: Fix undefined behaviour

Calling reset() on an empty BitVector would call memset with a nullptr
argument which is undefined behaviour.

This should fix the sanitizer bot.

llvm-svn: 292575

7 years agoRevert "LiveRegUnits: Add accumulateBackward() function"
Matthias Braun [Fri, 20 Jan 2017 03:58:42 +0000 (03:58 +0000)]
Revert "LiveRegUnits: Add accumulateBackward() function"

This seems to be breaking some bots.

This reverts commit r292543.

llvm-svn: 292574

7 years agoRevert "Demangle: only demangle mangled symbols"
Saleem Abdulrasool [Fri, 20 Jan 2017 03:54:04 +0000 (03:54 +0000)]
Revert "Demangle: only demangle mangled symbols"

This reverts SVN r286795.  This was incorrect the demangler is expected
to be able to demangle types as well as functions.  This makes the
behaviour of itaniumDemangle similar to __cxa_demangle once more.

llvm-svn: 292573

7 years agoRevert "Recommit "[InlineCost] Use TTI to check if GEP is free.""
Haicheng Wu [Fri, 20 Jan 2017 03:40:41 +0000 (03:40 +0000)]
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free.""

This reverts commit r292570.  The test still has problem.

llvm-svn: 292572

7 years ago[AST Printer] Print attributes on enum constants
Jordan Rose [Fri, 20 Jan 2017 03:33:42 +0000 (03:33 +0000)]
[AST Printer] Print attributes on enum constants

The AST printer was dropping attributes on enumerators (enum
constants). Now it's not.

llvm-svn: 292571

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free."
Haicheng Wu [Fri, 20 Jan 2017 03:09:11 +0000 (03:09 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free."

This recommits r292526 which is reverted in r292529 after fixing the test case.

The original summary:

Currently, a GEP is considered free only if its indices are all constant.
TTI::getGEPCost() can give target-specific more accurate analysis. TTI is
already used for the cost of many other instructions.

llvm-svn: 292570

7 years ago[LoopInfo] Add helper methods to compute two useful orderings of the
Chandler Carruth [Fri, 20 Jan 2017 02:41:20 +0000 (02:41 +0000)]
[LoopInfo] Add helper methods to compute two useful orderings of the
loops in a function.

These are relatively confusing to talk about and compute correctly so it
seems really good to write down their implementation in one place. I've
replaced one place we needed this in the loop PM infrastructure and
I have another place in a pending patch that wants it.

We can't quite use this for the core loop PM walk because there we're
sometimes working on a sub-forest.

I'll add the expected unittests before committing this but wanted to
make sure folks were happy with these names / comments.

Credit goes to Richard Smith for the idea for naming the order where siblings
are in reverse program order but the tree traversal remains preorder.

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

llvm-svn: 292569

7 years ago[test] Remove an unwanted match for `UNSUPPORTED:`.
Greg Parker [Fri, 20 Jan 2017 02:12:22 +0000 (02:12 +0000)]
[test] Remove an unwanted match for `UNSUPPORTED:`.

llvm-svn: 292568

7 years ago[test] Remove a unwanted match for `XFAIL:`.
Greg Parker [Fri, 20 Jan 2017 02:01:04 +0000 (02:01 +0000)]
[test] Remove a unwanted match for `XFAIL:`.

llvm-svn: 292567

7 years agoDisable aligned new/delete on Apple platforms without posix_memalign
Eric Fiselier [Fri, 20 Jan 2017 01:47:26 +0000 (01:47 +0000)]
Disable aligned new/delete on Apple platforms without posix_memalign

Summary:
This patch disables the aligned new/delet overloads on Apple platforms without `posix_memalign`. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

This patch should also be merged into the 4.0 release branch

Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 292564

7 years ago[AArch64][GlobalISel] Widen scalar int->fp conversions.
Ahmed Bougacha [Fri, 20 Jan 2017 01:37:24 +0000 (01:37 +0000)]
[AArch64][GlobalISel] Widen scalar int->fp conversions.

It's incorrect to ignore the higher bits of the integer source.
Teach the legalizer how to widen it.

llvm-svn: 292563

7 years agoclang-format: fix fallback style set to "none" not always formatting
Antonio Maiorano [Fri, 20 Jan 2017 01:22:42 +0000 (01:22 +0000)]
clang-format: fix fallback style set to "none" not always formatting

This fixes clang-format not formatting if fallback-style is explicitly set to
"none", and either a config file is found or YAML is passed in without a
"BasedOnStyle". With this change, passing "none" in these cases will have no
affect, and LLVM style will be used as the base style.

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

llvm-svn: 292562

7 years agoPR31701: Fix crash on invalid caused by parsing a dependent initializer when we
Richard Smith [Fri, 20 Jan 2017 01:19:46 +0000 (01:19 +0000)]
PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
don't know we're in a dependent context.

llvm-svn: 292561

7 years ago[NFC] Group aligned new/delete definitions together in new.cpp
Eric Fiselier [Fri, 20 Jan 2017 01:13:49 +0000 (01:13 +0000)]
[NFC] Group aligned new/delete definitions together in new.cpp

This patch is cleanup to prepare for future changes

llvm-svn: 292560

7 years agoFix documentation typo.
Richard Smith [Fri, 20 Jan 2017 01:08:15 +0000 (01:08 +0000)]
Fix documentation typo.

llvm-svn: 292559

7 years agoAdd documentation for constexpr string builtin support.
Richard Smith [Fri, 20 Jan 2017 00:57:59 +0000 (00:57 +0000)]
Add documentation for constexpr string builtin support.

llvm-svn: 292558

7 years agoFix handling of Apple target triple when checking the ABI lists.
Eric Fiselier [Fri, 20 Jan 2017 00:57:08 +0000 (00:57 +0000)]
Fix handling of Apple target triple when checking the ABI lists.

The check-cxx-abilist rule uses TARGET_TRIPLE to determine which
ABI list to check. However the triple on Apple contains the darwin
version which changes frequently, but libc++ doesn't need
different ABI lists for each darwin version.

This patch strips the minor version and patchlevel from TARGET_TRIPLE
before using it to determine the ABI list.

llvm-svn: 292557

7 years ago[PM] Attempt to pacify windows bots.
Michael Kuperstein [Fri, 20 Jan 2017 00:47:32 +0000 (00:47 +0000)]
[PM] Attempt to pacify windows bots.

Another difference in type pretty-printing, this one windows-specific.

llvm-svn: 292556

7 years agoP0426: Make the library implementation of constexpr char_traits a little easier
Richard Smith [Fri, 20 Jan 2017 00:45:35 +0000 (00:45 +0000)]
P0426: Make the library implementation of constexpr char_traits a little easier
by providing a memchr builtin that returns char* instead of void*.

Also add a __has_feature flag to indicate the presence of constexpr forms of
the relevant <string> functions.

llvm-svn: 292555

7 years ago[AMDGPU] Prevent spills before exec mask is restored
Stanislav Mekhanoshin [Fri, 20 Jan 2017 00:44:31 +0000 (00:44 +0000)]
[AMDGPU] Prevent spills before exec mask is restored

Inline spiller can decide to move a spill as early as possible in the basic block.
It will skip phis and label, but we also need to make sure it skips instructions
in the basic block prologue which restore exec mask.

Added isPositionLike callback in TargetInstrInfo to detect instructions which
shall be skipped in addition to common phis, labels etc.

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

llvm-svn: 292554

7 years agoGlobalISel: Add a note about how we're being a bit loose with memory operands
Justin Bogner [Fri, 20 Jan 2017 00:30:17 +0000 (00:30 +0000)]
GlobalISel: Add a note about how we're being a bit loose with memory operands

The logic in r292461 is conservatively correct, but we should revisit
this later. Add a TODO so we don't forget.

llvm-svn: 292553

7 years ago[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.
Ahmed Bougacha [Fri, 20 Jan 2017 00:30:09 +0000 (00:30 +0000)]
[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.

Big functions with large vreg # are quite unwieldy to update.

Change it to have one function per test (it does increase boilerplate,
but makes the core hopefully more readable and maintanable).

llvm-svn: 292552

7 years ago[AArch64][GlobalISel] Split legalizer combine tests. NFC.
Ahmed Bougacha [Fri, 20 Jan 2017 00:30:06 +0000 (00:30 +0000)]
[AArch64][GlobalISel] Split legalizer combine tests. NFC.

Big functions with large vreg # are quite unwieldy to update.  This test
also relied on legal s8 operations which we're considering removing.

Change it to have one function per test (it does increase boilerplate,
but makes the core hopefully more readable and maintanable), and use
100% legal operations throughout.

llvm-svn: 292551

7 years ago[MIRParser] Allow generic register specification on operand.
Ahmed Bougacha [Fri, 20 Jan 2017 00:29:59 +0000 (00:29 +0000)]
[MIRParser] Allow generic register specification on operand.

This completes r292321 by adding support for generic registers, e.g.:

  %2:_(s32) = G_ADD %0, %1

llvm-svn: 292550

7 years ago[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]
Kuba Mracek [Fri, 20 Jan 2017 00:25:01 +0000 (00:25 +0000)]
[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]

Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests.

This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests.

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

llvm-svn: 292549

7 years ago[lit] Limit parallelism of sanitizer tests on Darwin [llvm part, take 2]
Kuba Mracek [Fri, 20 Jan 2017 00:24:32 +0000 (00:24 +0000)]
[lit] Limit parallelism of sanitizer tests on Darwin [llvm part, take 2]

Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests.

This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests.

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

llvm-svn: 292548

7 years agoGlobalISel: Only set FailedISel on dropped dbg intrinsics when using fallback
Justin Bogner [Fri, 20 Jan 2017 00:24:30 +0000 (00:24 +0000)]
GlobalISel: Only set FailedISel on dropped dbg intrinsics when using fallback

It's easier to test the non-fallback path if we just drop these
intrinsics for now, like we did before we added the fallback path.
We'll obviously need to fix this properly, but the fixme for that is
already here.

llvm-svn: 292547

7 years ago[AliasAnalysis] Fences do not modify constant memory location
Anna Thomas [Fri, 20 Jan 2017 00:21:33 +0000 (00:21 +0000)]
[AliasAnalysis] Fences do not modify constant memory location

Summary:
Fence instructions are currently marked as `ModRef` for all memory locations.

We can improve this for constant memory locations (such as constant globals),
since fence instructions cannot modify these locations.

This helps us to forward constant loads across fences (added test case in GVN).
There were no changes in behaviour for similar test cases in early-cse and licm.

Reviewers: dberlin, sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 292546

7 years agoFinish implementation of C++ DR1310 (http://wg21.link/cwg1310).
Richard Smith [Fri, 20 Jan 2017 00:20:39 +0000 (00:20 +0000)]
Finish implementation of C++ DR1310 (wg21.link/cwg1310).

Diagnose the case when a dependent template name instantiates to an
injected-class-name outside a nested-name-specifier.

llvm-svn: 292545

7 years agoGlobalISel: Pass the MachineFunction in to reportSelectionError directly
Justin Bogner [Fri, 20 Jan 2017 00:16:19 +0000 (00:16 +0000)]
GlobalISel: Pass the MachineFunction in to reportSelectionError directly

Rather than trying to find MF based on the possibly-null MI we've
passed in here, just pass it in directly. It's already available at
all callers anyway.

llvm-svn: 292544

7 years agoLiveRegUnits: Add accumulateBackward() function
Matthias Braun [Fri, 20 Jan 2017 00:16:17 +0000 (00:16 +0000)]
LiveRegUnits: Add accumulateBackward() function

This function can be used to accumulate the set of all read and modified
register in a sequence of instructions.

Use this code in AArch64A57FPLoadBalancing::scavengeRegister() to prove
the concept.

- The AArch64A57LoadBalancing code is using a backwards analysis now
  which is irrespective of kill flags. This is the main motivation for
  this change.

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

llvm-svn: 292543

7 years agoCodeGen: Add/Factor out LiveRegUnits class; NFCI
Matthias Braun [Fri, 20 Jan 2017 00:16:14 +0000 (00:16 +0000)]
CodeGen: Add/Factor out LiveRegUnits class; NFCI

This is a set of register units intended to track register liveness, it
is similar in spirit to LivePhysRegs.
You can also think of this as the liveness tracking parts of the
RegisterScavenger factored out into an own class.

This was proposed in http://llvm.org/PR27609

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

llvm-svn: 292542

7 years agoFix demangle helper after r286788
Eric Fiselier [Fri, 20 Jan 2017 00:00:31 +0000 (00:00 +0000)]
Fix demangle helper after r286788

llvm-svn: 292541

7 years agoAArch64: fall back to DAG ISel for inline assembly.
Tim Northover [Thu, 19 Jan 2017 23:59:35 +0000 (23:59 +0000)]
AArch64: fall back to DAG ISel for inline assembly.

We can't currently handle "calls" to inlineasm strings so it's better to let
the DAG handle it than generate rubbish.

llvm-svn: 292540

7 years agoAdjust msvc_stdlib_force_include.hpp to handle clang++
Eric Fiselier [Thu, 19 Jan 2017 23:48:05 +0000 (23:48 +0000)]
Adjust msvc_stdlib_force_include.hpp to handle clang++

Summary: This patch adjusts the newly added `msvc_stdlib_force_include.hpp` so that it also works when used with `clang++`.

Reviewers: STL_MSFT

Reviewed By: STL_MSFT

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

llvm-svn: 292539

7 years agoFix a few more build errors.
Zachary Turner [Thu, 19 Jan 2017 23:44:14 +0000 (23:44 +0000)]
Fix a few more build errors.

llvm-svn: 292538

7 years agoFix incorrectly formed assert statement.
Zachary Turner [Thu, 19 Jan 2017 23:41:11 +0000 (23:41 +0000)]
Fix incorrectly formed assert statement.

llvm-svn: 292537

7 years ago[PM] Make default pipeline test for the new PM strict
Michael Kuperstein [Thu, 19 Jan 2017 23:39:28 +0000 (23:39 +0000)]
[PM] Make default pipeline test for the new PM strict

Use CHECK-NEXT to verify that a test breaks whenever unexpected passes,
analyses, or invalidations show up in default pipelines. The test case
is constructed so that we don't expect to invalidate anything, and needs
to be kept that way.

The test is slightly less strict than we'd like because of differences
in type pretty-printing.

(Right now it does show some invalidations - all of those are intentional
and temporary.)

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

llvm-svn: 292536

7 years ago[pdb] Add HashTable data structure.
Zachary Turner [Thu, 19 Jan 2017 23:31:24 +0000 (23:31 +0000)]
[pdb] Add HashTable data structure.

This was being parsed / serialized ad-hoc inside the code
for a specific PDB stream.  But this data structure is used
in multiple ways / places within the PDB format.  To be able
to re-use it we need to raise this code out and make it more
generic.  In doing so, a number of bugs are fixed in the
original implementation, and support is added for growing
the hash table and deleting items from the hash table,
which had either been omitted or incorrect implemented in
the initial version.

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

llvm-svn: 292535

7 years agoRevert r292530 since it breaks buildbots.
Michael Kuperstein [Thu, 19 Jan 2017 23:22:55 +0000 (23:22 +0000)]
Revert r292530 since it breaks buildbots.

llvm-svn: 292534

7 years agoclang-format SampleProfile.cpp (NFC)
Dehao Chen [Thu, 19 Jan 2017 23:20:31 +0000 (23:20 +0000)]
clang-format SampleProfile.cpp (NFC)

llvm-svn: 292533

7 years agoLTO: Flush the resolution file after writing to it.
Peter Collingbourne [Thu, 19 Jan 2017 23:10:14 +0000 (23:10 +0000)]
LTO: Flush the resolution file after writing to it.

Without this the file could be truncated if the linker crashes.

llvm-svn: 292532

7 years ago[SCCP] Teach the pass how to handle `div` with overdefined operands.
Davide Italiano [Thu, 19 Jan 2017 23:07:51 +0000 (23:07 +0000)]
[SCCP] Teach the pass how to handle `div` with overdefined operands.

This can prove that:

extern int f;
int g() {
    int x = 0;
    for (int i = 0; i < 365; ++i) {
        x /= f;
    }
    return x;
}

always returns zero. Thanks to Sanjoy for confirming this
transformation actually made sense (bugs are mine).

llvm-svn: 292531

7 years ago[PM] Make default pipeline test for the new PM strict
Michael Kuperstein [Thu, 19 Jan 2017 22:55:46 +0000 (22:55 +0000)]
[PM] Make default pipeline test for the new PM strict

Use CHECK-NEXT to verify that a test breaks whenever unexpected passes,
analyses, or invalidations show up in default pipelines. The test case
is constructed so that we don't expect to invalidate anything, and needs
to be kept that way.

(Right now it does show some invalidations - all of those are intentional
and temporary.)

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

llvm-svn: 292530

7 years agoRevert "[InlineCost] Use TTI to check if GEP is free."
Haicheng Wu [Thu, 19 Jan 2017 22:51:03 +0000 (22:51 +0000)]
Revert "[InlineCost] Use TTI to check if GEP is free."

This reverts commit r292526.  The test case has problem.

llvm-svn: 292529

7 years ago[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)
Simon Pilgrim [Thu, 19 Jan 2017 22:41:22 +0000 (22:41 +0000)]
[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)

This patch improves the knownbits logic for unsigned integer min/max opcodes.

For UMIN we know that the result will have the maximum of the inputs' known leading zero bits in the result, similarly for UMAX the maximum of the inputs' leading one bits.

This is particularly useful for simplifying clamping patterns,. e.g. as SSE doesn't have a uitofp instruction we want to use sitofp instead where possible and for that we need to confirm that the top bit is not set.

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

llvm-svn: 292528