platform/upstream/llvm.git
7 years ago[AVX-512] Lower AVX cvtpd2ps intrinsic to ISD::FP_ROUND so it can use EVEX instructio...
Craig Topper [Sun, 6 Nov 2016 04:12:46 +0000 (04:12 +0000)]
[AVX-512] Lower AVX cvtpd2ps intrinsic to ISD::FP_ROUND so it can use EVEX instruction when available.

llvm-svn: 286057

7 years ago[AVX-512] Lower SSE/AVX cvtdq2ps intrinsics directly to ISD::SINT_TO_FP so they can...
Craig Topper [Sun, 6 Nov 2016 04:12:42 +0000 (04:12 +0000)]
[AVX-512] Lower SSE/AVX cvtdq2ps intrinsics directly to ISD::SINT_TO_FP so they can use EVEX instructions when available.

llvm-svn: 286056

7 years ago[AVX-512] Add -show-mc-encoding to legacy vector intrinsic tests so we can see when...
Craig Topper [Sun, 6 Nov 2016 02:03:58 +0000 (02:03 +0000)]
[AVX-512] Add -show-mc-encoding to legacy vector intrinsic tests so we can see when VEX or EVEX encoded instructions are being emitted. Make sure the tests all have an avx2 command line and an skx command line.

llvm-svn: 286055

7 years agoFix build breakage.
Rui Ueyama [Sat, 5 Nov 2016 23:14:54 +0000 (23:14 +0000)]
Fix build breakage.

llvm-svn: 286054

7 years agoRewrite CommonInputSection as a synthetic input section.
Rui Ueyama [Sat, 5 Nov 2016 23:05:47 +0000 (23:05 +0000)]
Rewrite CommonInputSection as a synthetic input section.

A CommonInputSection is a section containing all common symbols.
That was an input section but was abstracted in a different way
than the synthetic input sections because it was written before
the synthetic input section was invented.

This patch rewrites CommonInputSection as a synthetic input section
so that it behaves better with other sections.

llvm-svn: 286053

7 years ago[ELF][MIPS] N32 ABI support
Simon Atanasyan [Sat, 5 Nov 2016 22:58:01 +0000 (22:58 +0000)]
[ELF][MIPS] N32 ABI support

In short the patch introduces support for linking object file conform
MIPS N32 ABI [1]. This ABI is similar to N64 ABI but uses 32-bit
pointer size.

The most non-trivial requirement of this ABI is one more relocation
packing format. N64 ABI puts multiple relocation type into the single
relocation record. The N32 ABI uses series of successive relocations
with the same offset for this purpose. In this patch, new function
`mergeMipsN32RelTypes` handle this case and "convert" N32 relocation to
the N64 relocation so the rest of the code keep unchanged.

For now, linker does not support series of relocations applied to sections
without SHF_ALLOC bit. Probably later I will add the support or insert
some sort of assert into the `relocateNonAlloc` routine to catch this
case.

