platform/upstream/llvm.git
6 years agoMore tests with x86 prefixes which work after rL315899 commit
Andrew V. Tischenko [Tue, 17 Oct 2017 08:49:47 +0000 (08:49 +0000)]
More tests with x86 prefixes which work after rL315899 commit

llvm-svn: 315983

6 years ago[Coverage] Discard deferred region in closing if-else
Vedant Kumar [Tue, 17 Oct 2017 07:47:39 +0000 (07:47 +0000)]
[Coverage] Discard deferred region in closing if-else

A trailing deferred region isn't necessary in a function that ends with
this pattern:

  ...
  else {
    ...
    return;
  }

Special-case this pattern so that the closing curly brace of the
function isn't marked as uncovered. This issue came up in PR34962.

llvm-svn: 315982

6 years ago[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)
Vedant Kumar [Tue, 17 Oct 2017 06:51:54 +0000 (06:51 +0000)]
[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)

This makes it possible to view sub-line region counts for the l.h.s of
&& and || expressions in coverage reports.

It also fixes PR33465, which shows an example of incorrect coverage
output for an assignment statement containing '||'.

llvm-svn: 315979

6 years ago[X86][SKL] Updated scheduling information for the SkylakeClient target
Gadi Haber [Tue, 17 Oct 2017 06:47:04 +0000 (06:47 +0000)]
[X86][SKL] Updated scheduling information for the SkylakeClient target

Updated the scheduling information for the SkylakeClient target with the following changes:

1. regrouped the instructions after adding load and store latencies.
2. regrouped the instructions after adding identified missing ports in several groups.
The changes were made after revisiting the latencies impact of all the load and store uOps.

Reviewers: zvi, RKSimon, craig.topper
Differential Revision: https://reviews.llvm.org/D38727

Change-Id: I778a308cc11e490e8fa5e27e2047412a1dca029f
llvm-svn: 315978

6 years agoRemove a test after revert of rL315440
Max Kazantsev [Tue, 17 Oct 2017 06:43:31 +0000 (06:43 +0000)]
Remove a test after revert of rL315440

llvm-svn: 315977

6 years ago[NFC] Add test from bug 34937
Max Kazantsev [Tue, 17 Oct 2017 06:37:58 +0000 (06:37 +0000)]
[NFC] Add test from bug 34937

llvm-svn: 315976

6 years agoRevert 315440 on behalf of mkazantsev
Philip Reames [Tue, 17 Oct 2017 06:21:07 +0000 (06:21 +0000)]
Revert 315440 on behalf of mkazantsev

This patch reverts rL315440 because of the bug described at
https://bugs.llvm.org/show_bug.cgi?id=34937

The fix for the bug is on review as D38944, but not yet ready.  Given this is a regression reverting until a fix is ready is called for.

Max would have done the revert himself, but is having trouble doing a build of fresh LLVM for some reason.  I did the build and test to ensure the revert worked as expected on his behalf.

llvm-svn: 315974

6 years ago[globalisel][tablegen] Add a GIM_CheckIsSameOperand test where OtherInsnID and OtherO...
Daniel Sanders [Tue, 17 Oct 2017 05:24:44 +0000 (05:24 +0000)]
[globalisel][tablegen] Add a GIM_CheckIsSameOperand test where OtherInsnID and OtherOpIdx differ

llvm-svn: 315972

6 years ago[X86] Add masked palignr tests to vector-shuffle-masked.ll
Craig Topper [Tue, 17 Oct 2017 04:17:56 +0000 (04:17 +0000)]
[X86] Add masked palignr tests to vector-shuffle-masked.ll

llvm-svn: 315971

6 years ago[X86] Add AVX512BW to the vector-shuffle-masked test to prepare for an upcoming commit.
Craig Topper [Tue, 17 Oct 2017 04:17:55 +0000 (04:17 +0000)]
[X86] Add AVX512BW to the vector-shuffle-masked test to prepare for an upcoming commit.

llvm-svn: 315970

6 years ago[X86] Fix typo in comment. NFC
Craig Topper [Tue, 17 Oct 2017 04:17:54 +0000 (04:17 +0000)]
[X86] Fix typo in comment. NFC

llvm-svn: 315969

6 years agoBasic: make the nan family pure
Saleem Abdulrasool [Tue, 17 Oct 2017 03:30:25 +0000 (03:30 +0000)]
Basic: make the nan family pure

The nan family of math routines do not rely on global state.  They do
however depend on their parameter.  This fits the description of pure:
  Functions which have no effects except the return value and their
  return value depends only on the parameters and/or global variables.
Mark the family as `readonly`.

llvm-svn: 315968

6 years agoReverting r315966 - it caused a build failure on an ubuntu x android bot.
Jason Molenda [Tue, 17 Oct 2017 03:13:39 +0000 (03:13 +0000)]
Reverting r315966 - it caused a build failure on an ubuntu x android bot.

llvm-svn: 315967

