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

7 years ago[ELF] - Attempt to fix ubuntu 64x buildbot (2).
George Rimar [Thu, 15 Dec 2016 09:59:18 +0000 (09:59 +0000)]
[ELF] - Attempt to fix ubuntu 64x buildbot (2).

Fixed inaccurate member type: uint32_t -> size_t
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/2984/steps/build/logs/stdio).

llvm-svn: 289796

7 years agoSimplify format member detection in FormatVariadic
Pavel Labath [Thu, 15 Dec 2016 09:40:27 +0000 (09:40 +0000)]
Simplify format member detection in FormatVariadic

Summary:
This replaces the format member search, which was quite complicated, with a more
direct approach to detecting whether a class should be formatted using the
format-member method. Instead we use a special type llvm::format_adapter, which
every adapter must inherit from. Then the search can be simply implemented with
the is_base_of type trait.

Aside from the simplification, I like this way more because it makes it more
explicit that you are supposed to use this type only for adapter-like
formattings, and the other approach (format_provider overloads) should be used
as a default (a mistake I made when first trying to use this library).

The only slight change in behaviour here is that now choose the format-adapter
branch even if the format member invocation will fail to compile (e.g. because it is a
non-const member function and we are passing a const adapter), whereas
previously we would have gone on to search for format_providers for the type.
However, I think that is actually a good thing, as it probably means the
programmer did something wrong.

Reviewers: zturner, inglorion

Subscribers: llvm-commits

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

llvm-svn: 289795

