platform/upstream/llvm.git
7 years ago[AMDGPU] Fixed typo in GCNRegPressure, NFC
Stanislav Mekhanoshin [Tue, 9 May 2017 20:50:04 +0000 (20:50 +0000)]
[AMDGPU] Fixed typo in GCNRegPressure, NFC

VGRP -> VGPR, SGRP -> SGPR

llvm-svn: 302586

7 years ago[InstCombine] update test file to use FileCheck; NFC
Sanjay Patel [Tue, 9 May 2017 20:46:12 +0000 (20:46 +0000)]
[InstCombine] update test file to use FileCheck; NFC

llvm-svn: 302585

7 years agoImport sys in repo.py.
Lang Hames [Tue, 9 May 2017 20:37:01 +0000 (20:37 +0000)]
Import sys in repo.py.

The find function in repo.py calls sys.exit on error. Without this import that
call to exit will fail, masking the actual error message. This patch fixes that.

llvm-svn: 302584

7 years agoDAGCombine: Combine shuffles of splat-shuffles
Zvi Rackover [Tue, 9 May 2017 20:25:38 +0000 (20:25 +0000)]
DAGCombine: Combine shuffles of splat-shuffles

Summary: Reapply r299047, but this time handle correctly splat-masks with undef elements.

Reviewers: spatel, RKSimon, eli.friedman, andreadb

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 302583

7 years ago[AArch64] Consider widening instructions in cost calculations
Matthew Simpson [Tue, 9 May 2017 20:18:12 +0000 (20:18 +0000)]
[AArch64] Consider widening instructions in cost calculations

The AArch64 instruction set has a few "widening" instructions (e.g., uaddl,
saddl, uaddw, etc.) that take one or more doubleword operands and produce
quadword results. The operands are automatically sign- or zero-extended as
appropriate. However, in LLVM IR, these extends are explicit. This patch
updates TTI to consider these widening instructions as single operations whose
cost is attached to the arithmetic instruction. It marks extends that are part
of a widening operation "free" and applies a sub-target specified overhead
(zero by default) to the arithmetic instructions.

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

llvm-svn: 302582

7 years ago[InstCombine] clean up matchDeMorgansLaws(); NFCI
Sanjay Patel [Tue, 9 May 2017 20:05:05 +0000 (20:05 +0000)]
[InstCombine] clean up matchDeMorgansLaws(); NFCI

The motivation for getting rid of dyn_castNotVal is to allow fixing:
https://bugs.llvm.org/show_bug.cgi?id=32706

So this was supposed to be functional-change-intended for the case
of inverting constants and applying DeMorgan. However, I can't find
any cases where that pattern will actually get to matchDeMorgansLaws()
because we have other folds in visitAnd/visitOr that do the same
thing. So this ends up just being a clean-up patch with slight efficiency
improvement, but no-functional-change-intended.

llvm-svn: 302581

7 years agoclang-format: [JS] Don't indent JavaScript IIFEs.
Martin Probst [Tue, 9 May 2017 20:04:09 +0000 (20:04 +0000)]
clang-format: [JS] Don't indent JavaScript IIFEs.

Because IIFEs[1] are often used like an anonymous namespace around large
sections of JavaScript code, it's useful not to indent to them (which
effectively reduces the column limit by the indent amount needlessly).

It's also common for developers to wrap these around entire files or
libraries. When adopting clang-format, changing the indent entire file
can reduce the usefulness of the blame annotations.

Patch by danbeam, thanks!

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

llvm-svn: 302580

7 years ago[NewGVN] Simplify a DEBUG() statement. NFCI.
Davide Italiano [Tue, 9 May 2017 20:02:48 +0000 (20:02 +0000)]
[NewGVN] Simplify a DEBUG() statement. NFCI.

llvm-svn: 302579

7 years ago[codeview] Check for a DIExpression offset for local variables
Reid Kleckner [Tue, 9 May 2017 19:59:29 +0000 (19:59 +0000)]
[codeview] Check for a DIExpression offset for local variables

Fixes inalloca parameters, which previously all pointed to the same
offset. Extend the test to use llvm-readobj so that we can test the
offset in a readable way.

llvm-svn: 302578

7 years agoUpdate testcase for upstream LLVM changes (r302469).
Adrian Prantl [Tue, 9 May 2017 19:47:41 +0000 (19:47 +0000)]
Update testcase for upstream LLVM changes (r302469).

llvm-svn: 302577

7 years agoMake it illegal for two Functions to point to the same DISubprogram
Adrian Prantl [Tue, 9 May 2017 19:47:37 +0000 (19:47 +0000)]
Make it illegal for two Functions to point to the same DISubprogram

As recently discussed on llvm-dev [1], this patch makes it illegal for
two Functions to point to the same DISubprogram and updates
FunctionCloner to also clone the debug info of a function to conform
to the new requirement. To simplify the implementation it also factors
out the creation of inlineAt locations from the Inliner into a
general-purpose utility in DILocation.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/112661.html
<rdar://problem/31926379>

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

This reapplies r302469 with a fix for a bot failure (reparentDebugInfo
now checks for the case the orig and new function are identical).

llvm-svn: 302576

7 years agoNFC: refactor replaceDominatedUsesWith
Piotr Padlewski [Tue, 9 May 2017 19:39:44 +0000 (19:39 +0000)]
NFC: refactor replaceDominatedUsesWith

Summary:
Since I will post patch with some changes to
replaceDominatedUsesWith, it would be good to avoid
duplicating code again.

Reviewers: davide, dberlin

Subscribers: llvm-commits

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

llvm-svn: 302575

7 years ago[DWARF] Fix a parsing issue with type unit headers.
Wolfgang Pieb [Tue, 9 May 2017 19:38:38 +0000 (19:38 +0000)]
[DWARF] Fix a parsing issue with type unit headers.

Reviewers: dblaikie

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

llvm-svn: 302574

