platform/upstream/llvm.git
7 years ago[clang] Add abi-breaking-checks support to clang
Mandeep Singh Grang [Tue, 25 Jul 2017 23:00:02 +0000 (23:00 +0000)]
[clang] Add abi-breaking-checks support to clang

Summary: You can now use REQUIRES:abi-breaking-checks in clang too

Reviewers: chapuni, probinson, ddunbar, jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, cfe-commits

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

llvm-svn: 309049

7 years agoLTO: Handle sections with valid C names.
Rafael Espindola [Tue, 25 Jul 2017 22:51:05 +0000 (22:51 +0000)]
LTO: Handle sections with valid C names.

These can be referenced with __start_/__stop_ symbols. I will try to make
this more precise in a followup patch.

llvm-svn: 309048

7 years agollvm-mt: implement simple merging of manifests, not factoring namespaces.
Eric Beckmann [Tue, 25 Jul 2017 22:50:25 +0000 (22:50 +0000)]
llvm-mt: implement simple merging of manifests, not factoring namespaces.

Summary:
Does a simple merge, where mergeable elements are combined, all others
are appended.  Does not apply trickly namespace rules.

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 309047

7 years agoSkip test_unique_stacks on Darwin, because it doesn't terminate reliably.
Sean Callanan [Tue, 25 Jul 2017 22:44:34 +0000 (22:44 +0000)]
Skip test_unique_stacks on Darwin, because it doesn't terminate reliably.

rdar://problem/33462362

