platform/upstream/llvm.git
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

7 years agoExtract LaneBitmask into a separate type
Krzysztof Parzyszek [Thu, 15 Dec 2016 14:36:06 +0000 (14:36 +0000)]
Extract LaneBitmask into a separate type

Specifically avoid implicit conversions from/to integral types to
avoid potential errors when changing the underlying type. For example,
a typical initialization of a "full" mask was "LaneMask = ~0u", which
would result in a value of 0x00000000FFFFFFFF if the type was extended
to uint64_t.

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

llvm-svn: 289820

7 years ago[CostModel][X86] Updated reverse shuffle costs
Simon Pilgrim [Thu, 15 Dec 2016 14:24:07 +0000 (14:24 +0000)]
[CostModel][X86] Updated reverse shuffle costs

llvm-svn: 289819

7 years ago[TEST] Initial commit of tests for minmax horizontal reductions.
Alexey Bataev [Thu, 15 Dec 2016 13:21:29 +0000 (13:21 +0000)]
[TEST] Initial commit of tests for minmax horizontal reductions.

llvm-svn: 289817

7 years ago[change-namespace] fix a case references to templated using alias are qualified types.
Eric Liu [Thu, 15 Dec 2016 13:02:41 +0000 (13:02 +0000)]
[change-namespace] fix a case references to templated using alias are qualified types.

llvm-svn: 289816

7 years agoRestrict ranges of extension maps
Roman Gareev [Thu, 15 Dec 2016 12:35:59 +0000 (12:35 +0000)]
Restrict ranges of extension maps

To prevent copy statements from accessing arrays out of bounds, ranges of their
extension maps are restricted, according to the constraints of domains.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D25655

llvm-svn: 289815

7 years agoRevert "[TESTS] Initial commit of tests, by Andrew Tischenko"
Alexey Bataev [Thu, 15 Dec 2016 12:26:18 +0000 (12:26 +0000)]
Revert "[TESTS] Initial commit of tests, by Andrew Tischenko"

This reverts commit ee709f8988653a0334fbf100cdbbdd83a3933347.

llvm-svn: 289814