7 years agoFix the Endianness bug by adding the little endian UTF marker.
Eric Beckmann [Tue, 9 May 2017 19:35:45 +0000 (19:35 +0000)]
Fix the Endianness bug by adding the little endian UTF marker.

Summary: Quick fix

Reviewers: zturner, uweigand

Subscribers: llvm-commits

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

llvm-svn: 302573

7 years agoSuppress all uses of LLVM_END_WITH_NULL. NFC.
Serge Guelton [Tue, 9 May 2017 19:31:30 +0000 (19:31 +0000)]
Suppress all uses of LLVM_END_WITH_NULL. NFC.

Use variadic templates instead of relying on <cstdarg> + sentinel.

This enforces better type checking and makes code more readable.

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

llvm-svn: 302572

7 years agoSuppress all uses of LLVM_END_WITH_NULL. NFC.
Serge Guelton [Tue, 9 May 2017 19:31:13 +0000 (19:31 +0000)]
Suppress all uses of LLVM_END_WITH_NULL. NFC.

Use variadic templates instead of relying on <cstdarg> + sentinel.
This enforces better type checking and makes code more readable.

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

llvm-svn: 302571

7 years ago[mips] XFAIL dfsan's custom.cc test on mips64.
Simon Dardis [Tue, 9 May 2017 19:17:16 +0000 (19:17 +0000)]
[mips] XFAIL dfsan's custom.cc test on mips64.

Test was already marked as failing for mips64el. Now that it's being
tested on mips64, it has to be XFAILed there as well.

llvm-svn: 302570

7 years ago[WebAssembly] Fix failing wasm-toolchain test
Sam Clegg [Tue, 9 May 2017 18:44:23 +0000 (18:44 +0000)]
[WebAssembly] Fix failing wasm-toolchain test

This test was broken in r302558.

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

llvm-svn: 302569

7 years ago[lanai] Add computeKnownBitsForTargetNode for Lanai.
Jacques Pienaar [Tue, 9 May 2017 18:35:26 +0000 (18:35 +0000)]
[lanai] Add computeKnownBitsForTargetNode for Lanai.

Summary: computeKnownBitsForTargetNode was not defined for Lanai which resulted in additional AND's with 0x1 for the output of SETCC instructions.

Reviewers: eliben, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 302568

7 years ago[mips] Remove XFAIL from sanitizer_coverage_no_prune.cc
Simon Dardis [Tue, 9 May 2017 18:29:44 +0000 (18:29 +0000)]
[mips] Remove XFAIL from sanitizer_coverage_no_prune.cc

Test is XPASSing, so remove the XFAIL marker.

llvm-svn: 302567

7 years ago[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.
Davide Italiano [Tue, 9 May 2017 18:29:37 +0000 (18:29 +0000)]
[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.

Thanks to Eli for pointing out in a post-commit review comment.

llvm-svn: 302566

7 years ago[SystemZ] Support missing relocation types in RuntimeDyldELF
Ulrich Weigand [Tue, 9 May 2017 18:27:39 +0000 (18:27 +0000)]
[SystemZ] Support missing relocation types in RuntimeDyldELF

Handle some more relocation types in
RuntimeDyldELF::resolveSystemZRelocation

This fixes a number of failing LLDB test cases.

llvm-svn: 302565

7 years agoAdd memory ORIGIN and LENGTH expression support
Rui Ueyama [Tue, 9 May 2017 18:24:38 +0000 (18:24 +0000)]
Add memory ORIGIN and LENGTH expression support

Adds support for the ORIGIN and LENGTH linker script built in functions.

  ORIGIN(memory) Return the origin of the memory region
  LENGTH(memory) Return the length of the memory region

Redo of D29775 for refactored linker script parsing.

Patch by Robert Clarke

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

llvm-svn: 302564

7 years ago[SystemZ] Remove XFAIL on sanitizer_coverage_no_prune.cc
Ulrich Weigand [Tue, 9 May 2017 18:17:26 +0000 (18:17 +0000)]
[SystemZ] Remove XFAIL on sanitizer_coverage_no_prune.cc

This test case works fine on SystemZ as well.

llvm-svn: 302563

7 years ago[SystemZ] Fix failures after D32542
Ulrich Weigand [Tue, 9 May 2017 18:07:50 +0000 (18:07 +0000)]
[SystemZ] Fix failures after D32542

This commit made ubsan use the fast unwinder.  On SystemZ this requires
test cases to be compiled with -mbackchain.  That was already done for
asan, but not ubsan.  Add the flag for ubsan as well.

llvm-svn: 302562

7 years ago[compiler-rt][mips] Fix a test for mips.
Simon Dardis [Tue, 9 May 2017 17:58:33 +0000 (17:58 +0000)]
[compiler-rt][mips] Fix a test for mips.

GCC 4.9.2 likes the specialize one of the memcpys in msan_interceptors.cc,
leading to test failure.

llvm-svn: 302561

7 years ago[WebAssembly] Fix validation of start function
Sam Clegg [Tue, 9 May 2017 17:51:38 +0000 (17:51 +0000)]
[WebAssembly] Fix validation of start function

The check for valid start function was inverted.  Added a new
test in test/Object to check this case and fixed the existing
tests in for ObjectYAML.

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

llvm-svn: 302560

7 years ago[X86][LWP] Remove MSVC LWP intrinsics stubs.
Simon Pilgrim [Tue, 9 May 2017 17:50:16 +0000 (17:50 +0000)]
[X86][LWP] Remove MSVC LWP intrinsics stubs.

Now provided in lwpintrin.h

llvm-svn: 302559

7 years ago[WebAssembly] Fix location and -flavor when running lld
Sam Clegg [Tue, 9 May 2017 17:47:50 +0000 (17:47 +0000)]
[WebAssembly] Fix location and -flavor when running lld

Add the toolchain installation directory to the program
path so that lld can be found.

Change -flavor to wasm.  Although this new flavor hasn't
yet landed in upstream lld yet there are no point in
passing wasm objects the gnu flavor.

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

llvm-svn: 302558

7 years ago[X86][LWP] Removing LWP todo comment. NFCI.
Simon Pilgrim [Tue, 9 May 2017 17:43:16 +0000 (17:43 +0000)]
[X86][LWP] Removing LWP todo comment. NFCI.

LWP / lwpintrin.h is now supported

llvm-svn: 302557

7 years agoBuild the Apple-style stage2 with modules
Adrian Prantl [Tue, 9 May 2017 17:27:03 +0000 (17:27 +0000)]
Build the Apple-style stage2 with modules

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch turns on LLVM_ENABLE_MODULES.

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
rdar://problem/28672159

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

llvm-svn: 302556

7 years agoRevert r302547 ([mips] Impose a threshold for coercion of aggregates)
Petar Jovanovic [Tue, 9 May 2017 17:20:06 +0000 (17:20 +0000)]
Revert r302547 ([mips] Impose a threshold for coercion of aggregates)

Reverting
  Modified MipsABIInfo::classifyArgumentType so that it now coerces
  aggregate structures only if the size of said aggregate is less than 16/64
  bytes, depending on the ABI.
as it broke clang-with-lto-ubuntu builder.

llvm-svn: 302555

7 years ago[RegScavenger] Rangify a loop, NFC
Krzysztof Parzyszek [Tue, 9 May 2017 17:16:52 +0000 (17:16 +0000)]
[RegScavenger] Rangify a loop, NFC

llvm-svn: 302554

7 years agoAdding VSCode syntax colorizer to utils (generated from textmate colorizer).
Puyan Lotfi [Tue, 9 May 2017 17:13:37 +0000 (17:13 +0000)]
Adding VSCode syntax colorizer to utils (generated from textmate colorizer).
--This line, and those below, will be igored--

A    utils/vscode
A    utils/vscode/README
A    utils/vscode/tablegen
A    utils/vscode/tablegen/.vscode
A    utils/vscode/tablegen/.vscode/launch.json
A    utils/vscode/tablegen/CHANGELOG.md
A    utils/vscode/tablegen/README.md
A    utils/vscode/tablegen/language-configuration.json
A    utils/vscode/tablegen/package.json
A    utils/vscode/tablegen/syntaxes
A    utils/vscode/tablegen/syntaxes/TableGen.tmLanguage
A    utils/vscode/tablegen/vsc-extension-quickstart.md

llvm-svn: 302553

7 years ago[NewGVN] Fix a consistent order for phi nodes operands.
Davide Italiano [Tue, 9 May 2017 16:58:28 +0000 (16:58 +0000)]
[NewGVN] Fix a consistent order for phi nodes operands.

The way we currently define congruency for two PHIExpression(s) is:

1) The operands to the phi functions are congruent
2) The PHIs are defined in the same BasicBlock.

