platform/upstream/llvm.git
7 years ago[AMDGPU] Fix incorrect register pressure calculation
Stanislav Mekhanoshin [Thu, 11 May 2017 17:16:55 +0000 (17:16 +0000)]
[AMDGPU] Fix incorrect register pressure calculation

Earlier fix D32572 introduced a bug where live-ins were calculated
for basic block instead of scheduling region. This change fixes it.

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

llvm-svn: 302812

7 years ago[SLP] Emit optimization remarks
Adam Nemet [Thu, 11 May 2017 17:06:17 +0000 (17:06 +0000)]
[SLP] Emit optimization remarks

The approach I followed was to emit the remark after getTreeCost concludes
that SLP is profitable.  I initially tried emitting them after the
vectorizeRootInstruction calls in vectorizeChainsInBlock but I vaguely
remember missing a few cases for example in HorizontalReduction::tryToReduce.

ORE is placed in BoUpSLP so that it's available from everywhere (notably
HorizontalReduction::tryToReduce).

We use the first instruction in the root bundle as the locator for the remark.
In order to get a sense how far the tree is spanning I've include the size of
the tree in the remark.  This is not perfect of course but it gives you at
least a rough idea about the tree.  Then you can follow up with -view-slp-tree
to really see the actual tree.

llvm-svn: 302811

7 years ago[PowerPC] Eliminate integer compare instructions - vol. 1
Nemanja Ivanovic [Thu, 11 May 2017 16:54:23 +0000 (16:54 +0000)]
[PowerPC] Eliminate integer compare instructions - vol. 1

This patch is the first in a series of patches to provide code gen for
doing compares in GPRs when the compare result is required in a GPR.

It adds the infrastructure to select GPR sequences for i1->i32 and i1->i64
extensions. This first patch handles equality comparison on i32 operands with
the result sign or zero extended.

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

llvm-svn: 302810

7 years agoAdd a test that local submodule visibility has no effect on debug info
Adrian Prantl [Thu, 11 May 2017 16:40:48 +0000 (16:40 +0000)]
Add a test that local submodule visibility has no effect on debug info

rdar://problem/27876262

llvm-svn: 302809

7 years ago[DAGCombine] Use SelectionDAG::getAnyExtOrTrunc helper. NFCI.
Simon Pilgrim [Thu, 11 May 2017 16:40:44 +0000 (16:40 +0000)]
[DAGCombine] Use SelectionDAG::getAnyExtOrTrunc helper. NFCI.

llvm-svn: 302808

7 years ago[asan] Test 'strndup_oob_test.cc' added in r302781 fails on the clang-cmake-thumbv7...
Pierre Gousseau [Thu, 11 May 2017 16:26:50 +0000 (16:26 +0000)]
[asan] Test 'strndup_oob_test.cc' added in r302781 fails on the clang-cmake-thumbv7-a15-full-sh bot.
Marking as unsupported on armv7l-unknown-linux-gnueabihf, same as strdup_oob_test.cc

llvm-svn: 302807

7 years agoFix -DLLVM_ENABLE_THREADS=OFF build after r302748
Hans Wennborg [Thu, 11 May 2017 15:32:47 +0000 (15:32 +0000)]
Fix -DLLVM_ENABLE_THREADS=OFF build after r302748

llvm-svn: 302806

7 years ago[Simplify] Remove identical scalar writes.
Michael Kruse [Thu, 11 May 2017 15:07:38 +0000 (15:07 +0000)]
[Simplify] Remove identical scalar writes.

After DeLICM, it is possible to have two writes of the same value to
the same location in the same statement when it determined that those
writes do not conflict (write the same value).

Teach -polly-simplify to remove one of the writes. It interferes with
the pattern matching of matrix-multiplication kernels and also seem
to not be optimized away by LLVM.

The algorthm is simple, has O(n^2) behaviour (n = max number of
MemoryAccesses in a statement) and only matches the most obvious cases,
but seem to be enough to pattern-match Boost ublas gemm.

Not handled cases include:
- StoreInst instructions (a.k.a. explicit writes), since the value might
  be loaded or overwritten between the two stores.
- PHINode, especially LCSSA, when the PHI value matches with on other's.
- Partial writes (in preparation)

llvm-svn: 302805

7 years ago[X86][AVX] Added zeroall/zeroupper scheduler tests
Simon Pilgrim [Thu, 11 May 2017 15:02:49 +0000 (15:02 +0000)]
[X86][AVX] Added zeroall/zeroupper scheduler tests

Missing on SandyBridge and Btver2 models

llvm-svn: 302804

7 years agoModules: fix modules build.
Tim Northover [Thu, 11 May 2017 14:51:43 +0000 (14:51 +0000)]
Modules: fix modules build.

A recent commit made GlobalVariable.h depend on intrinsics generation, so (I
think) it needs to be in the lower-level module. I'll confirm with others, but
this should fix the bots.

llvm-svn: 302803

