platform/upstream/llvm.git
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

6 years agoSimplify.
Rui Ueyama [Sun, 15 Oct 2017 21:07:25 +0000 (21:07 +0000)]
Simplify.

llvm-svn: 315877

6 years agoReally do make sure that last_write_time.pass.cpp still works with old clang
Roman Lebedev [Sun, 15 Oct 2017 20:46:12 +0000 (20:46 +0000)]
Really do make sure that last_write_time.pass.cpp still works with old clang

I *did* try to check that such kind of an issue was not introduced
by the rL315874, but clearly i failed to finish verification.

llvm-svn: 315876

6 years ago[Sema] Re-land: Diagnose tautological comparison with type's min/max values
Roman Lebedev [Sun, 15 Oct 2017 20:13:17 +0000 (20:13 +0000)]
[Sema] Re-land: Diagnose tautological comparison with type's min/max values

The first attempt, rL315614 was reverted because one libcxx
test broke, and i did not know at the time how to deal with it.

Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

llvm-svn: 315875

6 years agoSilence clang's -Wtautological-constant-compare in last_write_time.pass.cpp
Roman Lebedev [Sun, 15 Oct 2017 20:12:42 +0000 (20:12 +0000)]
Silence clang's -Wtautological-constant-compare in last_write_time.pass.cpp

Previously this broke the builders, when D38101 was committed.
Silence the warning so that it can be re-landed.

llvm-svn: 315874

6 years agoSearch for libxml2 on macOS too.
Nico Weber [Sun, 15 Oct 2017 19:13:57 +0000 (19:13 +0000)]
Search for libxml2 on macOS too.

This allows lld-link to process /manifestinput: flags on macOS too.
Also makes the `REQUIRES: manifesttool` lld tests run on macOS.
Setting LLVM_ENABLE_LIBXML2 to off can suppress this behavior, like on Linux.

llvm-svn: 315873

6 years ago[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode...
Daniel Sanders [Sun, 15 Oct 2017 19:01:32 +0000 (19:01 +0000)]
[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode().empty(). NFC

These are cheaper ways of testing for the presence of code than generating the C++ code and testing it's empty.

llvm-svn: 315872

6 years agoConvert clang::LangAS to a strongly typed enum
Alexander Richardson [Sun, 15 Oct 2017 18:48:14 +0000 (18:48 +0000)]
Convert clang::LangAS to a strongly typed enum

Summary:
Convert clang::LangAS to a strongly typed enum

Currently both clang AST address spaces and target specific address spaces
are represented as unsigned which can lead to subtle errors if the wrong
type is passed. It is especially confusing in the CodeGen files as it is
not possible to see what kind of address space should be passed to a
function without looking at the implementation.
I originally made this change for our LLVM fork for the CHERI architecture
where we make extensive use of address spaces to differentiate between
capabilities and pointers. When merging the upstream changes I usually
run into some test failures or runtime crashes because the wrong kind of
address space is passed to a function. By converting the LangAS enum to a
C++11 we can catch these errors at compile time. Additionally, it is now
obvious from the function signature which kind of address space it expects.

I found the following errors while writing this patch:

- ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address
  space to  TargetInfo::getPointer{Width,Align}()
- TypePrinter::printAttributedAfter() prints the numeric value of the
  clang AST address space instead of the target address space.
  However, this code is not used so I kept the current behaviour
- initializeForBlockHeader() in CGBlocks.cpp was passing
  LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}()
- CodeGenFunction::EmitBlockLiteral() was passing a AST address space to
  TargetInfo::getPointerWidth()
- CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space
  to Qualifiers::addAddressSpace()
- CGOpenMPRuntimeNVPTX::getParameterAddress() was using
  llvm::Type::getPointerTo() with a AST address space
- clang_getAddressSpace() returns either a LangAS or a target address
  space. As this is exposed to C I have kept the current behaviour and
  added a comment stating that it is probably not correct.

Other than this the patch should not cause any functional changes.

Reviewers: yaxunl, pcc, bader

Reviewed By: yaxunl, bader

Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits

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

llvm-svn: 315871

6 years agoPhony change to CMakeLists.txt to (hopefully) trigger regeneration
Krzysztof Parzyszek [Sun, 15 Oct 2017 18:23:16 +0000 (18:23 +0000)]
Phony change to CMakeLists.txt to (hopefully) trigger regeneration

Ninja doesn't seem to recognize a change in a CMakeLists.txt in a
subdirectory, so r315861 is not having any effect.

llvm-svn: 315870

6 years agoRe-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 18:22:54 +0000 (18:22 +0000)]
Re-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

Hopefully fixed the ambiguous constructor that a large number of bots reported.

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

Reviewed By: qcolombet

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

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

llvm-svn: 315869

