platform/upstream/llvm.git
7 years ago[X86] Implement __readgsqword (and the rest) as builtins (PR32373)
Hans Wennborg [Wed, 22 Mar 2017 19:13:13 +0000 (19:13 +0000)]
[X86] Implement __readgsqword (and the rest) as builtins (PR32373)

It seems MS headers have started using __readgsqword, and since it's
used in a header that doesn't include intrin.h, we can't implement it as
an inline function anymore.

That was already the case for __readfsdword, which Saleem added support
for in r220859. This patch reuses that codegen to implement all of
__read[fg]s{byte,word,dword,qword}.

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

llvm-svn: 298538

7 years agoFactor lsan allocator cache accesses into a function
Francis Ricci [Wed, 22 Mar 2017 18:42:43 +0000 (18:42 +0000)]
Factor lsan allocator cache accesses into a function

Summary:
This patch is the first step towards allows us to move away from using
__thread for the allocator cache on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

This will be followed by patches to move the function into OS-specific files.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 298537

7 years agoMove FileSpec from Host -> Utility.
Zachary Turner [Wed, 22 Mar 2017 18:40:07 +0000 (18:40 +0000)]
Move FileSpec from Host -> Utility.

llvm-svn: 298536

7 years ago[analyze deps] Show incoming and outgoing counts on island members.
Zachary Turner [Wed, 22 Mar 2017 18:23:14 +0000 (18:23 +0000)]
[analyze deps] Show incoming and outgoing counts on island members.

llvm-svn: 298535

7 years agoIPO: Const correctness for summaries passed into passes.
Peter Collingbourne [Wed, 22 Mar 2017 18:22:59 +0000 (18:22 +0000)]
IPO: Const correctness for summaries passed into passes.

Pass const qualified summaries into importers and unqualified summaries into
exporters. This lets us const-qualify the summary argument to thinBackend.

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

llvm-svn: 298534

7 years agoAdd "(compatible with GNU linkers)" to the -version output.
Rui Ueyama [Wed, 22 Mar 2017 18:04:57 +0000 (18:04 +0000)]
Add "(compatible with GNU linkers)" to the -version output.

Previous output:

  $ ld.lld -version
  LLD 5.0.0

New output:

  $ ld.lld -version
  LLD 5.0.0 (compatible with GNU linkers)

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

llvm-svn: 298532

7 years agoIR: Fix a race condition in type id clients of ModuleSummaryIndex.
Peter Collingbourne [Wed, 22 Mar 2017 18:04:39 +0000 (18:04 +0000)]
IR: Fix a race condition in type id clients of ModuleSummaryIndex.

Add a const version of the getTypeIdSummary accessor that avoids
mutating the TypeIdMap.

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

llvm-svn: 298531

7 years ago[analyze deps] Also show cycle islands.
Zachary Turner [Wed, 22 Mar 2017 18:04:20 +0000 (18:04 +0000)]
[analyze deps] Also show cycle islands.

We currently display a list of all minimal cycles, but it's
useful to be able to see the big picture impact of these cycles
by merging them all together into groups of interconnected
components.

Because the cycle discovery algorithm only considers "minimal"
cycles, it discards all information for dependencies which are
not considered part of the minimal cycle.  So all we know is that
the components of each island definitely all depend on each other
but it's still possible that there are hidden dependencies due
to transitive includes.

The cycle list should still be the authoritative reference for
deciding where the easiest places to break cycles are, though.

llvm-svn: 298530

7 years ago[DeLICM] Remove overloaded Knowledge constructor. NFC.
Michael Kruse [Wed, 22 Mar 2017 18:01:23 +0000 (18:01 +0000)]
[DeLICM] Remove overloaded Knowledge constructor. NFC.

The isl C++ bindings now has implicit conversions from isl::set to
isl::union_set. Therefore the additional overload accepting isl::set
is not required anymore.

llvm-svn: 298529

7 years agoDocument the status quo of DIExpression semantics in LangRef.rst
Adrian Prantl [Wed, 22 Mar 2017 18:01:01 +0000 (18:01 +0000)]
Document the status quo of DIExpression semantics in LangRef.rst

llvm-svn: 298528

7 years ago[OpenMP] CUDA plugin: More descriptive error messages
George Rokos [Wed, 22 Mar 2017 17:36:22 +0000 (17:36 +0000)]
[OpenMP] CUDA plugin: More descriptive error messages

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

llvm-svn: 298527

7 years agoResubmit "Delete the remainder of platform specific code in FileSpec."
Zachary Turner [Wed, 22 Mar 2017 17:33:23 +0000 (17:33 +0000)]
Resubmit "Delete the remainder of platform specific code in FileSpec."

This was causing a test failure in one of LLDB's tests which
specifically dealt with a limitation in LLVM's implementation
of home_directory() that LLDB's own implementation had worked
around.

This limitation has been addressed in r298513 on the LLVM side,
so the failing test (which is now unnecessary as the limitation
no longer exists) was removed in r298519, allowing this patch to
be re-submitted without modification.

llvm-svn: 298526

7 years ago[compiler-rt] build compiler-rt runtimes without LTO
Bob Haarman [Wed, 22 Mar 2017 17:25:49 +0000 (17:25 +0000)]
[compiler-rt] build compiler-rt runtimes without LTO