7 years agoMark LWG#2782 as complete. No functionality change; we already do this. Just added...
Marshall Clow [Thu, 11 May 2017 14:25:45 +0000 (14:25 +0000)]
Mark LWG#2782 as complete. No functionality change; we already do this. Just added a few more tests.

llvm-svn: 302802

7 years agoRenumber test line number expectations after r302783.
Benjamin Kramer [Thu, 11 May 2017 14:04:23 +0000 (14:04 +0000)]
Renumber test line number expectations after r302783.

Also remove a confused stable-runtimes requirement.

llvm-svn: 302801

7 years agoReplace a nested namespace used for overload resolution with a struct. Richard Smith...
Marshall Clow [Thu, 11 May 2017 14:00:54 +0000 (14:00 +0000)]
Replace a nested namespace used for overload resolution with a struct. Richard Smith says that using the namespace results in an ODR violation, but I disagree. Nevertheless, the struct works just as well.

llvm-svn: 302800

7 years agoMark LWG#2850 as complete. No functionality change; we had tests that covered it...
Marshall Clow [Thu, 11 May 2017 13:55:20 +0000 (13:55 +0000)]
Mark LWG#2850 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests. Thanks to K-ballo for the heads up.

llvm-svn: 302799

7 years agoMark LWG#2796 as complete. No functionality change; we had tests that covered it...
Marshall Clow [Thu, 11 May 2017 13:51:09 +0000 (13:51 +0000)]
Mark LWG#2796 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests

llvm-svn: 302798

7 years ago[CodeCompletion] Provide member completions for dependent expressions whose
Alex Lorenz [Thu, 11 May 2017 13:48:57 +0000 (13:48 +0000)]
[CodeCompletion] Provide member completions for dependent expressions whose
type is a TemplateSpecializationType or InjectedClassNameType

Fixes PR30847. Partially fixes PR20973 (first position only).

PR17614 is still not working, its expression has the dependent
builtin type. We'll have to teach the completion engine how to "resolve"
dependent expressions to fix it.

rdar://29818301

llvm-svn: 302797

7 years ago[CodeCompletion] NFC, extract a function that generates member
Alex Lorenz [Thu, 11 May 2017 13:41:00 +0000 (13:41 +0000)]
[CodeCompletion] NFC, extract a function that generates member
completion results for records

llvm-svn: 302796

7 years agoFix two-stage build on windows using DistributionExample cmake cache
NAKAMURA Takumi [Thu, 11 May 2017 13:19:24 +0000 (13:19 +0000)]
Fix two-stage build on windows using DistributionExample cmake cache

Thanks to Matthew Larionov <matthewtff@gmail.com>

llvm-svn: 302795

7 years ago[IR] Allow attributes with global variables
Javed Absar [Thu, 11 May 2017 12:28:08 +0000 (12:28 +0000)]
[IR] Allow attributes with global variables

This patch extends llvm-ir to allow attributes to be set on global variables.
An RFC was sent out earlier by my colleague James Molloy: http://lists.llvm.org/pipermail/cfe-dev/2017-March/053100.html
A key part of that proposal was to extend LLVM-IR to carry attributes on global variables.
This generic feature could be useful for multiple purposes.
In our present context, it would be useful to carry user specified sections for bss/rodata/data.

Reviewed by: Jonathan Roelofs, Reid Kleckner
Differential Revision: https://reviews.llvm.org/D32009

llvm-svn: 302794

7 years ago[GlobalISel][X86] Remove hand-written G_FADD/F_SUB selection.
Igor Breger [Thu, 11 May 2017 12:15:03 +0000 (12:15 +0000)]
[GlobalISel][X86] Remove hand-written G_FADD/F_SUB selection.
Now it handle by TableGen.

llvm-svn: 302793

7 years ago[ELF] - Make text section location explicit in early-assign-symbol.s test.
George Rimar [Thu, 11 May 2017 11:53:49 +0000 (11:53 +0000)]
[ELF] - Make text section location explicit in early-assign-symbol.s test.

Testcase itself depends on .text section location, which was orphan earlier.

Suggested by Rafael EspĂ­ndola

llvm-svn: 302792

7 years ago[X86] Moving X86Local namespace from .cpp to .h file to use it in memory folding...
Ayman Musa [Thu, 11 May 2017 11:51:12 +0000 (11:51 +0000)]
[X86] Moving X86Local namespace from .cpp to .h file to use it in memory folding TableGen backend.

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

llvm-svn: 302791

7 years ago[LV] Refactor ILV.vectorize{Loop}() by introducing LVP.executePlan(); NFC
Ayal Zaks [Thu, 11 May 2017 11:36:33 +0000 (11:36 +0000)]
[LV] Refactor ILV.vectorize{Loop}() by introducing LVP.executePlan(); NFC