7 years ago[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
Sjoerd Meijer [Thu, 15 Dec 2016 09:38:59 +0000 (09:38 +0000)]
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently

This is essentially a recommit of r285893, but with a correctness fix. The
problem of the original commit was that this:

bic r5, r7, #31
cbz r5, .LBB2_10

got rewritten into:

lsrs  r5, r7, #5
beq .LBB2_10

The result in destination register r5 is not the same and this is incorrect
when r5 is not dead. So this fix includes checking the uses of the AND
destination register. And also, compared to the original commit, some regression
tests didn't need changing anymore because of this extra check.

For completeness, this was the original commit message:

For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more
efficient instruction selection if the bitmask is one consecutive sequence of
set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and
set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and
set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit
into the sign bit with one LSLS and change the condition query from NE/EQ to
MI/PL (we could also implement this by shifting into the carry bit and
branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower
zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two
16-bit instructions but can elide the CMP and doesn't require materializing a
complex immediate, so is also a win.

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

llvm-svn: 289794

7 years ago[AVR] Add argument indices to the instrumention hook functions
Dylan McKay [Thu, 15 Dec 2016 09:38:09 +0000 (09:38 +0000)]
[AVR] Add argument indices to the instrumention hook functions

This allows the instrumention hook functions to do better
pretty-printing.

llvm-svn: 289793

7 years ago[ELF] - Attempt to fix ubuntu bot.
George Rimar [Thu, 15 Dec 2016 09:30:07 +0000 (09:30 +0000)]
[ELF] - Attempt to fix ubuntu bot.

(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/2982)

llvm-svn: 289792

7 years agoRemove references to AssumptionCache. NFC.
Michael Kruse [Thu, 15 Dec 2016 09:25:14 +0000 (09:25 +0000)]
Remove references to AssumptionCache. NFC.

The AssumptionCache was removed in r289756 after being replaced by the an
addtional operand list of affected values in r289755. The absence of that cache
means that we have now have to manually search for llvm.assume intrinsics as
now done by other passes (LazyValueInfo, CodeMetrics) do not take into
account an llvm::Instruction's user lists (ScalarEvolution).

llvm-svn: 289791

7 years ago[ELF] - Partial support of --gdb-index command line option (Part 2).
George Rimar [Thu, 15 Dec 2016 09:08:13 +0000 (09:08 +0000)]
[ELF] - Partial support of --gdb-index command line option (Part 2).

Patch continues work started in D24706,

in this patch address area was added to .gdb_index section output.

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

llvm-svn: 289790

7 years ago[XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.
Dean Michael Berris [Thu, 15 Dec 2016 09:04:05 +0000 (09:04 +0000)]
[XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.

Summary:
The layout of all registers saved on stack shouldn't deviate and will be reused in future trampolines as well.

While there, fix whitespace and clarify comments.

Author: mpel

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 289789

7 years agoFix for build warning in execute-only support
Prakhar Bahuguna [Thu, 15 Dec 2016 08:42:04 +0000 (08:42 +0000)]
Fix for build warning in execute-only support

llvm-svn: 289788

7 years agoRe-commit r289252 and r289285, and fix PR31374
Yaxun Liu [Thu, 15 Dec 2016 08:09:08 +0000 (08:09 +0000)]
Re-commit r289252 and r289285, and fix PR31374

llvm-svn: 289787

7 years ago[ARM] Implement execute-only support in CodeGen
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:24 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen

Summary:
This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
  alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
  with VMOV used in addition for floating-point literals. As the MOVT
  instruction is required, execute-only support is only available in
  Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
  marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
  This also overrides selection of ELF sections for globals.

Reviewers: t.p.northover, rengolin

Subscribers: llvm-commits, aemerson

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

llvm-svn: 289786

7 years agoAllow ELF section flags to be specified numerically
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:15 +0000 (07:59 +0000)]
Allow ELF section flags to be specified numerically

Summary:
GAS already allows flags for sections to be specified directly as a
numeric value. This functionality is particularly useful for setting
processor or application-specific values that may not be directly
supported or understood by LLVM. This patch allows LLVM to use numeric
section flag values verbatim if specified by the assembly file.

Reviewers: grosbach, rafael, t.p.northover, rengolin

Subscribers: llvm-commits

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

llvm-svn: 289785

7 years ago[ARM] Implement execute-only support in CodeGen
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:08 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen

This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
  alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
  with VMOV used in addition for floating-point literals. As the MOVT
  instruction is required, execute-only support is only available in
  Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
  marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
  This also overrides selection of ELF sections for globals.

llvm-svn: 289784

7 years agoCodeGen: force builtins to be local
Saleem Abdulrasool [Thu, 15 Dec 2016 07:29:04 +0000 (07:29 +0000)]
CodeGen: force builtins to be local

Unfortunately _setjmp3 can be both import or local.  The ASAN tests try to
emulate the flags which makes this harder to detect.  Rely on the linker
creating or using thunks here instead.  Should repair the ASAN windows bots.

llvm-svn: 289783

7 years ago[ELF] - Do not crash when move location counter backward.
George Rimar [Thu, 15 Dec 2016 07:27:28 +0000 (07:27 +0000)]
[ELF] - Do not crash when move location counter backward.

PR31335 shows that we do that in next case:
SECTIONS { .text 0x2000 : {. = 0x100 ; *(.text) } }

though documentations says that "If . is used inside a section
description however, it refers to the byte offset from the start
of that section, not an absolute address. " looks does not work
as documented in bfd (as mentioned in comments for PR31335).

Until we find out the expected behavior was suggested at least not
to 'crash', what we do after trying to generate huge file.

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

llvm-svn: 289782

7 years agoFix typo
Eric Fiselier [Thu, 15 Dec 2016 07:23:44 +0000 (07:23 +0000)]
Fix typo

llvm-svn: 289781

7 years agoAdd tests for LWG 2796
Eric Fiselier [Thu, 15 Dec 2016 07:15:39 +0000 (07:15 +0000)]
Add tests for LWG 2796

llvm-svn: 289780

7 years agoAdd missing -mtriple to MIR test case
Sanjoy Das [Thu, 15 Dec 2016 07:13:50 +0000 (07:13 +0000)]
Add missing -mtriple to MIR test case

llvm-svn: 289779

7 years agoAdd more test cases for PR31384
Eric Fiselier [Thu, 15 Dec 2016 07:05:19 +0000 (07:05 +0000)]
Add more test cases for PR31384

llvm-svn: 289778

7 years agoAttempt to fix llvm-readobj crash on ppc64 due to r289674
Yaxun Liu [Thu, 15 Dec 2016 06:59:23 +0000 (06:59 +0000)]
Attempt to fix llvm-readobj crash on ppc64 due to r289674

llvm-svn: 289777

7 years agoCodeGen: fix runtime function dll storage
Saleem Abdulrasool [Thu, 15 Dec 2016 06:59:05 +0000 (06:59 +0000)]
CodeGen: fix runtime function dll storage

Properly attribute DLL storage to runtime functions.  When generating the
runtime function, scan for an existing declaration which may provide an explicit
declaration (local storage) or a DLL import or export storage from the user.
Honour that if available.  Otherwise, if building with a local visibility of the
public or standard namespaces (-flto-visibility-public-std), give the symbols
local storage (it indicates a /MT[d] link, so static runtime).  Otherwise,
assume that the link is dynamic, and give the runtime function dllimport
storage.

This allows for implementations to get the correct storage as long as they are
properly declared, the user to override the import storage, and in case no
explicit storage is given, use of the import storage.

llvm-svn: 289776

7 years agoFix go bindings after r289702 (hopefully, don't really know how to build
Daniel Jasper [Thu, 15 Dec 2016 06:54:29 +0000 (06:54 +0000)]
Fix go bindings after r289702 (hopefully, don't really know how to build
them, build.sh seems to be broken).

llvm-svn: 289775

7 years agoAdd test case for PR31384
Eric Fiselier [Thu, 15 Dec 2016 06:38:07 +0000 (06:38 +0000)]
Add test case for PR31384

llvm-svn: 289774

7 years agoRevert r289727 due to PR31384
Eric Fiselier [Thu, 15 Dec 2016 06:34:54 +0000 (06:34 +0000)]
Revert r289727 due to PR31384

This patch reverts the changes to tuple which fixed construction from
types derived from tuple. It breaks the code mentioned in llvm.org/PR31384.
I'll follow this commit up with a test case.

llvm-svn: 289773

7 years ago[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)
Kostya Serebryany [Thu, 15 Dec 2016 06:21:21 +0000 (06:21 +0000)]
[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)

llvm-svn: 289772

7 years ago[AVR] Whitelist the avrlit config environment variables
Dylan McKay [Thu, 15 Dec 2016 06:04:53 +0000 (06:04 +0000)]
[AVR] Whitelist the avrlit config environment variables

This allows us to use `lit` to run on-target execution tests.

llvm-svn: 289769

7 years agoRevert part of r289765 that is not necessary
Hal Finkel [Thu, 15 Dec 2016 05:50:45 +0000 (05:50 +0000)]
Revert part of r289765 that is not necessary

CS.doesNotAccessMemory(ArgNo) and CS.onlyReadsMemory(ArgNo) calls
dataOperandHasImpliedAttr, so revert this part of r289765 because
it should not be necessary.

llvm-svn: 289768

7 years agoXFAIL test for more apple-clang versions
Eric Fiselier [Thu, 15 Dec 2016 05:41:07 +0000 (05:41 +0000)]
XFAIL test for more apple-clang versions

llvm-svn: 289767

7 years agoTrying to fix NDEBUG build after r289764
Hal Finkel [Thu, 15 Dec 2016 05:33:19 +0000 (05:33 +0000)]
Trying to fix NDEBUG build after r289764

llvm-svn: 289766