Summary: Currently, we build the compiler-rt runtimes with link-time optimization if LTO is configured for the LLVM project. This will break external programs that don't invoke the linker in such a way that it supports LLVM's LTO. To avoid this, this change causes the compiler-rt runtimes to be compiled with -fno-lto. This also makes the check-profile tests work on systems when doing a lld LTO build on a system where the system linker does not support LLVM LTO.

Reviewers: rnk, davidxl

Reviewed By: davidxl

Subscribers: dberris, mgorny, llvm-commits, mehdi_amini

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

llvm-svn: 298525

7 years agoReuse appropriate Launch and Attach on NetBSD
Kamil Rytarowski [Wed, 22 Mar 2017 17:24:37 +0000 (17:24 +0000)]
Reuse appropriate Launch and Attach on NetBSD

Summary:
NetBSD ships with NativeProcessNetBSD  inherited from NativeProcessProtocol.

Link Plugins/Process/gdb-remote with lldbPluginProcessNetBSD in order to resolve
correctly the linking to Launch and Attach from the NetBSD plugin.

Sponsored by <The NetBSD Foundation>

Reviewers: kettenis, labath, emaste, joerg

Reviewed By: labath, emaste

Subscribers: mgorny, #lldb

Tags: #lldb

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

llvm-svn: 298524

7 years agoRename helper functions in DwarfExpression to be less misleading (NFC)
Adrian Prantl [Wed, 22 Mar 2017 17:19:55 +0000 (17:19 +0000)]
Rename helper functions in DwarfExpression to be less misleading (NFC)

llvm-svn: 298523

7 years ago[DeLICM] Remove AllElements. NFC.
Michael Kruse [Wed, 22 Mar 2017 17:18:39 +0000 (17:18 +0000)]
[DeLICM] Remove AllElements. NFC.

It is not used and will not be used (anymore) in future commits.

llvm-svn: 298522

7 years agoFix testcase on windows.
Adrian Prantl [Wed, 22 Mar 2017 17:15:03 +0000 (17:15 +0000)]
Fix testcase on windows.

llvm-svn: 298521

7 years ago[InstCombine] canonicalize insertelement of scalar constant ahead of insertelement...
Sanjay Patel [Wed, 22 Mar 2017 17:10:44 +0000 (17:10 +0000)]
[InstCombine] canonicalize insertelement of scalar constant ahead of insertelement of variable

insertelement (insertelement X, Y, IdxC1), ScalarC, IdxC2 -->
insertelement (insertelement X, ScalarC, IdxC2), Y, IdxC1

As noted in the code comment and seen in the test changes, the motivation is that by pulling
constant insertion up, we may be able to constant fold some insertelement instructions.

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

llvm-svn: 298520

7 years agoDelete TestLLVM.py
Zachary Turner [Wed, 22 Mar 2017 17:08:25 +0000 (17:08 +0000)]
Delete TestLLVM.py

This was added to workaround a limitation in LLVM's implementation
of getting the current user's home directory, since it would
only look at the value of $HOME, but we did not want to rely
on that being set so we would also look in the password database.

Adding the ability to look in the password database to LLVM was
a straightforward patch that was submitted in r298513, so since
that is done this test is no longer needed.

llvm-svn: 298519

7 years agoFix PR32298 by adding an early exit to getFrameIndexExprs().
Adrian Prantl [Wed, 22 Mar 2017 16:50:16 +0000 (16:50 +0000)]
Fix PR32298 by adding an early exit to getFrameIndexExprs().

Also add an assertion for the case that there are multiple FI
expressions with a DW_OP_LLVM_fragment; which should violate internal
constraints in DbgVariable.

llvm-svn: 298518

7 years agoMerge changes from r298466 into Xcode project
Tim Hammerquist [Wed, 22 Mar 2017 16:47:14 +0000 (16:47 +0000)]
Merge changes from r298466 into Xcode project

rdar://problem/31197116

llvm-svn: 298517

7 years ago[OpenMP] Allow multiple weak symbols to be loaded from the fat binary
George Rokos [Wed, 22 Mar 2017 16:43:40 +0000 (16:43 +0000)]
[OpenMP] Allow multiple weak symbols to be loaded from the fat binary

For compatibility with Fortran.

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

llvm-svn: 298516

7 years ago[OpenMP] CUDA plugin: add include directory for libelf
George Rokos [Wed, 22 Mar 2017 16:41:46 +0000 (16:41 +0000)]
[OpenMP] CUDA plugin: add include directory for libelf

Allow the user to manually specify where libelf is installed.

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

llvm-svn: 298515

7 years agoMake the home_directory test a little more resilient.
Zachary Turner [Wed, 22 Mar 2017 16:30:06 +0000 (16:30 +0000)]
Make the home_directory test a little more resilient.

It's possible (albeit strange) for $HOME to intentionally
point somewhere other than the user's home directory as
reported by the password database.  Our test shouldn't fail
in this case.  This patch updates the test to pull directly
from the password database before unsetting $HOME, rather
than comparing the return value of home_directory() to the
original value of the environment variable.

llvm-svn: 298514