6 years agoFix test case regresstion from rL315864
Martell Malone [Sun, 15 Oct 2017 18:01:28 +0000 (18:01 +0000)]
Fix test case regresstion from rL315864

The patch should have been checking against STDCXX17 not STDCXX14.

llvm-svn: 315868

6 years agoDriver: use ld64.lld when -fuse-ld=lld for darwin
Martell Malone [Sun, 15 Oct 2017 17:53:45 +0000 (17:53 +0000)]
Driver: use ld64.lld when -fuse-ld=lld for darwin

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

This is the clang driver component change to use this new alias.

Reviewers: ruiu, rnk

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

llvm-svn: 315867

6 years agoRevert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:51:07 +0000 (17:51 +0000)]
Revert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

A large number of bots are failing on an ambiguous constructor call.

llvm-svn: 315866

6 years agoMACHO: ld64.lld alias for the MACHO LLD target
Martell Malone [Sun, 15 Oct 2017 17:41:20 +0000 (17:41 +0000)]
MACHO: ld64.lld alias for the MACHO LLD target

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

The clang driver component changes will be in a follow-up commit.

Reviewers: ruiu, rnk

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

llvm-svn: 315865

6 years ago[driver] [cl] Add/fix c++17/c++latest
Martell Malone [Sun, 15 Oct 2017 17:27:58 +0000 (17:27 +0000)]
[driver] [cl] Add/fix c++17/c++latest

Patch by: daxpedda

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

llvm-svn: 315864