6 years agoCommitting this for Larry D'Anna:
Jason Molenda [Tue, 17 Oct 2017 03:03:44 +0000 (03:03 +0000)]
Committing this for Larry D'Anna:

This patch adds support for passing an arbitrary python stream
(anything inheriting from IOBase) to SetOutputFileHandle or
SetErrorFileHandle.

Differential revision: https://reviews.llvm.org/D38829
<rdar://problem/34870417>

llvm-svn: 315966

6 years agoFuzzMutate: Fix arch parsing in FuzzerCLI
Justin Bogner [Tue, 17 Oct 2017 02:39:40 +0000 (02:39 +0000)]
FuzzMutate: Fix arch parsing in FuzzerCLI

The right way to parse arch names is by creating a triple. This was
using getArchTypeForLLVMName before, which doesn't really do the right
thing here.

llvm-svn: 315965

6 years ago[ExecutionEngine] Correct the size of a write in a COFF i386 relocation
Shoaib Meenai [Tue, 17 Oct 2017 01:41:14 +0000 (01:41 +0000)]
[ExecutionEngine] Correct the size of a write in a COFF i386 relocation

We want to be writing a 32bit value, so we should be writing 4 bytes
instead of 2.

Patch by Alex Langford <apl@fb.com>.

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

llvm-svn: 315964

6 years ago[llvm-cov] Add one correction to r315960 (PR34962)
Vedant Kumar [Tue, 17 Oct 2017 01:34:41 +0000 (01:34 +0000)]
[llvm-cov] Add one correction to r315960 (PR34962)

In r315960, I accidentally assumed that the first line segment is
guaranteed to be the non-gap region entry segment (given that one is
present). It can actually be any segment on the line, and the test I
checked in demonstrates that.

llvm-svn: 315963

6 years agoRevert "[SCEV] Maintain and use a loop->loop invalidation dependency"
Sanjoy Das [Tue, 17 Oct 2017 01:03:56 +0000 (01:03 +0000)]
Revert "[SCEV] Maintain and use a loop->loop invalidation dependency"

This reverts commit r315713.  It causes PR34968.

I think I know what the problem is, but I don't think I'll have time to fix it
this week.

llvm-svn: 315962

6 years agoTry to make crlf portable to other printf implementations
Reid Kleckner [Tue, 17 Oct 2017 00:27:31 +0000 (00:27 +0000)]
Try to make crlf portable to other printf implementations

llvm-svn: 315961

6 years ago[llvm-cov] Remove workaround in line execution count calculation (PR34962)
Vedant Kumar [Mon, 16 Oct 2017 23:47:10 +0000 (23:47 +0000)]
[llvm-cov] Remove workaround in line execution count calculation (PR34962)

Gap areas make it possible to correctly determine when to use counts
from deferred regions. Before gap areas were introduced, llvm-cov needed
to use a heuristic to do this: it ignored counts from segments that
start, but do not end, on a line. This heuristic breaks down on a simple
example (see PR34962).

This patch removes the heuristic and picks counts from any region entry
segment which isn't a gap area.

llvm-svn: 315960

6 years ago[libclang] Add support for querying cursor availability
Jonathan Coe [Mon, 16 Oct 2017 23:46:02 +0000 (23:46 +0000)]
[libclang] Add support for querying cursor availability

Summary:
This patch allows checking the availability of cursors through libclang and clang.cindex (Python).
This e.g. allows to check whether a C++ member function has been marked as deleted.

Reviewers: arphaman, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

llvm-svn: 315959

6 years ago[libclang] Visit attributes for function and class templates
Jonathan Coe [Mon, 16 Oct 2017 23:43:02 +0000 (23:43 +0000)]
[libclang] Visit attributes for function and class templates

Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang.

Reviewers: bkramer, arphaman, rsmith, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

llvm-svn: 315958