NewGVN works under the assumption that phi operands are in predecessor
order, or at least in some consistent order. OTOH, is valid IR:

patatino:
  %meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ]
  %banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ]
  br label %end

and the in-memory representations of the two SSA registers have an
inconsistent order. This violation of NewGVN assumptions results into
two PHIs found congruent when they're not. While we think it's useful
to have always a consistent order enforced, let's fix this in NewGVN
sorting uses in predecessor order before creating a PHI expression.

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

llvm-svn: 302552

7 years ago[APInt] Remove return value from tcFullMultiply.
Craig Topper [Tue, 9 May 2017 16:47:33 +0000 (16:47 +0000)]
[APInt] Remove return value from tcFullMultiply.

The description says it returns the number of words needed to represent the results. But the way it was coded it always returns (lhsWords + rhsWords) or (lhsWords + rhsWords - 1). But the result could be even smaller than that and it wouldn't tell you.

No one uses the result today so rather than try to fix it, just remove it.

llvm-svn: 302551

7 years agoNewGVN: Make all of symbolic evaluation logically const.
Daniel Berlin [Tue, 9 May 2017 16:40:04 +0000 (16:40 +0000)]
NewGVN: Make all of symbolic evaluation logically const.

llvm-svn: 302550

7 years ago[X86] Add more patterns for BZHI isel
Craig Topper [Tue, 9 May 2017 16:32:11 +0000 (16:32 +0000)]
[X86] Add more patterns for BZHI isel

This patch adds more patterns that a reasonable person might write that can be compiled to BZHI.

This adds support for

(~0U >> (32 - b)) & a;

and

a << (32 - b) >> (32 - b);

This was inspired by the code in APInt::clearUnusedBits.

This can pass an index of 32 to the bzhi instruction which a quick test of Haswell hardware shows will not mask any bits. Though the description text in the Intel manual says the "index is saturated to OperandSize-1". The pseudocode in the same manual indicates no bits will be zeroed for this case.

I think this is still missing cases where the subtract portion is an 8-bit operation.

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

llvm-svn: 302549

7 years ago[InstCombineCasts] Fix checks in sext->lshr->trunc pattern.
Sanjay Patel [Tue, 9 May 2017 16:24:59 +0000 (16:24 +0000)]
[InstCombineCasts] Fix checks in sext->lshr->trunc pattern.

The comment says to avoid the case where zero bits are shifted into the truncated value,
but the code checks that the shift is smaller than the truncated value instead of the
number of bits added by the sign extension. Fixing this allows a shift by more than the
value size to be introduced, which is undefined behavior, so the shift is capped at the
value size minus one, which has the expected behavior of filling the value with the sign
bit.

Patch by Jacob Young!

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

llvm-svn: 302548

7 years ago[mips] Impose a threshold for coercion of aggregates
Petar Jovanovic [Tue, 9 May 2017 16:24:03 +0000 (16:24 +0000)]
[mips] Impose a threshold for coercion of aggregates

Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate
structures only if the size of said aggregate is less than 16/64 bytes,
depending on the ABI.

