platform/upstream/llvm.git
7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Fri, 16 Dec 2016 04:26:15 +0000 (04:26 +0000)]
Update for LLVM global variable debug info API change.

llvm-svn: 289921

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 04:25:54 +0000 (04:25 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

This reapplies r289902 with additional testcase upgrades.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 289920

7 years agoRemove "-disable-llvm-optzns -verify" from the RUN line.
Akira Hatanaka [Fri, 16 Dec 2016 04:18:53 +0000 (04:18 +0000)]
Remove "-disable-llvm-optzns -verify" from the RUN line.

llvm-svn: 289919

7 years ago[ThinLTO] Thin link efficiency: More efficient export list computation
Teresa Johnson [Fri, 16 Dec 2016 04:11:51 +0000 (04:11 +0000)]
[ThinLTO] Thin link efficiency: More efficient export list computation

Summary:
Instead of checking whether a global referenced by a function being
imported is defined in the same module, speculatively always add the
referenced globals to the module's export list. After all imports are
computed, for each module prune any not in its defined set from its
export list.

For a huge C++ app with aggressive importing thresholds, even with
D27687 we spent a lot of time invoking modulePath() from
exportGlobalInModule (modulePath() was still the 2nd hottest routine in
profile). The reason is that with comdat/linkonce the summary lists for
each GUID can be long. For the app in question, for example, we were
invoking exportGlobalInModule almost 2 million times, and we traversed
an average of 63 entries in the summary list each time.

This patch reduced the thin link time for the app by about 10% (on top
of D27687) when using aggressive importing thresholds, and about 3.5% on
average with default importing thresholds.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 289918

7 years agoAdd extra headers that got deleted by my revert in r289916 but for which
Chandler Carruth [Fri, 16 Dec 2016 04:08:31 +0000 (04:08 +0000)]
Add extra headers that got deleted by my revert in r289916 but for which
new usage had already grown in the file.

llvm-svn: 289917

7 years agoRevert patch series introducing the DAG combine to match a load-by-bytes
Chandler Carruth [Fri, 16 Dec 2016 04:05:22 +0000 (04:05 +0000)]
Revert patch series introducing the DAG combine to match a load-by-bytes
idiom.

r289538: Match load by bytes idiom and fold it into a single load
r289540: Fix a buildbot failure introduced by r289538
r289545: Use more detailed assertion messages in the code ...
r289646: Add a couple of assertions to the load combine code ...

This DAG combine has a bad crash in it that is quite hard to trigger
sadly -- it relies on sneaking code with UB through the SDAG build and
into this particular combine. I've responded to the original commit with
a test case that reproduces it.

However, the code also has other problems that will require substantial
changes to address and so I'm going ahead and reverting it for now. This
should unblock us and perhaps others that are hitting the crash in the
wild and will let a fresh patch with updated approach come in cleanly
afterward.

Sorry for any trouble or disruption!

llvm-svn: 289916

7 years agoCOFF: Cache the result of library searches.
Peter Collingbourne [Fri, 16 Dec 2016 03:45:59 +0000 (03:45 +0000)]
COFF: Cache the result of library searches.

File system operations were still dominating the profile on Windows. In this
case we were spending a significant amount of our time repeatedly searching
for libraries as a result of processing linker directives. Address this
by caching whether we have already found a library with a given name. For
chrome_child.dll:

Before: 10.53s
After: 6.88s

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

llvm-svn: 289915

7 years ago[Sema] Fix handling of enumerators used as default arguments of lambda
Akira Hatanaka [Fri, 16 Dec 2016 03:19:41 +0000 (03:19 +0000)]
[Sema] Fix handling of enumerators used as default arguments of lambda
expressions in a function or class template.

This patch makes the following changes:

- Create a DependentScopeDeclRefExpr for the default argument instead of
  a CXXDependentScopeMemberExpr.
- Pass CombineWithOuterScope=true so that the outer scope in which the
  enum is declared is searched for the instantiation of the enum.

This is the first part of https://reviews.llvm.org/D23096. Fixes PR28795

rdar://problem/27535319

llvm-svn: 289914

7 years agoFix a bug when using a StructuredData darwin-log plugin
Jason Molenda [Fri, 16 Dec 2016 02:48:39 +0000 (02:48 +0000)]
Fix a bug when using a StructuredData darwin-log plugin
where we would insert a breakpoint into a system library
but never remove it, so the second time we ran the binary
there would be two breakpoints and the debugger would
stop there.

<rdar://problem/29654974>

llvm-svn: 289913

7 years ago[clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop
Felix Berger [Fri, 16 Dec 2016 02:47:56 +0000 (02:47 +0000)]
[clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop

Summary: This fixes a bug where the performance-unnecessary-value-param check suggests a fix to move the parameter inside of a loop which could be invoked multiple times.

Reviewers: sbenza, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 289912

7 years ago[SimplifyLibCalls] Use a lambda. NFCI.
Davide Italiano [Fri, 16 Dec 2016 02:28:38 +0000 (02:28 +0000)]
[SimplifyLibCalls] Use a lambda. NFCI.

llvm-svn: 289911

7 years agoclang-format-vsix: add command to format document
Antonio Maiorano [Fri, 16 Dec 2016 01:51:43 +0000 (01:51 +0000)]
clang-format-vsix: add command to format document

Bound to Ctrl+R, Ctrl+D by default. Also added section on how to debug the extension to the Readme.

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

llvm-svn: 289910

7 years agoclang-format-vsix: add a date stamp to the VSIX version number to ensure upgradability
Antonio Maiorano [Fri, 16 Dec 2016 01:37:01 +0000 (01:37 +0000)]
clang-format-vsix: add a date stamp to the VSIX version number to ensure upgradability

Presently, the version number of the VSIX matches the LLVM version number. However, as this number doesn't change often, it means that as we release new versions of this VSIX, it will have the same version number, which means users must first uninstall the old version before installing the new one. With this change, we generate a 4th part to the version number that is a date stamp (year, month, day); for example: 4.0.0.161203.

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

llvm-svn: 289909

7 years agoRevert "Update for LLVM global variable debug info API change."
Adrian Prantl [Fri, 16 Dec 2016 01:01:40 +0000 (01:01 +0000)]
Revert "Update for LLVM global variable debug info API change."

This reverts commit 289901 while investigating bot breakage.

llvm-svn: 289908

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Dec 2016 01:00:40 +0000 (01:00 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 289907

7 years agoRevert "[IR] Remove the DIExpression field from DIGlobalVariable."
Adrian Prantl [Fri, 16 Dec 2016 01:00:30 +0000 (01:00 +0000)]
Revert "[IR] Remove the DIExpression field from DIGlobalVariable."

This reverts commit 289902 while investigating bot berakage.

llvm-svn: 289906

7 years ago[c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.
Richard Smith [Fri, 16 Dec 2016 00:58:48 +0000 (00:58 +0000)]
[c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.

llvm-svn: 289905

7 years ago[APFloatTest] Log when test fails. NFC
Tim Shen [Fri, 16 Dec 2016 00:47:17 +0000 (00:47 +0000)]
[APFloatTest] Log when test fails. NFC

Reviewers: iteratee

Subscribers: llvm-commits

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

llvm-svn: 289904

7 years agoAdd missing library dep.
Peter Collingbourne [Fri, 16 Dec 2016 00:43:00 +0000 (00:43 +0000)]
Add missing library dep.

llvm-svn: 289903

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 00:36:43 +0000 (00:36 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 289902

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Fri, 16 Dec 2016 00:35:42 +0000 (00:35 +0000)]
Update for LLVM global variable debug info API change.

llvm-svn: 289901

7 years ago[PPC] corrections in two testcases
Ehsan Amiri [Fri, 16 Dec 2016 00:33:07 +0000 (00:33 +0000)]
[PPC] corrections in two testcases

Removing sensitivity to scheduling (by using CHECK-DAG instead of CHECK) and
some other minor corrections.

In preparation to commit Power9 processor model.

llvm-svn: 289900

7 years agoIPO: Introduce ThinLTOBitcodeWriter pass.
Peter Collingbourne [Fri, 16 Dec 2016 00:26:30 +0000 (00:26 +0000)]
IPO: Introduce ThinLTOBitcodeWriter pass.

This pass prepares a module containing type metadata for ThinLTO by splitting
it into regular and thin LTO parts if possible, and writing both parts to
a multi-module bitcode file. Modules that do not contain type metadata are
written unmodified as a single module.

All globals with type metadata are added to the regular LTO module, and
the rest are added to the thin LTO module.

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

llvm-svn: 289899

7 years ago[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2
Evandro Menezes [Fri, 16 Dec 2016 00:18:00 +0000 (00:18 +0000)]
[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2

This feature now gates such stores after r289845.  Thus the Exynos
processors now need this feature.

llvm-svn: 289898

7 years agoFix typo in error messages. NFC.
Kelvin Li [Fri, 16 Dec 2016 00:15:54 +0000 (00:15 +0000)]
Fix typo in error messages. NFC.

llvm-svn: 289897

7 years ago[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)
Teresa Johnson [Thu, 15 Dec 2016 23:50:06 +0000 (23:50 +0000)]
[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)

Summary:
We were reinvoking exportGlobalInModule numerous times redundantly.
No need to re-export globals referenced by a global that was already
imported from its module. This resulted in a large speedup in the thin
link for a big application, particularly when importing aggressiveness
was cranked up.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 289896

7 years ago[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.
Davide Italiano [Thu, 15 Dec 2016 23:48:07 +0000 (23:48 +0000)]
[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.

llvm-svn: 289895

7 years ago[SimplifyLibCalls] Lower fls() to llvm.ctlz().
Davide Italiano [Thu, 15 Dec 2016 23:45:11 +0000 (23:45 +0000)]
[SimplifyLibCalls] Lower fls() to llvm.ctlz().

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

llvm-svn: 289894

7 years agoDebugInfo: Make a Generic test case actually generic (remove datalayout/triple)
David Blaikie [Thu, 15 Dec 2016 23:39:25 +0000 (23:39 +0000)]
DebugInfo: Make a Generic test case actually generic (remove datalayout/triple)

llvm-svn: 289893

7 years agoDebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697
David Blaikie [Thu, 15 Dec 2016 23:37:38 +0000 (23:37 +0000)]
DebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697

Post-commit review feedback from Adrian Prantl.

Hopefully this fixes that up :)

llvm-svn: 289892

7 years ago[IRTranslator] Merge the entry and ABI lowering blocks.
Quentin Colombet [Thu, 15 Dec 2016 23:32:25 +0000 (23:32 +0000)]
[IRTranslator] Merge the entry and ABI lowering blocks.

The IRTranslator uses an additional block before the LLVM-IR entry block
to perform all the ABI lowering and the constant hoisting. Thus, this
block is the actual entry block and it falls through the LLVM-IR entry
block. However, with such representation, we end up with two basic
blocks that are not maximal.

Therefore, this patch adds a bit of canonicalization by merging both the
LLVM-IR entry block and the ABI lowering/constants hoisting into one
block, making the resulting block more likely to be maximal (indeed the
LLVM-IR entry block might not have been maximal).

llvm-svn: 289891

7 years ago[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT when buildi...
Kuba Mracek [Thu, 15 Dec 2016 23:20:54 +0000 (23:20 +0000)]
[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT when building compiler-rt from clang/runtime/CMakeLists.txt

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

llvm-svn: 289890

7 years agoDebugInfo: Emit ranges for functions with DISubprograms but lacking locations on...
David Blaikie [Thu, 15 Dec 2016 23:17:52 +0000 (23:17 +0000)]
DebugInfo: Emit ranges for functions with DISubprograms but lacking locations on any instructions

This seems more consistent, and helps tidy up/simplify some other code
in this change.

llvm-svn: 289889

7 years ago[SimplifyLibCalls] Remove redundant folding logic for ffs().
Davide Italiano [Thu, 15 Dec 2016 23:11:00 +0000 (23:11 +0000)]
[SimplifyLibCalls] Remove redundant folding logic for ffs().

Lowering to llvm.cttz() will result in constant folding anyway
if the argument to ffs is a constant. Pointed out by Eli for
fls() in D14590.

llvm-svn: 289888

7 years ago[asan][docs] Fix the documentation to use clang++ for the C++ example
Anna Zaks [Thu, 15 Dec 2016 22:55:21 +0000 (22:55 +0000)]
[asan][docs] Fix the documentation to use clang++ for the C++ example

After Darwin has been updated not to link in stdc++ on Darwin this actually
started to break.

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

llvm-svn: 289887

7 years ago[analyzer] Teach the analyzer that pointers can escape into __cxa_demangle
Anna Zaks [Thu, 15 Dec 2016 22:55:18 +0000 (22:55 +0000)]
[analyzer] Teach the analyzer that pointers can escape into __cxa_demangle

This fixes a reported false positive in the malloc checker.

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

llvm-svn: 289886

7 years ago[analyzer] Refine the diagnostics in the nullability checker to differentiate between...
Anna Zaks [Thu, 15 Dec 2016 22:55:15 +0000 (22:55 +0000)]
[analyzer] Refine the diagnostics in the nullability checker to differentiate between nil and null

This is a big deal for ObjC, where nullability annotations are extensively
used. I've also changed "Null" -> "null" and removed "is" as this is the
pattern that Sema is using.

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

llvm-svn: 289885

7 years ago[analyzer] Refer to macro names in diagnostics for macros representing a literal
Anna Zaks [Thu, 15 Dec 2016 22:55:11 +0000 (22:55 +0000)]
[analyzer] Refer to macro names in diagnostics for macros representing a literal

When a macro expending to a literal is used in a comparison, use the macro name
in the diagnostic rather than the literal. This improves readability of path
notes.

Added tests for various macro literals that could occur. Only BOOl, Int, and
NULL tests have changed behavior with this patch.

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

llvm-svn: 289884

7 years ago[analyzer] Include type name in Retain Count Checker diagnostics
Anna Zaks [Thu, 15 Dec 2016 22:55:03 +0000 (22:55 +0000)]
[analyzer] Include type name in Retain Count Checker diagnostics

The more detailed diagnostic will make identifying which object the
diagnostics refer to easier.

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

llvm-svn: 289883

7 years agoDon't combine splats with other shuffles.
Eli Friedman [Thu, 15 Dec 2016 22:41:40 +0000 (22:41 +0000)]
Don't combine splats with other shuffles.

We sometimes end up creating shuffles which are worse than the obvious
translation of the IR.

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

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

llvm-svn: 289882

7 years agoIfdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept...
Kuba Mracek [Thu, 15 Dec 2016 22:40:24 +0000 (22:40 +0000)]
Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept getutent and friends).

llvm-svn: 289881

7 years agoFix R_AARCH64_MOVW_UABS_G3 relocation
Yichao Yu [Thu, 15 Dec 2016 22:36:53 +0000 (22:36 +0000)]
Fix R_AARCH64_MOVW_UABS_G3 relocation

Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....)

Reviewers: t.p.northover, lhames

Subscribers: davide, aemerson, rengolin, llvm-commits

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

llvm-svn: 289880

7 years ago[CMake] Refactor LLDB libraries and tools to be components
Chris Bieneman [Thu, 15 Dec 2016 22:01:17 +0000 (22:01 +0000)]
[CMake] Refactor LLDB libraries and tools to be components

In LLVM's CMake we have a convention that components have both a build and an install target. Making LLDB follow this convention will allow LLDB to take advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM.

llvm-svn: 289879

7 years ago[msan] Intercept getutent and friends.
Evgeniy Stepanov [Thu, 15 Dec 2016 22:00:14 +0000 (22:00 +0000)]
[msan] Intercept getutent and friends.

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

llvm-svn: 289878

7 years agoAMDGPU: Select branch on undef to uniform scc branch
Matt Arsenault [Thu, 15 Dec 2016 21:57:11 +0000 (21:57 +0000)]
AMDGPU: Select branch on undef to uniform scc branch

llvm-svn: 289877

7 years ago[gold] Add datalayout to test where it was missing
Teresa Johnson [Thu, 15 Dec 2016 21:42:56 +0000 (21:42 +0000)]
[gold] Add datalayout to test where it was missing

Needed due to change to require datalayout (r289719).

Found this in my own testing, maybe there aren't any bots using a v1.12
gold yet.

llvm-svn: 289876

7 years ago[ThinLTO] Revert part of r289843 that belonged to another patch.
Teresa Johnson [Thu, 15 Dec 2016 21:39:42 +0000 (21:39 +0000)]
[ThinLTO] Revert part of r289843 that belonged to another patch.

The code change for D27687 accidentally got committed along with the
main change in r289843. Revert it temporarily, so that I can recommit it
along with its test as intended.

llvm-svn: 289875

7 years agoDon't combine a shuffle of two BUILD_VECTORs with duplicate elements.
Eli Friedman [Thu, 15 Dec 2016 21:36:59 +0000 (21:36 +0000)]
Don't combine a shuffle of two BUILD_VECTORs with duplicate elements.

Targets can't handle this case well in general; we often transform
a shuffle of two cheap BUILD_VECTORs to element-by-element insertion,
which is very inefficient.

Fixes https://llvm.org/bugs/show_bug.cgi?id=31364 . Partially
fixes https://llvm.org/bugs/show_bug.cgi?id=31301.

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

llvm-svn: 289874

7 years ago[analyzer] Add a new SVal to support pointer-to-member operations.
Devin Coughlin [Thu, 15 Dec 2016 21:27:06 +0000 (21:27 +0000)]
[analyzer] Add a new SVal to support pointer-to-member operations.

Add a new type of NonLoc SVal for C++ pointer-to-member operations. This SVal
supports both pointers to member functions and pointers to member data.

A patch by Kirill Romanenkov!

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

llvm-svn: 289873

7 years ago[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg
Sanjoy Das [Thu, 15 Dec 2016 21:23:44 +0000 (21:23 +0000)]
[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg

This used to be allowed before r289402 by default (before r289402 you
could have TBAA metadata on any instruction), and while I'm not sure
that it helps, it does sound reasonable enough to not fail the verifier
and we have out-of-tree users who use this.

llvm-svn: 289872

7 years ago[ThinLTO] Remove stale comment (NFC)
Teresa Johnson [Thu, 15 Dec 2016 20:53:31 +0000 (20:53 +0000)]
[ThinLTO] Remove stale comment (NFC)

This should have been removed with r288446.

llvm-svn: 289871

7 years agoAdd a class ASTRecordReader which wraps an ASTReader, a RecordData, and ModuleFile.
David L. Jones [Thu, 15 Dec 2016 20:53:26 +0000 (20:53 +0000)]
Add a class ASTRecordReader which wraps an ASTReader, a RecordData, and ModuleFile.

Summary:
When reading an ASTRecord, each RecordData is logically contained within a
single ModuleFile, and global(er) state is contained by a single ASTReader. This
means that any operations that read from a RecordData and reference an ASTReader
or a ModuleFile, will always reference the same ASTReader or ModuleFile.
ASTRecordReader groups these together so that parameters don't need to be
duplicated ad infinitum. Most uses of the Idx variable seem to be redunant
aliases as well, but I'll leave that for now.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 289870

7 years ago[PPC] Use CHECK-DAG instead of CHECK in the testcase
Ehsan Amiri [Thu, 15 Dec 2016 20:51:09 +0000 (20:51 +0000)]
[PPC] Use CHECK-DAG instead of CHECK in the testcase

This test is currently sensitive to scheduling. Using CHECK-DAG allows us to
preserve the main purpose of the test and remove this sensivity.

In preparation to commit Power9 processor model.

llvm-svn: 289869

7 years agoAMDGPU: Fix asserting on returned tail calls
Matt Arsenault [Thu, 15 Dec 2016 20:50:12 +0000 (20:50 +0000)]
AMDGPU: Fix asserting on returned tail calls

llvm-svn: 289868

7 years ago[ThinLTO] Thin link efficiency: skip candidate added later with higher threshold...
Teresa Johnson [Thu, 15 Dec 2016 20:48:19 +0000 (20:48 +0000)]
[ThinLTO] Thin link efficiency: skip candidate added later with higher threshold (NFC)

Summary:
Thin link efficiency improvement. After adding an importing candidate to
the worklist we might have later added it again with a higher threshold.
Skip it when popped from the worklist if we recorded a higher threshold
than the current worklist entry, it will get processed again at the
higher threshold when that entry is popped.

This required adding the summary's GUID to the worklist, so that it can
be used to query the recorded highest threshold for it when we pop from the
worklist.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 289867

7 years agoAMDGPU: Assembler support for vintrp instructions
Matt Arsenault [Thu, 15 Dec 2016 20:40:20 +0000 (20:40 +0000)]
AMDGPU: Assembler support for vintrp instructions

llvm-svn: 289866

7 years ago[test] Extend llvm_shlib_dir fix to unittests
Michal Gorny [Thu, 15 Dec 2016 20:31:08 +0000 (20:31 +0000)]
[test] Extend llvm_shlib_dir fix to unittests

Extend the fix from rL286952 to unittests. The fix added clang built
library directories (via llvm_shlib_dir) to LD_LIBRARY_PATH.
The previous logic has used llvm_libs_dir only which points to installed
LLVM when doing stand-alone builds.

The patch also removes the redundant win32 code that is no longer
necessary now that shlibdir is used unconditionally.

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

llvm-svn: 289865

7 years agoRevert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https...
Hans Wennborg [Thu, 15 Dec 2016 20:11:12 +0000 (20:11 +0000)]
Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)"

It breaks programs on Mac. See comments on the code review for details.

llvm-svn: 289864

7 years ago[LV] Enable vectorization of loops with conditional stores by default
Matthew Simpson [Thu, 15 Dec 2016 20:11:05 +0000 (20:11 +0000)]
[LV] Enable vectorization of loops with conditional stores by default

This patch sets the default value of the "-enable-cond-stores-vec" command line
option to "true".

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

llvm-svn: 289863

7 years ago[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else...
Andrea Di Biagio [Thu, 15 Dec 2016 20:01:26 +0000 (20:01 +0000)]
[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC.

Now that a new API to merge debug locations has been committed at r289661 (see
review D26256 for more details), we can use it to "improve" the code added by
revision r280995.

Instead of nulling the debugloc of a commoned instruction, we use the 'merged'
debug location. At the moment, this is just a no functional change since
function `DILocation::getMergedLocation()` is just a stub and would always
return a null location.

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

llvm-svn: 289862

7 years ago[LiveRangeEdit] Change eliminateDeadDef assert to if condition.
Geoff Berry [Thu, 15 Dec 2016 19:55:19 +0000 (19:55 +0000)]
[LiveRangeEdit] Change eliminateDeadDef assert to if condition.

The assert could potentially fire (though no cases have been
encountered), so just check that the instruction we're handling
specially for rematerialization only has one def to begin with.

Reviewed by Wei Mi over email.

llvm-svn: 289861

7 years agoLibDriver: Allow resource files to be archive members.
Peter Collingbourne [Thu, 15 Dec 2016 19:37:46 +0000 (19:37 +0000)]
LibDriver: Allow resource files to be archive members.

It seems pointless to add a resource to an archive because it won't have
any symbols to link against (and link.exe doesn't have an equivalent of
--whole-archive), but lib.exe allows it for some reason.

llvm-svn: 289859

7 years agoRe-add the check for __has_attribute in StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:33:31 +0000 (19:33 +0000)]
Re-add the check for __has_attribute in StringLiteral.

llvm-svn: 289858

7 years agoBrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Boris Ulasevich [Thu, 15 Dec 2016 19:29:42 +0000 (19:29 +0000)]
BrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Differential Revision: https://reviews.llvm.org/D26280

llvm-svn: 289857

7 years agoIgnore -Wgcc-compat diagnostic in StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:22:58 +0000 (19:22 +0000)]
Ignore -Wgcc-compat diagnostic in StringLiteral.

llvm-svn: 289856

7 years ago[InstCombine] add folds for icmp (smin X, Y), X
Sanjay Patel [Thu, 15 Dec 2016 19:13:37 +0000 (19:13 +0000)]
[InstCombine] add folds for icmp (smin X, Y), X

Min/max canonicalization (r287585) exposes the fact that we're missing combines for min/max patterns.
This patch won't solve the example that was attached to that thread, so something else still needs fixing.

The line between InstCombine and InstSimplify gets blurry here because sometimes the icmp instruction that
we want to fold to already exists, but sometimes it's the swapped form of what we want.

Corresponding changes for smax/umin/umax to follow.

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

llvm-svn: 289855

7 years agoFix some remaining documentation references to MSVC 2013
Reid Kleckner [Thu, 15 Dec 2016 19:08:02 +0000 (19:08 +0000)]
Fix some remaining documentation references to MSVC 2013

MSVC 2015 has been the minimum supported version of VS since October.

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

llvm-svn: 289854

7 years ago[StringRef] Add enable-if to StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:02:43 +0000 (19:02 +0000)]
[StringRef] Add enable-if to StringLiteral.

to prevent StringLiteral from being created with a non-literal
char array, clang has a macro enable_if() that can be used
in such a way as to guarantee that the constructor is disabled
unless the length fo the string can be computed at compile time.

This only works on clang, but at least it should allow bots
to catch abuse of StringLiteral.

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

llvm-svn: 289853

7 years agoxray: fix assembly macro definition
Saleem Abdulrasool [Thu, 15 Dec 2016 18:54:27 +0000 (18:54 +0000)]
xray: fix assembly macro definition

  projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:33:7: error: unexpected token in '.endm' directive
  .endm SAVE_REGISTERS
^
  projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:52:7: error: unexpected token in '.endm' directive
  .endm RESTORE_REGISTERS
^

Remove the trailing name on the `.endm` which does not take the name of the
macro.  This should bring the compiler-rt build bot back into working state.

llvm-svn: 289852

7 years agosanitizers: silence -pedantic warning
Saleem Abdulrasool [Thu, 15 Dec 2016 18:54:25 +0000 (18:54 +0000)]
sanitizers: silence -pedantic warning

  projects/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc:142:2: warning: extra ';' [-Wpedantic]
   };  // namespace
    ^

Identified by gcc 6.

llvm-svn: 289851

7 years agoFix printf specifier handling: invalid specifier should not be marked as "consuming...
Mehdi Amini [Thu, 15 Dec 2016 18:54:00 +0000 (18:54 +0000)]
Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments"

Reviewers: rsmith, bruno, dexonsmith

Subscribers: cfe-commits

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

llvm-svn: 289850

7 years ago[libFuzzer] doc update
Kostya Serebryany [Thu, 15 Dec 2016 18:47:22 +0000 (18:47 +0000)]
[libFuzzer] doc update

llvm-svn: 289849

7 years ago[GlobalISel] Drop workaround for Legalizer member/class sharing a name. NFC.
Ahmed Bougacha [Thu, 15 Dec 2016 18:45:30 +0000 (18:45 +0000)]
[GlobalISel] Drop workaround for Legalizer member/class sharing a name. NFC.

MachineLegalizer used to be the name of both the class and the member,
causing GCC errors. r276522 fixed that by renaming the member to just
'Legalizer'.  The 'class' workaround isn't necessary anymore; drop it.

llvm-svn: 289848

7 years ago[CUDA] Add --ptxas-path= flag.
Justin Lebar [Thu, 15 Dec 2016 18:44:57 +0000 (18:44 +0000)]
[CUDA] Add --ptxas-path= flag.

Summary:
This lets you build with one CUDA installation but use ptxas from
another install.

This is useful e.g. if you want to avoid bugs in an old ptxas without
actually upgrading wholesale to a newer CUDA version.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 289847

7 years ago[x86] use a single shufps for 256-bit vectors when it can save instructions
Sanjay Patel [Thu, 15 Dec 2016 18:43:46 +0000 (18:43 +0000)]
[x86] use a single shufps for 256-bit vectors when it can save instructions

This is the 256-bit counterpart to the 128-bit transform checked in here:
https://reviews.llvm.org/rL289837

This patch is based on the draft by @sroland (Roland Scheidegger) that is
attached to PR27885:
https://llvm.org/bugs/show_bug.cgi?id=27885

llvm-svn: 289846

7 years ago[AArch64] Guard Misaligned 128-bit store penalty by subtarget feature
Matthew Simpson [Thu, 15 Dec 2016 18:36:59 +0000 (18:36 +0000)]
[AArch64] Guard Misaligned 128-bit store penalty by subtarget feature

This patch checks that the SlowMisaligned128Store subtarget feature is set
when penalizing such stores in getMemoryOpCost.

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

llvm-svn: 289845

7 years ago[AArch64][GlobalISel] Remove redundant RBI comments. NFC.
Ahmed Bougacha [Thu, 15 Dec 2016 18:22:15 +0000 (18:22 +0000)]
[AArch64][GlobalISel] Remove redundant RBI comments. NFC.

It's brittle, and Doxygen already picks the overriden method's comment
anyway.

llvm-svn: 289844

7 years ago[ThinLTO] Ensure callees get hot threshold when first seen on cold path
Teresa Johnson [Thu, 15 Dec 2016 18:21:01 +0000 (18:21 +0000)]
[ThinLTO] Ensure callees get hot threshold when first seen on cold path

This is split out from D27696, since it turned out to be a bug fix and
not part of the NFC efficiency change.

Keep the same adjusted (possibly decayed) threshold in both the worklist
and the ImportList. Otherwise if we encountered it first along a cold
path, the callee would be added to the worklist with a lower decayed
threshold than when it is later encountered along a hot path. But the
logic uses the threshold recorded in the ImportList entry to check if
we should re-add it, and without this patch the threshold recorded there
is the same along both paths so we don't re-add it. Using the
same possibly decayed threshold in the ImportList ensures we re-add it
later with the higher non-decayed hot path threshold.

llvm-svn: 289843

7 years ago[CMake] Ensure Python files are inside the LLDB framework bundle
Chris Bieneman [Thu, 15 Dec 2016 18:19:10 +0000 (18:19 +0000)]
[CMake] Ensure Python files are inside the LLDB framework bundle

When building the LLDB Framework we need to ensure that the Python files get put into the Framework before the Framework's install target can be invoked.

All files inside the Framework's Resources bundle will get copied over during the install action.

llvm-svn: 289842

7 years ago[CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later
Chris Bieneman [Thu, 15 Dec 2016 18:18:47 +0000 (18:18 +0000)]
[CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later

CMake's framework target generation was unable to generate POST_BUILD steps (see: https://gitlab.kitware.com/cmake/cmake/issues/16363).

It turns out working around this is really not reasonable. The more reasonable solution to me is just to not support LLDB.framework unless you are on CMake 3.7 or newer.

Since CMake 3.7.1 is released that's how I'm going to handle this.

llvm-svn: 289841

7 years ago[CMake] Minor change to symlink generation for LLDB
Chris Bieneman [Thu, 15 Dec 2016 18:17:07 +0000 (18:17 +0000)]
[CMake] Minor change to symlink generation for LLDB

If OUTPUT_DIR is not specified we can assume the symlink is linking to a file in the same directory, so we can use $<TARGET_FILE_NAME:${target}> to create a relative symlink.

In the case of LLDB, when we build a framework, we are creating symlinks in a different directory than the file we're pointing to, and we don't install those links. To make this work in the build directory we can use $<TARGET_FILE:${target}> instead, which uses the full path to the target.

llvm-svn: 289840

7 years ago[Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+.
Ahmed Bougacha [Thu, 15 Dec 2016 18:14:27 +0000 (18:14 +0000)]
[Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+.

10.12 dropped support for all pre-Penryn Macs.

llvm-svn: 289839

7 years ago[scudo] Use DefaultSizeClassMap for 32-bit
Kostya Kortchinsky [Thu, 15 Dec 2016 18:06:55 +0000 (18:06 +0000)]
[scudo] Use DefaultSizeClassMap for 32-bit

Summary:
With the recent changes to the Secondary, we use less bits for UnusedBytes,
which allows us in return to increase the bits used for Offset. That means
that we can use a Primary SizeClassMap allowing for a larger maximum size.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 289838

7 years ago[x86] use a single shufps when it can save instructions
Sanjay Patel [Thu, 15 Dec 2016 18:03:38 +0000 (18:03 +0000)]
[x86] use a single shufps when it can save instructions

This is a tiny patch with a big pile of test changes.
This partially fixes PR27885:
https://llvm.org/bugs/show_bug.cgi?id=27885

My motivating case looks like this:

  - vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,2]
  - vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
  - vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]

  + vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]

And this happens several times in the diffs. For chips with domain-crossing penalties,
the instruction count and size reduction should usually overcome any potential
domain-crossing penalty due to using an FP op in a sequence of int ops. For chips such
as recent Intel big cores and Atom, there is no domain-crossing penalty for shufps, so
using shufps is a pure win.

So the test case diffs all appear to be improvements except one test in
vector-shuffle-combining.ll where we miss an opportunity to use a shift to generate
zero elements and one test in combine-sra.ll where multiple uses prevent the expected
shuffle combining.

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

llvm-svn: 289837

7 years agoFix typo in comment. NFC.
Kelvin Li [Thu, 15 Dec 2016 17:55:32 +0000 (17:55 +0000)]
Fix typo in comment.  NFC.

llvm-svn: 289836

7 years ago[sanitizers] dont dump coverage if not asked to
Mike Aizatsky [Thu, 15 Dec 2016 17:30:58 +0000 (17:30 +0000)]
[sanitizers] dont dump coverage if not asked to

llvm-svn: 289835

7 years ago[X86][SSE] Fix domains for scalar store instructions
Simon Pilgrim [Thu, 15 Dec 2016 17:09:24 +0000 (17:09 +0000)]
[X86][SSE] Fix domains for scalar store instructions

As discussed on D27692

llvm-svn: 289834

7 years agoRevert "[SimplifyCFG] In sinkLastInstruction correctly set debugloc of common inst"
Robert Lougher [Thu, 15 Dec 2016 16:59:13 +0000 (16:59 +0000)]
Revert "[SimplifyCFG] In sinkLastInstruction correctly set debugloc of common inst"

Reverting as it is causing buildbot failures (address sanitizer).

llvm-svn: 289833

7 years ago[lanai] Simplify small section check in LowerGlobalAddress and treat ldata sections...
Jacques Pienaar [Thu, 15 Dec 2016 16:56:16 +0000 (16:56 +0000)]
[lanai] Simplify small section check in LowerGlobalAddress and treat ldata sections specially.

Move the check for the code model into isGlobalInSmallSectionImpl and return false (not in small section) for variables placed in sections prefixed with .ldata (workaround for a tool limitation).

llvm-svn: 289832

7 years ago[tsan] Add interceptor for libcxx __shared_count::__release_shared()
Kuba Mracek [Thu, 15 Dec 2016 16:45:28 +0000 (16:45 +0000)]
[tsan] Add interceptor for libcxx __shared_count::__release_shared()

We already have an interceptor for __shared_weak_count::__release_shared, this patch handles __shared_count::__release_shared in the same way. This should get rid of TSan false positives when using std::future.

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

llvm-svn: 289831

7 years ago[X86][AVX512] Moved instruction domain lookups to the right table. NFCI.
Simon Pilgrim [Thu, 15 Dec 2016 16:38:51 +0000 (16:38 +0000)]
[X86][AVX512] Moved instruction domain lookups to the right table. NFCI.

Avoid duplicating instructions in the int32/int64 domains.

llvm-svn: 289830

7 years agoCodeGen: ubsan is built static on windows, give handlers local storage
Saleem Abdulrasool [Thu, 15 Dec 2016 16:30:20 +0000 (16:30 +0000)]
CodeGen: ubsan is built static on windows, give handlers local storage

The UBSAN runtime is built static on Windows.  This requires that we give local
storage always.  This impacts Windows where the linker would otherwise have to
generate a thunk to access the symbol via the IAT.  This should repair the
windows clang build bots.

llvm-svn: 289829

7 years ago[SimplifyCFG] In sinkLastInstruction correctly set debugloc of "common" inst
Robert Lougher [Thu, 15 Dec 2016 16:17:53 +0000 (16:17 +0000)]
[SimplifyCFG] In sinkLastInstruction correctly set debugloc of "common" inst

Simplify CFG will try to sink the last instruction in a series of basic blocks,
creating a "common" instruction in the successor block (sinkLastInstruction).
When it does this, the debug location of the single instruction should be the
merged debug locations of the commoned instructions.

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

llvm-svn: 289828

7 years ago[ELF] - Make LLD accept Ttext-segment X/Ttext-segment=X aliases for -Ttext.
George Rimar [Thu, 15 Dec 2016 16:12:34 +0000 (16:12 +0000)]
[ELF] - Make LLD accept Ttext-segment X/Ttext-segment=X aliases for -Ttext.

It os used in work/emulators/qemu-user-static port.
Which tries to use -Ttext-segment and then:

# In case ld does not support -Ttext-segment, edit the default linker
# script via sed to set the .text start addr.  This is needed on FreeBSD
# at least.
<here it calls -verbose to extract and edit default bfd linker script.>

Actually now we are do not fully support -Ttext properly (see D27613),
but we also seems never will provide anything close to default script, like bfd do,
so at least this patch introduces proper alias handling.

llvm-svn: 289827

7 years agoFix ubsan failures in lane mask shifts
Krzysztof Parzyszek [Thu, 15 Dec 2016 16:08:49 +0000 (16:08 +0000)]
Fix ubsan failures in lane mask shifts

llvm-svn: 289826

7 years ago[X86][SSE] Fix domains for VZEXT_LOAD type instructions
Simon Pilgrim [Thu, 15 Dec 2016 16:05:29 +0000 (16:05 +0000)]
[X86][SSE] Fix domains for VZEXT_LOAD type instructions

Add the missing domain equivalences for movss, movsd, movd and movq zero extending loading instructions.

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

llvm-svn: 289825

7 years ago[ELF] - Apply format (2). NFC.
George Rimar [Thu, 15 Dec 2016 15:38:58 +0000 (15:38 +0000)]
[ELF] - Apply format (2). NFC.

llvm-svn: 289824

7 years ago[ELF] - Apply format. NFC.
George Rimar [Thu, 15 Dec 2016 15:38:09 +0000 (15:38 +0000)]
[ELF] - Apply format. NFC.

llvm-svn: 289823

7 years agoFix for regression after Global Load Scalarization patch
Alexander Timofeev [Thu, 15 Dec 2016 15:17:19 +0000 (15:17 +0000)]
Fix for regression after Global Load Scalarization patch

llvm-svn: 289822

7 years agoFix build for mingw.
Hafiz Abid Qadeer [Thu, 15 Dec 2016 15:00:41 +0000 (15:00 +0000)]
Fix build for mingw.

Summary: I was building lldb using cross mingw-w64 toolchain on Linux and observed some issues. This is first patch in the series to fix that build. It mostly corrects the case of include files and adjusts some #ifdefs from _MSC_VER to _WIN32 and vice versa. I built lldb on windows with VS after applying this patch to make sure it does not break the build there.

Reviewers: zturner, labath, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

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

llvm-svn: 289821