7 years agoMake home_directory look in the password database in addition to $HOME.
Zachary Turner [Wed, 22 Mar 2017 15:24:59 +0000 (15:24 +0000)]
Make home_directory look in the password database in addition to $HOME.

This is something of an edge case, but when the $HOME environment
variable is not set, we can still look in the password database
to get the current user's home directory.

Added a test for this by getting the value of $HOME, then unsetting
it, then calling home_directory() and verifying that it succeeds
and that the value is the same as what we originally read from
the environment.

llvm-svn: 298513

7 years ago[ARM] t2_so_imm_neg had a subtle bug in the conversion, and could trigger UB by negat...
Artyom Skrobov [Wed, 22 Mar 2017 15:09:30 +0000 (15:09 +0000)]
[ARM] t2_so_imm_neg had a subtle bug in the conversion, and could trigger UB by negating (int)-2147483648. By pure luck, none of the pre-existing tests triggered this; so I'm adding one.

Summary: Thanks to Vitaly Buka for helping catch this.

Reviewers: rengolin, jmolloy, efriedma, vitalybuka

Subscribers: llvm-commits, aemerson

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

llvm-svn: 298512

7 years ago[X86][MMX] Add tests for _mm_set*_* intrinsics
Simon Pilgrim [Wed, 22 Mar 2017 14:55:43 +0000 (14:55 +0000)]
[X86][MMX] Add tests for _mm_set*_* intrinsics

llvm-svn: 298511

7 years agoIntroduce another level of metadata to distinguish non-aliasing accesses
Roman Gareev [Wed, 22 Mar 2017 14:25:24 +0000 (14:25 +0000)]
Introduce another level of metadata to distinguish non-aliasing accesses

Introduce another level of alias metadata to distinguish the individual
non-aliasing accesses that have inter iteration alias-free base pointers
marked with "Inter iteration alias-free" mark nodes. It can be used to,
for example, distinguish different stores (loads) produced by unrolling of
the innermost loops and, subsequently, sink (hoist) them by LICM.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D30606

llvm-svn: 298510

7 years agoRevert "Delete the remainder of platform specific code in FileSpec."
Pavel Labath [Wed, 22 Mar 2017 14:04:43 +0000 (14:04 +0000)]
Revert "Delete the remainder of platform specific code in FileSpec."

This reverts commit r298465 as it breaks
TestLLVM.TestHomeDirectory.test_tilde_home_directory.

llvm-svn: 298509

7 years agoAdd default typo to .tbss.*
Rafael Espindola [Wed, 22 Mar 2017 14:04:19 +0000 (14:04 +0000)]
Add default typo to .tbss.*

This matches gas behavior and is part of pr31888.

llvm-svn: 298508

7 years agoMap the new load to the base pointer of the invariant load hoisted load
Roman Gareev [Wed, 22 Mar 2017 13:57:53 +0000 (13:57 +0000)]
Map the new load to the base pointer of the invariant load hoisted load

Map the new load to the base pointer of the invariant load hoisted load
to be able to find the alias information for it.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D30605

llvm-svn: 298507

7 years agoSet the default type for .bss.foo.
Rafael Espindola [Wed, 22 Mar 2017 13:57:16 +0000 (13:57 +0000)]
Set the default type for .bss.foo.

This matches gas and is part of pr31888.

llvm-svn: 298506

7 years agoProduce INIT_ARRAY for sections named .init_array.*
Rafael Espindola [Wed, 22 Mar 2017 13:35:41 +0000 (13:35 +0000)]
Produce INIT_ARRAY for sections named .init_array.*

These sections are merged together by the linker, so they should have
the same time.

llvm-svn: 298505

7 years agoRevert "Correct class-template deprecation behavior"
Martin Bohme [Wed, 22 Mar 2017 13:34:37 +0000 (13:34 +0000)]
Revert "Correct class-template deprecation behavior"