Introduce LoopVectorizationPlanner.executePlan(), replacing ILV.vectorize() and
refactoring ILV.vectorizeLoop(). Method collectDeadInstructions() is moved from
ILV to LVP. These changes facilitate building VPlans and using them to generate
code, following https://reviews.llvm.org/D28975 and its tentative breakdown.

Method ILV.createEmptyLoop() is renamed ILV.createVectorizedLoopSkeleton() to
improve clarity; it's contents remain intact.

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

llvm-svn: 302790

7 years ago[asan] Test 'strndup_oob_test.cc' added in r302781 fails on clang-s390x-linux.
Pierre Gousseau [Thu, 11 May 2017 11:22:04 +0000 (11:22 +0000)]
[asan] Test 'strndup_oob_test.cc' added in r302781 fails on clang-s390x-linux.
Marking it as unsupported for now to hopefully make the bot green.

llvm-svn: 302789

7 years ago[msan] add a regression test for PR32842
Alexander Potapenko [Thu, 11 May 2017 11:12:26 +0000 (11:12 +0000)]
[msan] add a regression test for PR32842

Make sure MSan doesn't miss a bug comparing two integers with defined low bits.

llvm-svn: 302788

7 years ago[msan] Fix PR32842
Alexander Potapenko [Thu, 11 May 2017 11:07:48 +0000 (11:07 +0000)]
[msan] Fix PR32842

It turned out that MSan was incorrectly calculating the shadow for int comparisons: it was done by truncating the result of (Shadow1 OR Shadow2) to i1, effectively rendering all bits except LSB useless.
This approach doesn't work e.g. in the case where the values being compared are even (i.e. have the LSB of the shadow equal to zero).
Instead, if CreateShadowCast() has to cast a bigger int to i1, we replace the truncation with an ICMP to 0.

This patch doesn't affect the code generated for SPEC 2006 binaries, i.e. there's no performance impact.

For the test case reported in PR32842 MSan with the patch generates a slightly more efficient code:

  orq     %rcx, %rax
  jne     .LBB0_6
, instead of:

  orl     %ecx, %eax
  testb   $1, %al
  jne     .LBB0_6

llvm-svn: 302787

7 years ago[MSAN] test failed randomly on ARM when XFAILED for MIPS
Renato Golin [Thu, 11 May 2017 11:05:52 +0000 (11:05 +0000)]
[MSAN] test failed randomly on ARM when XFAILED for MIPS

llvm-svn: 302786

7 years ago[x86] Fix a failure to select with AVX-512 when the type legalizer
Chandler Carruth [Thu, 11 May 2017 10:52:16 +0000 (10:52 +0000)]
[x86] Fix a failure to select with AVX-512 when the type legalizer
manages to form a VSELECT with a non-i1 element type condition. Those
are technically allowed in SDAG (at least, the generic type legalization
logic will form them and I wouldn't want to try to audit everything te
preclude forming them) so we need to be able to lower them.

This isn't too hard to implement. We mark VSELECT as custom so we get
a chance in C++, add a fast path for i1 conditions to get directly
handled by the patterns, and a fallback when we need to manually force
the condition to be an i1 that uses the vptestm instruction to turn
a non-mask into a mask.

This, unsurprisingly, generates awful code. But it at least doesn't
crash. This was actually impacting open source packages built with LLVM
for AVX-512 in the wild, so quickly landing a patch that at least stops
the immediate bleeding.

I think I've found where to fix the codegen quality issue, but less
confident of that change so separating it out from the thing that
doesn't change the result of any existing test case but causes mine to
not crash.

llvm-svn: 302785

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Thu, 11 May 2017 10:03:05 +0000 (10:03 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 302784

7 years agomips] XFAIL wcsncpy.cc test.
Simon Dardis [Thu, 11 May 2017 09:56:01 +0000 (09:56 +0000)]
mips] XFAIL wcsncpy.cc test.

The stack unwinder fails to unwind the stack past the interceptor stack
frame, resulting in a test failure. XFAIL this for now.

llvm-svn: 302783

7 years ago[ARM][GlobalISel] Legalize narrow scalar ops by widening
Diana Picus [Thu, 11 May 2017 09:45:57 +0000 (09:45 +0000)]
[ARM][GlobalISel] Legalize narrow scalar ops by widening

This is the same as r292827 for AArch64: we widen 8- and 16-bit ADD, SUB
and MUL to 32 bits since we only have TableGen patterns for 32 bits.
See the commit message for r292827 for more details.

At this point we could just remove some of the tests for regbankselect
and instruction-select, since we're not going to see any narrow
operations at those levels anymore. Instead I decided to update them
with G_ANYEXT/G_TRUNC operations, so we can validate the full sequences
generated by the legalizer.

llvm-svn: 302782

7 years ago[asan] Recommit of r301904: Add strndup/__strndup interceptors
Pierre Gousseau [Thu, 11 May 2017 08:53:24 +0000 (08:53 +0000)]
[asan] Recommit of r301904: Add strndup/__strndup interceptors