llvm-svn: 309046

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Tue, 25 Jul 2017 22:39:52 +0000 (22:39 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This reverts commit 0d9d9250483761eb2f50236830161b0e2137d483.

llvm-svn: 309045

7 years ago[lit] Fix UnboundLocalError for invalid shtest redirects
Michal Gorny [Tue, 25 Jul 2017 22:38:31 +0000 (22:38 +0000)]
[lit] Fix UnboundLocalError for invalid shtest redirects

Replace the incorrect variable reference when invalid redirect is used.
This fixes the following issue:

  File "/usr/src/llvm/utils/lit/lit/TestRunner.py", line 316, in processRedirects
    raise InternalShellError(cmd, "Unsupported redirect: %r" % (r,))
UnboundLocalError: local variable 'r' referenced before assignment

which in turn broke shtest-shell.py and max-failures.py lit tests.

The breakage was introduced during refactoring in rL307310.

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

llvm-svn: 309044

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Tue, 25 Jul 2017 22:38:08 +0000 (22:38 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 309043

7 years ago[ubsan] Update a test missed in r309008, NFC
Vedant Kumar [Tue, 25 Jul 2017 22:33:28 +0000 (22:33 +0000)]
[ubsan] Update a test missed in r309008, NFC

llvm-svn: 309042

7 years agoUpdate the comments on default subtargets based on feedback.
Eric Christopher [Tue, 25 Jul 2017 22:21:08 +0000 (22:21 +0000)]
Update the comments on default subtargets based on feedback.

llvm-svn: 309041

7 years agoRevert accidental isl changes in 308923
Tobias Grosser [Tue, 25 Jul 2017 22:15:47 +0000 (22:15 +0000)]
Revert accidental isl changes in 308923

It seems I still had some incomplete changes in the tree when committing.
In general, we only import changes from isl upstream. In this case, the
changes were especially unfortunate, as they broke the error management
in isl_flow.c and consequently caused regressions.

Thanks to Michael Kruse for spotting this mistake.

llvm-svn: 309039

7 years ago[libFuzzer] don't disable msan for TracePC::CollectFeatures: this started to cause...
Kostya Serebryany [Tue, 25 Jul 2017 22:05:31 +0000 (22:05 +0000)]
[libFuzzer] don't disable msan for TracePC::CollectFeatures: this started to cause false positives in msan. No tests for libFuzzer+msan yet -- tests will need to wait until we move libFuzzer to compiler-rt

llvm-svn: 309038

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Tue, 25 Jul 2017 21:55:00 +0000 (21:55 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This reverts commit 960873b10dd071298c817ba74ef2228f94ead7a1.

llvm-svn: 309037

7 years ago[StaticAnalyzer] LoopUnrolling - Attempt to fix a crash in r309006.
Peter Szecsi [Tue, 25 Jul 2017 21:54:58 +0000 (21:54 +0000)]
[StaticAnalyzer] LoopUnrolling - Attempt to fix a crash in r309006.

llvm-svn: 309036

7 years agoRevert "Debug Info: Support fragmented variables in the MMI side table"
Adrian Prantl [Tue, 25 Jul 2017 21:50:45 +0000 (21:50 +0000)]
Revert "Debug Info: Support fragmented variables in the MMI side table"

This reverts commit r309034 because of a sanitizer issue.

llvm-svn: 309035

7 years agoDebug Info: Support fragmented variables in the MMI side table
Adrian Prantl [Tue, 25 Jul 2017 21:29:22 +0000 (21:29 +0000)]
Debug Info: Support fragmented variables in the MMI side table

<rdar://problem/17816343>

llvm-svn: 309034

7 years ago[scudo] Check for pvalloc overflow
Kostya Kortchinsky [Tue, 25 Jul 2017 21:18:02 +0000 (21:18 +0000)]
[scudo] Check for pvalloc overflow

Summary:
Previously we were rounding up the size passed to `pvalloc` to the next
multiple of page size no matter what. There is an overflow possibility that
wasn't accounted for. So now, return null in the event of an overflow. The man
page doesn't seem to indicate the errno to set in this particular situation,
but the glibc unit tests go for ENOMEM (https://code.woboq.org/userspace/glibc/malloc/tst-pvalloc.c.html#54)
so we'll do the same.
Update the aligned allocation funtions tests to check for properly aligned
returned pointers, and the `pvalloc` corner cases.

@alekseyshl: do you want me to do the same in the other Sanitizers?

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek, alekseyshl, llvm-commits

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

llvm-svn: 309033

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Tue, 25 Jul 2017 21:16:33 +0000 (21:16 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 309032

7 years ago[CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF
Don Hinton [Tue, 25 Jul 2017 21:13:18 +0000 (21:13 +0000)]
[CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF

Make sure multiple targets don't get rebuilt unnecessarily when LLVM_APPEND_VC_REV = OFF.

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

llvm-svn: 309031

7 years ago[CMake] Fix broken builds from r309029
Chris Bieneman [Tue, 25 Jul 2017 20:58:14 +0000 (20:58 +0000)]
[CMake] Fix broken builds from r309029

Fixing the mismatched beginning if and endif contents.

llvm-svn: 309030

7 years ago[CMake] Allow TableGen.cmake to be included multiple times
Chris Bieneman [Tue, 25 Jul 2017 20:53:31 +0000 (20:53 +0000)]
[CMake] Allow TableGen.cmake to be included multiple times

This patch allows TableGen.cmake to be safely included multiple times in sub-projects.

llvm-svn: 309029

7 years agoAMDGPU/SI: Fix Depth and Height computation for SI scheduler
Marek Olsak [Tue, 25 Jul 2017 20:37:03 +0000 (20:37 +0000)]
AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Patch by: Axel Davy

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

llvm-svn: 309028

7 years agoAMDGPU/SI: Force exports at the end for SI scheduler
Marek Olsak [Tue, 25 Jul 2017 20:36:58 +0000 (20:36 +0000)]
AMDGPU/SI: Force exports at the end for SI scheduler

Patch by: Axel Davy

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

llvm-svn: 309027

7 years ago[CMake] Build debugserver & debugserver_nonui
Chris Bieneman [Tue, 25 Jul 2017 20:31:53 +0000 (20:31 +0000)]
[CMake] Build debugserver & debugserver_nonui

When building for iOS we build two variants of debugserver. One which supports UI functionality like Springboard for launching applications, and one which does not.

This patch adds support for building debugserver with and without UI support libraries being available.

llvm-svn: 309026

7 years ago[CMake] Update Framework construction for iOS
Chris Bieneman [Tue, 25 Jul 2017 20:31:15 +0000 (20:31 +0000)]
[CMake] Update Framework construction for iOS

On iOS frameworks don't have versions or resources, they are flatter bundles. This updates the LLDB framework build to accommodate the flatter bundles.

llvm-svn: 309025

7 years ago[CMake] Rework construction of framework bundle
Chris Bieneman [Tue, 25 Jul 2017 20:30:58 +0000 (20:30 +0000)]
[CMake] Rework construction of framework bundle

This adds an explicit step for processing the headers and restructures how the framework bundles are constructed. This should make the frameworks more reliably constructed.

llvm-svn: 309024

7 years ago[CMake] Fix framework build
Chris Bieneman [Tue, 25 Jul 2017 20:30:35 +0000 (20:30 +0000)]
[CMake] Fix framework build

The LLDB framework build looks for the swig-generated source in the wrong place. This should resolve that.

llvm-svn: 309023

7 years ago[CMake] NFC. Cleanup unnecessary CMake policy
Chris Bieneman [Tue, 25 Jul 2017 20:30:18 +0000 (20:30 +0000)]
[CMake] NFC. Cleanup unnecessary CMake policy

This is just setting to the default behavior, so it does nothing.

llvm-svn: 309022

7 years ago[CMake] Cleanup unnecessary definition
Chris Bieneman [Tue, 25 Jul 2017 20:29:45 +0000 (20:29 +0000)]
[CMake] Cleanup unnecessary definition

This is only used in one file, and we already set it correctly on that file, so we don't need to set this everywhere.

llvm-svn: 309021

7 years ago[CMake] Add debugserver entitlements
Chris Bieneman [Tue, 25 Jul 2017 20:29:28 +0000 (20:29 +0000)]
[CMake] Add debugserver entitlements

When consigning debugserver we should also include the entitlements file on the code sign command.

llvm-svn: 309020

7 years agoImprove the fix for PR33875 by not hardcoding the section name.
Adrian Prantl [Tue, 25 Jul 2017 20:12:25 +0000 (20:12 +0000)]
Improve the fix for PR33875 by not hardcoding the section name.
This is a follow-up to r308905.

llvm-svn: 309019

7 years agoFix a bot by linking clang-import-test against libclangDriver
Sean Callanan [Tue, 25 Jul 2017 20:09:30 +0000 (20:09 +0000)]
Fix a bot by linking clang-import-test against libclangDriver

llvm-svn: 309018

7 years ago[COFF] Add support for delay loading DLLs on ARM
Martin Storsjo [Tue, 25 Jul 2017 20:00:37 +0000 (20:00 +0000)]
[COFF] Add support for delay loading DLLs on ARM

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

llvm-svn: 309017

7 years ago[AArch64] Update a comment in a test
Martin Storsjo [Tue, 25 Jul 2017 19:57:26 +0000 (19:57 +0000)]
[AArch64] Update a comment in a test

The comment ended up outdated when the test was rewritten in SVN r192281.

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

llvm-svn: 309016

7 years ago[AArch64] Add a test for float argument passing to win64 vararg functions
Martin Storsjo [Tue, 25 Jul 2017 19:57:22 +0000 (19:57 +0000)]
[AArch64] Add a test for float argument passing to win64 vararg functions

The existing tests only tested how a va_start is lowered.

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

llvm-svn: 309015

7 years ago[ExternalASTMerger] Import Objective-C classes
Sean Callanan [Tue, 25 Jul 2017 19:54:22 +0000 (19:54 +0000)]
[ExternalASTMerger] Import Objective-C classes

This patch adds functionality and a test for importing Objective-C classes
and their methods.

It also adds a flag to clang-import-test to set the language used for
parsing. This takes the same argument format as the -x option to the
driver.

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

llvm-svn: 309014

7 years ago[Frontend] Mark some ASTUnit methods as const. NFC.
Vedant Kumar [Tue, 25 Jul 2017 19:53:27 +0000 (19:53 +0000)]
[Frontend] Mark some ASTUnit methods as const. NFC.

Patch by Hamza Sood!

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

llvm-svn: 309013

7 years ago[LTO] Prevent dead stripping and internalization of symbols with sections
Teresa Johnson [Tue, 25 Jul 2017 19:42:32 +0000 (19:42 +0000)]
[LTO] Prevent dead stripping and internalization of symbols with sections

Summary:
ELF linkers generate __start_<secname> and __stop_<secname> symbols
when there is a value in a section <secname> where the name is a valid
C identifier.  If dead stripping determines that the values declared
in section <secname> are dead, and we then internalize (and delete)
such a symbol, programs that reference the corresponding start and end
section symbols will get undefined reference linking errors.

To fix this, add the section name to the IRSymtab entry when a symbol is
defined in a specific section. Then use this in the gold-plugin to mark
the symbol as external and visible from outside the summary when the
section name is a valid C identifier.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 309009

7 years ago[ubsan] -fsanitize=vptr now requires -fsanitize=null, update tests
Vedant Kumar [Tue, 25 Jul 2017 19:34:27 +0000 (19:34 +0000)]
[ubsan] -fsanitize=vptr now requires -fsanitize=null, update tests

See: https://bugs.llvm.org/show_bug.cgi?id=33881
llvm-svn: 309008

7 years ago[ubsan] Null-check pointers in -fsanitize=vptr (PR33881)
Vedant Kumar [Tue, 25 Jul 2017 19:34:23 +0000 (19:34 +0000)]
[ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

The instrumentation generated by -fsanitize=vptr does not null check a
user pointer before loading from it. This causes crashes in the face of
UB member calls (this=nullptr), i.e it's causing user programs to crash
only after UBSan is turned on.

The fix is to make run-time null checking a prerequisite for enabling
-fsanitize=vptr, and to then teach UBSan to reuse these run-time null
checks to make -fsanitize=vptr safe.

Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build

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

https://bugs.llvm.org/show_bug.cgi?id=33881

llvm-svn: 309007

7 years ago[StaticAnalyzer] Completely unrolling specific loops with known bound option
Peter Szecsi [Tue, 25 Jul 2017 19:23:23 +0000 (19:23 +0000)]
[StaticAnalyzer] Completely unrolling specific loops with known bound option

This feature allows the analyzer to consider loops to completely unroll.
New requirements/rules (for unrolling) can be added easily via ASTMatchers.

Right now it is hidden behind a flag, the aim is to find the correct heuristic
and create a solution which results higher coverage % and more precise
analysis, thus can be enabled by default.

Right now the blocks which belong to an unrolled loop are marked by the
LoopVisitor which adds them to the ProgramState.
Then whenever we encounter a CFGBlock in the processCFGBlockEntrance which is
marked then we skip its investigating. That means, it won't be considered to
be visited more than the maximal bound for visiting since it won't be checked.

llvm-svn: 309006

7 years agoRevert "This patch enables the usage of constant Enum identifiers within Microsoft...
Eric Christopher [Tue, 25 Jul 2017 19:22:09 +0000 (19:22 +0000)]
Revert "This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements."

This reverts commit r308966.

llvm-svn: 309005

7 years agoRevert "This patch enables the usage of constant Enum identifiers within Microsoft...
Eric Christopher [Tue, 25 Jul 2017 19:17:32 +0000 (19:17 +0000)]
Revert "This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements." as it is causing msan failures.

This reverts commits r308985 and r308965

llvm-svn: 309004

7 years agoAttempt to fix lld tests on Windows after 308998.
Nico Weber [Tue, 25 Jul 2017 18:39:38 +0000 (18:39 +0000)]
Attempt to fix lld tests on Windows after 308998.

The test used /manifestinput: without /manifest:embed, which isn't actually
supported.  Just remove this part of the test for now; if it's important to
check this the llvm-readobj part should be extended to check this.

llvm-svn: 309002

7 years ago[PowerPC] Pretty-print CR bits the way the binutils disassembler does
Nemanja Ivanovic [Tue, 25 Jul 2017 18:26:35 +0000 (18:26 +0000)]
[PowerPC] Pretty-print CR bits the way the binutils disassembler does

This patch just adds printing of CR bit registers in a more human-readable
form akin to that used by the GNU binutils.

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

llvm-svn: 309001

7 years agoCleanup: __kmp_env_* variables
Jonathan Peyton [Tue, 25 Jul 2017 18:20:16 +0000 (18:20 +0000)]
Cleanup: __kmp_env_* variables

Removed unused __kmp_env_* variables. Also clangified other people's code.

Patch by Terry Wilmarth

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

llvm-svn: 309000

7 years agoOnly scan global sections containing data in LSan on darwin
Francis Ricci [Tue, 25 Jul 2017 18:16:58 +0000 (18:16 +0000)]
Only scan global sections containing data in LSan on darwin

Summary:
__DATA segments on Darwin contain a large number of separate sections,
many of which cannot actually contain pointers, and contain const values or
objc metadata. Not scanning sections which cannot contain pointers significantly
improves performance.

On a medium-sized (~4000 files) internal project, I saw a speedup of about 30%
in standalone LSan's execution time (30% improvement in the time spent running
LSan, not the total program time).

Reviewers: kcc, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308999

7 years agolld: only write .manifest files if /manifest is passed, PR33925
Nico Weber [Tue, 25 Jul 2017 18:08:03 +0000 (18:08 +0000)]
lld: only write .manifest files if /manifest is passed, PR33925

Also emit an error if /manifestinput: is used without /manifest:embed.
Increases compatibility with link.exe

https://reviews.llvm.org/D35842

llvm-svn: 308998

7 years agoIntroduce -nostdlib++ flag to disable linking the C++ standard library.
Nico Weber [Tue, 25 Jul 2017 18:02:57 +0000 (18:02 +0000)]
Introduce -nostdlib++ flag to disable linking the C++ standard library.

Projects that want to statically link their own C++ standard library currently
need to pass -nostdlib or -nodefaultlibs, which also disables linking of the
builtins library, -lm, and so on. Alternatively, they could use `clang` instead
of `clang++`, but that already disables implicit addition of -lm on some
toolchains.

Add a dedicated flag -nostdlib++ that disables just linking of libc++ /
libstdc++. This is analogous to -nostdinc++.

https://reviews.llvm.org/D35780

llvm-svn: 308997

7 years ago[coroutines] Add serialization/deserialization of coroutines
Gor Nishanov [Tue, 25 Jul 2017 18:01:49 +0000 (18:01 +0000)]
[coroutines] Add serialization/deserialization of coroutines

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: EricWF, cfe-commits

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

llvm-svn: 308996

7 years ago[PowerPC] - Recommit r304907 now that the issue has been fixed
Nemanja Ivanovic [Tue, 25 Jul 2017 17:54:51 +0000 (17:54 +0000)]
[PowerPC] - Recommit r304907 now that the issue has been fixed

This is just a recommit since the issue that the commit exposed is now
resolved.

llvm-svn: 308995

7 years ago[docs] Fix a typo: iteratation -> iteration
Stephen Hines [Tue, 25 Jul 2017 17:52:55 +0000 (17:52 +0000)]
[docs] Fix a typo: iteratation -> iteration

Reviewers: dgross

Reviewed By: dgross

Subscribers: dgross, llvm-commits

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

llvm-svn: 308994

7 years ago[TypeSystem] Guard the global `ASTSourceMap` with a mutex
Sean Callanan [Tue, 25 Jul 2017 17:33:37 +0000 (17:33 +0000)]
[TypeSystem] Guard the global `ASTSourceMap` with a mutex

s_source_map in ClangExternalASTSourceCommon.cpp is unguarded
and therefore can break in multithreaded conditions. This can
cause crashes in particular if multiple targets are being set
up at once.

This patch wraps s_source_map in a function that ensures
exclusivity, and makes every user of it use that function
instead.

<rdar://problem/33429774> lldb crashes after "resume_off"

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

llvm-svn: 308993

7 years agoFix unused variable warning with MemoryMappedSegment private data
Francis Ricci [Tue, 25 Jul 2017 17:28:41 +0000 (17:28 +0000)]
Fix unused variable warning with MemoryMappedSegment private data

llvm-svn: 308992

7 years ago[analyzer] Add diagnostic text for generalized refcount annotations.
Devin Coughlin [Tue, 25 Jul 2017 17:17:09 +0000 (17:17 +0000)]
[analyzer] Add diagnostic text for generalized refcount annotations.

Add a 'Generalized' object kind to the retain-count checker and suitable
generic diagnostic text for retain-count diagnostics involving those objects.

For now the object kind is introduced in summaries by 'annotate' attributes.
Once we have more experience with these annotations we will propose explicit
attributes.

Patch by Malhar Thakkar!

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

llvm-svn: 308990

7 years ago[X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914)
Simon Pilgrim [Tue, 25 Jul 2017 17:04:37 +0000 (17:04 +0000)]
[X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914)

D35067/rL308322 attempted to support up to 4 load pairs for memcmp inlining which resulted in regressions for some optimized libc memcmp implementations (PR33914).

Until we can match these more optimal cases, this patch reduces the memcmp expansion to a maximum of 2 load pairs (which matches what we do for -Os).

This patch should be considered for the 5.0.0 release branch as well

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

llvm-svn: 308986

7 years agoThis test case is causing all PPC and SystemZ bots to remain red.
Nemanja Ivanovic [Tue, 25 Jul 2017 17:04:12 +0000 (17:04 +0000)]
This test case is causing all PPC and SystemZ bots to remain red.

Notifying the author via Diffusion did not yield any answer. Therefore, I'm
adding the missing triple. I have no idea if this is the intended triple, but
it seems to fit the bill and should turn the bots back to green.
If the intended triple is a different one, please feel free to change it but I
need make this change to turn the bots back to green now.

llvm-svn: 308985

7 years agoRevert "[compiler-rt] Include thread ID into sanitizers logs"
Vitaly Buka [Tue, 25 Jul 2017 16:56:22 +0000 (16:56 +0000)]
Revert "[compiler-rt] Include thread ID into sanitizers logs"

This improvement introduce additional dependencies on sandboxed environments.

This reverts commit r308637.

llvm-svn: 308984

7 years ago[DAG] Move DAGCombiner::GetDemandedBits to SelectionDAG
Simon Pilgrim [Tue, 25 Jul 2017 16:36:44 +0000 (16:36 +0000)]
[DAG] Move DAGCombiner::GetDemandedBits to SelectionDAG

This patch moves the DAGCombiner::GetDemandedBits function to SelectionDAG::GetDemandedBits as a first step towards making it easier for targets to get to the source of any demanded bits without the limitations of SimplifyDemandedBits.

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

llvm-svn: 308983

7 years ago[ScopInfo] Rename ScopStmt::contains(BB) to represents(BB). NFC.
Michael Kruse [Tue, 25 Jul 2017 16:25:37 +0000 (16:25 +0000)]
[ScopInfo] Rename ScopStmt::contains(BB) to represents(BB). NFC.

In future, there will be no more a 1:1 correspondence between statements
and basic blocks, the name `contains` does not correctly capture their
relationship. A BB may infact comprise of multiple statements; hence we
describe a statement 'representing' a basic block.

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

llvm-svn: 308982

7 years ago[X86] Regenerate test.
Simon Pilgrim [Tue, 25 Jul 2017 16:10:32 +0000 (16:10 +0000)]
[X86] Regenerate test.

llvm-svn: 308981

7 years ago[X86] Regenerate test with broadcast comments.
Simon Pilgrim [Tue, 25 Jul 2017 16:09:56 +0000 (16:09 +0000)]
[X86] Regenerate test with broadcast comments.

llvm-svn: 308980

7 years ago[OPENMP] Codegen for 'task_reduction' clause.
Alexey Bataev [Tue, 25 Jul 2017 15:53:26 +0000 (15:53 +0000)]
[OPENMP] Codegen for 'task_reduction' clause.

Added codegen for taskgroup directive with task_reduction clause.
```
<body>
```
The next code is emitted:
```
%struct.kmp_task_red_input_t red_init[n];
void *td;
call void @__kmpc_taskgroup(%ident_t id, i32 gtid)
...
red_init[i].shar = &<item>;
red_init[i].size = sizeof(<item>);
red_init[i].init = (void*)initializer_function;
red_init[i].fini = (void*)destructor_function;
red_init[i].comb = (void*)combiner_function;
red_init[i].flags = flags;
...
td = call i8* @__kmpc_task_reduction_init(i32 gtid, i32 n, i8*
(void*)red_init);
call void @__kmpc_end_taskgroup(%ident_t id, i32 gtid)

void initializer_function(i8* priv) {
  *(<type>*)priv = <red_init>;
  ret void;
}

void destructor_function(i8* priv) {
  (<type>*)priv->~();
  ret void;
}

void combiner_function(i8* inout, i8* in) {
  *(<type>*)inout = *(<type>*)inout <red_id> *(<type>*)in;
  ret void;
}
```

llvm-svn: 308979

7 years ago[Sparc] invalid adjustments in TLS_LE/TLS_LDO relocations removed
Fedor Sergeev [Tue, 25 Jul 2017 15:28:28 +0000 (15:28 +0000)]
[Sparc] invalid adjustments in TLS_LE/TLS_LDO relocations removed

Summary:
Some SPARC TLS relocations were applying nontrivial adjustments
to zero value, leading to unexpected non-zero values in ELF and then
Solaris linker failures.

Getting rid of these adjustments.

Fixes PR33825.

Reviewers: rafael, asb, jyknight

Subscribers: joerg, jyknight, llvm-commits

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

llvm-svn: 308978

7 years agoAdd address ranges for individual macho sections on darwin
Francis Ricci [Tue, 25 Jul 2017 15:27:32 +0000 (15:27 +0000)]
Add address ranges for individual macho sections on darwin

Summary:
This is a re-upload of the reverted commit r308644. It has changed quite
a bit to reflect post-commit comments by kcc, so I'm re-uploading as
a new review.

Reviewers: kubamracek, alekseyshl, kcc

Subscribers: llvm-commits

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

llvm-svn: 308977

7 years ago[IslAst] Untangle IslAst lit-testcases from specifics of the legacy-PM
Philip Pfaffe [Tue, 25 Jul 2017 15:07:42 +0000 (15:07 +0000)]
[IslAst] Untangle IslAst lit-testcases from specifics of the legacy-PM

Summary:
This consists instances of two changes:

- Accept any order of checks for a specific loop form, that appear in different order in the new vs legacy-PM.
- Remove checks for specific regions.

Reviewers: grosser

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 308976

7 years ago[clang-tidy] Fixup clang-apply-replacements/invalid-files test
Kevin Funk [Tue, 25 Jul 2017 14:39:08 +0000 (14:39 +0000)]
[clang-tidy] Fixup clang-apply-replacements/invalid-files test

llvm-svn: 308975

7 years ago[clang-tidy] clang-apply-replacements: Don't insert null entry
Kevin Funk [Tue, 25 Jul 2017 14:28:16 +0000 (14:28 +0000)]
[clang-tidy] clang-apply-replacements: Don't insert null entry

Summary:
[clang-tidy] clang-apply-replacements: Don't insert null entry

Fix crash when running clang-apply-replacements on YML files which
contain an invalid file path. Make sure we never add a nullptr into the
map. The previous code started adding nullptr to the map after the first
warnings via errs() has been emitted.

Backtrace:
```
Starting program:
/home/kfunk/devel/build/llvm/bin/clang-apply-replacements /tmp/tmpIqtp7m
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/x86_64-linux-gnu/libthread_db.so.1".
Described file '.moc/../../../../../../src/qt5.8/qtremoteobjects/src/remoteobjects/qremoteobjectregistrysource_p.h' doesn't exist. Ignoring...
...

Program received signal SIGSEGV, Segmentation fault.
main (argc=<optimized out>, argv=<optimized out>) at /home/kfunk/devel/src/llvm/tools/clang/tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp:262
(gdb) p FileAndReplacements.first
$1 = (const clang::FileEntry *) 0x0
(gdb)
```

Added tests.

Before patch:

```
******************** TEST 'Clang Tools :: clang-apply-replacements/invalid-files.cpp' FAILED ********************
Script:
--
mkdir -p /home/kfunk/devel/build/llvm/tools/clang/tools/extra/test/clang-apply-replacements/Output/Inputs/invalid-files
clang-apply-replacements /home/kfunk/devel/build/llvm/tools/clang/tools/extra/test/clang-apply-replacements/Output/Inputs/invalid-files
ls -1 /home/kfunk/devel/build/llvm/tools/clang/tools/extra/test/clang-apply-replacements/Output/Inputs/invalid-files | FileCheck /home/kfunk/devel/src/llvm/tools/clang/tools/extra/test/clang-apply-replacements/invalid-files.cpp --check-prefix=YAML
--
Exit Code: 139

Command Output (stderr):
--
Described file 'idonotexist.h' doesn't exist. Ignoring...
/home/kfunk/devel/build/llvm/tools/clang/tools/extra/test/clang-apply-replacements/Output/invalid-files.cpp.script: line 4:  9919 Segmentation fault      clang-apply-replacements /home/kfunk/devel/build/llvm/tools/clang/tools/extra/test/clang-apply-   replacements/Output/Inputs/invalid-files

--
```

After Patch:

```
PASS: Clang Tools :: clang-apply-replacements/invalid-files.cpp (5 of 6)
```

Reviewers: alexfh, yawanng

Reviewed By: alexfh

Subscribers: cfe-commits, klimek, JDevlieghere, xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 308974

7 years ago[ScopInfo] Fix assertion for PHIs not in a region stmts entry.
Michael Kruse [Tue, 25 Jul 2017 13:28:39 +0000 (13:28 +0000)]
[ScopInfo] Fix assertion for PHIs not in a region stmts entry.

A PHI node within a region statement is legal, but does not have
a MemoryKind::PHI access.

llvm-svn: 308973

7 years agoX86 Asm uses assertions instead of proper diagnostic. This patch fixes that.
Andrew V. Tischenko [Tue, 25 Jul 2017 13:05:12 +0000 (13:05 +0000)]
X86 Asm uses assertions instead of proper diagnostic. This patch fixes that.

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

llvm-svn: 308972

7 years ago[PPCGCodeGeneration] Skip arrays with empty extent.
Siddharth Bhat [Tue, 25 Jul 2017 12:35:36 +0000 (12:35 +0000)]
[PPCGCodeGeneration] Skip arrays with empty extent.

Invariant load hoisted scalars, and arrays whose size we can statically compute
to be 0 do not need to be allocated as arrays.

Invariant load hoisted scalars are sent to the kernel directly as parameters.

Earlier, we used to allocate `0` bytes of memory for these because our
computation of size from `PPCGCodeGeneration::getArraySize` would result in `0`.

Now, since we don't invariant loads as arrays in PPCGCodeGeneration, this
problem does not occur anymore.

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

llvm-svn: 308971

7 years ago[clangd] Reuse compile commands during reparse
Krasimir Georgiev [Tue, 25 Jul 2017 11:37:43 +0000 (11:37 +0000)]
[clangd] Reuse compile commands during reparse

Summary:
Previously we always queried the compilation database and discarded the results
if the file was already opened.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 308970

7 years agoFix spelling of FileCheck in test.
Manuel Klimek [Tue, 25 Jul 2017 11:34:55 +0000 (11:34 +0000)]
Fix spelling of FileCheck in test.

llvm-svn: 308969

7 years ago[LIR] Teach LIR to avoid extending the BE count prior to adding one to
Chandler Carruth [Tue, 25 Jul 2017 10:48:32 +0000 (10:48 +0000)]
[LIR] Teach LIR to avoid extending the BE count prior to adding one to
it when safe.

Very often the BE count is the trip count minus one, and the plus one
here should fold with that minus one. But because the BE count might in
theory be UINT_MAX or some such, adding one before we extend could in
some cases wrap to zero and break when we scale things.

This patch checks to see if it would be safe to add one because the
specific case that would cause this is guarded for prior to entering the
preheader. This should handle essentially all of the common loop idioms
coming out of C/C++ code once canonicalized by LLVM.

Before this patch, both forms of loop in the added test cases ended up
subtracting one from the size, extending it, scaling it up by 8 and then
adding 8 back onto it. This is really silly, and it turns out made it
all the way into generated code very often, so this is a surprisingly
important cleanup to do.

Many thanks to Sanjoy for showing me how to do this with SCEV.

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

llvm-svn: 308968

7 years ago[PM] Setup TargetLibraryInfo correctly for the new pass manager.
Chandler Carruth [Tue, 25 Jul 2017 10:46:07 +0000 (10:46 +0000)]
[PM] Setup TargetLibraryInfo correctly for the new pass manager.

Without this, -fno-builtin and friends doesn't work. Added the obvious
RUN lines to the test for -fno-builtin and they pass now.

llvm-svn: 308967

7 years agoThis patch enables the usage of constant Enum identifiers within Microsoft style...
Matan Haroush [Tue, 25 Jul 2017 10:44:09 +0000 (10:44 +0000)]
This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements.

Differential Revision:
https://reviews.llvm.org/D33277
https://reviews.llvm.org/D33278

llvm-svn: 308966

7 years agoThis patch enables the usage of constant Enum identifiers within Microsoft style...
Matan Haroush [Tue, 25 Jul 2017 10:43:43 +0000 (10:43 +0000)]
This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements.

Differential Revision:
https://reviews.llvm.org/D33277
https://reviews.llvm.org/D33278

llvm-svn: 308965

7 years ago[tests] Cleanup vect.omp.persistence.ll test.
Michael Zolotukhin [Tue, 25 Jul 2017 10:35:16 +0000 (10:35 +0000)]
[tests] Cleanup vect.omp.persistence.ll test.

llvm-svn: 308964

7 years ago[X86] Add 24-byte memcmp tests (PR33914)
Simon Pilgrim [Tue, 25 Jul 2017 10:33:36 +0000 (10:33 +0000)]
[X86] Add 24-byte memcmp tests (PR33914)

llvm-svn: 308963

7 years agoFix incorrect use of current directory to find moved paths in ASTReader.
Manuel Klimek [Tue, 25 Jul 2017 10:22:06 +0000 (10:22 +0000)]
Fix incorrect use of current directory to find moved paths in ASTReader.

CurrentDir was set as the path of the current module, but that can change as
part of a chain of loaded modules.

When we try to locate a file mentioned in a module that does not exist, we use
a heuristic to look at the relative path between the original location of the
module and the file we look for, and use that relatively to the CurrentDir.

This only works if CurrentDir is the same as the (current) path of the module
file the file was mentioned in; if it is not, we look at the path relatively to
the wrong directory, and can end up reading random unrelated files that happen
to have the same name.

This patch fixes this by using the BaseDirectory of the module file the file
we look for was mentioned in instead of the CurrentDir heuristic.

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

llvm-svn: 308962

7 years ago[analyzer] Treat throws as sinks for suppress-on-sink purposes.
Artem Dergachev [Tue, 25 Jul 2017 09:44:02 +0000 (09:44 +0000)]
[analyzer] Treat throws as sinks for suppress-on-sink purposes.

Because since r308957 the suppress-on-sink feature contains its own
mini-analysis, it also needs to become aware that C++ unhandled exceptions
cause sinks. Unfortunately, for now we treat all exceptions as unhandled in
the analyzer, so suppress-on-sink needs to do the same.

rdar://problem/28157554

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

llvm-svn: 308961

7 years agoFix endianness bug in DAGCombiner::visitTRUNCATE and visitEXTRACT_VECTOR_ELT
Francois Pichet [Tue, 25 Jul 2017 09:40:35 +0000 (09:40 +0000)]
Fix endianness bug in DAGCombiner::visitTRUNCATE and visitEXTRACT_VECTOR_ELT

Summary:
Do not assume little endian architecture in DAGCombiner::visitTRUNCATE and DAGCombiner::visitEXTRACT_VECTOR_ELT.
PR33682

Reviewers: hfinkel, sdardis, RKSimon

Reviewed By: sdardis, RKSimon

Subscribers: uabelho, RKSimon, sdardis, llvm-commits

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

llvm-svn: 308960

7 years ago[clangd] Workaround Windows test failures.
Ilya Biryukov [Tue, 25 Jul 2017 09:31:51 +0000 (09:31 +0000)]
[clangd] Workaround Windows test failures.

To properly fix this, Unix-specific paths should not be used when
running tests on Windows.

llvm-svn: 308959

7 years ago[ELF] - Fix init_fini_priority.s test.
George Rimar [Tue, 25 Jul 2017 09:26:35 +0000 (09:26 +0000)]
[ELF] - Fix init_fini_priority.s test.

Previously .init_array/.fini_array sections
were not unique and we had 3 .init_array sections +
3 .fini_array input sections passed to linker,
instead of 5 + 5.

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

llvm-svn: 308958

7 years ago[analyzer] Further improve suppress-on-sink behavior in incomplete analyses.
Artem Dergachev [Tue, 25 Jul 2017 09:25:10 +0000 (09:25 +0000)]
[analyzer] Further improve suppress-on-sink behavior in incomplete analyses.

If a certain memory leak (or other similar bug) found by the analyzer is known
to be happening only before abnormal termination of the program ("sink", eg.
assertion failure in the code under analysis, or another bug that introduces
undefined behavior), such leak warning is discarded. However, if the analysis
has never reaches completion (due to complexity of the code), it may be
failing to notice the sink.

This commit further extends the partial solution introduced in r290341 to cover
cases when a complicated control flow occurs before encountering a no-return
statement (which anyway inevitably leads to such statement(s)) by traversing
the respective section of the CFG in a depth-first manner. A complete solution
still seems elusive.

rdar://problem/28157554

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

llvm-svn: 308957

7 years ago[ARM] Enable partial and runtime unrolling
Sam Parker [Tue, 25 Jul 2017 08:51:30 +0000 (08:51 +0000)]
[ARM] Enable partial and runtime unrolling

Enable runtime and partial loop unrolling of simple loops without
calls on M-class cores. The thresholds are calculated based on
whether the target is Thumb or Thumb-2.

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

llvm-svn: 308956

7 years ago[ELF] - Fix calculation of memory region offset.
George Rimar [Tue, 25 Jul 2017 08:29:29 +0000 (08:29 +0000)]
[ELF] - Fix calculation of memory region offset.

This is PR33714.

Previously for each input section offset of memory region
was incremented on a size of output section.

That resulted in a wrong error message saying about
overflow. Patch fixes that.

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

llvm-svn: 308955

7 years ago[clang-tidy] Handle incomplete types in bugprone-undefined-memory-manipulation
Gabor Horvath [Tue, 25 Jul 2017 06:52:08 +0000 (06:52 +0000)]
[clang-tidy] Handle incomplete types in bugprone-undefined-memory-manipulation
check

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 308954

7 years ago[COFF] Correctly set the thumb bit in DLL export addresses
Martin Storsjo [Tue, 25 Jul 2017 06:10:44 +0000 (06:10 +0000)]
[COFF] Correctly set the thumb bit in DLL export addresses

The same adjustment is already done for the entry point in
Writer.cpp and for relocations that point to executable code
in Chunks.cpp.

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

llvm-svn: 308953

7 years ago[COFF] Add a test for producing DLLs and import libraries for ARM64
Martin Storsjo [Tue, 25 Jul 2017 06:08:25 +0000 (06:08 +0000)]
[COFF] Add a test for producing DLLs and import libraries for ARM64

This is a test for LLVM SVN r308951.

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

llvm-svn: 308952

7 years ago[COFF] ARM64 support for COFFImportFile
Martin Storsjo [Tue, 25 Jul 2017 06:05:49 +0000 (06:05 +0000)]
[COFF] ARM64 support for COFFImportFile

A test will be committed separately in the lld repo.

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

llvm-svn: 308951

7 years ago[AArch64] Reserve a 16 byte aligned amount of fixed stack for win64 varargs
Martin Storsjo [Tue, 25 Jul 2017 05:20:01 +0000 (05:20 +0000)]
[AArch64] Reserve a 16 byte aligned amount of fixed stack for win64 varargs

Create a dummy 8 byte fixed object for the unused slot below the first
stored vararg.

Alternative ideas tested but skipped: One could try to align the whole
fixed object to 16, but I haven't found how to add an offset to the stack
frame used in LowerWin64_VASTART.

If only the size of the fixed stack object size is padded but not the offset, via
MFI.CreateFixedObject(alignTo(GPRSaveSize, 16), -(int)GPRSaveSize, false),
PrologEpilogInserter crashes due to "Attempted to reset backwards range!".

This fixes misconceptions about where registers are spilled, since
AArch64FrameLowering.cpp assumes the offset from fixed objects is
aligned to 16 bytes (and the Win64 case there already manually aligns
the offset to 16 bytes).

This fixes cases where local stack allocations could overwrite callee
saved registers on the stack.

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

llvm-svn: 308950

7 years agoDWARFVerifier.cpp: Fix -m32 in r308928. Use PRIx64.
NAKAMURA Takumi [Tue, 25 Jul 2017 05:03:17 +0000 (05:03 +0000)]
DWARFVerifier.cpp: Fix -m32 in r308928. Use PRIx64.

llvm-svn: 308949

7 years ago[NFC] Use RAII to un-poison and then re-poison __VA_ARGS__
Faisal Vali [Tue, 25 Jul 2017 03:15:36 +0000 (03:15 +0000)]
[NFC] Use RAII to un-poison and then re-poison __VA_ARGS__
  - This will also be used for the forthcoming __VA_OPT__ feature approved for C++2a.
  - recommended by rsmith during his review of the __VA_OPT__ patch (https://reviews.llvm.org/D35782)

llvm-svn: 308948

7 years ago[libFuzzer] make one test faster, fix compiler warnings in tests
Kostya Serebryany [Tue, 25 Jul 2017 02:09:46 +0000 (02:09 +0000)]
[libFuzzer] make one test faster, fix compiler warnings in tests

llvm-svn: 308945

7 years ago[sanitizer-coverage] simplify the code, NFC
Kostya Serebryany [Tue, 25 Jul 2017 02:07:38 +0000 (02:07 +0000)]
[sanitizer-coverage] simplify the code, NFC

llvm-svn: 308944

7 years ago[DWARF] Modified test for die ranges verification so that it doesn't fail on windows...
Spyridoula Gravani [Tue, 25 Jul 2017 01:58:27 +0000 (01:58 +0000)]
[DWARF] Modified test for die ranges verification so that it doesn't fail on windows hosts.

llvm-svn: 308943

7 years agollvm/test/CMakeLists.txt: Add llvm-rc to LLVM_TEST_DEPENDS.
NAKAMURA Takumi [Tue, 25 Jul 2017 01:44:38 +0000 (01:44 +0000)]
llvm/test/CMakeLists.txt: Add llvm-rc to LLVM_TEST_DEPENDS.

llvm-svn: 308942

7 years agollvm-rc: Fixup for r308940. This should use LLVMSupport.
NAKAMURA Takumi [Tue, 25 Jul 2017 00:51:40 +0000 (00:51 +0000)]
llvm-rc: Fixup for r308940. This should use LLVMSupport.

llvm-svn: 308941

7 years agoAdd an empty shell of llvm-rc.
Marek Sokolowski [Tue, 25 Jul 2017 00:25:18 +0000 (00:25 +0000)]
Add an empty shell of llvm-rc.

This starts the development on one of MS Visual Studio binutils,
Resource Converter. The tool compiles resource scripts (.rc)
into binary resource files (.res).

The current implementation does nothing but parse the command
line arguments. It is going to be extended in the future.

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

llvm-svn: 308940

7 years agoMake a function static. NFC.
Rafael Espindola [Mon, 24 Jul 2017 23:55:33 +0000 (23:55 +0000)]
Make a function static. NFC.

llvm-svn: 308939