Patch by Stefan Maksimovic.

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

llvm-svn: 302547

7 years agoVX512] Only look at lower bit in constant scalar masks
Guy Blank [Tue, 9 May 2017 16:16:48 +0000 (16:16 +0000)]
VX512] Only look at lower bit in constant scalar masks

for scalar masked instructions only the lower bit of the mask is relevant. so for constant masks we should either do an unmasked operation or no operation, depending on the value of the lower bit.
This patch handles cases where the lower bit is '1'.

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

llvm-svn: 302546

7 years ago[CodeCompletion] Complete platform names in @available expressions
Alex Lorenz [Tue, 9 May 2017 16:05:04 +0000 (16:05 +0000)]
[CodeCompletion] Complete platform names in @available expressions

rdar://32074504

llvm-svn: 302545

7 years agoRe-land "Use the frame index side table for byval and inalloca arguments"
Reid Kleckner [Tue, 9 May 2017 16:02:20 +0000 (16:02 +0000)]
Re-land "Use the frame index side table for byval and inalloca arguments"

This re-lands r302483. It was not the cause of PR32977.

llvm-svn: 302544

7 years agoRe-land "Don't add DBG_VALUE instructions for static allocas in dbg.declare"
Reid Kleckner [Tue, 9 May 2017 16:01:47 +0000 (16:01 +0000)]
Re-land "Don't add DBG_VALUE instructions for static allocas in dbg.declare"

This re-lands commit r302461. It was not the cause of PR32977.

llvm-svn: 302543

7 years agoRevert r302476 "Update testcase for upstream LLVM changes."
Hans Wennborg [Tue, 9 May 2017 15:55:39 +0000 (15:55 +0000)]
Revert r302476 "Update testcase for upstream LLVM changes."

That test update was for r302469, which was reverted in r302533 due to PR32977.

llvm-svn: 302542

7 years agoAllow compiler-rt to find lld and libc++ parallel to LLVM, as in the monorepo
Reid Kleckner [Tue, 9 May 2017 15:54:57 +0000 (15:54 +0000)]
Allow compiler-rt to find lld and libc++ parallel to LLVM, as in the monorepo

llvm-svn: 302541

7 years agoAdd support for pretty platform names to `@available`/
Alex Lorenz [Tue, 9 May 2017 15:34:46 +0000 (15:34 +0000)]
Add support for pretty platform names to `@available`/
`__builtin_available`

This commit allows us to use the macOS/iOS/tvOS/watchOS platform names in
`@available`/`__builtin_available`.

rdar://32067795

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

llvm-svn: 302540

7 years ago[Atomic] Remove IsStore/IsLoad in the interface, and pass the instruction instead...
Tim Shen [Tue, 9 May 2017 15:27:17 +0000 (15:27 +0000)]
[Atomic] Remove IsStore/IsLoad in the interface, and pass the instruction instead. NFC.

Now both emitLeadingFence and emitTrailingFence take the instruction
itself, instead of taking IsLoad/IsStore pairs.
Instruction::mayReadFromMemory and Instrucion::mayWriteToMemory are used
for determining those two booleans.

The instruction argument is also useful for later D32763, in
emitTrailingFence. For emitLeadingFence, it seems to have cleaner
interface with the proposed change.

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

llvm-svn: 302539

7 years ago[scudo] CRC32 optimizations
Kostya Kortchinsky [Tue, 9 May 2017 15:12:38 +0000 (15:12 +0000)]
[scudo] CRC32 optimizations

Summary:
This change optimizes several aspects of the checksum used for chunk headers.

First, there is no point in checking the weak symbol `computeHardwareCRC32`
everytime, it will either be there or not when we start, so check it once
during initialization and set the checksum type accordingly.

Then, the loading of `HashAlgorithm` for SSE versions (and ARM equivalent) was
not optimized out, while not necessary. So I reshuffled that part of the code,
which duplicates a tiny bit of code, but ends up in a much cleaner assembly
(and faster as we avoid an extraneous load and some calls).

The following code is the checksum at the end of `scudoMalloc` for x86_64 with
full SSE 4.2, before:
```
mov     rax, 0FFFFFFFFFFFFFFh
shl     r10, 38h
mov     edi, dword ptr cs:_ZN7__scudoL6CookieE ; __scudo::Cookie
and     r14, rax
lea     rsi, [r13-10h]
movzx   eax, cs:_ZN7__scudoL13HashAlgorithmE ; __scudo::HashAlgorithm
or      r14, r10
mov     rbx, r14
xor     bx, bx
call    _ZN7__scudo20computeHardwareCRC32Ejm ; __scudo::computeHardwareCRC32(uint,ulong)
mov     rsi, rbx
mov     edi, eax
call    _ZN7__scudo20computeHardwareCRC32Ejm ; __scudo::computeHardwareCRC32(uint,ulong)
mov     r14w, ax
mov     rax, r13
mov     [r13-10h], r14
```
After:
```
mov     rax, cs:_ZN7__scudoL6CookieE ; __scudo::Cookie
lea     rcx, [rbx-10h]
mov     rdx, 0FFFFFFFFFFFFFFh
and     r14, rdx
shl     r9, 38h
or      r14, r9
crc32   eax, rcx
mov     rdx, r14
xor     dx, dx
mov     eax, eax
crc32   eax, rdx
mov     r14w, ax
mov     rax, rbx
mov     [rbx-10h], r14
```

Reviewers: dvyukov, alekseyshl, kcc

Reviewed By: alekseyshl

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 302538

7 years agoAmend r302535; ifndef and ifdef are different, as it turns out.
Aaron Ballman [Tue, 9 May 2017 15:12:03 +0000 (15:12 +0000)]
Amend r302535; ifndef and ifdef are different, as it turns out.

llvm-svn: 302537