6 years ago[globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:03:36 +0000 (17:03 +0000)]
[globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

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

Reviewed By: qcolombet

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

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

llvm-svn: 315863

6 years ago[X86] Remove the SlowBTMem feature flag entirely
Craig Topper [Sun, 15 Oct 2017 16:57:33 +0000 (16:57 +0000)]
[X86] Remove the SlowBTMem feature flag entirely

Turns out we have no patterns on the instructions that were using this feature flag for other reasons. These instructions are slow on all modern CPUs so it seems unlikely that we will spend any effort supporting these instructions going forward. So we might as well just kill of the feature flag and just fix up the comments.

llvm-svn: 315862

6 years ago[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD
Krzysztof Parzyszek [Sun, 15 Oct 2017 16:55:23 +0000 (16:55 +0000)]
[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD

The test requires a target for triple x86-64, and it fails in builds that
do not have the X86 backend.

llvm-svn: 315861

6 years ago[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.
Craig Topper [Sun, 15 Oct 2017 16:41:17 +0000 (16:41 +0000)]
[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.

Summary:
This was impeding our ability to combine the extending shuffles with other shuffles as you can see from the test changes.

There's one special case that needed to be added to use VZEXT directly for v8i8->v8i64 since the custom lowering requires v64i8.

Reviewers: RKSimon, zvi, delena

Reviewed By: delena

Subscribers: llvm-commits

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

llvm-svn: 315860

6 years ago[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights...
Craig Topper [Sun, 15 Oct 2017 16:41:15 +0000 (16:41 +0000)]
[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights Landing CPUs.

Summary: I see nothing in Agner Fog's tables to indicate that this improved between Ivy Bridge and Haswell. It's also set for all Atom CPUs so I assume KNL should have it too.

Reviewers: RKSimon, zvi, gadi.haber

Reviewed By: gadi.haber

Subscribers: llvm-commits

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

llvm-svn: 315859

6 years ago[TableGen] Remove error checks incorrectly failing on non-error conditions
Krzysztof Parzyszek [Sun, 15 Oct 2017 15:39:56 +0000 (15:39 +0000)]
[TableGen] Remove error checks incorrectly failing on non-error conditions

In type inference, an empty type set for a specific hw mode is not an
error. In earlier stages of the design it was, but having to use non-
parameterized types with target intrinsics necessarily led to type
contradictions: since the intrinsics used specific types, they were
only valid for a specific hw mode, and the resulting type set for other
modes ended up empty. To accommodate the existence of such intrinsics
individual type sets were allowed to be empty as long as not all sets
were empty.

llvm-svn: 315858

6 years agorevert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp...
Sanjay Patel [Sun, 15 Oct 2017 15:39:15 +0000 (15:39 +0000)]
revert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

Recommitting r314698. The bug exposed by this change should be fixed with:
https://reviews.llvm.org/rL315579

llvm-svn: 315857

6 years agoAdd -f[no-]double-square-bracket-attributes as new driver options to control use...
Aaron Ballman [Sun, 15 Oct 2017 15:01:42 +0000 (15:01 +0000)]
Add -f[no-]double-square-bracket-attributes as new driver options to control use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later.

llvm-svn: 315856

6 years ago[SimplifyCFG] use range-for-loops, tidy; NFCI
Sanjay Patel [Sun, 15 Oct 2017 14:43:39 +0000 (14:43 +0000)]
[SimplifyCFG] use range-for-loops, tidy; NFCI

There seems to be something missing here as shown in PR34471:
https://bugs.llvm.org/show_bug.cgi?id=34471

llvm-svn: 315855

6 years agoReverting r315590; it did not include changes for llvm-tblgen, which is causing link...
Aaron Ballman [Sun, 15 Oct 2017 14:32:27 +0000 (14:32 +0000)]
Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people.

Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1

llvm-svn: 315854

6 years ago[MergeFunctions] Merge small functions if possible without a thunk.
whitequark [Sun, 15 Oct 2017 12:29:09 +0000 (12:29 +0000)]
[MergeFunctions] Merge small functions if possible without a thunk.

This can result in significant code size savings in some cases,
e.g. an interrupt table all filled with the same assembly stub
in a certain Cortex-M BSP results in code blowup by a factor of 2.5.

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

llvm-svn: 315853

6 years ago[MergeFunctions] Replace all uses of unnamed_addr functions.
whitequark [Sun, 15 Oct 2017 12:29:01 +0000 (12:29 +0000)]
[MergeFunctions] Replace all uses of unnamed_addr functions.

This reduces code size for constructs like vtables or interrupt
tables that refer to functions in global initializers.

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

llvm-svn: 315852

6 years ago[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565
Amjad Aboud [Sun, 15 Oct 2017 11:00:56 +0000 (11:00 +0000)]
[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565

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

llvm-svn: 315851

6 years ago[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass...
Hongbin Zheng [Sun, 15 Oct 2017 07:31:02 +0000 (07:31 +0000)]
[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass, NFC.

This avoid code duplication and allow us to add the disable unroll metadata elsewhere.

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

llvm-svn: 315850

6 years ago[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instru...
Craig Topper [Sun, 15 Oct 2017 06:39:07 +0000 (06:39 +0000)]
[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instructions.

Summary:
It's better to use our shuffle lowering code to handle these than loading an immediate into a k-register.

It really feels like this should be a DAG combine optimization rather than a lowering operation, but that's a problem for another day.

Reviewers: RKSimon, delena, zvi

Reviewed By: delena

Subscribers: llvm-commits

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

llvm-svn: 315849

6 years ago[X86] Don't use constant condition for select instruction when testing masking ops.
Craig Topper [Sun, 15 Oct 2017 06:05:50 +0000 (06:05 +0000)]
[X86] Don't use constant condition for select instruction when testing masking ops.

We should be able to fold constant conditions by converting to shuffles, but fixing that would break these tests in their current form. Since they are really trying to test masking ops, add a non-constant mask to the selects.

llvm-svn: 315848

6 years agoRemove unused variables
Vitaly Buka [Sun, 15 Oct 2017 05:35:02 +0000 (05:35 +0000)]
Remove unused variables

llvm-svn: 315847

6 years ago[Lex] Remove unused variables. No functionality change.
Benjamin Kramer [Sun, 15 Oct 2017 04:27:37 +0000 (04:27 +0000)]
[Lex] Remove unused variables. No functionality change.

llvm-svn: 315845

6 years ago[asan] Increase kHandlerStackSize for TracerThreadSignalHandler
Vitaly Buka [Sun, 15 Oct 2017 04:18:29 +0000 (04:18 +0000)]
[asan] Increase kHandlerStackSize for TracerThreadSignalHandler

4096 is not enough on some platform, e.g. Debian 4.9.0-3-amd64

llvm-svn: 315844

6 years ago[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC
Daniel Sanders [Sun, 15 Oct 2017 02:41:12 +0000 (02:41 +0000)]
[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC

Summary:
There is an important mismatch between ISD::LOAD and G_LOAD (and likewise for
ISD::STORE and G_STORE). In SelectionDAG, ISD::LOAD is a non-atomic load
and atomic loads are handled by a separate node. However, this is not true of
GlobalISel's G_LOAD. For G_LOAD, the MachineMemOperand indicates the atomicity
of the operation. As a result, this mapping must also add a predicate that
checks for non-atomic MachineMemOperands.

This is NFC since these nodes always have predicates in practice and are
therefore always rejected at the moment.

Depends on D37443

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

Reviewed By: qcolombet

Subscribers: kristof.beyls, llvm-commits, igorb

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

llvm-svn: 315843

6 years ago[c++2a] Fix failing regression test related to not adding the extension warning to...
Faisal Vali [Sun, 15 Oct 2017 02:13:17 +0000 (02:13 +0000)]
[c++2a] Fix failing regression test related to not adding the extension warning to a diagnostic group (in r315840)

In passing also complete a comment that I left uncompleted.

For ease of reference, here's the parent commit: https://reviews.llvm.org/rL315840

llvm-svn: 315842