This reverts commit r298410 (which produces incorrect warnings, see
comments on https://reviews.llvm.org/rL298410).

llvm-svn: 298504

7 years agoRevert "iFix Test deprecation behavior in C89 mode as a result of r298410"
Martin Bohme [Wed, 22 Mar 2017 13:33:03 +0000 (13:33 +0000)]
Revert "iFix Test deprecation behavior in C89 mode as a result of r298410"

This reverts commit r298433. (Required to revert r298410, see comments
there.)

llvm-svn: 298503

7 years ago[AMDGPU][MC] Fix for Bug 28204 + LIT tests
Dmitry Preobrazhensky [Wed, 22 Mar 2017 13:31:01 +0000 (13:31 +0000)]
[AMDGPU][MC] Fix for Bug 28204 + LIT tests

Fixed v_mad_i64_i32/u64_u32 encoding

Reviewers: artem.tamazov

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

llvm-svn: 298502

7 years ago[clang-tidy] Tests should not rely on STL headers being available.
Alexander Kornienko [Wed, 22 Mar 2017 12:50:10 +0000 (12:50 +0000)]
[clang-tidy] Tests should not rely on STL headers being available.

llvm-svn: 298501

7 years ago[clang-tidy] clang-format the last patch. NFC
Alexander Kornienko [Wed, 22 Mar 2017 12:50:05 +0000 (12:50 +0000)]
[clang-tidy] clang-format the last patch. NFC

llvm-svn: 298500

7 years ago[clang-tidy] modified identifier naming case to use CT_AnyCase for ignoring case...
Alexander Kornienko [Wed, 22 Mar 2017 12:49:58 +0000 (12:49 +0000)]
[clang-tidy] modified identifier naming case to use CT_AnyCase for ignoring case style

Summary:
Using CaseType::CT_AnyCase for selected identifier results in inheriting case style setting from more basic identifier type.

This patch changes CT_AnyCase behavior to ignore case style of specified identifier. If case style was not set, llvm::Optional will be used for keeping this information (llvm::Optional<>::hasVal), thus CT_AnyCase will no longer mean more general identifier style should be used.

This eliminates false-positives when naming convention is not clear for specific areas of code (legacy, third party) or for selected types.

Reviewers: berenm, alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, JDevlieghere

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

llvm-svn: 298499

7 years ago[CMake] Use variable interpolation instead of string concatenation
Serge Pavlov [Wed, 22 Mar 2017 12:06:11 +0000 (12:06 +0000)]
[CMake] Use variable interpolation instead of string concatenation

String concatenation used in r298336 allowed to get rid of extra spaces
but also resulted in lost delimiter spaces, so use previous method.

llvm-svn: 298498

7 years ago[X86] Add multiply by constant tests (PR28513)
Simon Pilgrim [Wed, 22 Mar 2017 12:03:56 +0000 (12:03 +0000)]
[X86] Add multiply by constant tests (PR28513)

As discussed on PR28513, add tests for constant multiplication by constants between 1 to 32

llvm-svn: 298497

7 years agor286814 resulted that CallPenalty can be subtracted twice:
Evgeny Astigeevich [Wed, 22 Mar 2017 12:01:57 +0000 (12:01 +0000)]
r286814 resulted that CallPenalty can be subtracted twice:
- First time, during calculation of the cost in InlineCost.cpp
- Second time, during calculation of the cost in Inliner.cpp

This patches fixes this.

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

llvm-svn: 298496

7 years ago[X86] Remove unnecessary duplicate code (PR30649). NFCI.
Simon Pilgrim [Wed, 22 Mar 2017 11:23:49 +0000 (11:23 +0000)]
[X86] Remove unnecessary duplicate code (PR30649). NFCI.

llvm-svn: 298495

7 years agoRemove an overly aggressive assert in r298491 and leave a comment
Chandler Carruth [Wed, 22 Mar 2017 10:38:07 +0000 (10:38 +0000)]
Remove an overly aggressive assert in r298491 and leave a comment
explaining why we have to ignore errors here even though in other parts
of codegen we can be more strict with builtins.

Also add a test case based on the code in a TSan test that found this
issue.

llvm-svn: 298494

7 years ago[Serialization] Serialize DependentSizedExtVectorType
Alex Lorenz [Wed, 22 Mar 2017 10:04:48 +0000 (10:04 +0000)]
[Serialization] Serialize DependentSizedExtVectorType

rdar://30659700

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

llvm-svn: 298493

7 years agotsan: fix a typo
Dmitry Vyukov [Wed, 22 Mar 2017 09:31:17 +0000 (09:31 +0000)]
tsan: fix a typo

s/covert_morder/convert_morder/

llvm-svn: 298492

7 years ago[nonnull] Teach Clang to attach the nonnull LLVM attribute to
Chandler Carruth [Wed, 22 Mar 2017 09:09:13 +0000 (09:09 +0000)]
[nonnull] Teach Clang to attach the nonnull LLVM attribute to
declarations and calls instead of just definitions, and then teach it to
*not* attach such attributes even if the source code contains them.

This follows the design direction discussed on cfe-dev here:
http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html

The idea is that for C standard library builtins, even if the library
vendor chooses to annotate their routines with __attribute__((nonnull)),
we will ignore those attributes which pertain to pointer arguments that
have an associated size. This allows the widespread (and seemingly
reasonable) pattern of calling these routines with a null pointer and
a zero size. I have only done this for the library builtins currently
recognized by Clang, but we can now trivially add to this set. This will
be controllable with -fno-builtin if anyone should care to do so.

Note that this does *not* change the AST. As a consequence, warnings,
static analysis, and source code rewriting are not impacted.

This isn't even a regression on any platform as neither Clang nor LLVM
have ever put 'nonnull' onto these arguments for declarations. All this
patch does is enable it on other declarations while preventing us from
ever accidentally enabling it on these libc functions due to a library
vendor.

It will also allow any other libraries using this annotation to gain
optimizations based on the annotation even when only a declaration is
visible.

llvm-svn: 298491

7 years agoAdd LibreOffice Clang plugin to ExternalClangExamples.rst
Stephan Bergmann [Wed, 22 Mar 2017 08:45:49 +0000 (08:45 +0000)]
Add LibreOffice Clang plugin to ExternalClangExamples.rst

Reviewers: rsmith, rizsotto.mailinglist

Subscribers: cfe-commits

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

llvm-svn: 298490

7 years agoRevert "[ScalarEvolution] Predicate implication from operations"
Max Kazantsev [Wed, 22 Mar 2017 07:50:33 +0000 (07:50 +0000)]
Revert "[ScalarEvolution] Predicate implication from operations"

This reverts commit rL298481

Fails clang-with-lto-ubuntu build.

llvm-svn: 298489

7 years ago[ValueTracking] Make sure we keep range metadata information when calculating known...
Craig Topper [Wed, 22 Mar 2017 07:22:49 +0000 (07:22 +0000)]
[ValueTracking] Make sure we keep range metadata information when calculating known bits for calls to bitreverse intrinsic.

llvm-svn: 298488

7 years agoMove setting of LangOpts based on target flags out of CompilerInstance
Eric Christopher [Wed, 22 Mar 2017 06:36:09 +0000 (06:36 +0000)]
Move setting of LangOpts based on target flags out of CompilerInstance
and into TargetInfo::adjust so that it gets called in more places
throughout the compiler (AST serialization in particular).

Should fix PPC modules after removing of faltivec.

llvm-svn: 298487

7 years ago[ValueTracking] use setLowBits/setHighBits/setBitsFrom to replace |= getHighBits...
Craig Topper [Wed, 22 Mar 2017 06:19:37 +0000 (06:19 +0000)]
[ValueTracking] use setLowBits/setHighBits/setBitsFrom to replace |= getHighBits/getLowBits. NFCI

llvm-svn: 298486

7 years ago[X86] Remove an unused function from release builds. Reported by gccs unused function...
Craig Topper [Wed, 22 Mar 2017 06:07:58 +0000 (06:07 +0000)]
[X86] Remove an unused function from release builds. Reported by gccs unused function warning.

llvm-svn: 298485

7 years ago[SystemZ] Don't drop any operands in expandZExtPseudo()
Jonas Paulsson [Wed, 22 Mar 2017 06:03:32 +0000 (06:03 +0000)]
[SystemZ]  Don't drop any operands in expandZExtPseudo()

Make sure that any operands, e.g. of an implicit def of a super reg is
transferred to the new instruction.

Review: Ulrich Weigand
llvm-svn: 298484

7 years agoRevert "[ARM] Recommit the glueless lowering of addc/adde in Thumb1, including the...
Vitaly Buka [Wed, 22 Mar 2017 05:07:44 +0000 (05:07 +0000)]
Revert "[ARM] Recommit the glueless lowering of addc/adde in Thumb1, including the amended (no UB anymore) fix for adding/subtracting -2147483648."

Fails check-llvm with ubsan

This reverts commit r298417.

llvm-svn: 298482

7 years ago[ScalarEvolution] Predicate implication from operations
Max Kazantsev [Wed, 22 Mar 2017 04:48:46 +0000 (04:48 +0000)]
[ScalarEvolution] Predicate implication from operations

This patch allows SCEV predicate analysis to prove implication of some expression predicates
from context predicates related to arguments of those expressions.
It introduces three new rules:

For addition:
  (A >X && B >= 0) || (B >= 0 && A > X) ===> (A + B) > X.

For division:
  (A > X) && (0 < B <= X + 1) ===> (A / B > 0).
  (A > X) && (-B <= X < 0) ===> (A / B >= 0).

Using these rules, SCEV is able to prove facts like "if X > 1 then X / 2 > 0".
They can also be combined with the same context, to prove more complex expressions like
"if X > 1 then X/2 + 1 > 1".

Diffirential Revision: https://reviews.llvm.org/D30887

Reviewed by: sanjoy

llvm-svn: 298481

7 years ago[XRay][compiler-rt] Remove dependency on <system_error>
Dean Michael Berris [Wed, 22 Mar 2017 04:40:32 +0000 (04:40 +0000)]
[XRay][compiler-rt] Remove dependency on <system_error>

Summary:
Depending on C++11 <system_error> introduces a link-time requirement to
C++11 symbols. Removing it allows us to depend on header-only C++11 and
up libraries.

Partially fixes http://llvm.org/PR32274 -- we know there's more invasive work
to be done, but we're doing it incrementally.

Reviewers: dblaikie, kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 298480

7 years agolit: remove python2-isms
Brian Gesiak [Wed, 22 Mar 2017 04:23:01 +0000 (04:23 +0000)]
lit: remove python2-isms

Summary:
`assert.assertItemEqual` went away in Python 3. Seeing how lists
are ordered, comparing a list against each other should work just
as well.

Patch by @jbergstroem (Johan Bergström).

Reviewers: modocache, gparker42

Reviewed By: modocache

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

llvm-svn: 298479

7 years ago[InstCombine] Teach SimplifyDemandedUseBits to shrink Constants on the left side...
Craig Topper [Wed, 22 Mar 2017 04:03:53 +0000 (04:03 +0000)]
[InstCombine] Teach SimplifyDemandedUseBits to shrink Constants on the left side of subtracts

Summary: Subtracts can have constants on the left side, but we don't shrink them based on demanded bits. This patch fixes that to match the right hand side.

Reviewers: davide, majnemer, spatel, sanjoy, hfinkel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 298478

7 years agoSuppress warning on unreachable [[clang::fallthrough]] within a template instantiation.
Richard Smith [Wed, 22 Mar 2017 01:49:19 +0000 (01:49 +0000)]
Suppress warning on unreachable [[clang::fallthrough]] within a template instantiation.

We don't know whether some other instantiation of the template might be able to
reach the annotation, so warning on it has a high chance of false positives.

Patch by Ahmed Asadi!

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

llvm-svn: 298477

7 years agoXFAIL CFI stats test while LLD produces corrupt PDBs that confuse DIA
Reid Kleckner [Wed, 22 Mar 2017 01:45:08 +0000 (01:45 +0000)]
XFAIL CFI stats test while LLD produces corrupt PDBs that confuse DIA

llvm-svn: 298476

7 years agoUpdate LLD tests for codeview dumping changes
Reid Kleckner [Wed, 22 Mar 2017 01:43:49 +0000 (01:43 +0000)]
Update LLD tests for codeview dumping changes

llvm-svn: 298475

7 years ago[codeview] Use separate records for LF_SUBSTR_LIST and LF_ARGLIST
Reid Kleckner [Wed, 22 Mar 2017 01:37:38 +0000 (01:37 +0000)]
[codeview] Use separate records for LF_SUBSTR_LIST and LF_ARGLIST

They are structurally the same, but now we need to distinguish them
because one record lives in the IPI stream and the other lives in TPI.

llvm-svn: 298474

7 years ago[GlobalISel]: Create VREGs for ConstantInt args
Aditya Nandakumar [Wed, 22 Mar 2017 01:16:39 +0000 (01:16 +0000)]
[GlobalISel]: Create VREGs for ConstantInt args

This patch changes the behavior of IRTranslating intrinsics where we
now create VREG + G_CONSTANT for ConstantInt values. We already do this
for FloatingPoint values. This makes it easier for the backends to
select code and it won't have to de-duplicate creation+selection of
constants.

Reviewed by: ab

llvm-svn: 298473

7 years agoDon't compose DWARF expressions with multiple subregisters.
Adrian Prantl [Wed, 22 Mar 2017 01:16:01 +0000 (01:16 +0000)]
Don't compose DWARF expressions with multiple subregisters.

If a register location can only be described by a complex expression
(i.e., multiple subregisters) it doesn't safely compose with another
complex expression. For example, it is not possible to apply a
DW_OP_deref operation to multiple DW_OP_pieces.

llvm-svn: 298472

7 years agoDwarfExpression: Defer emitting DWARF register operations
Adrian Prantl [Wed, 22 Mar 2017 01:15:57 +0000 (01:15 +0000)]
DwarfExpression: Defer emitting DWARF register operations
until the rest of the expression is known.

This is still an NFC refactoring in preparation of a subsequent bugfix.

This reapplies r298388 with a bugfix for non-physical frame registers.

llvm-svn: 298471

7 years agoReverting r298421 due to using a header that's unavailable to all systems and some...
Aaron Ballman [Wed, 22 Mar 2017 01:08:54 +0000 (01:08 +0000)]
Reverting r298421 due to using a header that's unavailable to all systems and some other post-commit review feedback.

llvm-svn: 298470

7 years agoRemove -ffp-contract=fast from this test
Adam Nemet [Wed, 22 Mar 2017 00:58:18 +0000 (00:58 +0000)]
Remove -ffp-contract=fast from this test

It does not need it and causes mismatch after -ffp-contract=fast is turned
into an FMF.

llvm-svn: 298469

7 years agoChange -ffp-contract=fast test to run on Aarch64
Adam Nemet [Wed, 22 Mar 2017 00:58:15 +0000 (00:58 +0000)]
Change -ffp-contract=fast test to run on Aarch64

(I don't have powerpc enabled in my build and I am changing
how -ffp-contract=fast works.)

llvm-svn: 298468

7 years ago[COFF] Put the PDB next to the image if the user doesn't pass /PDB:
Reid Kleckner [Wed, 22 Mar 2017 00:57:14 +0000 (00:57 +0000)]
[COFF] Put the PDB next to the image if the user doesn't pass /PDB:

Summary: This is compatible with MSVC link.exe.

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 298467

7 years agoBreak the cycle between Host and PluginProcessUtility.
Zachary Turner [Wed, 22 Mar 2017 00:27:54 +0000 (00:27 +0000)]
Break the cycle between Host and PluginProcessUtility.

There are only two users of NativeRegisterContextRegisterInfo,
and both are in process plugins.  Moving this code from Host
to Plugins/Process/Utility thus makes sense, and as it is the
only dependency from Host -> PluginProcessUtility, it also
breaks this cycle, reducing LLDB's overall cycle count from
45 to 44.

llvm-svn: 298466

7 years agoDelete the remainder of platform specific code in FileSpec.
Zachary Turner [Wed, 22 Mar 2017 00:27:24 +0000 (00:27 +0000)]
Delete the remainder of platform specific code in FileSpec.

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

llvm-svn: 298465

7 years ago[Modules] Rebuild modules on umbrella header mismatch
Bruno Cardoso Lopes [Wed, 22 Mar 2017 00:11:21 +0000 (00:11 +0000)]
[Modules] Rebuild modules on umbrella header mismatch

This restores behavior pre-r230064 since after PCMCache work (r298278)
we don't reload PCMs from disk within the same compiler invocation.

Testcases from r230064 are still left around since they still guarantee
the correct behavior we're expecting.

rdar://problem/19889777

llvm-svn: 298464

7 years agoDefine Config::Is64.
Rui Ueyama [Wed, 22 Mar 2017 00:01:11 +0000 (00:01 +0000)]
Define Config::Is64.

This is a shorthand for Config->Wordsize == 8. So this is not strictly
necessary but seems handy. "Is 64 bit?" is easier to read than "Is
wordsize 8 byte?"

llvm-svn: 298463

7 years agoMake test more robust
Adam Nemet [Tue, 21 Mar 2017 23:50:52 +0000 (23:50 +0000)]
Make test more robust

Set the flags on FAdd locally rather than assuming nothing will change it from
way earlier in the test.

llvm-svn: 298462

7 years agoResubmit "Improve StringMap iterator support."
Zachary Turner [Tue, 21 Mar 2017 23:45:03 +0000 (23:45 +0000)]
Resubmit "Improve StringMap iterator support."

The issue was trying to advance past the end of the iterator
when computing the end() iterator.

llvm-svn: 298461

7 years ago[GlobalISel] Update DBG_VALUEs referencing DCE'd instructions.
Ahmed Bougacha [Tue, 21 Mar 2017 23:42:54 +0000 (23:42 +0000)]
[GlobalISel] Update DBG_VALUEs referencing DCE'd instructions.

Quentin points out that r298358 would cause us to emit different code
with debug info.  That's a big no-no; also erase the instructions that
only live thanks to DBG_VALUE users.

Adrian explained how this is an existing problem and an OK thing to do:
clang has allocas for all variables so shouldn't be affected at -O0, but
swift uses a bit of inlineasm to explicitly keep values live for the
purpose of debug info quality.  I'm not sure there is a better scheme.

llvm-svn: 298460

7 years ago[GlobalISel] Don't translate br to layout successor.
Ahmed Bougacha [Tue, 21 Mar 2017 23:42:50 +0000 (23:42 +0000)]
[GlobalISel] Don't translate br to layout successor.

MI can represent fallthrough to layout successor blocks, and our
post-isel representation uses that extensively.

We might as well use it too, to avoid translating and carrying along
unnecessary branches.

llvm-svn: 298459

7 years ago[IR] Remove validAlignment and validPointer methods DataLayout as they aren't used.
Craig Topper [Tue, 21 Mar 2017 23:04:23 +0000 (23:04 +0000)]
[IR] Remove validAlignment and validPointer methods DataLayout as they aren't used.

I don't think validAlignment has been used since r34358 in 2007. I think validPointer was copied from validAlignment some time later, but it definitely wasn't used in the first commit that contained it.

llvm-svn: 298458

7 years agoMake elf::ScriptConfig a LinkerScript class member variable.
Rui Ueyama [Tue, 21 Mar 2017 23:03:09 +0000 (23:03 +0000)]
Make elf::ScriptConfig a LinkerScript class member variable.

LinkerScript used to be a template class, so we couldn't instantiate
that class in elf::link. We instantiated ScriptConfig class earlier
instead so that the linker script parser can store configurations to
the object.

Now that LinkerScript is not a template, it doesn't make sense to
separate ScriptConfig from LinkerScript. This patch merges them.

llvm-svn: 298457

7 years agoRename LinkerScriptBase -> LinkerScript.
Rui Ueyama [Tue, 21 Mar 2017 23:02:51 +0000 (23:02 +0000)]
Rename LinkerScriptBase -> LinkerScript.

llvm-svn: 298456

7 years ago[deps script] Sort cycles by the difficulty of breaking.
Zachary Turner [Tue, 21 Mar 2017 22:46:46 +0000 (22:46 +0000)]
[deps script] Sort cycles by the difficulty of breaking.

When passing --discover-cycles and --show-counts, it displays
the number of dependencies between each hop of the cycle,
and sorts by the sum.  Dependencies at the top of the list
should be the easiest to break.

llvm-svn: 298455

7 years agoAMDGPU: Remove hasSideEffects from SI_RETURN_TO_EPILOG
Matt Arsenault [Tue, 21 Mar 2017 22:28:48 +0000 (22:28 +0000)]
AMDGPU: Remove hasSideEffects from SI_RETURN_TO_EPILOG

llvm-svn: 298454

7 years agoGlobalISel: respect BooleanContents when extending i1.
Tim Northover [Tue, 21 Mar 2017 22:22:05 +0000 (22:22 +0000)]
GlobalISel: respect BooleanContents when extending i1.

The world isn't just x86 & ARM, some targets need to store -1 into the byte
when legalizing a bool store.

llvm-svn: 298453

7 years agoAMDGPU: Rename SI_RETURN
Matt Arsenault [Tue, 21 Mar 2017 22:18:10 +0000 (22:18 +0000)]
AMDGPU: Rename SI_RETURN

This is used for a specific type of return to a shader part's
epilog code. Rename to try avoiding confusion from a true
call's return.

llvm-svn: 298452

7 years agoMirror CMake changes from r298412 to Xcode project
Tim Hammerquist [Tue, 21 Mar 2017 22:08:16 +0000 (22:08 +0000)]
Mirror CMake changes from r298412 to Xcode project

<rdar://problem/31181635>
M    lldb.xcodeproj/project.pbxproj

llvm-svn: 298451

7 years agoRevert "[compiler-rt][asan] Turn on ASAN unittests for win64."
Reid Kleckner [Tue, 21 Mar 2017 22:07:06 +0000 (22:07 +0000)]
Revert "[compiler-rt][asan] Turn on ASAN unittests for win64."

This reverts commit r296878.

These test still require too much swap to pass reliably.

llvm-svn: 298450

7 years agoRemove the -faltivec alias option and replace it with -maltivec everywhere.
Eric Christopher [Tue, 21 Mar 2017 22:06:18 +0000 (22:06 +0000)]
Remove the -faltivec alias option and replace it with -maltivec everywhere.
The alias was only ever used on darwin and had some issues there,
and isn't used in practice much. Also fixes a problem with -mno-altivec
not turning off -maltivec.

Also add a diagnostic for faltivec/fno-altivec that directs users to use
maltivec options and include the altivec.h file explicitly.

llvm-svn: 298449

7 years agoSplitKit: Fix subreg copy related problems
Matthias Braun [Tue, 21 Mar 2017 21:58:08 +0000 (21:58 +0000)]
SplitKit: Fix subreg copy related problems

Fix two problems related to r298025:
- SplitKit would create duplicate VNIs in some cases leading to crashs
  when hoisting copies.
- VirtRegMap could fail expanding copies at the beginning of a basic
  block.

This fixes http://llvm.org/PR32353

llvm-svn: 298448

7 years agoSort. NFC.
Rui Ueyama [Tue, 21 Mar 2017 21:49:16 +0000 (21:49 +0000)]
Sort. NFC.

llvm-svn: 298447

7 years agoAdd support for -fno-auto-profile and -fno-profile-sample-use
Dehao Chen [Tue, 21 Mar 2017 21:40:53 +0000 (21:40 +0000)]
Add support for -fno-auto-profile and -fno-profile-sample-use

Summary: We need to be able to disable samplepgo for specific files by supporting -fno-auto-profile and -fno-profile-sample-use

Reviewers: davidxl, dnovillo, echristo

Reviewed By: echristo

Subscribers: echristo, cfe-commits

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

llvm-svn: 298446

7 years agoDefine Config::Endianness.
Rui Ueyama [Tue, 21 Mar 2017 21:40:08 +0000 (21:40 +0000)]
Define Config::Endianness.

This is a shorthand for `Config->IsLE ? support::little : support::big`.

llvm-svn: 298445

7 years agoAMDGPU: Mark all unspecified CC functions in tests as amdgpu_kernel
Matt Arsenault [Tue, 21 Mar 2017 21:39:51 +0000 (21:39 +0000)]
AMDGPU: Mark all unspecified CC functions in tests as amdgpu_kernel

Currently the default C calling convention functions are treated
the same as compute kernels. Make this explicit so the default
calling convention can be changed to a non-kernel.

Converted with perl -pi -e 's/define void/define amdgpu_kernel void/'
on the relevant test directories (and undoing in one place that actually
wanted a non-kernel).

llvm-svn: 298444

7 years agoApply clang-tidy's performance-unnecessary-value-param to parts of clang.
Benjamin Kramer [Tue, 21 Mar 2017 21:35:04 +0000 (21:35 +0000)]
Apply clang-tidy's performance-unnecessary-value-param to parts of clang.

No functionality change intended.

llvm-svn: 298443

7 years agoApply clang-tidy's performance-unnecessary-value-param to clang-tidy.
Benjamin Kramer [Tue, 21 Mar 2017 21:34:58 +0000 (21:34 +0000)]
Apply clang-tidy's performance-unnecessary-value-param to clang-tidy.

No functionality change intended.

llvm-svn: 298442

7 years ago[c-index-test] Fix memory leak in c-index-test tool.
Argyrios Kyrtzidis [Tue, 21 Mar 2017 21:34:05 +0000 (21:34 +0000)]
[c-index-test] Fix memory leak in c-index-test tool.

llvm-svn: 298441

7 years agoRevert "Improve StringMap iterator support."
Zachary Turner [Tue, 21 Mar 2017 21:23:57 +0000 (21:23 +0000)]
Revert "Improve StringMap iterator support."

This is causing crashes in clang, so reverting until the problem
is figured out.

llvm-svn: 298440

7 years agoGlobalISel: widen booleans by zero-extending to a byte.
Tim Northover [Tue, 21 Mar 2017 21:12:04 +0000 (21:12 +0000)]
GlobalISel: widen booleans by zero-extending to a byte.

A bool is represented by a single byte, which the ARM ABI requires to be either
0 or 1. So we cannot use G_ANYEXT when legalizing the type.

llvm-svn: 298439

7 years agoFix test failure I introduced
Marshall Clow [Tue, 21 Mar 2017 21:05:28 +0000 (21:05 +0000)]
Fix test failure I introduced

llvm-svn: 298438

7 years agoFix clang errors caused by StringMap iterator changes.
Zachary Turner [Tue, 21 Mar 2017 20:41:51 +0000 (20:41 +0000)]
Fix clang errors caused by StringMap iterator changes.

llvm-svn: 298437