[1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf

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

llvm-svn: 286052

7 years agoCreate a vector containing all input sections.
Rui Ueyama [Sat, 5 Nov 2016 22:37:59 +0000 (22:37 +0000)]
Create a vector containing all input sections.

Previously, we do this piece of code to iterate over all input sections.

  for (elf::ObjectFile<ELFT> *F : Symtab.getObjectFiles())
    for (InputSectionBase<ELFT> *S : F->getSections())

It turned out that this mechanisms doesn't work well with synthetic
input sections because synthetic input sections don't belong to any
input file.

This patch defines a vector that contains all input sections including
synthetic ones.

llvm-svn: 286051

7 years agoIslNodeBuilder: Ensure newly generated memory accesses are well-defined
Tobias Grosser [Sat, 5 Nov 2016 21:46:01 +0000 (21:46 +0000)]
IslNodeBuilder: Ensure newly generated memory accesses are well-defined

Add some additional asserts that ensure newly code-generated memory accesses
are defined on all domain and schedule domain instances.

llvm-svn: 286050

7 years ago[Hexagon] Relocate pattern-related bits to proper places
Krzysztof Parzyszek [Sat, 5 Nov 2016 21:44:50 +0000 (21:44 +0000)]
[Hexagon] Relocate pattern-related bits to proper places

llvm-svn: 286049

7 years ago[Hexagon] Round 1 of selection pattern simplifications
Krzysztof Parzyszek [Sat, 5 Nov 2016 21:02:54 +0000 (21:02 +0000)]
[Hexagon] Round 1 of selection pattern simplifications

Consistently use register class pat frags instead of spelling out
the type and class each time.

llvm-svn: 286048

7 years agoScopInfo: Ensure copy statement memory accesses are correct
Tobias Grosser [Sat, 5 Nov 2016 21:02:43 +0000 (21:02 +0000)]
ScopInfo: Ensure copy statement memory accesses are correct

Add asserts that verify that the memory accesses of a new copy statement
are defined for all domain instances the copy statement is defined for.

llvm-svn: 286047

7 years agotest commit
Boris Ulasevich [Sat, 5 Nov 2016 20:25:18 +0000 (20:25 +0000)]
test commit

llvm-svn: 286046

7 years ago[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsBlend. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 18:31:57 +0000 (18:31 +0000)]
[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsBlend. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286045

7 years ago[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsZeroOrAnyExtend. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 18:22:13 +0000 (18:22 +0000)]
[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsZeroOrAnyExtend. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286044

7 years ago[X86][SSE] Reuse zeroable element mask in SSE4A EXTRQ/INSERTQ vector shuffle lowering...
Simon Pilgrim [Sat, 5 Nov 2016 18:05:13 +0000 (18:05 +0000)]
[X86][SSE] Reuse zeroable element mask in SSE4A EXTRQ/INSERTQ vector shuffle lowering. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286043

7 years ago[X86][SSE] Reuse zeroable element mask in PSHUFB vector shuffle lowering. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 17:53:27 +0000 (17:53 +0000)]
[X86][SSE] Reuse zeroable element mask in PSHUFB vector shuffle lowering. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286042

7 years agoclang-format: Better support for CUDA's triple brackets.
Daniel Jasper [Sat, 5 Nov 2016 17:43:16 +0000 (17:43 +0000)]
clang-format: Better support for CUDA's triple brackets.

Before:
  aaaaaaaaaaaaaaa<
      aaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaa><<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>>>();

After:
  aaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
      <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>>>();

llvm-svn: 286041

7 years ago[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsInsertPS. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 17:27:48 +0000 (17:27 +0000)]
[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsInsertPS. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286040

7 years ago[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsBitMask. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 17:12:19 +0000 (17:12 +0000)]
[X86][SSE] Reuse zeroable element mask in lowerVectorShuffleAsBitMask. NFCI

Don't regenerate a zeroable element mask with computeZeroableShuffleElements when its already available.

llvm-svn: 286039

7 years ago[LoopStrengthReduce] Don't use a DenseSet<int64_t> when we might add any valid int64_...
Justin Lebar [Sat, 5 Nov 2016 16:47:25 +0000 (16:47 +0000)]
[LoopStrengthReduce] Don't use a DenseSet<int64_t> when we might add any valid int64_t to the set.

Summary:
SmallSetVector uses DenseSet, but that means we need to reserve some
values for the empty and tombstone keys.

It seems to me we should have a general way to let us store full-range
ints inside of DenseSets, and furthermore that we probably shouldn't
silently let you add ints into DenseSets without explicitly promising
that they're in range.  But that's a battle for another day; for now,
just fix this code, since we currently do something Very Bad when
compiling ffmpeg.

Fixes PR30914.

Reviewers: jeremyhu

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 286038

7 years ago[X86][SSE] Reuse zeroable element mask instead of regenerating it. NFCI
Simon Pilgrim [Sat, 5 Nov 2016 16:40:20 +0000 (16:40 +0000)]
[X86][SSE] Reuse zeroable element mask instead of regenerating it. NFCI

We are repeatedly calling computeZeroableShuffleElements in many shuffle lowering calls for the same shuffle mask/inputs.

This is a first step towards reusing the zeroable result, initially just for lowerVectorShuffleAsShift calls.

llvm-svn: 286037

7 years ago[Hexagon] Split all selection patterns into a separate file
Krzysztof Parzyszek [Sat, 5 Nov 2016 15:01:38 +0000 (15:01 +0000)]
[Hexagon] Split all selection patterns into a separate file

This is just the basic separation, without any cleanup. Further changes
will follow.

llvm-svn: 286036

7 years agomake-core.sh: add FreeBSD support
Ed Maste [Sat, 5 Nov 2016 14:45:13 +0000 (14:45 +0000)]
make-core.sh: add FreeBSD support

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

llvm-svn: 286035

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Sat, 5 Nov 2016 14:43:04 +0000 (14:43 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 286034

7 years ago[AVX-512] Use an equality compare instead of StringRef::startswith in a few places...
Craig Topper [Sat, 5 Nov 2016 05:35:23 +0000 (05:35 +0000)]
[AVX-512] Use an equality compare instead of StringRef::startswith in a few places in auto upgrade that were looking for the complete intrinsic name anyway.

llvm-svn: 286033

7 years agoCorrect mprotect page boundries to round up end page. Fixes PR30905.
Alina Sbirlea [Sat, 5 Nov 2016 04:22:15 +0000 (04:22 +0000)]
Correct mprotect page boundries to round up end page. Fixes PR30905.

Summary:
Update the boundries for mprotect.
Patch by Andrew Adams. Fixes PR30905.

Reviewers: loladiro, andrew.w.kaylor, chandlerc

Subscribers: abadams, llvm-commits

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

llvm-svn: 286032

7 years ago[X86] Remove broken support for autoupgrading llvm.x86.fma4.* intrinsics to llvm...
Craig Topper [Sat, 5 Nov 2016 04:00:31 +0000 (04:00 +0000)]
[X86] Remove broken support for autoupgrading llvm.x86.fma4.* intrinsics to llvm.x86.fma.*.

It currently fires an assert if you even try. Looking back, I don't think it ever worked because it only changed the name of the function object, but not the intrinsic ID stored in it. Given that, I think it can be removed since no one has noticed or complained in the past 4 years.

llvm-svn: 286031

7 years agoFix some Clang-tidy modernize-use-default and Include What You Use warnings; other...
Eugene Zelenko [Sat, 5 Nov 2016 01:00:56 +0000 (01:00 +0000)]
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.

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

llvm-svn: 286030

7 years agoUpgrade in-tree google benchmark to v1.1
Eric Fiselier [Sat, 5 Nov 2016 00:30:27 +0000 (00:30 +0000)]
Upgrade in-tree google benchmark to v1.1

llvm-svn: 286029

7 years agoFix buildbot.
Rui Ueyama [Fri, 4 Nov 2016 23:26:29 +0000 (23:26 +0000)]
Fix buildbot.

llvm-svn: 286028

7 years agoAppend a (uint32_t)pad into arm_thread_state64_t. Implicit pad isn't appended on...
NAKAMURA Takumi [Fri, 4 Nov 2016 23:22:19 +0000 (23:22 +0000)]
Append a (uint32_t)pad into arm_thread_state64_t. Implicit pad isn't appended on i686.

llvm-svn: 286027

7 years ago[ExecutionEngine] Document the insane ownership contract for
Lang Hames [Fri, 4 Nov 2016 22:29:34 +0000 (22:29 +0000)]
[ExecutionEngine] Document the insane ownership contract for
ExecutionEngine::removeModule.

llvm-svn: 286026

7 years agoDon't gc .interp section.
Rui Ueyama [Fri, 4 Nov 2016 22:25:39 +0000 (22:25 +0000)]
Don't gc .interp section.

This change fixes a bug that was introduced by r285851.
r285851 converted .interp section as an output section to an input
section. But I forgot to make it a "Live" section, so if -gc-section
is given, it was garbage collected.

llvm-svn: 286025

7 years agocmake: When using LLVM_DISTRIBUTION_COMPONENTS, adjust LLVMExports accordingly
Justin Bogner [Fri, 4 Nov 2016 21:55:23 +0000 (21:55 +0000)]
cmake: When using LLVM_DISTRIBUTION_COMPONENTS, adjust LLVMExports accordingly

This Makes sure we only export targets that we're distributing, since
cmake will fail to import the file otherwise due to missing targets.

llvm-svn: 286024

7 years ago[ClangTidy - performance-unnecessary-value-param] Only add "const" when current param...
Felix Berger [Fri, 4 Nov 2016 20:51:31 +0000 (20:51 +0000)]
[ClangTidy - performance-unnecessary-value-param] Only add "const" when current parameter is not already const qualified

Reviewers: alexfh, sbenza, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 286010

7 years ago[Hexagon] Account for <def,read-undef> when validating moves for predication
Krzysztof Parzyszek [Fri, 4 Nov 2016 20:41:03 +0000 (20:41 +0000)]
[Hexagon] Account for <def,read-undef> when validating moves for predication

llvm-svn: 286009

7 years ago[clang-tidy] Ignore incomplete types when determining whether they are expensive...
Felix Berger [Fri, 4 Nov 2016 20:29:22 +0000 (20:29 +0000)]
[clang-tidy] Ignore incomplete types when determining whether they are expensive to copy

Summary: IsExpensiveToCopy can return false positives for incomplete types, so ignore them.

All existing ClangTidy tests that depend on this function still pass as the types are complete.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 286008

7 years ago[libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
Stephan T. Lavavej [Fri, 4 Nov 2016 20:26:59 +0000 (20:26 +0000)]
[libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.

This replaces every occurrence of _LIBCPP_STD_VER in the tests with
TEST_STD_VER. Additionally, for every affected
file, #include "test_macros.h" is being added explicitly if it wasn't
already there.

https://reviews.llvm.org/D26294

llvm-svn: 286007

7 years agoFix 24560: assembler does not share constant pool for same constants
Weiming Zhao [Fri, 4 Nov 2016 19:17:32 +0000 (19:17 +0000)]
Fix 24560:  assembler does not share constant pool for same constants

Summary: This patch returns the same label if the CP entry with the same value has been created.

Reviewers: eli.friedman, rengolin, jmolloy

Subscribers: majnemer, jmolloy, llvm-commits

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

llvm-svn: 286006

7 years agollvm/test/Transforms/DCE/calls-errno.ll: Suppress checking @pow(+0,-1).
NAKAMURA Takumi [Fri, 4 Nov 2016 18:50:45 +0000 (18:50 +0000)]
llvm/test/Transforms/DCE/calls-errno.ll: Suppress checking @pow(+0,-1).

It depends on host's pow(3), and mingw's pow doesn't raise any errors, just returns +INF.

llvm-svn: 286005

7 years agoRevert r285968: Always use parallel_for_each because it falls back to std::for_each.
Rui Ueyama [Fri, 4 Nov 2016 18:22:36 +0000 (18:22 +0000)]
Revert r285968: Always use parallel_for_each because it falls back to std::for_each.

It turned ou that we actually want to call std::for_each even if
threading is supported. Unless --thread is given, LLD shouldn't use
more than one threads.

llvm-svn: 286004

7 years agoPreliminary plumbing work to make 'parray' able to take offset and stride options
Enrico Granata [Fri, 4 Nov 2016 18:15:39 +0000 (18:15 +0000)]
Preliminary plumbing work to make 'parray' able to take offset and stride options

llvm-svn: 286003

7 years ago[docs] Add initial Global ISel documentation.
Ahmed Bougacha [Fri, 4 Nov 2016 17:57:34 +0000 (17:57 +0000)]
[docs] Add initial Global ISel documentation.

This reflects the current state of Global ISel.  As progress is
made, we'll document our design decisions in it.
Comments very welcome!

llvm-svn: 286002

7 years agoFix -Wcast-qual warnings.
Rui Ueyama [Fri, 4 Nov 2016 17:41:29 +0000 (17:41 +0000)]
Fix -Wcast-qual warnings.

llvm-svn: 286001

7 years agoFix some Clang-tidy modernize-use-default and Include What You Use warnings; other...
Eugene Zelenko [Fri, 4 Nov 2016 17:39:46 +0000 (17:39 +0000)]
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.

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

llvm-svn: 286000

7 years ago[clang-tidy] Fixed readability-else-after-return for cascade statements
Malcolm Parsons [Fri, 4 Nov 2016 16:32:14 +0000 (16:32 +0000)]
[clang-tidy] Fixed readability-else-after-return for cascade statements

Summary:
Fix generated by this check changed program semantics
in the case where 'if' was a part (direct child) of other statement.

Fixes PR30652.

Patch by PaweÅ‚ Å»ukowski.

Reviewers: malcolm.parsons, alexfh, djasper

Subscribers: mgehre, omtcyfz, cfe-commits

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

llvm-svn: 285999

7 years ago[X86] Broadcast from memory intructions aren't unfoldable
Zvi Rackover [Fri, 4 Nov 2016 15:15:19 +0000 (15:15 +0000)]
[X86] Broadcast from memory intructions aren't unfoldable

Broadcast from memory instructions should be treated as moves. They can't be unfolded.

Fixes pr30693.

llvm-svn: 285998

7 years agoAdd bugpoint-reduced reproducer for pr30693
Zvi Rackover [Fri, 4 Nov 2016 14:53:22 +0000 (14:53 +0000)]
Add bugpoint-reduced reproducer for pr30693

llvm-svn: 285997

7 years agoAdd a few const qualifiers.
Rafael Espindola [Fri, 4 Nov 2016 13:20:45 +0000 (13:20 +0000)]
Add a few const qualifiers.

llvm-svn: 285996

7 years agoRevert "AMDGPU: Add VI i16 support"
Tom Stellard [Fri, 4 Nov 2016 13:06:34 +0000 (13:06 +0000)]
Revert "AMDGPU: Add VI i16 support"

This reverts commit r285939 and r285948.  These broke some conformance tests.

llvm-svn: 285995

7 years ago[test] Test that static_assert is properly visited in liblcang
Olivier Goffart [Fri, 4 Nov 2016 12:04:16 +0000 (12:04 +0000)]
[test] Test that static_assert is properly visited in liblcang

llvm-svn: 285994

7 years agoUpdate isl to isl-0.17.1-243-g24c0339
Tobias Grosser [Fri, 4 Nov 2016 11:56:48 +0000 (11:56 +0000)]
Update isl to isl-0.17.1-243-g24c0339

This introduces big-endian support in imath and resolves
http://llvm.org/PR24632.

llvm-svn: 285993

7 years agoFix GDBRemoteCommunicationClientTest.TestPacketSpeedJSON
Pavel Labath [Fri, 4 Nov 2016 11:49:06 +0000 (11:49 +0000)]
Fix GDBRemoteCommunicationClientTest.TestPacketSpeedJSON

The mock server was listening for only one packet (I forgot to put a loop around
it), which caused the client to stall in debug builds, as the timeout there is
1000 seconds. In case of a release builds the test would just silently succeed as
the tested function does not check or report errors (which should be fixed).

This fixes the test by adding the server loop. Since the test was taking quite a
long time now (8s), I have added a parameter to control the amount of data sent
(default 4MB), and call it with a smaller value in the test, to make the test run
faster.

llvm-svn: 285992

7 years agoComment rewording in MachineScheduler.cpp.
Jonas Paulsson [Fri, 4 Nov 2016 08:31:14 +0000 (08:31 +0000)]
Comment rewording in MachineScheduler.cpp.

Author: A Trick
llvm-svn: 285991

7 years agoAdd a missing return to the move assignment operator for
Chandler Carruth [Fri, 4 Nov 2016 07:16:33 +0000 (07:16 +0000)]
Add a missing return to the move assignment operator for
SequenceNumberManager.

Sadly, we don't have any unittests for this class because it is
a private class. Since it seems to have a nice isolated and testable
interface, it'd be great to extract it to a detail namespace and write
unit tests for it as then we could catch issues. I'll probably pester
Lang about that or some alternative refactoring.

This was noticed by PVS-Studio.

llvm-svn: 285990

7 years agoRemove dead code trying to handle when the amount of data read is
Chandler Carruth [Fri, 4 Nov 2016 07:10:24 +0000 (07:10 +0000)]
Remove dead code trying to handle when the amount of data read is
insufficient to populate the expected struct. Prior to this we already
bailed out of the routine when this situation comes up, so none of this
code had any effect.

If someone wants to bring it back to handle these cases, fixing the
earlier conditions and adding the necessary test cases that actually
exercises it, they can always revert this and go from there.

Both of these were noticed by PVS-Studio due to the identical (dead)
condition.

llvm-svn: 285989

7 years agoOnly log the visit of a return instruction if we in fact found a return
Chandler Carruth [Fri, 4 Nov 2016 06:59:50 +0000 (06:59 +0000)]
Only log the visit of a return instruction if we in fact found a return
instruction.

This avoids dereferencing null in the debug logging if the instruction
was not in fact a return instruction. This potential bug was found by
PVS-Studio.

This actually fixes the last of the "dereferenced a pointer before
checking it for null" reports in the recent PVS-Studio run. However,
there are quite a few reports of this nature that I did not do anything
to fix because they are pretty glaring false positives. They usually
took the form of quite clear correlated checks or a check made in
a separate function. I've even added asserts anywhere this correlation
wasn't pretty obvious and fundamental to the code.

llvm-svn: 285988

7 years agoHoist check for TLI above all of the attempts to use it (including one
Chandler Carruth [Fri, 4 Nov 2016 06:54:00 +0000 (06:54 +0000)]
Hoist check for TLI above all of the attempts to use it (including one
of which that is hidden inside a separate function call) and helpfully
before building expensive transaction infrastructure. This will avoid
crashing when running CGP in a generic mode if we ever managed to hit
this case.

Note that I spent some time looking at alternatives. CGP is actually
used without a TM or TLI in order to do some target-independent testing.
Further, all of the neighboring optimization techniques actually have
some paths that are effective even in the absence of TLI so this seemed
the correct scope at which to check and bypass logic. It still isn't
clear that long-term support for missing TM/TLI is the right
cost/benefit tradeoff for CGP -- we seem to get relatively little for it
and the code is just littered with checks (and assumptions which
I suspect are still missing some checks).

This at least fixes the potential bug in this code spotted by
PVS-Studio, so we've got that going for us. ;]

llvm-svn: 285987

7 years ago[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL
Olivier Goffart [Fri, 4 Nov 2016 06:50:59 +0000 (06:50 +0000)]
[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL

CXCursor_FriendDecl was added in r285984

llvm-svn: 285986

7 years agoAdd some more asserts to clearly indicate that there are special cases
Chandler Carruth [Fri, 4 Nov 2016 06:32:57 +0000 (06:32 +0000)]
Add some more asserts to clearly indicate that there are special cases
which guarantee pointers are not null. These all seem to have useful
properties and correlations to document, in one case we even had it in
a comment but now it will also be an assert.

This should prevent PVS-Studio from incorrectly claiming that there are
a bunch of potential bugs here. But I feel really strongly that the
PVS-Studio warnings that pointed at this code have a far too high
false-positive rate to be entirely useful. These are just places where
there did seem to be a useful invariant to document and verify with an
assert. Several other places in the code were already correct and
already have perfectly clear code documenting and validating their
invariants, but still ran afoul of PVS-Studio.

llvm-svn: 285985

7 years ago[index] Expose FriendDecl
Olivier Goffart [Fri, 4 Nov 2016 06:29:27 +0000 (06:29 +0000)]
[index] Expose FriendDecl

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

llvm-svn: 285984

7 years agoDelete a trivially true check for a variable 'S' being null.
Chandler Carruth [Fri, 4 Nov 2016 06:16:09 +0000 (06:16 +0000)]
Delete a trivially true check for a variable 'S' being null.

The exact same test guards entry into the loop in which this test
occurs, and there is nothing inside the loop that assigns to the
variable, so it has already been checked for null.

This was flagged by PVS-Studio as well, but the report is actually wrong
-- this is not a case where we dereference a variable prior to testing
it for null, this is a case where we have a redundant test for null
after we already performed the exact same test.

llvm-svn: 285983

7 years agoAdd an assert to further check the invariant that a null pointer
Chandler Carruth [Fri, 4 Nov 2016 06:11:54 +0000 (06:11 +0000)]
Add an assert to further check the invariant that a null pointer
corresponds to another argument being valid.

This makes it clear that the code is correct despite the PVS-Studio
report that a pointer might be dereferenced prior to being checked for
whether it is null. It likely is also enough for static analyzers to not
flag the code.

llvm-svn: 285982

7 years agoEnhancement to test for -ast-print
Serge Pavlov [Fri, 4 Nov 2016 06:09:23 +0000 (06:09 +0000)]
Enhancement to test for -ast-print

Present tests for the functionality provided by command lime option
`-ast-print` check only absence of crash. This change tries to make
testing better, - the output produced by the compiler is compiled again
with option `-print-ast` and both outputs are compared. Such test at
least checks that the output is valid code. This change fixes only the
test for pure C.

This is recommit of r285882.

llvm-svn: 285981

7 years agoRemove no-op checks for a null CodeCompleter. We have already
Chandler Carruth [Fri, 4 Nov 2016 06:06:50 +0000 (06:06 +0000)]
Remove no-op checks for a null CodeCompleter. We have already
dereferenced the pointer at this point, and these routines are
exclusively called after the parser encounters a code completion token.
Other code completion routines called at that point do not check for
null either, so this is clearly the current invariant expected in the
code.

This fixes another PVS-Studio found issue.

llvm-svn: 285980

7 years agoDo not print enum underlying type if language is not C++11
Serge Pavlov [Fri, 4 Nov 2016 06:03:34 +0000 (06:03 +0000)]
Do not print enum underlying type if language is not C++11

Output generated by option '-ast-print' must not contains enum
base type specifications if source language does not include C++11.

llvm-svn: 285979

7 years agoFix typo
Xinliang David Li [Fri, 4 Nov 2016 03:00:52 +0000 (03:00 +0000)]
Fix typo

llvm-svn: 285978

7 years agoAdded a couple more odd dot patterns that we got out
Jim Ingham [Fri, 4 Nov 2016 01:47:59 +0000 (01:47 +0000)]
Added a couple more odd dot patterns that we got out
of clang.

llvm-svn: 285977

7 years agoRemove POLLY_LINK_LIBS, it is not used
Hongbin Zheng [Fri, 4 Nov 2016 00:32:32 +0000 (00:32 +0000)]
Remove POLLY_LINK_LIBS, it is not used

llvm-svn: 285976

7 years agoX86: Move a non-null assert to before the pointer is dereferenced
Justin Bogner [Thu, 3 Nov 2016 23:55:36 +0000 (23:55 +0000)]
X86: Move a non-null assert to before the pointer is dereferenced

llvm-svn: 285975

7 years agoDon't access the process in expressions w/o checking that
Jim Ingham [Thu, 3 Nov 2016 23:42:09 +0000 (23:42 +0000)]
Don't access the process in expressions w/o checking that
the process exists.

I also added some tests that crash before this fix, and work correctly after.

<rdar://problem/29083321>

llvm-svn: 285974

7 years ago[lit] Remove TODO
Brian Gesiak [Thu, 3 Nov 2016 23:41:49 +0000 (23:41 +0000)]
[lit] Remove TODO

Summary:
Instead of keeping track of TODOs for lit in a file checked into source
control, use LLVM's bug tracker. The TODOs have been migrated to the
following bugs:

* https://llvm.org/bugs/show_bug.cgi?id=30666
* https://llvm.org/bugs/show_bug.cgi?id=30667
* https://llvm.org/bugs/show_bug.cgi?id=30668
* https://llvm.org/bugs/show_bug.cgi?id=30669
* https://llvm.org/bugs/show_bug.cgi?id=30670
* https://llvm.org/bugs/show_bug.cgi?id=30671

Reviewers: ddunbar, beanz, echristo, delcypher

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 285973

7 years agoSink all of the code relying on the MachO MachineModuleInfo to live
Chandler Carruth [Thu, 3 Nov 2016 23:33:46 +0000 (23:33 +0000)]
Sink all of the code relying on the MachO MachineModuleInfo to live
behind the test that the MachineModuleInfo analysis was
actually available and can be used.

While the MachO bits may well be reasonable to assume in the darwin
assembly printer, the analysis isn't constructively guaranteed anywhere
I could find so it seems safest to avoid crashing here.

This issue was found with PVS-Studio. Pretty sure the Clang Static
Anaylzer flags similar issues but we've probably never pointed it at
this code effectively.

llvm-svn: 285972

7 years agoRemove the unused POLLY_LINK_LIBS for linking polly into clang
Hongbin Zheng [Thu, 3 Nov 2016 22:02:40 +0000 (22:02 +0000)]
Remove the unused POLLY_LINK_LIBS for linking polly into clang

llvm-svn: 285971

7 years ago[Support] Fix a segfault in llvm::Expected.
Lang Hames [Thu, 3 Nov 2016 22:01:47 +0000 (22:01 +0000)]
[Support] Fix a segfault in llvm::Expected.

This fixes a mismatch between the declared error_type and the type used with
the placement new that initializes the field.

Patch by Yichao Yu.

llvm-svn: 285970

7 years ago[Cortex-M0] Atomic lowering
Weiming Zhao [Thu, 3 Nov 2016 21:49:08 +0000 (21:49 +0000)]
[Cortex-M0] Atomic lowering

Summary: ARMv6m supports dmb etc fench instructions but not ldrex/strex etc. So for some atomic load/store, LLVM should inline instructions instead of lowering to __sync_ calls.

Reviewers: rengolin, efriedma, t.p.northover, jmolloy

Subscribers: efriedma, aemerson, llvm-commits

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

llvm-svn: 285969

7 years agoAlways use parallel_for_each because it falls back to std::for_each.
Rui Ueyama [Thu, 3 Nov 2016 21:28:19 +0000 (21:28 +0000)]
Always use parallel_for_each because it falls back to std::for_each.

If multi-threading is disabled, parallel_for_each will automatically
fall back to std::for_each, so we don't have to do that ourselves.

llvm-svn: 285968

7 years agoAdd support for the ARM_THREAD_STATE64 and
Kevin Enderby [Thu, 3 Nov 2016 20:51:28 +0000 (20:51 +0000)]
Add support for the ARM_THREAD_STATE64 and
in llvm-objdump for Mach-O files add the printing of the
ARM_THREAD_STATE64 in the same format as
otool-classic(1) on darwin.

To do this the 64-bit ARM general tread state
needed to be defined in include/llvm/Support/MachO.h .

rdar://28985800

llvm-svn: 285967

7 years agoSimplify now that this is only used for global symbols.
Rafael Espindola [Thu, 3 Nov 2016 20:48:57 +0000 (20:48 +0000)]
Simplify now that this is only used for global symbols.

llvm-svn: 285966

7 years agoNow that the ELFFile constructor does nothing, create it when needed.
Rafael Espindola [Thu, 3 Nov 2016 20:44:50 +0000 (20:44 +0000)]
Now that the ELFFile constructor does nothing, create it when needed.

This avoids duplicating the buffer in InputFile.

llvm-svn: 285965

7 years agoNFC - Test commit.
Tony Jiang [Thu, 3 Nov 2016 20:32:21 +0000 (20:32 +0000)]
NFC - Test commit.

Delete an empty line at the end of README.txt file.

llvm-svn: 285964

7 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 20:17:25 +0000 (20:17 +0000)]
Update for llvm change.

llvm-svn: 285962

7 years agoDon't error in the ELFFile constructor.
Rafael Espindola [Thu, 3 Nov 2016 20:16:53 +0000 (20:16 +0000)]
Don't error in the ELFFile constructor.

All error checking now happens when the information is needed. The
only thing left is the minimum size of the buffer and that can be just
a precondition. I will add an ErrorOr create method in a followup
commit.

Also don't store a pointer to the Header, since it is just a trivial
cast.

llvm-svn: 285961

7 years agoAdd debug info support for C++11 inline namespaces.
Adrian Prantl [Thu, 3 Nov 2016 19:42:14 +0000 (19:42 +0000)]
Add debug info support for C++11 inline namespaces.

<rdar://problem/18616046>

llvm-svn: 285960

7 years agoAdd DWARF debug info support for C++11 inline namespaces.
Adrian Prantl [Thu, 3 Nov 2016 19:42:02 +0000 (19:42 +0000)]
Add DWARF debug info support for C++11 inline namespaces.
This implements the DWARF 5 DW_AT_export_symbols feature:
http://dwarfstd.org/ShowIssue.php?issue=141212.1

<rdar://problem/18616046>

llvm-svn: 285959

7 years ago[libFuzzer] fix -error_exitcode=N, now with a test
Kostya Serebryany [Thu, 3 Nov 2016 19:31:18 +0000 (19:31 +0000)]
[libFuzzer] fix -error_exitcode=N, now with a test

llvm-svn: 285958

7 years ago[ADT] IntervalMap: fix setStart and setStop
Michael LeMay [Thu, 3 Nov 2016 19:14:46 +0000 (19:14 +0000)]
[ADT] IntervalMap: fix setStart and setStop

Summary:
These functions currently require that the new closed interval has a length of
at least 2.  They also currently permit empty half-open intervals.  This patch
defines nonEmpty in each traits structure and uses it to correct the
implementations of setStart and setStop.

Reviewers: stoklund, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 285957

7 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 19:07:44 +0000 (19:07 +0000)]
Update for llvm change.

llvm-svn: 285956

7 years agoRemove the last use of report_fatal_error from ELF.h.
Rafael Espindola [Thu, 3 Nov 2016 19:07:15 +0000 (19:07 +0000)]
Remove the last use of report_fatal_error from ELF.h.

llvm-svn: 285955

7 years agoImprove obvious-most-derived-type devirtualization:
Richard Smith [Thu, 3 Nov 2016 18:55:18 +0000 (18:55 +0000)]
Improve obvious-most-derived-type devirtualization:

  * if the base is produced by a series of derived-to-base conversions, check
    the expression inside them when looking for an expression with a known
    dynamic type
  * step past MaterializeTemporaryExprs when checking for a known dynamic type
  * when checking for a known dynamic type, treat all class prvalues as having
    a known dynamic type after skipping all relevant rvalue subobject
    adjustments
  * treat callees formed by pointer-to-member access for a non-reference member
    type like callees formed by member access.

llvm-svn: 285954

7 years agoPDB: Fix some APIs to avoid use-after-frees
Justin Bogner [Thu, 3 Nov 2016 18:28:04 +0000 (18:28 +0000)]
PDB: Fix some APIs to avoid use-after-frees

The buffer is already owned by the PDBFile for all of these APIs, so
don't pass it in separately.

llvm-svn: 285953

7 years agoSimplify by directly using this->Symbols. NFC.
Rui Ueyama [Thu, 3 Nov 2016 18:20:08 +0000 (18:20 +0000)]
Simplify by directly using this->Symbols. NFC.

llvm-svn: 285952

7 years agoAdd error handling to getEntry.
Rafael Espindola [Thu, 3 Nov 2016 18:05:33 +0000 (18:05 +0000)]
Add error handling to getEntry.

Issue found by inspection.

llvm-svn: 285951

7 years agoInstead of resetting the pointer, or releasing it which was the previous
Chandler Carruth [Thu, 3 Nov 2016 18:03:14 +0000 (18:03 +0000)]
Instead of resetting the pointer, or releasing it which was the previous
code, let's just assert that the DiagonsticEngine doesn't own the client
because our constructor took ownership of it and has a std::unique_ptr
that handles deleting it. This seems much more clear -- the release was
harmless but confusing as if there were some memory there it would have
leaked, and the reset was harmless but confusing as if there were some
memory there it would have been double-freed. But in both cases there
was nothing there.

llvm-svn: 285950

7 years agoAdd [<chars>] to the glob matcher to eliminate use of llvm::Regex.
Rui Ueyama [Thu, 3 Nov 2016 17:57:38 +0000 (17:57 +0000)]
Add [<chars>] to the glob matcher to eliminate use of llvm::Regex.

Previously, it didn't support the character class, so we couldn't
eliminate the use fo llvm::Regex. Now that it is supported, we
can remove compileGlobPattern, which converts a glob pattern to
a regex.

This patch contains optimization for exact/prefix/suffix matches.

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

llvm-svn: 285949

7 years agoAMDGPU/SI: Re add VIInstructions.td to unbreak bots
Tom Stellard [Thu, 3 Nov 2016 17:56:46 +0000 (17:56 +0000)]
AMDGPU/SI: Re add VIInstructions.td to unbreak bots

This file is unused as of r285939, but we need to keep it around
for bots that don't do full rebuilds.   We should be able to delete this
again in a few days.

llvm-svn: 285948

7 years agofixed typo in comment
Andrey Churbanov [Thu, 3 Nov 2016 17:48:46 +0000 (17:48 +0000)]
fixed typo in comment

llvm-svn: 285947

7 years agoUsing release to free memory is at best confusing -- one would expect
Chandler Carruth [Thu, 3 Nov 2016 17:42:32 +0000 (17:42 +0000)]
Using release to free memory is at best confusing -- one would expect
that its result is in fact used. Instead, use reset.

This was pointed out by PVS-Studio.

llvm-svn: 285946

7 years agoRemove a redundant condition found by PVS-Studio.
Chandler Carruth [Thu, 3 Nov 2016 17:42:02 +0000 (17:42 +0000)]
Remove a redundant condition found by PVS-Studio.

Filed http://llvm.org/PR30897 to teach Clang to warn on this kind of
stuff.

llvm-svn: 285945

7 years agoReplace another report_fatal_error with an ErrorOr.
Rafael Espindola [Thu, 3 Nov 2016 17:37:28 +0000 (17:37 +0000)]
Replace another report_fatal_error with an ErrorOr.

llvm-svn: 285944