Fix undeclared __interceptor_malloc in esan_interceptors.cc
Fix undeclared strnlen on OSX

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

llvm-svn: 302781

7 years agoRemove spurious cast of nullptr. NFC.
Serge Guelton [Thu, 11 May 2017 08:53:00 +0000 (08:53 +0000)]
Remove spurious cast of nullptr. NFC.

Conversion rules allow automatic casting of nullptr to any pointer type.

llvm-svn: 302780

7 years agoRemove now useless trailing nullptr in StructType::get
Serge Guelton [Thu, 11 May 2017 08:46:02 +0000 (08:46 +0000)]
Remove now useless trailing nullptr in StructType::get

llvm-svn: 302779

7 years ago[ARM][GlobalISel] Support for G_ANYEXT
Diana Picus [Thu, 11 May 2017 08:28:31 +0000 (08:28 +0000)]
[ARM][GlobalISel] Support for G_ANYEXT

G_ANYEXT can be introduced by the legalizer when widening scalars. Add
support for it in the register bank info (same mapping as everything
else) and in the instruction selector.

When selecting it, we treat it as a COPY, just like G_TRUNC. On this
occasion we get rid of some assertions in selectCopy so we can reuse it.
This shouldn't be a problem at the moment since we're not supporting any
complicated cases (e.g. FPR, different register banks). We might want to
separate the paths when we do.

llvm-svn: 302778

7 years agoReverted r302775
Serge Pavlov [Thu, 11 May 2017 08:25:22 +0000 (08:25 +0000)]
Reverted r302775

llvm-svn: 302777

7 years agoRevert "PR22877: When constructing an array via a constructor with a default argument...
Diana Picus [Thu, 11 May 2017 08:10:41 +0000 (08:10 +0000)]
Revert "PR22877: When constructing an array via a constructor with a default argument in list-initialization, run cleanups for the default argument after each iteration of the initialization loop."

Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc."

This reverts commit r302750 and its fixup r302757 because the test is
still breaking on some of the ARM bots.

array-default-argument.cpp:20:12: error: expected string not found in input
 // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]])
           ^
<stdin>:18:1: note: scanning from here
arrayctor.loop: ; preds = %arrayctor.loop, %entry
^
<stdin>:28:2: note: possible intended match here
 call void @_Z1fv()
 ^

--

llvm-svn: 302776

7 years agoDriver must return non-zero code on errors in command line
Serge Pavlov [Thu, 11 May 2017 08:00:33 +0000 (08:00 +0000)]
Driver must return non-zero code on errors in command line

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 302775

7 years ago[GlobalISel][X86] G_ICMP support.
Igor Breger [Thu, 11 May 2017 07:17:40 +0000 (07:17 +0000)]
[GlobalISel][X86] G_ICMP support.

Summary: support G_ICMP for scalar types i8/i16/i64.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, llvm-commits, krytarowski

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

llvm-svn: 302774

7 years agoFix `std::visit` for the zero variants case.
Michael Park [Thu, 11 May 2017 07:17:12 +0000 (07:17 +0000)]
Fix `std::visit` for the zero variants case.

Summary:
The following code is broken:

```
    std::visit([]{});
```

Reviewers: EricWF

Reviewed By: EricWF

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

llvm-svn: 302773

7 years ago[APInt] Remove an unneeded extra temporary APInt from toString.
Craig Topper [Thu, 11 May 2017 07:10:43 +0000 (07:10 +0000)]
[APInt] Remove an unneeded extra temporary APInt from toString.

Turns out udivrem can write its output to the same location as one of its inputs so the extra temporary isn't needed.

llvm-svn: 302772

7 years agoMake tests from r302765 windows friendly
Bruno Cardoso Lopes [Thu, 11 May 2017 07:06:52 +0000 (07:06 +0000)]
Make tests from r302765 windows friendly

and appease:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2030

llvm-svn: 302771

7 years ago[APInt] Use negate() instead of copying an APInt to negate it and then writing back...
Craig Topper [Thu, 11 May 2017 07:02:04 +0000 (07:02 +0000)]
[APInt] Use negate() instead of copying an APInt to negate it and then writing back over the original value.

llvm-svn: 302770

7 years ago[SCEV] Reduce possible APInt allocations a bit.
Craig Topper [Thu, 11 May 2017 06:48:54 +0000 (06:48 +0000)]
[SCEV] Reduce possible APInt allocations a bit.

llvm-svn: 302769

7 years ago[SCEV] Remove unneeded 'using namespace APIntOps'.
Craig Topper [Thu, 11 May 2017 06:48:51 +0000 (06:48 +0000)]
[SCEV] Remove unneeded 'using namespace APIntOps'.

llvm-svn: 302768

7 years ago[X86] Move getX86ConditionCode() from X86FastISel.cpp to X86InstrInfo.cpp. NFC
Igor Breger [Thu, 11 May 2017 06:36:37 +0000 (06:36 +0000)]
[X86] Move getX86ConditionCode() from X86FastISel.cpp to X86InstrInfo.cpp. NFC