7 years ago[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp
Ehsan Amiri [Thu, 15 Dec 2016 12:25:13 +0000 (12:25 +0000)]
[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp

A number of new patterns for simplifying and/xor of icmp:

(icmp ne %x, 0) ^ (icmp ne %y, 0) => icmp ne %x, %y if the following is true:
1- (%x = and %a, %mask) and (%y = and %b, %mask)
2- %mask is a power of 2.

(icmp eq %x, 0) & (icmp ne %y, 0) => icmp ult %x, %y if the following is true:
1- (%x = and %a, %mask1) and (%y = and %b, %mask2)
2- Let %t be the smallest power of 2 where %mask1 & %t != 0. Then for any
   %s that is a power of 2 and %s & %mask2 != 0, we must have %s <= %t.
For example if %mask1 = 24 and %mask2 = 16, setting %s = 16 and %t = 8
violates condition (2) above. So this optimization cannot be applied.

llvm-svn: 289813

7 years agoRevert "[TESTS] Initial commit of tests, by Andrew Tischenko"
Alexey Bataev [Thu, 15 Dec 2016 12:24:20 +0000 (12:24 +0000)]
Revert "[TESTS] Initial commit of tests, by Andrew Tischenko"

This reverts commit 5898c713bee5e96aae87c73e11f3f4a7d19c74ed.

llvm-svn: 289812

7 years ago[CostModel] Fix long standing bug with reverse shuffle mask detection
Simon Pilgrim [Thu, 15 Dec 2016 12:12:45 +0000 (12:12 +0000)]
[CostModel] Fix long standing bug with reverse shuffle mask detection

Incorrect 'undef' mask index matching meant that broadcast shuffles could be detected as reverse shuffles

llvm-svn: 289811

7 years ago[ELF] - Partial support of --gdb-index command line option (Part 3).
George Rimar [Thu, 15 Dec 2016 12:07:53 +0000 (12:07 +0000)]
[ELF] - Partial support of --gdb-index command line option (Part 3).

Patch continues work started in D24706 and D25821.

in this patch symbol table and constant pool areas were
added to .gdb_index section output.

This one finishes the implementation of --gdb-index functionality in LLD.

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

llvm-svn: 289810

7 years ago[TESTS] Initial commit of tests, by Andrew Tischenko
Alexey Bataev [Thu, 15 Dec 2016 12:06:27 +0000 (12:06 +0000)]
[TESTS] Initial commit of tests, by Andrew Tischenko

llvm-svn: 289809

7 years ago[NFC] Fix typos in getMacroKernelParams.
Roman Gareev [Thu, 15 Dec 2016 12:00:57 +0000 (12:00 +0000)]
[NFC] Fix typos in getMacroKernelParams.

llvm-svn: 289808

7 years ago[TESTS] Initial commit of tests, by Andrew Tischenko
Alexey Bataev [Thu, 15 Dec 2016 11:48:24 +0000 (11:48 +0000)]
[TESTS] Initial commit of tests, by Andrew Tischenko

llvm-svn: 289807

7 years agoThe order of the loops defines the data reused in the BLIS implementation of
Roman Gareev [Thu, 15 Dec 2016 11:47:38 +0000 (11:47 +0000)]
The order of the loops defines the data reused in the BLIS implementation of
gemm ([1]). In particular, elements of the matrix B, the second operand of
matrix multiplication, are reused between iterations of the innermost loop.
To keep the reused data in cache, only elements of matrix A, the first operand
of matrix multiplication, should be evicted during an iteration of the
innermost loop. To provide such a cache replacement policy, elements of the
matrix A can, in particular, be loaded first and, consequently, be
least-recently-used.

In our case matrices are stored in row-major order instead of column-major
order used in the BLIS implementation ([1]). One of the ways to address it is
to accordingly change the order of the loops of the loop nest. However, it
makes elements of the matrix A to be reused in the innermost loop and,
consequently, requires to load elements of the matrix B first. Since the LLVM
vectorizer always generates loads from the matrix A before loads from the
matrix B and we can not provide it. Consequently, we only change the BLIS micro
kernel and the computation of its parameters instead. In particular, reused
elements of the matrix B are successively multiplied by specific elements of
the matrix A .

Refs.:
[1] - http://www.cs.utexas.edu/users/flame/pubs/TOMS-BLIS-Analytical.pdf

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

llvm-svn: 289806

7 years ago[Power9] Allow AnyExt immediates for XXSPLTIB
Nemanja Ivanovic [Thu, 15 Dec 2016 11:16:20 +0000 (11:16 +0000)]
[Power9] Allow AnyExt immediates for XXSPLTIB

In some situations, the BUILD_VECTOR node that builds a v18i8 vector by
a splat of an i8 constant will end up with signed 8-bit values and other
situations, it'll end up with unsigned ones. Handle both situations.

Fixes PR31340.

llvm-svn: 289804

7 years ago[AVR] Support floats in the instrumention pass
Dylan McKay [Thu, 15 Dec 2016 11:02:41 +0000 (11:02 +0000)]
[AVR] Support floats in the instrumention pass

This also refactors some common code into the 'GetTypeName' method.

llvm-svn: 289803

7 years agoFix XFAILS for is_trivially_destructible trait
Eric Fiselier [Thu, 15 Dec 2016 11:00:07 +0000 (11:00 +0000)]
Fix XFAILS for is_trivially_destructible trait

llvm-svn: 289802

7 years agoRemove linux/personality.h wrapper
Pavel Labath [Thu, 15 Dec 2016 10:47:40 +0000 (10:47 +0000)]
Remove linux/personality.h wrapper

This code is currently unused.

Removing it should make porting of the linux plugin to NetBSD easier, and we can
always add it later if needed.

llvm-svn: 289801

7 years ago[CostModel][X86] Add tests for reverse shuffle costs
Simon Pilgrim [Thu, 15 Dec 2016 10:45:53 +0000 (10:45 +0000)]
[CostModel][X86] Add tests for reverse shuffle costs

llvm-svn: 289800

7 years ago[change-namespace] handling templated type aliases correctly.
Eric Liu [Thu, 15 Dec 2016 10:42:35 +0000 (10:42 +0000)]
[change-namespace] handling templated type aliases correctly.

Summary: This fixes templated type aliases and templated type aliases in classes.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 289799

7 years agoAdd missing triple target for numeric section flag test
Prakhar Bahuguna [Thu, 15 Dec 2016 10:20:48 +0000 (10:20 +0000)]
Add missing triple target for numeric section flag test

llvm-svn: 289798

7 years ago[clang-tidy] Enhance modernize-use-auto to templated function casts
Malcolm Parsons [Thu, 15 Dec 2016 10:19:56 +0000 (10:19 +0000)]
[clang-tidy] Enhance modernize-use-auto to templated function casts

Summary:
Use auto when declaring variables that are initialized by calling a templated
function that returns its explicit first argument.

Fixes PR26763.

Reviewers: aaron.ballman, alexfh, staronj, Prazek

Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits

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

llvm-svn: 289797