7 years ago[clang-tidy] Allow disabling compatibility check for generated fixes.
Alexander Kornienko [Tue, 9 May 2017 15:10:26 +0000 (15:10 +0000)]
[clang-tidy] Allow disabling compatibility check for generated fixes.

llvm-svn: 302536

7 years agoARMRegisterBankInfo.h requires LLVM_BUILD_GLOBAL_ISEL to be defined. If it is not...
Aaron Ballman [Tue, 9 May 2017 14:59:48 +0000 (14:59 +0000)]
ARMRegisterBankInfo.h requires LLVM_BUILD_GLOBAL_ISEL to be defined. If it is not defined, then ARMGenRegisterBank.inc is not table generated and the inclusion of this header causes the build to fail.

llvm-svn: 302535

7 years agoChange EOL style to LF. NFC
Alexander Kornienko [Tue, 9 May 2017 14:56:28 +0000 (14:56 +0000)]
Change EOL style to LF. NFC

llvm-svn: 302534

7 years agoRevert r302469 "Make it illegal for two Functions to point to the same DISubprogram"
Hans Wennborg [Tue, 9 May 2017 14:44:15 +0000 (14:44 +0000)]
Revert r302469 "Make it illegal for two Functions to point to the same DISubprogram"

This caused PR32977.

Original commit message:

> Make it illegal for two Functions to point to the same DISubprogram
>
> As recently discussed on llvm-dev [1], this patch makes it illegal for
> two Functions to point to the same DISubprogram and updates
> FunctionCloner to also clone the debug info of a function to conform
> to the new requirement. To simplify the implementation it also factors
> out the creation of inlineAt locations from the Inliner into a
> general-purpose utility in DILocation.
>
> [1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/112661.html
> <rdar://problem/31926379>
>
> Differential Revision: https://reviews.llvm.org/D32975

llvm-svn: 302533

7 years ago[LV] Fix insertion point for shuffle vectors in first order recurrence
Anna Thomas [Tue, 9 May 2017 14:29:33 +0000 (14:29 +0000)]
[LV] Fix insertion point for shuffle vectors in first order recurrence

Summary:
In first order recurrence vectorization, when the previous value is a phi node, we need to
set the insertion point to the first non-phi node.
We can have the previous value being a phi node, due to the generation of new
IVs as part of trunc optimization [1].

[1] https://reviews.llvm.org/rL294967

Reviewers: mssimpso, mkuper

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 302532

7 years agoRemoving a file that is not necessary (and was causing link diagnostics with MSVC...
Aaron Ballman [Tue, 9 May 2017 14:22:48 +0000 (14:22 +0000)]
Removing a file that is not necessary (and was causing link diagnostics with MSVC 2015); NFC.

llvm-svn: 302531

7 years agoAvoid unnecessary calls to vm_region_recurse
Francis Ricci [Tue, 9 May 2017 14:10:30 +0000 (14:10 +0000)]
Avoid unnecessary calls to vm_region_recurse

Summary: This should significantly improve darwin lsan performance in cases where root regions are not used.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 302530

7 years ago[X86][AVX512] Refine some avx512er intrinsics tests. NFC.
Guy Blank [Tue, 9 May 2017 14:03:51 +0000 (14:03 +0000)]
[X86][AVX512] Refine some avx512er intrinsics tests. NFC.

The modified tests should test the masked intrinsics.
Currently the mask is constant, which with a future patch (https://reviews.llvm.org/D32805) will cause the intrinsics to be replaced with an unmasked version.
This patch changes the constant mask to be a variable one.

llvm-svn: 302529

7 years agoUse a simpler heuristic for placing orphans.
Rafael Espindola [Tue, 9 May 2017 13:58:46 +0000 (13:58 +0000)]
Use a simpler heuristic for placing orphans.

This is a bit easier to read and a lot faster in some cases. A version
of many-sections.s with linker scripts goes from 0m41.232s to
0m19.575s.

llvm-svn: 302528

7 years agoAdd extra operand to CALLSEQ_START to keep frame part set up previously
Serge Pavlov [Tue, 9 May 2017 13:35:13 +0000 (13:35 +0000)]
Add extra operand to CALLSEQ_START to keep frame part set up previously

Using arguments with attribute inalloca creates problems for verification
of machine representation. This attribute instructs the backend that the
argument is prepared in stack prior to  CALLSEQ_START..CALLSEQ_END
sequence (see http://llvm.org/docs/InAlloca.htm for details). Frame size
stored in CALLSEQ_START in this case does not count the size of this
argument. However CALLSEQ_END still keeps total frame size, as caller can
be responsible for cleanup of entire frame. So CALLSEQ_START and
CALLSEQ_END keep different frame size and the difference is treated by
MachineVerifier as stack error. Currently there is no way to distinguish
this case from actual errors.

This patch adds additional argument to CALLSEQ_START and its
target-specific counterparts to keep size of stack that is set up prior to
the call frame sequence. This argument allows MachineVerifier to calculate
actual frame size associated with frame setup instruction and correctly
process the case of inalloca arguments.

The changes made by the patch are:
- Frame setup instructions get the second mandatory argument. It
  affects all targets that use frame pseudo instructions and touched many
  files although the changes are uniform.
- Access to frame properties are implemented using special instructions
  rather than calls getOperand(N).getImm(). For X86 and ARM such
  replacement was made previously.
- Changes that reflect appearance of additional argument of frame setup
  instruction. These involve proper instruction initialization and
  methods that access instruction arguments.
- MachineVerifier retrieves frame size using method, which reports sum of
  frame parts initialized inside frame instruction pair and outside it.

The patch implements approach proposed by Quentin Colombet in
https://bugs.llvm.org/show_bug.cgi?id=27481#c1.
It fixes 9 tests failed with machine verifier enabled and listed
in PR27481.

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

llvm-svn: 302527

7 years agoRevert "[MIPS] Add support to match more patterns for DINS instruction"
Simon Dardis [Tue, 9 May 2017 13:18:48 +0000 (13:18 +0000)]
Revert "[MIPS] Add support to match more patterns for DINS instruction"

This reverts commit rL302512. This broke the mips buildbots.

llvm-svn: 302526

7 years ago[X86][SSE42] Lower v2i64/v4i64 ASHR(X, 63) as PCMPGTQ(0, X)
Simon Pilgrim [Tue, 9 May 2017 13:14:40 +0000 (13:14 +0000)]
[X86][SSE42] Lower v2i64/v4i64 ASHR(X, 63) as PCMPGTQ(0, X)

Similar to what we do for vXi8 ASHR(X, 7), use SSE42's PCMPGTQ to splat the sign instead of using the PSRAD+PSHUFD.

Avoiding bitcasts this improves combines that utilize computeNumSignBits, permits memory folding and reduces pipe pressure. Although it does require a second register, given that this is a (cheap) zero register the impact is minimal.

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

llvm-svn: 302525

7 years agoRevert "[Dwarf] Disable reference verification for now (PR32972)"
Diana Picus [Tue, 9 May 2017 13:05:43 +0000 (13:05 +0000)]
Revert "[Dwarf] Disable reference verification for now (PR32972)"

This reverts commit r302520 because it break the unit tests.

llvm-svn: 302524

7 years agoclang-format: [JS] keep triple slash directives intact.
Martin Probst [Tue, 9 May 2017 12:45:48 +0000 (12:45 +0000)]
clang-format: [JS] keep triple slash directives intact.

Summary:
TypeScript uses triple slash directives of the form:
    /// <reference path="..."/>

For various non-source instructions that should not be wrapped.

Reference:
https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 302523

7 years ago[clang-tidy] Minor cleanup + a disabled test case for PR26228. NFC
Alexander Kornienko [Tue, 9 May 2017 12:41:11 +0000 (12:41 +0000)]
[clang-tidy] Minor cleanup + a disabled test case for PR26228. NFC

llvm-svn: 302522

7 years agoPR5935: Adjust documentation.
Vassil Vassilev [Tue, 9 May 2017 12:37:15 +0000 (12:37 +0000)]
PR5935: Adjust documentation.

https://reviews.llvm.org/D31867

Patch by Johannes Altmanninger!

llvm-svn: 302521

7 years ago[Dwarf] Disable reference verification for now (PR32972)
Renato Golin [Tue, 9 May 2017 12:36:50 +0000 (12:36 +0000)]
[Dwarf] Disable reference verification for now (PR32972)

There is no other explanation about why this only started happening
now, even though it crashes on old code (supposedly reachable from
here).

The only common factor between the failing bots is that they use GCC
(4.9 and 5.3) to compile Clang, while the others use Clang 3.8, but the
failure is while building the tests, as an assertion, on Clang.

Commenting it out for now in hope the bots will go back green, but we
should keep looking for the real cause, and update bugzilla.

llvm-svn: 302520

7 years ago[X86][AVX512] Add test for masking of scalar instructions.
Guy Blank [Tue, 9 May 2017 12:32:48 +0000 (12:32 +0000)]
[X86][AVX512] Add test for masking of scalar instructions.

llvm-svn: 302519

7 years agoReland "Warn about unused static file scope function template declarations."
Vassil Vassilev [Tue, 9 May 2017 11:25:41 +0000 (11:25 +0000)]
Reland "Warn about unused static file scope function template declarations."

This patch reinstates r299930, reverted in r299956, as a separate diagnostic
option (-Wunused-template).

llvm-svn: 302518

7 years agodocs: Fix Sphinx detection with out-of-tree builds
Tom Stellard [Tue, 9 May 2017 11:18:03 +0000 (11:18 +0000)]
docs: Fix Sphinx detection with out-of-tree builds

Adapt to changes made in r302499.

llvm-svn: 302517

7 years agodocs: Fix Sphinx detection with out-of-tree builds
Tom Stellard [Tue, 9 May 2017 11:11:52 +0000 (11:11 +0000)]
docs: Fix Sphinx detection with out-of-tree builds

Adapt to changes made in r302499.

llvm-svn: 302516

7 years ago[Polly][PPCGCodeGen] OpenCL now gets kernel argument size from PPCG CodeGen
Siddharth Bhat [Tue, 9 May 2017 10:45:52 +0000 (10:45 +0000)]
[Polly][PPCGCodeGen] OpenCL now gets kernel argument size from PPCG CodeGen

Summary: PPCGCodeGeneration now attaches the size of the kernel launch parameters at the end of the parameter list. For the existing CUDA Runtime, this gets ignored, but the OpenCL Runtime knows to check for kernel-argument size at the end of the parameter list. (The resulting parameters list is twice as long. This has been accounted for in the corresponding test cases).

Reviewers: grosser, Meinersbur, bollu

Reviewed By: bollu

Subscribers: nemanjai, yaxunl, Anastasia, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 302515

7 years agoIntroduce experimental generic intrinsics for horizontal vector reductions.
Amara Emerson [Tue, 9 May 2017 10:43:25 +0000 (10:43 +0000)]
Introduce experimental generic intrinsics for horizontal vector reductions.

- This change allows targets to opt-in to using them instead of the log2
  shufflevector algorithm.
- The SLP and Loop vectorizers have the common code to do shuffle reductions
  factored out into LoopUtils, and now have a unified interface for generating
  reductions regardless of the preference of the target. LoopUtils now uses TTI
  to determine what kind of reductions the target wants to handle.
- For CodeGen, basic legalization support is added.

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

llvm-svn: 302514

7 years ago[X86] Clang option -fuse-init-array has no effect when generating for MCU target
Nikolai Bozhenov [Tue, 9 May 2017 10:14:03 +0000 (10:14 +0000)]
[X86] Clang option -fuse-init-array has no effect when generating for MCU target

Reviewers: Eugene.Zelenko, dschuff, craig.topper

Reviewed By: craig.topper

Subscribers: ahatanak, aaboud, DavidKreitzer, llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D32543
Patch by AndreiGrischenko <andrei.l.grischenko@intel.com>

llvm-svn: 302513

7 years ago[MIPS] Add support to match more patterns for DINS instruction
Strahinja Petrovic [Tue, 9 May 2017 10:02:00 +0000 (10:02 +0000)]
[MIPS] Add support to match more patterns for DINS instruction

This patch adds support for recognizing patterns to match
DINS instruction.

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

llvm-svn: 302512

7 years ago[ARM GlobalISel] Remove hand-written G_FADD selection
Diana Picus [Tue, 9 May 2017 08:32:42 +0000 (08:32 +0000)]
[ARM GlobalISel] Remove hand-written G_FADD selection

Remove the code selecting G_FADD - now that TableGen can handle more
opcodes, it's not needed anymore.

llvm-svn: 302511

7 years ago[ConstantRange] Rewrite shl to avoid repeated calls to getUnsignedMax and avoid creat...
Craig Topper [Tue, 9 May 2017 07:04:04 +0000 (07:04 +0000)]
[ConstantRange] Rewrite shl to avoid repeated calls to getUnsignedMax and avoid creating the min APInt until we're sure we need it. Use inplace shift operations.

llvm-svn: 302510

7 years ago[ConstantRange] Combine the two adds max+1 in lshr into a single addition.
Craig Topper [Tue, 9 May 2017 07:04:02 +0000 (07:04 +0000)]
[ConstantRange] Combine the two adds max+1 in lshr into a single addition.

llvm-svn: 302509

7 years ago[ConstantRange] Use APInt::isNullValue in place of comparing with 0. The compiler...
Craig Topper [Tue, 9 May 2017 05:01:29 +0000 (05:01 +0000)]
[ConstantRange] Use APInt::isNullValue in place of comparing with 0. The compiler should be able to generate slightly better code for the former. NFC

llvm-svn: 302508

7 years agoFix PR32638 : Make sure we switch Sema's CurContext to the substituted FunctionDecl...
Faisal Vali [Tue, 9 May 2017 04:17:15 +0000 (04:17 +0000)]
Fix PR32638 : Make sure we switch Sema's CurContext to the substituted FunctionDecl when instantiating the exception specification.

This fixes the bug: https://bugs.llvm.org/show_bug.cgi?id=32638

  int main()
  {
    [](auto x) noexcept(noexcept(x)) { } (0);
  }

In the above code, prior to this patch, when substituting into the noexcept expression, i.e. transforming the DeclRefExpr that represents 'x' - clang attempts to capture 'x' because Sema's CurContext is still pointing to the pattern FunctionDecl (i.e. the templated-decl set in FinishTemplateArgumentDeduction) which does not match the substituted 'x's DeclContext, which leads to an attempt to capture and an assertion failure.

We fix this by adjusting Sema's CurContext to point to the substituted FunctionDecl under which the noexcept specifier's argument should be transformed, and so the ParmVarDecl that 'x' refers to has the same declcontext and no capture is attempted.

I briefly investigated whether the SwitchContext should occur right after VisitMethodDecl creates the new substituted FunctionDecl, instead of only during instantiating the exception specification - but seeing no other code that seemed to rely on that, I decided to leave it just for the duration of the exception specification instantiation.

llvm-svn: 302507

7 years ago[Sema] Make typeof(OverloadedFunctionName) not a pointer.
George Burgess IV [Tue, 9 May 2017 04:06:24 +0000 (04:06 +0000)]
[Sema] Make typeof(OverloadedFunctionName) not a pointer.

We were sometimes doing a function->pointer conversion in
Sema::CheckPlaceholderExpr, which isn't the job of CheckPlaceholderExpr.

So, when we saw typeof(OverloadedFunctionName), where
OverloadedFunctionName referenced a name with only one function that
could have its address taken, we'd give back a function pointer type
instead of a function type. This is incorrect.

I kept the logic for doing the function pointer conversion in
resolveAndFixAddressOfOnlyViableOverloadCandidate because it was more
consistent with existing ResolveAndFix* methods.

llvm-svn: 302506

7 years ago[ODRHash] Loosen checks on typedefs.
Richard Trieu [Tue, 9 May 2017 03:24:34 +0000 (03:24 +0000)]
[ODRHash] Loosen checks on typedefs.

When a type in a class is from a typedef, only check the canonical type.  Skip
checking the intermediate underlying types.  This is in response to PR 32965

llvm-svn: 302505

7 years agoRevert "Don't add DBG_VALUE instructions for static allocas in dbg.declare"
Reid Kleckner [Tue, 9 May 2017 01:57:44 +0000 (01:57 +0000)]
Revert "Don't add DBG_VALUE instructions for static allocas in dbg.declare"

This reverts commit r302461.

It appears to be causing failures compiling gtest with debug info on the
Linux sanitizer bot. I was unable to reproduce the failure locally,
however.

llvm-svn: 302504

7 years ago[Sema][ObjC] Clean up possible null dereference.
Akira Hatanaka [Tue, 9 May 2017 01:54:51 +0000 (01:54 +0000)]
[Sema][ObjC] Clean up possible null dereference.

It appears that the code is actually dead since unbridged-cast
placeholder types are created by calling CastOperation::complete and
ImplicitCastExprs are never passed to it.

Spotted by Vedant Kumar.

rdar://problem/31542226

llvm-svn: 302503

7 years agoFix code section prefix for proper layout
Teresa Johnson [Tue, 9 May 2017 01:43:24 +0000 (01:43 +0000)]
Fix code section prefix for proper layout

Summary:
r284533 added hot and cold section prefixes based on profile
information, to enable grouping of hot/cold functions at link time.
However, it used "cold" as the prefix for cold sections, but gold only
recognizes "unlikely" (which is used by gcc for cold sections).
Therefore, cold sections were not properly being grouped. Switch to
using "unlikely"

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

llvm-svn: 302502

7 years agodocs: Fix Sphinx detection with out-of-tree builds
Tom Stellard [Tue, 9 May 2017 01:43:22 +0000 (01:43 +0000)]
docs: Fix Sphinx detection with out-of-tree builds

Adapt to changes made in r302499.

llvm-svn: 302501

7 years agodocs: Fix Sphinx detection with out-of-tree builds
Tom Stellard [Tue, 9 May 2017 01:42:33 +0000 (01:42 +0000)]
docs: Fix Sphinx detection with out-of-tree builds

Adapt to changes made in r302499.

llvm-svn: 302500

7 years agoRevert "Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake""
Tom Stellard [Tue, 9 May 2017 01:41:28 +0000 (01:41 +0000)]
Revert "Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake""

This reverts commit r302054.

Re-commit now that I have fixes for clang/lld.

llvm-svn: 302499

7 years ago[libFuzzer] update docs on -print_coverage/-dump_coverage
Kostya Serebryany [Tue, 9 May 2017 01:34:27 +0000 (01:34 +0000)]
[libFuzzer] update docs on -print_coverage/-dump_coverage

llvm-svn: 302498

7 years agoFix Windows tests when __config_site is present.
Ben Craig [Tue, 9 May 2017 01:34:12 +0000 (01:34 +0000)]
Fix Windows tests when __config_site is present.
Previously, the force includes would complain about a missing _DEBUG symbol.
Now we dump macros before adding the force includes to the command line.
Now with proper newlines.

llvm-svn: 302497

7 years agoRevert "Fix Windows tests when __config_site is present."
Ben Craig [Tue, 9 May 2017 01:26:39 +0000 (01:26 +0000)]
Revert "Fix Windows tests when __config_site is present."
It's 2017, and line endings are still an issue.

llvm-svn: 302496

7 years ago[CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
Akira Hatanaka [Tue, 9 May 2017 01:20:05 +0000 (01:20 +0000)]
[CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
blocks.

r302270 made changes to avoid emitting clang.arc.use at -O0 and instead
emit @objc_release. We also have to emit @objc_retain for the captured
variable at -O0 to match the @objc_release instead of just storing the
pointer to the capture field.

llvm-svn: 302495

7 years ago[libFuzzer] make sure the input data is not overwritten in the fuzz target (if it...
Kostya Serebryany [Tue, 9 May 2017 01:17:29 +0000 (01:17 +0000)]
[libFuzzer] make sure the input data is not overwritten in the fuzz target (if it is -- report an error)

llvm-svn: 302494

7 years agoRevert "Use the frame index side table for byval and inalloca arguments"
Reid Kleckner [Tue, 9 May 2017 01:14:39 +0000 (01:14 +0000)]
Revert "Use the frame index side table for byval and inalloca arguments"

This reverts r302483 and it's follow up fix.

llvm-svn: 302493

7 years ago[XRay] Add __xray_customeevent(...) as a clang-supported builtin
Dean Michael Berris [Tue, 9 May 2017 00:45:40 +0000 (00:45 +0000)]
[XRay] Add __xray_customeevent(...) as a clang-supported builtin

Summary:
We define the `__xray_customeevent` builtin that gets translated to
IR calls to the correct intrinsic. The default implementation of this is
a no-op function. The codegen side of this follows the following logic:

- When `-fxray-instrument` is not provided in the driver, we elide all
calls to `__xray_customevent`.
- When `-fxray-instrument` is enabled and a function is marked as "never
instrumented", we elide all calls to `__xray_customevent` in that
function; if either marked as "always instrumented" or subject to
threshold-based instrumentation, we emit a call to the
`llvm.xray.customevent` intrinsic from LLVM for each
`__xray_customevent` occurrence in the function.

This change depends on D27503 (to land in LLVM first).

Reviewers: echristo, rsmith

Subscribers: mehdi_amini, pelikan, lrl, cfe-commits

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

llvm-svn: 302492

7 years ago[Modules] Allow umbrella frameworks to define private submodules for subframeworks
Bruno Cardoso Lopes [Tue, 9 May 2017 00:41:38 +0000 (00:41 +0000)]
[Modules] Allow umbrella frameworks to define private submodules for subframeworks

In r298391 we fixed the umbrella framework model to work when submodules
named "Private" are used. This complements the work by allowing the
umbrella framework model to work in general.

rdar://problem/31790067

llvm-svn: 302491

7 years agoRename a method. NFC.
Vedant Kumar [Tue, 9 May 2017 00:12:33 +0000 (00:12 +0000)]
Rename a method. NFC.

llvm-svn: 302490

7 years agoXFAIL noexcept member function throw/catch test under GCC.
Eric Fiselier [Tue, 9 May 2017 00:11:02 +0000 (00:11 +0000)]
XFAIL noexcept member function throw/catch test under GCC.

I'm still not exactly sure why the test fails, but I suspect it's
a bug in GCC. More investigation needed.

llvm-svn: 302489

7 years agoFix GCC 7 test failures.
Eric Fiselier [Tue, 9 May 2017 00:00:00 +0000 (00:00 +0000)]
Fix GCC 7 test failures.

This patch fixes the test failures and unexpected passes that occur
when testing against GCC 7. Specifically:

* don't mark __gcd as always inline because it's a recursive function. GCC diagnoses this.
* don't XFAIL the aligned allocation tests. GCC 7 supports them but not the -faligned-allocation option.
* Work around gcc.gnu.org/PR78489 in variants constructors.

llvm-svn: 302488

7 years ago[APInt] Use default constructor instead of explicitly creating a 1-bit APInt in udiv...
Craig Topper [Mon, 8 May 2017 23:49:54 +0000 (23:49 +0000)]
[APInt] Use default constructor instead of explicitly creating a 1-bit APInt in udiv and urem. NFC

The default constructor does the same thing.

llvm-svn: 302487