Summary:
Move getX86ConditionCode() from X86FastISel.cpp to X86InstrInfo.cpp so it can be used by GloabalIsel instruction selector.
This is a pre-commit for a patch I'm working on to support G_ICMP. NFC.

Reviewers: zvi, guyblank, delena

Reviewed By: guyblank, delena

Subscribers: llvm-commits

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

llvm-svn: 302767

7 years agoSupportTests: Suppress ParallelTests on mingw for now. Investigating.
NAKAMURA Takumi [Thu, 11 May 2017 06:35:51 +0000 (06:35 +0000)]
SupportTests: Suppress ParallelTests on mingw for now. Investigating.

llvm-svn: 302766

7 years ago[Sema] Improve redefinition errors pointing to the same header
Bruno Cardoso Lopes [Thu, 11 May 2017 06:20:07 +0000 (06:20 +0000)]
[Sema] Improve redefinition errors pointing to the same header

Diagnostics related to redefinition errors that point to the same header
file do not provide much information that helps users fixing the issue.

- In the modules context, it usually happens because of non modular
includes.
- When modules aren't involved it might happen because of the lack of
header guards.

Enhance diagnostics in these scenarios.

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

rdar://problem/31669175

llvm-svn: 302765

7 years agoRevert "[libcxxabi] Align unwindHeader on a double-word boundary."
Akira Hatanaka [Thu, 11 May 2017 06:17:49 +0000 (06:17 +0000)]
Revert "[libcxxabi] Align unwindHeader on a double-word boundary."

This reverts commit r302763.

The commit caused bot failures.

llvm-svn: 302764

7 years ago[libcxxabi] Align unwindHeader on a double-word boundary.
Akira Hatanaka [Thu, 11 May 2017 05:58:52 +0000 (05:58 +0000)]
[libcxxabi] Align unwindHeader on a double-word boundary.

r276215 made a change to annotate _Unwind_Exception with attribute
"aligned" so that an exception object following field __cxa_exception
is sufficiently aligned. This fix hasn't been incorporated to unwind.h
on Darwin since it is an ABI breaking change.

Instead of annotating struct _Unwind_Exception with the attribute, this
commit annotates field unwindHeader of __cxa_exception. This ensures the
exception object is sufficiently aligned without breaking the ABI.

rdar://problem/25364625

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

llvm-svn: 302763

7 years agoRevert "Rename c++abi.a on Windows to libc++abi to avoid name conflicts"
Eric Fiselier [Thu, 11 May 2017 05:05:06 +0000 (05:05 +0000)]
Revert "Rename c++abi.a on Windows to libc++abi to avoid name conflicts"

This reverts commit r302759

llvm-svn: 302762

7 years agoAllow undefined symbols when linking libc++abi.dll on Windows
Eric Fiselier [Thu, 11 May 2017 03:49:48 +0000 (03:49 +0000)]
Allow undefined symbols when linking libc++abi.dll on Windows

llvm-svn: 302761

7 years agoFix Libc++abi linking under MinGW64
Eric Fiselier [Thu, 11 May 2017 03:29:59 +0000 (03:29 +0000)]
Fix Libc++abi linking under MinGW64

llvm-svn: 302760

7 years agoRename c++abi.a on Windows to libc++abi to avoid name conflicts
Eric Fiselier [Thu, 11 May 2017 03:18:29 +0000 (03:18 +0000)]
Rename c++abi.a on Windows to libc++abi to avoid name conflicts

llvm-svn: 302759

7 years agoPrune unused \param(s) of clang::Parser::ParseTemplateIdAfterTemplateName() in r30273...
NAKAMURA Takumi [Thu, 11 May 2017 02:43:47 +0000 (02:43 +0000)]
Prune unused \param(s) of clang::Parser::ParseTemplateIdAfterTemplateName() in r302737. [-Wdocumentation]

llvm-svn: 302758

7 years agoclang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thisc...
NAKAMURA Takumi [Thu, 11 May 2017 02:39:30 +0000 (02:39 +0000)]
clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc.

llvm-svn: 302757

7 years agoRemove redundant initialization. NFC
Paul Robinson [Thu, 11 May 2017 02:07:08 +0000 (02:07 +0000)]
Remove redundant initialization. NFC

Post-commit review of r301940 by David Blaikie.

llvm-svn: 302756

7 years agoDon't use posix_memalign under MinGW
Eric Fiselier [Thu, 11 May 2017 02:01:05 +0000 (02:01 +0000)]
Don't use posix_memalign under MinGW

llvm-svn: 302755

7 years agoApply libc++ MinGW CMake fix to libc++abi
Eric Fiselier [Thu, 11 May 2017 02:00:25 +0000 (02:00 +0000)]
Apply libc++ MinGW CMake fix to libc++abi

llvm-svn: 302754