6 years agoUse the return value of UpdateNodeOperands(); in some cases, UpdateNodeOperands(...
Mark Searles [Mon, 16 Oct 2017 23:38:53 +0000 (23:38 +0000)]
Use the return value of UpdateNodeOperands(); in some cases, UpdateNodeOperands() modifies the node in-place and using the return value isn’t strictly necessary. However, it does not necessarily modify the node, but may return a resultant node if it already exists in the DAG. See comments in UpdateNodeOperands(). In that case, the return value must be used to avoid such scenarios as an infinite loop (node is assumed to have been updated, so added back to the worklist, and re-processed; however, node hasn’t changed so it is once again passed to UpdateNodeOperands(), assumed modified, added back to worklist; cycle infinitely repeats).

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

llvm-svn: 315957

6 years agoFix usage in TableGen of getValueAsString
Erich Keane [Mon, 16 Oct 2017 23:25:24 +0000 (23:25 +0000)]
Fix usage in TableGen of getValueAsString

Record::getValueAsString returns a stringref to an interned
string (apparently had been changed since most of tablegen was
written). In this patch, I audited the usage of getValueAsString
to find places where we can trivially stop storing 'std::string' and instead
keep the stringref.

There was one instance where an unnecessary 'stringstream' was being used,
so that has been removed as well to unblock the stringref replacing string fix.

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

llvm-svn: 315956

6 years ago[X86][AVX] Add v4x64 vector shuffle test for <0,2,1,3> mask
Simon Pilgrim [Mon, 16 Oct 2017 23:20:16 +0000 (23:20 +0000)]
[X86][AVX] Add v4x64 vector shuffle test for <0,2,1,3> mask

llvm-svn: 315955

6 years agoCOFF: Add resource files to linkrepro instead of the cvtres object file.
Peter Collingbourne [Mon, 16 Oct 2017 23:15:04 +0000 (23:15 +0000)]
COFF: Add resource files to linkrepro instead of the cvtres object file.

Now that we have our own implementation of cvtres, we can add resource
files directly to the linkrepro.

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

llvm-svn: 315954

6 years agoDon't print end-of-directive tokens in -E output
Reid Kleckner [Mon, 16 Oct 2017 23:07:15 +0000 (23:07 +0000)]
Don't print end-of-directive tokens in -E output

This comes up when pre-processing standalone .s files containing
hash-prefixed comments. The pre-processor should skip the unknown
directive and not emit an extra newline as we were doing.

Fixes PR34950

llvm-svn: 315953

6 years agocmake: BSD: Mark /usr/local/include as system include directory
Matthias Braun [Mon, 16 Oct 2017 23:03:21 +0000 (23:03 +0000)]
cmake: BSD: Mark /usr/local/include as system include directory

We add /usr/local/include to the include directory list for some BSD
systems. We should mark this as a system directory to avoid files from
/usr/local/include getting picked over files shipping with llvm.

This typically manifested as gtest headers installed with the system
getting picked over the ones shipping with llvm.

Patch by Petr Penzin <penzin.dev@gmail.com>

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

llvm-svn: 315952

6 years agoMake __builtin_types_compatible_p more like GCC's
George Burgess IV [Mon, 16 Oct 2017 22:58:37 +0000 (22:58 +0000)]
Make __builtin_types_compatible_p more like GCC's

GCC ignore qualifiers on array types. Since we seem to have this
function primarily for GCC compatibility, we should try to match that
behavior.

This also adds a few more test-cases __builtin_types_compatible_p,
which were inspired by GCC's documentation on the builtin.

llvm-svn: 315951

6 years agoReplace usage of std::stringstream with raw_string_ostream
Erich Keane [Mon, 16 Oct 2017 22:47:26 +0000 (22:47 +0000)]
Replace usage of std::stringstream with raw_string_ostream

Typically we don't use the stringstream, so instead use
raw_string_stream.  Additionally, the dependent function
changed to use raw_ostream.

llvm-svn: 315950

6 years agoCOFF: Give manifest resource file a name.
Peter Collingbourne [Mon, 16 Oct 2017 22:37:56 +0000 (22:37 +0000)]
COFF: Give manifest resource file a name.

Without this, /linkrepro would create an invalid tar file.

No tests because this requires Windows and the linkrepro tests
require not-Windows.

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

llvm-svn: 315948

6 years agoRe-apply [AArch64][RegisterBankInfo] Use the statically computed mappings for COPY
Quentin Colombet [Mon, 16 Oct 2017 22:28:40 +0000 (22:28 +0000)]
Re-apply [AArch64][RegisterBankInfo] Use the statically computed mappings for COPY

This reverts commit r315823, thus re-applying r315781.

Also make sure we don't use G_BITCAST mapping for non-generic registers.
Non-generic registers don't have a type but do have a reg bank.
Something the COPY mapping now how to deal with but the G_BITCAST
mapping don't.

-- Original Commit Message --
We use to resort on the generic implementation to get the mappings for
COPYs. The generic implementation resorts on table lookup and
dynamically allocated objects to get the valid mappings.

Given we already know how to map G_BITCAST and have the static mappings
for them, use that code path for COPY as well. This is much more
efficient.

Improve the compile time of RegBankSelect by up to 20%.

Note: When we eventually generate all the mappings via TableGen, we
wouldn't have to do that dance to shave compile time. The intent of this
change was to make sure that moving to static structure really pays off.

NFC.

llvm-svn: 315947

6 years ago[AArch64][RegisterBankInfo] Add mapping support for G_BITCAST of s128
Quentin Colombet [Mon, 16 Oct 2017 22:28:38 +0000 (22:28 +0000)]
[AArch64][RegisterBankInfo] Add mapping support for G_BITCAST of s128

Anything bigger than 64-bit just map to FPR.

llvm-svn: 315946

6 years ago[AArch64][LegalizerInfo] Mark s128 G_BITCAST legal
Quentin Colombet [Mon, 16 Oct 2017 22:28:27 +0000 (22:28 +0000)]
[AArch64][LegalizerInfo] Mark s128 G_BITCAST legal

We used to mark all G_BITCAST of 128-bit legal but only for vector
types. Scalars of this size are just fine as well.

llvm-svn: 315945

6 years agoAdd !callees metadata
Matthew Simpson [Mon, 16 Oct 2017 22:22:11 +0000 (22:22 +0000)]
Add !callees metadata

This patch adds a new kind of metadata that indicates the possible callees of
indirect calls.

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

llvm-svn: 315944

6 years ago[MC] Lex CRLF as one token
Reid Kleckner [Mon, 16 Oct 2017 22:20:03 +0000 (22:20 +0000)]
[MC] Lex CRLF as one token

This will prevent doubling of line endings when parsing assembly and
emitting assembly.

Otherwise we'd parse the directive, consume the end of statement, hit
the next end of statement, and emit a fresh newline.

llvm-svn: 315943

6 years ago[X86][3DNow] Add scheduling latency/throughput tests for 3DNow! instructions
Simon Pilgrim [Mon, 16 Oct 2017 21:55:09 +0000 (21:55 +0000)]
[X86][3DNow] Add scheduling latency/throughput tests for 3DNow! instructions

llvm-svn: 315942

6 years ago[JumpThreading] Move two PredValueInfoTy vectors to a scope closer to their usage...
Craig Topper [Mon, 16 Oct 2017 21:54:13 +0000 (21:54 +0000)]
[JumpThreading] Move two PredValueInfoTy vectors to a scope closer to their usage. NFCI

llvm-svn: 315941

6 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Mon, 16 Oct 2017 21:34:24 +0000 (21:34 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 315940

6 years ago[X86][MMX] Add scheduling latency/throughput tests for MMX instructions
Simon Pilgrim [Mon, 16 Oct 2017 21:29:29 +0000 (21:29 +0000)]
[X86][MMX] Add scheduling latency/throughput tests for MMX instructions

llvm-svn: 315939

6 years agoReplace make_range in MachineRegisterInfo with ArrayRef, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 21:19:40 +0000 (21:19 +0000)]
Replace make_range in MachineRegisterInfo with ArrayRef, NFC

llvm-svn: 315938

6 years ago[libFuzzer] Delete llvm/lib/Fuzzer
Vitaly Buka [Mon, 16 Oct 2017 20:48:19 +0000 (20:48 +0000)]
[libFuzzer] Delete llvm/lib/Fuzzer

Summary: Code is already in compiler-rt

Reviewers: kcc

Subscribers: krytarowski, llvm-commits, hiraditya

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

llvm-svn: 315937

6 years agoAdd base relative relocation record that can be used for the following case (OpenCL...
Tony Tye [Mon, 16 Oct 2017 20:46:53 +0000 (20:46 +0000)]
Add base relative relocation record that can be used for the following case (OpenCL example):

static __global int Var = 0;
__global int* Ptr[] = {&Var};
...

In this case Var is a non premptable symbol and so its address can be used as the value of Ptr, with a base relative relocation that will add the delta between the ELF address and the actual load address. Such relocations do not require a symbol.

This also fixes LLD which was incorrectly generating a PCREL64 for this case.

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

llvm-svn: 315936

6 years agoAdd base relative relocation record that can be used for the following case (OpenCL...
Tony Tye [Mon, 16 Oct 2017 20:44:29 +0000 (20:44 +0000)]
Add base relative relocation record that can be used for the following case (OpenCL example):

static __global int Var = 0;
__global int* Ptr[] = {&Var};
...

In this case Var is a non premptable symbol and so its address can be used as the value of Ptr, with a base relative relocation that will add the delta between the ELF address and the actual load address. Such relocations do not require a symbol.

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

llvm-svn: 315935

6 years agoRemove AnyX86Interrupt documentation
Erich Keane [Mon, 16 Oct 2017 20:44:14 +0000 (20:44 +0000)]
Remove AnyX86Interrupt documentation

This documentation was copied directly from the GCC
documentaiton in r257867.  Reverting and alterting
the original author so that it can be rewritten in
copyright-safe language.

llvm-svn: 315934

6 years agofix llvm-isel-fuzzer: LLVMFuzzerTestOneInput should never return non-zero (according...
Kostya Serebryany [Mon, 16 Oct 2017 20:36:57 +0000 (20:36 +0000)]
fix  llvm-isel-fuzzer: LLVMFuzzerTestOneInput should never return non-zero (according to the contract)

llvm-svn: 315933

6 years agoRevert MSVC 2017 build fix and fix it by moving the method that implicitly instantiat...
Reid Kleckner [Mon, 16 Oct 2017 20:31:16 +0000 (20:31 +0000)]
Revert MSVC 2017 build fix and fix it by moving the method that implicitly instantiates addPredicate out of line

llvm-svn: 315932

6 years agoSort Attributes by "HeaderName"
Erich Keane [Mon, 16 Oct 2017 20:31:05 +0000 (20:31 +0000)]
Sort Attributes by "HeaderName"

Attributes in the docs were previously sorted (apparently)
by the attribute name, so AnyX86Interrupt ended up being the
first one, rather than in a meaningful place. This resulted in the
4 'interrupt' titled sections being all in different places.

This replaces it with a naive alphabetical sort (case sensitive, underscore
and special characters first, etc).

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

llvm-svn: 315931

6 years agoFix the build of GlobalISelEmitter with MSVC 2017 by specializing earlier
Reid Kleckner [Mon, 16 Oct 2017 20:23:16 +0000 (20:23 +0000)]
Fix the build of GlobalISelEmitter with MSVC 2017 by specializing earlier

MSVC doesn't seem to like implicitly instantiating addPredicate and then
explicitly specializing it later. It causes an internal compiler error.

llvm-svn: 315930

6 years agoClarify the 'interrupt' names in Attribute Docs
Erich Keane [Mon, 16 Oct 2017 20:13:36 +0000 (20:13 +0000)]
Clarify the 'interrupt' names in Attribute Docs

All 4 of the 'interrupt' headers were automatically named
'interrupt'. This patch gives them unique names.

llvm-svn: 315929

6 years agoAdd iterator range MachineRegisterInfo::liveins(), adopt users, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 19:08:41 +0000 (19:08 +0000)]
Add iterator range MachineRegisterInfo::liveins(), adopt users, NFC

llvm-svn: 315927

6 years agoRevert r315877: Simplify.
Konstantin Zhuravlyov [Mon, 16 Oct 2017 18:49:28 +0000 (18:49 +0000)]
Revert r315877: Simplify.

It causes MSVC 2015 to emit "C4307: '-': integral constant overflow" warning

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

llvm-svn: 315926

6 years ago[Hexagon] Rangify some loops, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 18:43:08 +0000 (18:43 +0000)]
[Hexagon] Rangify some loops, NFC

Recommit r315763 with a fix.

llvm-svn: 315925

6 years ago[refactor] allow the use of refactoring diagnostics
Alex Lorenz [Mon, 16 Oct 2017 18:28:26 +0000 (18:28 +0000)]
[refactor] allow the use of refactoring diagnostics

This commit allows the refactoring library to use its own set of
refactoring-specific diagnostics to reports things like initiation errors.

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

llvm-svn: 315924

6 years agoclang-refactor: Use llvm_unreachable in an unused override
Alex Lorenz [Mon, 16 Oct 2017 18:07:16 +0000 (18:07 +0000)]
clang-refactor: Use llvm_unreachable in an unused override

As suggested by David Blaikie!

llvm-svn: 315923

6 years ago[cfi] Test cross-dso CFI on Android.
Evgeniy Stepanov [Mon, 16 Oct 2017 18:03:11 +0000 (18:03 +0000)]
[cfi] Test cross-dso CFI on Android.

Reviewers: vitalybuka, pcc

Subscribers: llvm-commits, srhines

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

llvm-svn: 315922

6 years agoDo not link clang_rt.cfi on Android.
Evgeniy Stepanov [Mon, 16 Oct 2017 18:02:57 +0000 (18:02 +0000)]
Do not link clang_rt.cfi on Android.

Summary:
The OS provides cross-dso CFI support starting with Android O.
Trapping mode does not require any runtime at all, and diagnostic mode
requires just ubsan-standalone.

Reviewers: pcc

Subscribers: srhines, cfe-commits

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

llvm-svn: 315921

6 years ago[SCEV] Rename getMaxBECount and update comments. NFC
Anna Thomas [Mon, 16 Oct 2017 17:47:17 +0000 (17:47 +0000)]
[SCEV] Rename getMaxBECount and update comments. NFC

Post commit review comments at D38825.

llvm-svn: 315920

6 years ago[SparsePropagation] Enable interprocedural analysis
Matthew Simpson [Mon, 16 Oct 2017 17:44:17 +0000 (17:44 +0000)]
[SparsePropagation] Enable interprocedural analysis

This patch adds the ability to perform IPSCCP-like interprocedural analysis to
the generic sparse propagation solver. The patch gives clients the ability to
define their own custom LatticeKey types that the generic solver maps to custom
LatticeVal types. The custom lattice keys can be used, for example, to
distinguish among mappings for regular values, values returned from functions,
and values stored in global variables. Clients are responsible for defining how
to convert between LatticeKeys and LLVM Values by providing a specialization of
the LatticeKeyInfo template.

The added unit tests demonstrate how the generic solver can be used to perform
a simplified version of interprocedural constant propagation.

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

llvm-svn: 315919

6 years agoRecommit r315738 "[clang-refactor] Apply source replacements"
Alex Lorenz [Mon, 16 Oct 2017 17:31:16 +0000 (17:31 +0000)]
Recommit r315738 "[clang-refactor] Apply source replacements"

The fixed commit ensures that ParsedSourceRange works correctly
with Windows paths.

Original message:

This commit actually brings clang-refactor to a usable state as it can now
apply the refactoring changes to source files.
The -selection option is now also fully supported.

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

llvm-svn: 315918

6 years ago[scudo] Do not include sanitizer_posix.h if not on a Posix platform
Kostya Kortchinsky [Mon, 16 Oct 2017 17:06:13 +0000 (17:06 +0000)]
[scudo] Do not include sanitizer_posix.h if not on a Posix platform

Summary:
Move the `sanitizer_posix.h` include within the `SANITIZER_ANDROID` `#if`,
otherwise this errors when built on non-Posix platforms (eg: Fuchsia).

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 315917

6 years ago[AMDGPU] : revert r315908
Alexander Timofeev [Mon, 16 Oct 2017 16:57:37 +0000 (16:57 +0000)]
[AMDGPU] : revert r315908

llvm-svn: 315916

6 years ago[Bitfield] Add an option to access bitfield in a fine-grained manner.
Wei Mi [Mon, 16 Oct 2017 16:50:27 +0000 (16:50 +0000)]
[Bitfield] Add an option to access bitfield in a fine-grained manner.

Currently all the consecutive bitfields are wrapped as a large integer unless there is unamed zero sized bitfield in between. The patch provides an alternative manner which makes the bitfield to be accessed as separate memory location if it has legal integer width and is naturally aligned. Such separate bitfield may split the original consecutive bitfields into subgroups of consecutive bitfields, and each subgroup will be wrapped as an integer. Now This is all controlled by an option -ffine-grained-bitfield-accesses. The alternative of bitfield access manner can improve the access efficiency of those bitfields with legal width and being aligned, but may reduce the chance of load/store combining of other bitfields, so it depends on how the bitfields are defined and actually accessed to choose when to use the option. For now the option is off by default.

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

llvm-svn: 315915

6 years ago[ObjCARC] Do not move a release that has the clang.imprecise_release tag
Akira Hatanaka [Mon, 16 Oct 2017 16:46:59 +0000 (16:46 +0000)]
[ObjCARC] Do not move a release that has the clang.imprecise_release tag
above PHI instructions.

ARC optimizer has an optimization that moves a call to an ObjC runtime
function above a phi instruction when the phi has a null operand and is
an argument passed to the function call. This optimization should not
kick in when the runtime function is an objc_release that releases an
object with precise lifetime semantics.

rdar://problem/34959669

llvm-svn: 315914

6 years ago[x86] add minmax tests with more predicate coverage; NFC
Sanjay Patel [Mon, 16 Oct 2017 15:20:00 +0000 (15:20 +0000)]
[x86] add minmax tests with more predicate coverage; NFC

llvm-svn: 315913

6 years ago[Polly] Add XFAIL to large-numbers-in-boundary-context.ll
Anna Thomas [Mon, 16 Oct 2017 15:12:39 +0000 (15:12 +0000)]
[Polly] Add XFAIL to large-numbers-in-boundary-context.ll

After rL315683 (improve SCEV to calculate max BETakenCount when end
bound of loop is variant and loop is of form {Start,+1, Stride} LT End)
this test in polly started failing.
However, as discussed in https://reviews.llvm.org/rL315683,
this polly test is not a loops bound test and the MaxBECount calculated by
SCEV looks correct. The max BECount is the value calculated even when the end
bound of loop is invariant.

As discussed with Tobias offline, I'm marking this as an XFAIL, until he
gets a chance to update the testcase, so the build bot goes to green.

llvm-svn: 315912

6 years ago[TableGen] Simplify CallingConvEmitter.cpp. NFC.
Javed Absar [Mon, 16 Oct 2017 14:52:26 +0000 (14:52 +0000)]
[TableGen] Simplify CallingConvEmitter.cpp. NFC.

llvm-svn: 315911

6 years ago[InstCombine] don't unnecessarily generate a constant; NFCI
Sanjay Patel [Mon, 16 Oct 2017 14:47:24 +0000 (14:47 +0000)]
[InstCombine] don't unnecessarily generate a constant; NFCI

llvm-svn: 315910

6 years ago[ValueTracking] fix typos, formatting; NFC
Sanjay Patel [Mon, 16 Oct 2017 14:46:37 +0000 (14:46 +0000)]
[ValueTracking] fix typos, formatting; NFC

llvm-svn: 315909

6 years ago[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one
Alexander Timofeev [Mon, 16 Oct 2017 14:35:29 +0000 (14:35 +0000)]
[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one

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

llvm-svn: 315908

6 years agoFix test name typo.
Simon Pilgrim [Mon, 16 Oct 2017 14:33:51 +0000 (14:33 +0000)]
Fix test name typo.

llvm-svn: 315907

6 years ago[X86][SSE] Added additional PACKUS shuffle tests
Simon Pilgrim [Mon, 16 Oct 2017 14:32:41 +0000 (14:32 +0000)]
[X86][SSE] Added additional PACKUS shuffle tests

Mainly inspired by PR34773

llvm-svn: 315906

6 years ago[mips][micromips] Fix (dis)assembly of bc1(t|f)
Simon Dardis [Mon, 16 Oct 2017 14:20:22 +0000 (14:20 +0000)]
[mips][micromips] Fix (dis)assembly of bc1(t|f)

Previously these instructions were marked codegen only and had
an under-specified instruction description that did not record the
fcc register.

Reviewers: atanasyan, abeserminji

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

llvm-svn: 315905

6 years agoISel type legalizer: debug messages. NFC.
Sjoerd Meijer [Mon, 16 Oct 2017 14:07:30 +0000 (14:07 +0000)]
ISel type legalizer: debug messages. NFC.

Minor addition and follow up of r314773 and r311533: this adds more
debug messages to the type legalizer. For each node, it dumps
legalization info for results and operands nodes, rather than just the
final legalized node.

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

llvm-svn: 315904

6 years agoFix or vs || typo.
Simon Pilgrim [Mon, 16 Oct 2017 14:01:59 +0000 (14:01 +0000)]
Fix or vs || typo.

llvm-svn: 315903

6 years ago[CUDA] Require libdevice only if needed
Jonas Hahnfeld [Mon, 16 Oct 2017 13:31:30 +0000 (13:31 +0000)]
[CUDA] Require libdevice only if needed

If the user passes -nocudalib, we can live without it being present.
Simplify the code by just checking whether LibDeviceMap is empty.

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

llvm-svn: 315902

6 years ago[mips] Provide alternate predicates for constant synthesis
Stefan Maksimovic [Mon, 16 Oct 2017 13:18:21 +0000 (13:18 +0000)]
[mips] Provide alternate predicates for constant synthesis

Ordering of patterns should not be of importance anymore
since the predicates used are mutually exclusive now.

llvm-svn: 315901

6 years ago[PowerPC] fix up in sign-/zero-extension elimination
Hiroshi Inoue [Mon, 16 Oct 2017 12:11:15 +0000 (12:11 +0000)]
[PowerPC] fix up in sign-/zero-extension elimination

This patch fixes a potential problem in my previous commit (https://reviews.llvm.org/rL315888) by adding a null check.

llvm-svn: 315900

6 years agoThis patch is a result of D37262: The issues with X86 prefixes. It closes PR7709...
Andrew V. Tischenko [Mon, 16 Oct 2017 11:14:29 +0000 (11:14 +0000)]
This patch is a result of D37262: The issues with X86 prefixes. It closes  PR7709, PR17697, PR19251, PR32809 and PR21640. There could be other bugs closed by this patch.

llvm-svn: 315899

6 years ago[clang-rename] Add function unit tests.
Haojian Wu [Mon, 16 Oct 2017 10:37:42 +0000 (10:37 +0000)]
[clang-rename] Add function unit tests.

Summary:
Also contain a fix:

* Fix a false positive of renaming a using shadow function declaration.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 315898

6 years ago[llvm-dwarfdump] - Teach tool to parse DW_CFA_GNU_args_size.
George Rimar [Mon, 16 Oct 2017 10:26:17 +0000 (10:26 +0000)]
[llvm-dwarfdump] - Teach tool to parse DW_CFA_GNU_args_size.

Currently llvm-dwarfdump runs into llvm_unreachable when
faces DW_CFA_GNU_args_size. Patch implements the support.

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

llvm-svn: 315897

6 years agoRevert rL315894, "SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)"
NAKAMURA Takumi [Mon, 16 Oct 2017 09:50:01 +0000 (09:50 +0000)]
Revert rL315894, "SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)"

llvm-svn: 315896

6 years agoMove folding of icmp with zero after checking for min/max idioms.
Nikolai Bozhenov [Mon, 16 Oct 2017 09:19:21 +0000 (09:19 +0000)]
Move folding of icmp with zero after checking for min/max idioms.

Summary:
The following transformation for cmp instruction:

  icmp smin(x, PositiveValue), 0 -> icmp x, 0

should only be done after checking for min/max to prevent infinite
looping caused by a reverse canonicalization. That is why this
transformation was moved to place after the mentioned check.

Reviewers: spatel, efriedma

Subscribers: llvm-commits

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

Patch by: Artur Gainullin <artur.gainullin@intel.com>

llvm-svn: 315895

6 years agoSLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)
NAKAMURA Takumi [Mon, 16 Oct 2017 09:15:23 +0000 (09:15 +0000)]
SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)

llvm-svn: 315894

6 years ago[clang-format] Break non-trailing comments, try 2
Krasimir Georgiev [Mon, 16 Oct 2017 09:08:53 +0000 (09:08 +0000)]
[clang-format] Break non-trailing comments, try 2

Summary:
This patch enables `BreakableToken` to manage the formatting of non-trailing
block comments. It is a refinement of https://reviews.llvm.org/D37007.
We discovered that the optimizer outsmarts us on cases where breaking the comment
costs considerably less than breaking after the comment. This patch addresses
this by ensuring that a newline is inserted between a block comment and the next
token.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 315893

6 years ago[change-namespace] do not change type locs in defaulted functions.
Eric Liu [Mon, 16 Oct 2017 08:20:10 +0000 (08:20 +0000)]
[change-namespace] do not change type locs in defaulted functions.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 315892

6 years ago[TableGen] Range loopify DAGISelMatcher. NFC.
Javed Absar [Mon, 16 Oct 2017 06:43:54 +0000 (06:43 +0000)]
[TableGen] Range loopify DAGISelMatcher. NFC.

llvm-svn: 315891

6 years ago[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect...
Daniel Sanders [Mon, 16 Oct 2017 05:39:30 +0000 (05:39 +0000)]
[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect G_FRAME_INDEX handling

The wrong operand was being rendered to the result instruction.

The crash was detected by Bitcode/simd_ops/AArch64_halide_runtime.bc

llvm-svn: 315890

6 years agobpf: fix bug on silently truncating 64-bit immediate
Yonghong Song [Mon, 16 Oct 2017 04:14:53 +0000 (04:14 +0000)]
bpf: fix bug on silently truncating 64-bit immediate

We came across an llvm bug when compiling some testcases that 64-bit
immediates are silently truncated into 32-bit and then packed into
BPF_JMP | BPF_K encoding.  This caused comparison with wrong value.

This bug looks to be introduced by r308080.  The Select_Ri pattern is
supposed to be lowered into J*_Ri while the latter only support 32-bit
immediate encoding, therefore Select_Ri should have similar immediate
predicate check as what J*_Ri are doing.

Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 315889

6 years ago[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended
Hiroshi Inoue [Mon, 16 Oct 2017 04:12:57 +0000 (04:12 +0000)]
[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended

This patch enables redundant sign- and zero-extension elimination in PowerPC MI Peephole pass.
If the input value of a sign- or zero-extension is known to be already sign- or zero-extended, the operation is redundant and can be eliminated.
One common case is sign-extensions for a method parameter or for a method return value; they must be sign- or zero-extended as defined in PPC ELF ABI.
For example of the following simple code, two extsw instructions are generated before the invocation of int_func and before the return. With this patch, both extsw are eliminated.

void int_func(int);
void ii_test(int a) {
    if (a & 1) return int_func(a);
}

Such redundant sign- or zero-extensions are quite common in many programs; e.g. I observed about 60,000 occurrences of the elimination while compiling the LLVM+CLANG.

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

llvm-svn: 315888

6 years agoRe-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscale...
Daniel Sanders [Mon, 16 Oct 2017 03:36:29 +0000 (03:36 +0000)]
Re-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

The previous commit failed on MSVC due to a failure to convert an
initializer_list to a std::vector. Hopefully, MSVC will accept this version.

Depends on D37457

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315887

6 years agoRevert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled...
Daniel Sanders [Mon, 16 Oct 2017 02:15:39 +0000 (02:15 +0000)]
Revert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

MSVC doesn't like one of the constructors.

llvm-svn: 315886

6 years ago[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*
Daniel Sanders [Mon, 16 Oct 2017 01:16:35 +0000 (01:16 +0000)]
[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

Depends on D37457

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315885

6 years ago[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks
Daniel Sanders [Mon, 16 Oct 2017 00:56:30 +0000 (00:56 +0000)]
[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks

Summary:
This includes some context-sensitivity in the MVT to LLT conversion so that
pointer types are tested correctly.
FIXME: I'm not happy with the way this is done since everything is a
       special-case. I've yet to find a reasonable way to implement it.

select-load.mir fails because <1 x s64> loads in tablegen get priority over s64
loads. This is fixed in the next patch and as such they should be committed
together, I've posted them separately to help with the review.

Depends on D37456

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315884

6 years ago[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 00:29:47 +0000 (00:29 +0000)]
[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC

This should silence "unused function" warnings.

llvm-svn: 315883

6 years agoFix last_write_time.pass.cpp to work with clang-3.9 and earlier
Roman Lebedev [Sun, 15 Oct 2017 21:52:53 +0000 (21:52 +0000)]
Fix last_write_time.pass.cpp to work with clang-3.9 and earlier

At least with clang-3.9 and earlier, -Wunknown-pragmas is also needed.

llvm-svn: 315882

6 years agoRemove Config::FirstElf.
Rui Ueyama [Sun, 15 Oct 2017 21:43:09 +0000 (21:43 +0000)]
Remove Config::FirstElf.

llvm-svn: 315881

6 years ago[COFF] Fix a typo in a comment in a test. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:50 +0000 (21:09 +0000)]
[COFF] Fix a typo in a comment in a test. NFC.

These chars are accidentally included vim commands.

llvm-svn: 315880

6 years ago[COFF] Fix indentation. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:46 +0000 (21:09 +0000)]
[COFF] Fix indentation. NFC.

llvm-svn: 315879

6 years ago[COFF] Fix the description of the data type in a comment. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:43 +0000 (21:09 +0000)]
[COFF] Fix the description of the data type in a comment. NFC.

This was missed when changing data types back and forth during
review.

llvm-svn: 315878