7 years agoAdd temporary workaround to allow in-tree libc++ builds on Windows
Eric Fiselier [Thu, 11 May 2017 01:44:30 +0000 (01:44 +0000)]
Add temporary workaround to allow in-tree libc++ builds on Windows

llvm-svn: 302753

7 years agoFinal (hopefully) fix for the build bots.
Zachary Turner [Thu, 11 May 2017 00:22:18 +0000 (00:22 +0000)]
Final (hopefully) fix for the build bots.

This time it actually occurred to me to change the #defines
to actually test the pre-processed out codepath.  Hopefully
this time it works.

llvm-svn: 302752

7 years agoTry again to fix the buildbots.
Zachary Turner [Thu, 11 May 2017 00:18:52 +0000 (00:18 +0000)]
Try again to fix the buildbots.

TaskGroup and Latch need to be in llvm::parallel::detail, not
in llvm::detail.

llvm-svn: 302751

7 years agoPR22877: When constructing an array via a constructor with a default argument
Richard Smith [Thu, 11 May 2017 00:17:17 +0000 (00:17 +0000)]
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

llvm-svn: 302750

7 years agoFix build errors with Parallel.
Zachary Turner [Thu, 11 May 2017 00:09:30 +0000 (00:09 +0000)]
Fix build errors with Parallel.

llvm-svn: 302749

7 years ago[Support] Move Parallel algorithms from LLD to LLVM.
Zachary Turner [Thu, 11 May 2017 00:03:52 +0000 (00:03 +0000)]
[Support] Move Parallel algorithms from LLD to LLVM.

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

llvm-svn: 302748

7 years ago[libFuzzer] fix a compiler warning
Kostya Serebryany [Wed, 10 May 2017 23:59:03 +0000 (23:59 +0000)]
[libFuzzer] fix a compiler warning

llvm-svn: 302747

7 years agoRevert "[SDAG] Relax conditions under stores of loaded values can be merged"
David L. Jones [Wed, 10 May 2017 23:56:21 +0000 (23:56 +0000)]
Revert "[SDAG] Relax conditions under stores of loaded values can be merged"

This reverts r302712.

The change fails with ASAN enabled:

ERROR: AddressSanitizer: use-after-poison on address ... at ...
READ of size 2 at ... thread T0
  #0 ... in llvm::SDNode::getNumValues() const <snip>/include/llvm/CodeGen/SelectionDAGNodes.h:855:42
  #1 ... in llvm::SDNode::hasAnyUseOfValue(unsigned int) const <snip>/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:7270:3
  #2 ... in llvm::SDValue::use_empty() const <snip> include/llvm/CodeGen/SelectionDAGNodes.h:1042:17
  #3 ... in (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*) <snip>/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12944:7

Reviewers: niravd

Subscribers: llvm-commits

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

llvm-svn: 302746

7 years ago[IR] Rollback changes in r302744 which caused buildbots failures.
Eugene Zelenko [Wed, 10 May 2017 23:53:40 +0000 (23:53 +0000)]
[IR] Rollback changes in r302744 which caused buildbots failures.

llvm-svn: 302745

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Wed, 10 May 2017 23:41:30 +0000 (23:41 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 302744

7 years agoWorkaround -W#warnings on Windows until the correct fixes can land
Eric Fiselier [Wed, 10 May 2017 23:29:13 +0000 (23:29 +0000)]
Workaround -W#warnings on Windows until the correct fixes can land

llvm-svn: 302743

7 years ago[PHIElimination] Use the same name for DEBUG_TYPE and pass name.
Davide Italiano [Wed, 10 May 2017 23:13:26 +0000 (23:13 +0000)]
[PHIElimination] Use the same name for DEBUG_TYPE and pass name.

In an attempt to reduce the confusion.

llvm-svn: 302742

7 years agoclang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.
NAKAMURA Takumi [Wed, 10 May 2017 22:30:44 +0000 (22:30 +0000)]
clang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.

llvm-svn: 302741

7 years agoPartially revert r302685 and swith Apple-style full LTO builds to
Adrian Prantl [Wed, 10 May 2017 22:14:23 +0000 (22:14 +0000)]
Partially revert r302685 and swith Apple-style full LTO builds to
-gline-tables-only. The memory consumption is apparently still too
much for some of the green dragon builders.

<rdar://problem/28672159>

llvm-svn: 302740

7 years ago[libc++abi] Disable libc++ extern templates project-wide
Shoaib Meenai [Wed, 10 May 2017 21:52:39 +0000 (21:52 +0000)]
[libc++abi] Disable libc++ extern templates project-wide

libc++abi can't depend on libc++, so disable extern templates in libc++
headers project-wide. This was previously done in cxa_demangle.cpp, but
I consider it more appropriate to do at the cmake level (since none of
libc++abi's source files can use libc++ extern templates).

I also think the _LIBCPP_NO_EXCEPTIONS in cxa_demangle.cpp is
suspicious, but I'm doing one thing at a time.

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

llvm-svn: 302739

7 years ago[Myriad] Pass -Xclang and -mllvm flags to moviCompile
James Y Knight [Wed, 10 May 2017 21:48:13 +0000 (21:48 +0000)]
[Myriad] Pass -Xclang and -mllvm flags to moviCompile

Patch by Walter Lee.

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

llvm-svn: 302738

7 years agoChanges missed from r302732.
Richard Smith [Wed, 10 May 2017 21:47:30 +0000 (21:47 +0000)]
Changes missed from r302732.

llvm-svn: 302737

7 years agoRemove usages of _LIBCPP_MSVC which is never defined
Eric Fiselier [Wed, 10 May 2017 21:40:58 +0000 (21:40 +0000)]
Remove usages of _LIBCPP_MSVC which is never defined

llvm-svn: 302736

7 years ago[NFC] [Fortran Support] move Fortran array detection testcases
Siddharth Bhat [Wed, 10 May 2017 21:35:14 +0000 (21:35 +0000)]
[NFC] [Fortran Support] move Fortran array detection testcases

move these testcases to where they belong: ScopDetect

llvm-svn: 302735

7 years agoFix MinGW build to use Pthread when the header is available.
Eric Fiselier [Wed, 10 May 2017 21:34:58 +0000 (21:34 +0000)]
Fix MinGW build to use Pthread when the header is available.

Some MinGW configurations use WinPThread instead of the native
threading interfaces. When this happens libc++ doesn't build because
it tries to use the wrong threading API.

This patch attempts to correctly detect and enable pthreads; Selecting
them when __MINGW32__ is defined and __has_include(<pthread.h>) is true.
I'm not sure if this works correctly 100% of the time but it seemed
like the most correct approach available.

llvm-svn: 302734

7 years ago[InstCombine] remove fold that swaps xor/or with constants; NFCI
Sanjay Patel [Wed, 10 May 2017 21:33:55 +0000 (21:33 +0000)]
[InstCombine] remove fold that swaps xor/or with constants; NFCI

// (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

This canonicalization was added at:
https://reviews.llvm.org/rL7264

By moving xors out/down, we can more easily combine constants. I'm adding
tests that do not change with this patch, so we can verify that those kinds
of transforms are still happening.

This is no-functional-change-intended because there's a later fold:
// (X^C)|Y -> (X|Y)^C iff Y&C == 0
...and demanded-bits appears to guarantee that any fold that would have
hit the fold we're removing here would be caught by that 2nd fold.

Similar reasoning was used in:
https://reviews.llvm.org/rL299384

The larger motivation for removing this code is that it could interfere with
the fix for PR32706:
https://bugs.llvm.org/show_bug.cgi?id=32706

Ie, we're not checking if the 'xor' is actually a 'not', so we could reverse
a 'not' optimization and cause an infinite loop by altering an 'xor X, -1'.

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

llvm-svn: 302733

7 years agoImprove diagnosis of unknown template name.
Richard Smith [Wed, 10 May 2017 21:32:16 +0000 (21:32 +0000)]
Improve diagnosis of unknown template name.

When an undeclared identifier in a context that requires a type is followed by
'<', only look for type templates when typo-correcting, tweak the diagnostic
text to say that a template name (not a type name) was undeclared, and parse
the template arguments when recovering from the error.

llvm-svn: 302732

7 years agoDon't interfere with the __builtin_foo namespace under MSVC
Eric Fiselier [Wed, 10 May 2017 21:30:04 +0000 (21:30 +0000)]
Don't interfere with the __builtin_foo namespace under MSVC

This patch follows up on feedback received in the review for
D32988. Specifically that libc++ should not mess with the
__builtin namespace, and that libc++ should use __popcnt to implement
__pop_count under MSVC.

llvm-svn: 302731

7 years agoAMDGPU: Make some packed shuffles free
Matt Arsenault [Wed, 10 May 2017 21:29:33 +0000 (21:29 +0000)]
AMDGPU: Make some packed shuffles free

VOP3P instructions can encode access to either
half of the register.

llvm-svn: 302730

7 years agoAMDGPU: Add new subtarget features for gfx9 flat instructions
Matt Arsenault [Wed, 10 May 2017 21:19:05 +0000 (21:19 +0000)]
AMDGPU: Add new subtarget features for gfx9 flat instructions

Flat instructions gain an immediate offset, and 2 new
sets of segment specific flat instructions are added.

llvm-svn: 302729

7 years agoFix bad #endif in msvc_stdlib_force_include.hpp.
Billy Robert O'Neal III [Wed, 10 May 2017 20:58:30 +0000 (20:58 +0000)]
Fix bad #endif in msvc_stdlib_force_include.hpp.

llvm-svn: 302728

7 years ago[libc++] Refactor Windows support headers.
Eric Fiselier [Wed, 10 May 2017 20:57:45 +0000 (20:57 +0000)]
[libc++] Refactor Windows support headers.

Summary:
This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers.

The changes in this patch are:

* remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers.

* Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles.

* Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang.

I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check?

This refactor is needed to support upcoming fixes to `<locale>` on Windows.

Reviewers: bcraig, rmaprath, compnerd, EricWF

Reviewed By: EricWF

Subscribers: majnemer, cfe-commits

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

llvm-svn: 302727

7 years ago[Simplify] Mark variables as used. NFC.
Michael Kruse [Wed, 10 May 2017 20:45:10 +0000 (20:45 +0000)]
[Simplify] Mark variables as used. NFC.

Mark one more variable as used that is needed in assertions.

llvm-svn: 302726

7 years ago[Simplify] Mark variables as used. NFC.
Michael Kruse [Wed, 10 May 2017 20:42:02 +0000 (20:42 +0000)]
[Simplify] Mark variables as used. NFC.

Mark variables as used that are needed in assertions.

llvm-svn: 302725

7 years agoImplement LWG 2591 - Patch from K-Ballo
Eric Fiselier [Wed, 10 May 2017 20:37:43 +0000 (20:37 +0000)]
Implement LWG 2591 - Patch from K-Ballo

llvm-svn: 302724

7 years agoXFAIL is_trivially_copyable test for compilers that don't implement Core 2094
Eric Fiselier [Wed, 10 May 2017 20:19:35 +0000 (20:19 +0000)]
XFAIL is_trivially_copyable test for compilers that don't implement Core 2094

llvm-svn: 302723

7 years ago[Fix][Fortran Support] Don't use -debug-only in pattern matching test cases
Siddharth Bhat [Wed, 10 May 2017 20:10:17 +0000 (20:10 +0000)]
[Fix][Fortran Support] Don't use -debug-only in pattern matching test cases

-debug-only is unnecessary and causes the tests to break in Release
mode. Remove the option to opt in the test cases.

llvm-svn: 302722

7 years agoFix enable_shared_from_this test in C++11
Eric Fiselier [Wed, 10 May 2017 20:09:20 +0000 (20:09 +0000)]
Fix enable_shared_from_this test in C++11

llvm-svn: 302721

7 years agoFix errored return value in CheckFunctionReturnType and add a fixit hint
Erich Keane [Wed, 10 May 2017 20:03:16 +0000 (20:03 +0000)]
Fix errored return value in CheckFunctionReturnType and add a fixit hint

As discovered by ChenWJ and listed on cfe-dev, the error for Objective C
return type ended up being wrong. This fixes that. Additionally, as a
"while we're there", the other usages of this error and the usage of the
FP above both use a FixItHint, so I'll add it here.

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

llvm-svn: 302720

7 years agoRemove unused #include.
Rui Ueyama [Wed, 10 May 2017 20:02:41 +0000 (20:02 +0000)]
Remove unused #include.

llvm-svn: 302719

7 years agoRename parallelFor -> parallelForEachN.
Rui Ueyama [Wed, 10 May 2017 20:02:19 +0000 (20:02 +0000)]
Rename parallelFor -> parallelForEachN.

So that it is clear that the function is a wrapper for for_each_n.

llvm-svn: 302718

7 years ago[ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers...
Craig Topper [Wed, 10 May 2017 20:01:48 +0000 (20:01 +0000)]
[ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers to really do what the comment says

r271020 added an early out to skip the signed multiply portion of ConstantRange::multiply. The comment says we don't need to do signed multiply if the range is only positive numbers, but the implemented check only ensures that the start of the range is positive. It doesn't look at the end of the range.

This patch checks the end of the range instead. Because Upper is one more than the end we have to see if its positive or if its one past the last positive number.

llvm-svn: 302717

7 years ago[APInt] Add negate helper method to implement twos complement. Use it to shorten...
Craig Topper [Wed, 10 May 2017 20:01:38 +0000 (20:01 +0000)]
[APInt] Add negate helper method to implement twos complement. Use it to shorten code.

llvm-svn: 302716

7 years ago[DeLICM] Avoid compiler warning. NFC.
Michael Kruse [Wed, 10 May 2017 19:58:52 +0000 (19:58 +0000)]
[DeLICM] Avoid compiler warning. NFC.

gcc 5.4 warns about using a C-style case to case away a const.
Use case a const_cast instead.

llvm-svn: 302715

7 years ago[NewGVN] Introduce a definesNoMemory() helper and use it.
Davide Italiano [Wed, 10 May 2017 19:57:43 +0000 (19:57 +0000)]
[NewGVN] Introduce a definesNoMemory() helper and use it.

This is nice as is, but it will be used in my next patch to
fix a bug. Suggested by Daniel Berlin.

llvm-svn: 302714

7 years agoClean up LIT failure output by not showing the entire environment
Eric Fiselier [Wed, 10 May 2017 19:55:42 +0000 (19:55 +0000)]
Clean up LIT failure output by not showing the entire environment

llvm-svn: 302713