platform/upstream/llvm.git
7 years ago[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwindi...
Kuba Brecka [Mon, 14 Nov 2016 21:41:13 +0000 (21:41 +0000)]
[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), LLVM part

This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

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

llvm-svn: 286893

7 years agoUpdate stats-gathering code
Jonathan Peyton [Mon, 14 Nov 2016 21:13:44 +0000 (21:13 +0000)]
Update stats-gathering code

Have developer timers use partitioning scheme which also required that some
redundant developer timers be removed in favor of the already existing normal
timers. Move per thread stats initialization to just after global thread id
assignment which is as early as possible. Also put all global stats
initialization code in __kmp_stats_init() and all global stats destruction code
in __kmp_stats_fini().

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

llvm-svn: 286892

7 years agoRevert "Revert "llvm-strings: support printing the filename""
Saleem Abdulrasool [Mon, 14 Nov 2016 21:10:41 +0000 (21:10 +0000)]
Revert "Revert "llvm-strings: support printing the filename""

Change the dynamic files to static in the hope that it will actually fix the
transient errors that Ive been unable to reproduce.

llvm-svn: 286891

7 years agoIntroduce dynamic affinity dispatch capabilities
Jonathan Peyton [Mon, 14 Nov 2016 21:08:35 +0000 (21:08 +0000)]
Introduce dynamic affinity dispatch capabilities

This set of changes enables the affinity interface (Either the preexisting
native operating system or HWLOC) to be dynamically set at runtime
initialization. The point of this change is that we were seeing performance
degradations when using HWLOC. This allows the user to use the old affinity
mechanisms which on large machines (>64 cores) makes a large difference in
initialization time.

These changes mostly move affinity code under a small class hierarchy:

KMPAffinity
  class Mask {}
KMPNativeAffinity : public KMPAffinity
  class Mask : public KMPAffinity::Mask
KMPHwlocAffinity
  class Mask : public KMPAffinity::Mask

Since all interface functions (for both affinity and the mask implementation)
are virtual, the implementation can be chosen at runtime initialization.

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

llvm-svn: 286890

7 years agoAdd a checkSymbolTable() method to the MachOObjectFile class.
Kevin Enderby [Mon, 14 Nov 2016 20:57:04 +0000 (20:57 +0000)]
Add a checkSymbolTable() method to the MachOObjectFile class.

The philosophy of the error checking in libObject for Mach-O files
is that the constructor will check the load commands so for their
tables the offsets and sizes are properly contained in the file.
But there is no checking of the entries of any of the tables.

For the contents of the tables themselves the methods accessing
the contents of the entries return errors as needed.  In some
cases this however makes it difficult or cumbersome to produce
a good error message which would include the tool name, file name,
archive member, and name of the architecture of a slice of a universal file
the error occurred in.

So idea is that there will be a method to check a table which can
be called up front before using it allowing a good error message
to be produced before a table is used.  And if only verification of
the Mach-O file and its tables are wanted a new possible method
checkAllTables() could be added to call all of the methods to
check all the tables at some time when such methods exist.

The checkSymbolTable() is the first of such methods to check
one of the Mach-O file tables.  This method initially will used in
llvm-objdump’s DisassembleMachO() routine before it gets the
section and symbol information.  As if there are problems with
the symbol table currently the error is first encountered by the
bool operator() in the SymbolSorter() struct which passed to
std::sort().  In this case there is no context as to the file name
the symbol which results a poor error message:

LLVM ERROR: truncated or malformed object (bad string index: 22 for symbol at index 1)

with the added call to the checkSymbolTable() method the
error message includes the tool name and file name:

llvm-objdump: 'macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
llvm-svn: 286887

7 years ago[Hexagon] Give a predicate function a more meaningful name
Krzysztof Parzyszek [Mon, 14 Nov 2016 20:53:09 +0000 (20:53 +0000)]
[Hexagon] Give a predicate function a more meaningful name

Change "orisadd" to "IsOrAdd" to follow the naming conventions, and
change "isOrAdd" in the C++ code to "isOrEquivalentToAdd".

llvm-svn: 286886

7 years agoTemporarily relax test expectations to fix failures on ppc64.
Evgeniy Stepanov [Mon, 14 Nov 2016 20:46:52 +0000 (20:46 +0000)]
Temporarily relax test expectations to fix failures on ppc64.

Summary: Relax test expectations to fix failures on ppc64.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 286885

7 years agoP0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iter...
Marshall Clow [Mon, 14 Nov 2016 20:41:17 +0000 (20:41 +0000)]
P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests.  Also resolved P0509 and P0521, which required no changes to the library or tests.

llvm-svn: 286884

7 years agoMissed a test with exceptions disabled earlier. Oops.
Marshall Clow [Mon, 14 Nov 2016 20:38:43 +0000 (20:38 +0000)]
Missed a test with exceptions disabled earlier. Oops.

llvm-svn: 286883

7 years agoARM: try to fix GCC 4.8 compilation again after r286881.
Tim Northover [Mon, 14 Nov 2016 20:31:53 +0000 (20:31 +0000)]
ARM: try to fix GCC 4.8 compilation again after r286881.

llvm-svn: 286882

7 years agoRecommit: ARM: sort register lists by encoding in push/pop instructions.
Tim Northover [Mon, 14 Nov 2016 20:28:24 +0000 (20:28 +0000)]
Recommit: ARM: sort register lists by encoding in push/pop instructions.

For example we were producing

    push {r8, r10, r11, r4, r5, r7, lr}

This is misleading (r4, r5 and r7 are actually pushed before the rest), and
other components (stack folding recently) often forget to deal with the extra
complexity coming from the different order, leading to miscompiles. Finally, we
warn about our own code in -no-integrated-as mode without this, which is really
not a good idea.

Fixed usage of std::sort so that we (hopefully) use instantiations that
actually exist in GCC 4.8.

llvm-svn: 286881

7 years agoFix heap-use-after-free coff::createPDB
Vitaly Buka [Mon, 14 Nov 2016 20:21:41 +0000 (20:21 +0000)]
Fix heap-use-after-free coff::createPDB

Summary:
getInputSections returns std::vector by value and ArrayRef
pointed to destroyed temporarily.

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 286880

7 years ago[AArch64] Change some pointers to references. NFC.
Geoff Berry [Mon, 14 Nov 2016 19:59:11 +0000 (19:59 +0000)]
[AArch64] Change some pointers to references. NFC.

Follow-up change to r286875.

llvm-svn: 286879

7 years ago[X86] Tests exhibiting bad parial reloading behavior. NFC.
Michael Kuperstein [Mon, 14 Nov 2016 19:58:11 +0000 (19:58 +0000)]
[X86] Tests exhibiting bad parial reloading behavior. NFC.

llvm-svn: 286878

7 years agoImplement P0516: 'Clarify That shared_future’s Copy Operations have Wide Contracts...
Marshall Clow [Mon, 14 Nov 2016 19:58:05 +0000 (19:58 +0000)]
Implement P0516: 'Clarify That shared_future’s Copy Operations have Wide Contracts' which was adopted last week in Issaquah

llvm-svn: 286877

7 years agoAttempt to fix freaky bot.
Rui Ueyama [Mon, 14 Nov 2016 19:50:10 +0000 (19:50 +0000)]
Attempt to fix freaky bot.

I don't really understand what is failing on lld-x86_64-darwin13 bot,
but this patch should at least reduces the number of moving parts.

llvm-svn: 286876

7 years ago[AArch64] Split 0 vector stores into scalar store pairs.
Geoff Berry [Mon, 14 Nov 2016 19:39:04 +0000 (19:39 +0000)]
[AArch64] Split 0 vector stores into scalar store pairs.

Summary:
Replace a splat of zeros to a vector store by scalar stores of WZR/XZR.
The load store optimizer pass will merge them to store pair stores.
This should be better than a movi to create the vector zero followed by
a vector store if the zero constant is not re-used, since one
instructions and one register live range will be removed.

For example, the final generated code should be:

  stp xzr, xzr, [x0]

instead of:

  movi v0.2d, #0
  str q0, [x0]

Reviewers: t.p.northover, mcrosier, MatzeB, jmolloy

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 286875

7 years ago[AArch64] Factor out transform code from split16BStore. NFC.
Geoff Berry [Mon, 14 Nov 2016 19:39:00 +0000 (19:39 +0000)]
[AArch64] Factor out transform code from split16BStore.  NFC.

llvm-svn: 286874

7 years ago[change-namespace] consider typedef/using alias decls in the moved namespace.
Eric Liu [Mon, 14 Nov 2016 19:37:55 +0000 (19:37 +0000)]
[change-namespace] consider typedef/using alias decls in the moved namespace.

Summary: If a TypeLoc refers to a type alias defined in the moved namespace, we do not need to update its specifier since the type alias decl will be moved along with the type reference.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 286873

7 years agoMake one of the new tests fail correctly on pre-C++17 systems
Marshall Clow [Mon, 14 Nov 2016 19:35:34 +0000 (19:35 +0000)]
Make one of the new tests fail correctly on pre-C++17 systems

llvm-svn: 286872

7 years ago[ThinLTO] Only promote exported locals as marked in index
Teresa Johnson [Mon, 14 Nov 2016 19:21:41 +0000 (19:21 +0000)]
[ThinLTO] Only promote exported locals as marked in index

Summary:
We have always speculatively promoted all renamable local values
(except const non-address taken variables) for both the exporting
and importing module. We would then internalize them back based on
the ThinLink results if they weren't actually exported. This is
inefficient, and results in unnecessary renames. It also meant we
had to check the non-renamability of a value in the summary, which
was already checked during function importing analysis in the ThinLink.

Made renameModuleForThinLTO (which does the promotion/renaming) instead
use the index when exporting, to avoid unnecessary renames/promotions.
For importing modules, we can simply promoted all values as any local
we import by definition is exported and needs promotion.

This required changes to the method used by the FunctionImport pass
(only invoked from 'opt' for testing) and when invoked from llvm-link,
since neither does a ThinLink. We simply conservatively mark all locals
in the index as promoted, which preserves the current aggressive
promotion behavior.

I also needed to change an llvm-lto based test where we had previously
been aggressively promoting values that weren't importable (aliasees),
but now will not promote.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 286871

7 years ago[libFuzzer] replace 'auto' with 'auto *' to better follow the LLVM style
Kostya Serebryany [Mon, 14 Nov 2016 19:21:38 +0000 (19:21 +0000)]
[libFuzzer] replace 'auto' with 'auto *' to better follow the LLVM style

llvm-svn: 286870

7 years agoRevert: r286868 - Test commit
Daniel Sanders [Mon, 14 Nov 2016 19:10:56 +0000 (19:10 +0000)]
Revert: r286868 - Test commit

llvm-svn: 286869

7 years agoTest commit
Daniel Sanders [Mon, 14 Nov 2016 19:09:33 +0000 (19:09 +0000)]
Test commit

llvm-svn: 286868

7 years agoRevert "ARM: sort register lists by encoding in push/pop instructions."
Tim Northover [Mon, 14 Nov 2016 19:05:28 +0000 (19:05 +0000)]
Revert "ARM: sort register lists by encoding in push/pop instructions."

This reverts commit 286866. It broke a bot, something to do with exactly which
templates std::sort accepts.

llvm-svn: 286867

7 years agoARM: sort register lists by encoding in push/pop instructions.
Tim Northover [Mon, 14 Nov 2016 19:02:17 +0000 (19:02 +0000)]
ARM: sort register lists by encoding in push/pop instructions.

For example we were producing

    push {r8, r10, r11, r4, r5, r7, lr}

This is misleading (r4, r5 and r7 are actually pushed before the rest), and
other components (stack folding recently) often forget to deal with the extra
complexity coming from the different order, leading to miscompiles. Finally, we
warn about our own code in -no-integrated-as mode without this, which is really
not a good idea.

llvm-svn: 286866

7 years agoGive SLP vectorizer credit where it's due.
Michael Kuperstein [Mon, 14 Nov 2016 19:01:59 +0000 (19:01 +0000)]
Give SLP vectorizer credit where it's due.

llvm-svn: 286865

7 years agoImplement P0510 'Make future_error Constructible' adopted in Issaquah
Marshall Clow [Mon, 14 Nov 2016 18:56:24 +0000 (18:56 +0000)]
Implement P0510 'Make future_error Constructible' adopted in Issaquah

llvm-svn: 286864

7 years ago[PPC] altivec.h functions for converting half precision to single precision.
Sean Fertile [Mon, 14 Nov 2016 18:47:15 +0000 (18:47 +0000)]
[PPC] altivec.h functions for converting half precision to single precision.

Adds 2 vector functions for converting from a vector of unsigned short to a
vector of float. One converts the low 4 halfwords and one converts the high
4 halfwords.

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

llvm-svn: 286863

7 years ago[PPC] Add intrinsic mapping to the xscvhpsp instruction
Sean Fertile [Mon, 14 Nov 2016 18:43:59 +0000 (18:43 +0000)]
[PPC] Add intrinsic mapping to the xscvhpsp instruction

add an intrinsic to expose the 'VSX Scalar Convert Half-Precision to
Single-Precision' instruction.

Differential review: https://reviews.llvm.org/D26536

llvm-svn: 286862

7 years ago[opt-viewer] Don't fail with remarks without debug location
Adam Nemet [Mon, 14 Nov 2016 18:38:48 +0000 (18:38 +0000)]
[opt-viewer] Don't fail with remarks without debug location

llvm-svn: 286861

7 years agoAMDGPU/SI: Support data types other than V4f32 in image intrinsics
Changpeng Fang [Mon, 14 Nov 2016 18:33:18 +0000 (18:33 +0000)]
AMDGPU/SI: Support data types other than V4f32 in image intrinsics

Summary:
  Extend image intrinsics to support data types of V1F32 and V2F32.

  TODO: we should define a mapping table to change the opcode for data type of V2F32 but just one channel is active,
  even though such case should be very rare.

Reviewers:
  tstellarAMD

Differential Revision:
  http://reviews.llvm.org/D26472

llvm-svn: 286860

7 years ago[sanitizer] Max out allowed macOS deployment targets to 10.9
Kuba Brecka [Mon, 14 Nov 2016 18:27:47 +0000 (18:27 +0000)]
[sanitizer] Max out allowed macOS deployment targets to 10.9

It's not a good idea to build the sanitizers with e.g. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12, because some deprecated functions that we intercept will cause build errors. Let's limit the allowed deployment targets to 10.9 (which is the default anyway), and warn when it's set above.

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

llvm-svn: 286859

7 years agoFixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week...
Marshall Clow [Mon, 14 Nov 2016 18:22:19 +0000 (18:22 +0000)]
Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah

llvm-svn: 286858

7 years ago[ELF] Clarify why `lld -flavor gnu` is used.
Davide Italiano [Mon, 14 Nov 2016 18:20:20 +0000 (18:20 +0000)]
[ELF] Clarify why `lld -flavor gnu` is used.

Pointed out by Rafael!

llvm-svn: 286857

7 years agoFix OpenCL test for buildbot by removing extra (erroneous) RUN line
Anastasia Stulova [Mon, 14 Nov 2016 18:11:09 +0000 (18:11 +0000)]
Fix OpenCL test for buildbot by removing extra (erroneous) RUN line

llvm-svn: 286856

7 years ago[X86] Adding reproducer for pr30981
Zvi Rackover [Mon, 14 Nov 2016 18:10:44 +0000 (18:10 +0000)]
[X86] Adding reproducer for pr30981

llvm-svn: 286855

7 years agoRemove pwd to fix WinASan bot
Reid Kleckner [Mon, 14 Nov 2016 18:02:42 +0000 (18:02 +0000)]
Remove pwd to fix WinASan bot

It only slipped in while I was debugging the test case.

llvm-svn: 286854

7 years ago[PDB] Add documentation for the DBI Stream.
Zachary Turner [Mon, 14 Nov 2016 17:59:28 +0000 (17:59 +0000)]
[PDB] Add documentation for the DBI Stream.

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

llvm-svn: 286853

7 years ago[PDB] Add documentation for the PDB Stream.
Zachary Turner [Mon, 14 Nov 2016 17:59:21 +0000 (17:59 +0000)]
[PDB] Add documentation for the PDB Stream.

https://reviews.llvm.org/D26516

llvm-svn: 286852

7 years agoUse _Unwind_Backtrace on Apple platforms.
Bob Wilson [Mon, 14 Nov 2016 17:56:18 +0000 (17:56 +0000)]
Use _Unwind_Backtrace on Apple platforms.

Darwin's backtrace() function does not work with sigaltstack (which was
enabled when available with r270395) — it does a sanity check to make
sure that the current frame pointer is within the expected stack area
(which it is not when using an alternate stack) and gives up otherwise.
The alternative of _Unwind_Backtrace seems to work fine on macOS, so use
that when backtrace() fails. Note that we then use backtrace_symbols_fd()
with the addresses from _Unwind_Backtrace, but I’ve tested that and it
also seems to work fine. rdar://problem/28646552

llvm-svn: 286851

7 years agoSplit strncmp and strncasecmp test and XFAIL one for Windows
Reid Kleckner [Mon, 14 Nov 2016 17:51:11 +0000 (17:51 +0000)]
Split strncmp and strncasecmp test and XFAIL one for Windows

llvm-svn: 286850

7 years ago[OpenCL] Fix for integer parameters of enqueue_kernel
Anastasia Stulova [Mon, 14 Nov 2016 17:39:58 +0000 (17:39 +0000)]
[OpenCL] Fix for integer parameters of enqueue_kernel

Make handling integer parameters more flexible:

- For the number of events argument allow to pass larger
integers than 32 bits as soon as compiler can prove that
the range fits in 32 bits. If not, the diagnostic will be given.

- Change type of the arguments specifying the sizes of
the corresponding block arguments to be size_t.

Review: https://reviews.llvm.org/D26509
llvm-svn: 286849

7 years ago[asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization
Reid Kleckner [Mon, 14 Nov 2016 17:37:50 +0000 (17:37 +0000)]
[asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization

Summary:
ASan needs to initialize before ucrtbase.dll so that it can intercept
all of its heap allocations. New versions of dbghelp.dll depend on
ucrtbase.dll, which means both of those DLLs will initialize before the
dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we
avoid the issue.

Eventually, I would like to remove our dbghelp.dll dependency in favor
of always using llvm-symbolizer.exe, but this seems like an acceptable
interim solution.

Fixes PR30903

Reviewers: etienneb

Subscribers: kubabrecka, mgorny, llvm-commits

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

llvm-svn: 286848

7 years ago[libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but...
Stephan T. Lavavej [Mon, 14 Nov 2016 17:35:14 +0000 (17:35 +0000)]
[libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but not referenced".

test/std/depr/depr.c.headers/inttypes_h.pass.cpp
test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
test/std/input.output/iostream.forward/iosfwd.pass.cpp
Add test() to avoid a bunch of void-casts, although we still need a few.

test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below).

test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
When retrieving facets, the references are unused.

test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
"std::ios_base::iostate err = ios.goodbit;" was completely unused here.

test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
test/std/numerics/c.math/ctgmath.pass.cpp
test/std/numerics/rand/rand.device/entropy.pass.cpp
test/std/numerics/rand/rand.device/eval.pass.cpp
test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
test/std/thread/futures/futures.promise/dtor.pass.cpp
test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
These variables are verifying types but are otherwise unused.

test/std/strings/basic.string/string.capacity/reserve.pass.cpp
old_cap was unused (it's unclear to me whether it was intended to be used).

test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
These tests contained unused characters.

llvm-svn: 286847

7 years ago[clang docs] Minor fix in ClangCheck.rst
Mandeep Singh Grang [Mon, 14 Nov 2016 17:31:24 +0000 (17:31 +0000)]
[clang docs] Minor fix in ClangCheck.rst

Reviewers: djasper, rengolin

Subscribers: Eugene.Zelenko

Tags: #clang-c

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

llvm-svn: 286846

7 years agoTypo
Adrian Prantl [Mon, 14 Nov 2016 17:26:32 +0000 (17:26 +0000)]
Typo

llvm-svn: 286845

7 years agoRestore "[ThinLTO] Prevent exporting of locals used/defined in module level asm"
Teresa Johnson [Mon, 14 Nov 2016 17:12:32 +0000 (17:12 +0000)]
Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm"

This restores the rest of r286297 (part was restored in r286475).
Specifically, it restores the part requiring adding a dependency from
the Analysis to Object library (downstream use changed to correctly
model split BitReader vs BitWriter libraries).

Original description of this part of patch follows:

Module level asm may also contain defs of values. We need to prevent
export of any refs to local values defined in module level asm (e.g. a
ref in normal IR), since that also requires renaming/promotion of the
local. To do that, the summary index builder looks at all values in the
module level asm string that are not marked Weak or Global, which is
exactly the set of locals that are defined. A summary is created for
each of these local defs and flagged as NoRename.

This required adding handling to the BitcodeWriter to look at GV
declarations to see if they have a summary (rather than skipping them
all).

Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to
ensure that an MCAsmParser is available, otherwise the module asm parse
would silently fail. Initialized the asm parser in the opt tool for use
in testing this fix.

Fixes PR30610.

llvm-svn: 286844

7 years ago[Hexagon] Remove unsafe load instructions that affect Stack Slot Coloring
Sumanth Gundapaneni [Mon, 14 Nov 2016 17:11:00 +0000 (17:11 +0000)]
[Hexagon] Remove unsafe load instructions that affect Stack Slot Coloring

The Stack slot coloring pass removes a store that is followed by a load
that deal with the same stack slot. The function isLoadFromStackSlot
is supposed to consider the loads that have no side-effects. This
patch fixed the issue by removing the unsafe loads from this function
Eg:
%vreg0<def> = L2_loadruh_io <fi#15>, 0
S2_storeri_io <fi#15>, 0, %vreg0

In this case, we load an unsigned extended half word and store this in to
the same stack slot. The Stack slot coloring pass considers safe to remove
the store. This patch marked all the non-vector byte and half word loads as
unsafe.

llvm-svn: 286843

7 years agoFix the unit test darwin-multiarch-arm.c for windows
Sumanth Gundapaneni [Mon, 14 Nov 2016 17:09:39 +0000 (17:09 +0000)]
Fix the unit test darwin-multiarch-arm.c for windows

llvm-svn: 286842

7 years agoHandle non-inlined clang::Type::getAs specializations in extract_symbols.py
Stephan Bergmann [Mon, 14 Nov 2016 17:07:09 +0000 (17:07 +0000)]
Handle non-inlined clang::Type::getAs specializations in extract_symbols.py

The existing logic was to discard any symbols representing function template
instantiations, as the definitions were assumed to be inline. But there are
three explicit specializations of clang::Type::getAs that are only defined in
Clang's lib/AST/Type.cpp, and at least the plugin used by the LibreOffice build
(https://wiki.documentfoundation.org/Development/Clang_plugins) uses those
functions.

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

llvm-svn: 286841

7 years ago[ThinLTO] Make inline assembly handling more efficient in summary
Teresa Johnson [Mon, 14 Nov 2016 16:40:19 +0000 (16:40 +0000)]
[ThinLTO] Make inline assembly handling more efficient in summary

Summary:
The change in r285513 to prevent exporting of locals used in
inline asm added all locals in the llvm.used set to the reference
set of functions containing inline asm. Since these locals were marked
NoRename, this automatically prevented importing of the function.

Unfortunately, this caused an explosion in the summary reference lists
in some cases. In my particular example, it happened for a large protocol
buffer generated C++ file, where many of the generated functions
contained an inline asm call. It was exacerbated when doing a ThinLTO
PGO instrumentation build, where the PGO instrumentation included
thousands of private __profd_* values that were added to llvm.used.

We really only need to include a single llvm.used local (NoRename) value
in the reference list of a function containing inline asm to block it
being imported. However, it seems cleaner to add a flag to the summary
that explicitly describes this situation, which is what this patch does.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 286840

7 years agoFix build since r286752.
Tom Stellard [Mon, 14 Nov 2016 16:06:33 +0000 (16:06 +0000)]
Fix build since r286752.

llvm-svn: 286839

7 years ago[CostModel][X86] Added mul costs for vXi8 vectors
Simon Pilgrim [Mon, 14 Nov 2016 15:54:24 +0000 (15:54 +0000)]
[CostModel][X86] Added mul costs for vXi8 vectors

More realistic v16i8/v32i8/v64i8 MUL costs - we have to extend to vXi16, use PMULLW and then truncate the result

llvm-svn: 286838

7 years agoFix program header propagation.
Rafael Espindola [Mon, 14 Nov 2016 15:39:38 +0000 (15:39 +0000)]
Fix program header propagation.

Propagate program headers by walking the commands, not the
sections. This allows us to propagate program headers even from
sections that don't end up in the output.

Fixes pr30997.

llvm-svn: 286837

7 years ago[OpenCL] Change to clk_event parameter in enqueue_kernel.
Anastasia Stulova [Mon, 14 Nov 2016 15:34:01 +0000 (15:34 +0000)]
[OpenCL] Change to clk_event parameter in enqueue_kernel.

- Accept NULL pointer as a valid parameter value for clk_event.
- Generate clk_event_t arguments of internal
__enqueue_kernel_XXX function as pointers in generic address space.

Review: https://reviews.llvm.org/D26507
llvm-svn: 286836

7 years agoUpdate C++1z status with LWG papers from Issaquah.
Marshall Clow [Mon, 14 Nov 2016 15:09:45 +0000 (15:09 +0000)]
Update C++1z status with LWG papers from Issaquah.

llvm-svn: 286835

7 years agoUpdate C++1z status with LFTS issues from Issaquah.
Marshall Clow [Mon, 14 Nov 2016 14:53:07 +0000 (14:53 +0000)]
Update C++1z status with LFTS issues from Issaquah.

llvm-svn: 286834

7 years ago[clang-move] Fix an incorrect range for the functions whose returned value is a macro
Haojian Wu [Mon, 14 Nov 2016 14:46:48 +0000 (14:46 +0000)]
[clang-move] Fix an incorrect range for the functions whose returned value is a macro

Summary:
Fix an incorrect range for the functions whose returned value is a macro
(e.g. `bool`). This incorrect range can lead to modifications of an unexpected
file where the macro is in.

We should use expansion location instead of spelling location.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286833

7 years ago[X86][AVX] Fixed v16i16/v32i8 ADD/SUB costs on AVX1 subtargets
Simon Pilgrim [Mon, 14 Nov 2016 14:45:16 +0000 (14:45 +0000)]
[X86][AVX] Fixed v16i16/v32i8 ADD/SUB costs on AVX1 subtargets

Add explicit v16i16/v32i8 ADD/SUB costs, matching the costs of v4i64/v8i32 - they were missing for some reason.

This has side effects on the LV max bandwidth tests (AVX1 now prefers 128-bit vectors vs AVX2 which still prefers 256-bit)

llvm-svn: 286832

7 years ago[ELF] - Ignore -Map,-M and --cref options.
George Rimar [Mon, 14 Nov 2016 14:45:11 +0000 (14:45 +0000)]
[ELF] - Ignore -Map,-M and --cref options.

-M, --print-map Write map file on standard output
-Map MAPFILENAME Write map file
--cref Output cross reference table

This is relative to PR30973.

Next FreeBSD ports were atm failing because of
lack of -Map, -M and --cref:

sysutils/openipmi
emulators/adamem
devel/jwasm
net/pimd
devel/k8048
textproc/libcrm114
lang/micropython
net/mrouted
print/openprinting

After this patch all of them can be link fine.

llvm-svn: 286831

7 years ago[PPC] add extract sig/exp test data class for vec float and vec double.
Sean Fertile [Mon, 14 Nov 2016 14:43:27 +0000 (14:43 +0000)]
[PPC] add extract sig/exp test data class for vec float and vec double.

 Add vector extract exponent/significand functions to altivec.h, as well as
 functions (and related constants) to test the data class of vector float
 and vector double.

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

llvm-svn: 286830

7 years ago[PPC] add intrinsics for vec extract exp/significand and vec test data class.
Sean Fertile [Mon, 14 Nov 2016 14:42:37 +0000 (14:42 +0000)]
[PPC] add intrinsics for vec extract exp/significand and vec test data class.

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

llvm-svn: 286829

7 years agoUpdate C++1z status with C++17 issues from Issaquah. Still to come: LFTS issues and...
Marshall Clow [Mon, 14 Nov 2016 14:41:33 +0000 (14:41 +0000)]
Update C++1z status with C++17 issues from Issaquah. Still to come: LFTS issues and papers

llvm-svn: 286828

7 years agoDelay removing empty section commands. NFC.
Rafael Espindola [Mon, 14 Nov 2016 14:33:49 +0000 (14:33 +0000)]
Delay removing empty section commands. NFC.

To fix pr30997 we will have to keep them a bit longer, this just
splits that part of the diff.

llvm-svn: 286827

7 years agoFactor out removeEmptyCommands. NFC.
Rafael Espindola [Mon, 14 Nov 2016 14:23:35 +0000 (14:23 +0000)]
Factor out removeEmptyCommands. NFC.

llvm-svn: 286826

7 years ago[clang-move] Abstract a ClassMather for matching class declarations.
Haojian Wu [Mon, 14 Nov 2016 14:15:44 +0000 (14:15 +0000)]
[clang-move] Abstract a ClassMather for matching class declarations.

Summary:
No functionality change.

This is a refactoring patch, which makes the code more readable and easy
to extend it to support more types.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286825

7 years agoFactor out placeOrphanSections. NFC.
Rafael Espindola [Mon, 14 Nov 2016 14:13:32 +0000 (14:13 +0000)]
Factor out placeOrphanSections. NFC.

llvm-svn: 286824

7 years agoProtect std::ios tests under libcpp-no-exceptions
Roger Ferrer Ibanez [Mon, 14 Nov 2016 13:44:50 +0000 (13:44 +0000)]
Protect std::ios tests under libcpp-no-exceptions

Skip tests that expect an exception be thrown. Also add
some missing asserts in the original test.

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

llvm-svn: 286823

7 years agoReverting r285406, which was a temporary workaround to get one of the documentation...
Aaron Ballman [Mon, 14 Nov 2016 13:33:51 +0000 (13:33 +0000)]
Reverting r285406, which was a temporary workaround to get one of the documentation bots upgraded to something newer than GCC 4.7. This restores the check for GCC 4.8.

llvm-svn: 286822

7 years agoFix r286819 (accidentally patched multiple times.
Pekka Jaaskelainen [Mon, 14 Nov 2016 13:14:38 +0000 (13:14 +0000)]
Fix r286819 (accidentally patched multiple times.

llvm-svn: 286821

7 years agoRevert "llvm-strings: support printing the filename"
Renato Golin [Mon, 14 Nov 2016 13:09:24 +0000 (13:09 +0000)]
Revert "llvm-strings: support printing the filename"

Also,

Revert "test: remove the archive before modifying it"
Revert "test: explicitly use gnu format"

This reverts commits r286778, r286729 and r286767, as they are randomly failing
on many bots (AArch64, x86_64).

llvm-svn: 286820

7 years ago[OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD
Pekka Jaaskelainen [Mon, 14 Nov 2016 13:08:30 +0000 (13:08 +0000)]
[OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD

It doesn't make sense to use the target's address space ids in this context as
this is metadata that should be referring to the "logical" OpenCL address spaces.
For flat AS machines like all "CPUs" in general, the logical AS info gets lost as
there's only one address space (0).

This commit changes the logic such that we always use the SPIR address space
ids for the argument metadata. It thus allows implementing the clGetKernelArgInfo()
and the other detection needs.

https://reviews.llvm.org/D26157

llvm-svn: 286819

7 years agoRevert "Improve handling of floating point literals in OpenCL to only use double...
Renato Golin [Mon, 14 Nov 2016 12:19:18 +0000 (12:19 +0000)]
Revert "Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64."

This reverts commit r286815, as it broke all ARM and AArch64 bots.

llvm-svn: 286818

7 years agoRemove redundant condition (PR28352) NFCI.
Simon Pilgrim [Mon, 14 Nov 2016 12:00:46 +0000 (12:00 +0000)]
Remove redundant condition (PR28352) NFCI.

We were already testing is the op was not a leaf, so need to then test if it was a leaf (added it to the assert instead).

llvm-svn: 286817

7 years ago[lsan] [aarch64] Fix printing of pointers in make check tests - update
Strahinja Petrovic [Mon, 14 Nov 2016 11:40:56 +0000 (11:40 +0000)]
[lsan] [aarch64] Fix printing of pointers in make check tests - update

This patch replaces fprintf with print_address function in LSAN
tests. This is necessary because of different printing of pointers
in fprintf and sanitizer's print function.
Differential Revision: https://reviews.llvm.org/D26084.

llvm-svn: 286816

7 years agoImprove handling of floating point literals in OpenCL to only use double precision...
Neil Hickey [Mon, 14 Nov 2016 11:15:51 +0000 (11:15 +0000)]
Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.

This change makes sure single-precision floating point types are used if the
cl_fp64 extension is not supported by the target.

Also removed the check to see whether the OpenCL version is >= 1.2, as this has
been incorporated into the extension setting code.

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

llvm-svn: 286815

7 years ago[InlineCost] Remove skew when calculating call costs
James Molloy [Mon, 14 Nov 2016 11:14:41 +0000 (11:14 +0000)]
[InlineCost] Remove skew when calculating call costs

When calculating the cost of a call instruction we were applying a heuristic penalty as well as the cost of the instruction itself.

However, when calculating the benefit from inlining we weren't discounting the equivalent penalty for the call instruction that would be removed! This caused skew in the calculation and meant we wouldn't inline in the following, trivial case:

  int g() {
    h();
  }
  int f() {
    g();
  }

llvm-svn: 286814

7 years agoProtect nested-exceptions tests under no-exceptions
Roger Ferrer Ibanez [Mon, 14 Nov 2016 11:00:28 +0000 (11:00 +0000)]
Protect nested-exceptions tests under no-exceptions

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

llvm-svn: 286813

7 years agoUpdate tests for strings conversions under libcpp-no-exceptions
Roger Ferrer Ibanez [Mon, 14 Nov 2016 10:44:26 +0000 (10:44 +0000)]
Update tests for strings conversions under libcpp-no-exceptions

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

llvm-svn: 286812

7 years agoRemove redundant condition (PR28800) NFCI.
Simon Pilgrim [Mon, 14 Nov 2016 10:40:23 +0000 (10:40 +0000)]
Remove redundant condition (PR28800) NFCI.

'A || (!A && B)' is equivalent to 'A || B':

(LoopCycle > DefCycle) || (LoopCycle <= DefCycle && LoopStage <= DefStage)
-->
(LoopCycle > DefCycle) || (LoopStage <= DefStage)

llvm-svn: 286811

7 years ago[ELF] - Simplify edata-etext.s test. NFC.
George Rimar [Mon, 14 Nov 2016 10:33:53 +0000 (10:33 +0000)]
[ELF] - Simplify edata-etext.s test. NFC.

llvm-svn: 286810

7 years agoProtect smart-pointer tests under no exceptions
Roger Ferrer Ibanez [Mon, 14 Nov 2016 10:27:56 +0000 (10:27 +0000)]
Protect smart-pointer tests under no exceptions

Skip tests that expect an exception be thrown under no-exceptions.

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

llvm-svn: 286809

7 years agoGlobalISel: Fix indentation. NFC
Diana Picus [Mon, 14 Nov 2016 10:25:43 +0000 (10:25 +0000)]
GlobalISel: Fix indentation. NFC

llvm-svn: 286808

7 years ago[JumpThreading] Prevent non-deterministic use lists
Pablo Barrio [Mon, 14 Nov 2016 10:24:26 +0000 (10:24 +0000)]
[JumpThreading] Prevent non-deterministic use lists

Summary:
Unfolding selects was previously done with the help of a vector
of pointers that was then sorted to be able to remove duplicates.
As this sorting depends on the memory addresses, it was
non-deterministic. A SetVector is used now so that duplicates are
removed without the need of sorting first.

Reviewers: mgrang, efriedma

Subscribers: llvm-commits

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

llvm-svn: 286807

7 years agoGlobalISel: Fix typos. NFC
Diana Picus [Mon, 14 Nov 2016 10:22:18 +0000 (10:22 +0000)]
GlobalISel: Fix typos. NFC

llvm-svn: 286806

7 years ago[ELF] - format. NFC.
George Rimar [Mon, 14 Nov 2016 10:14:18 +0000 (10:14 +0000)]
[ELF] - format. NFC.

llvm-svn: 286805

7 years ago[ELF] - format. NFC.
George Rimar [Mon, 14 Nov 2016 10:05:53 +0000 (10:05 +0000)]
[ELF] - format. NFC.

llvm-svn: 286804

7 years ago[ELF] - Removed trailing whitespace. NFC.
George Rimar [Mon, 14 Nov 2016 10:04:45 +0000 (10:04 +0000)]
[ELF] - Removed trailing whitespace. NFC.

llvm-svn: 286803

7 years ago[ELF] - Removed unused code. NFC.
George Rimar [Mon, 14 Nov 2016 10:03:54 +0000 (10:03 +0000)]
[ELF] - Removed unused code. NFC.

This branch was unused I believe,
as Tok can never be empty.

llvm-svn: 286802

7 years ago[ELF] - Fix mistype. NFC.
George Rimar [Mon, 14 Nov 2016 09:56:35 +0000 (09:56 +0000)]
[ELF] - Fix mistype. NFC.

llvm-svn: 286801

7 years ago[ELF] - Untabify. NFC.
George Rimar [Mon, 14 Nov 2016 09:33:38 +0000 (09:33 +0000)]
[ELF] - Untabify. NFC.

llvm-svn: 286800

7 years ago[ELF] Convert StringTableSection to input section
Eugene Leviant [Mon, 14 Nov 2016 09:16:00 +0000 (09:16 +0000)]
[ELF] Convert StringTableSection to input section

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

llvm-svn: 286799

7 years agoRemove some false positives when taking the address of packed members
Roger Ferrer Ibanez [Mon, 14 Nov 2016 08:53:27 +0000 (08:53 +0000)]
Remove some false positives when taking the address of packed members

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

llvm-svn: 286798

7 years agoAdd explicit (void) cast to unused unique_ptr::release() results
Eric Fiselier [Mon, 14 Nov 2016 07:26:17 +0000 (07:26 +0000)]
Add explicit (void) cast to unused unique_ptr::release() results

Summary:
This patch adds explicit `(void)` casts to discarded `release()` calls to suppress -Wunused-result.

This patch fixes *all* warnings are generated as a result of [applying `[[nodiscard]]`  within libc++](https://reviews.llvm.org/D26596).
Similar fixes were applied to Clang in r286796.

Reviewers: chandlerc, dberris

Subscribers: llvm-commits

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

llvm-svn: 286797

7 years agoAdd explicit (void) cast to result of unique_ptr::release()
Eric Fiselier [Mon, 14 Nov 2016 07:03:50 +0000 (07:03 +0000)]
Add explicit (void) cast to result of unique_ptr::release()

llvm-svn: 286796

7 years agoDemangle: only demangle mangled symbols
Saleem Abdulrasool [Mon, 14 Nov 2016 04:54:47 +0000 (04:54 +0000)]
Demangle: only demangle mangled symbols

Only attempt to demangle symbols which have the itanium C++ prefix of `_Z`.
This ensures that we do not treat any symbol name as a managled named.  We would
previously treat a C function `f` as a mangled name and decode that to `float`
incorrectly.

While it is easy to add tests for this, Mehdi recommended against introducing
tests for the demangler as libc++abi should cover the testing.

llvm-svn: 286795

7 years ago__cxa_demangle: allow demangling invocation blocks
Saleem Abdulrasool [Mon, 14 Nov 2016 03:07:47 +0000 (03:07 +0000)]
__cxa_demangle: allow demangling invocation blocks

The block invocation function uses an extension where the prefix is ___Z
as opposed to _Z.  This should make the tests pass again.

Disable a negative test which was testing a crasher.  The symbol being
demangled is not a valid mangled symbol and will return a nullptr.

Adjust the type info decoding test to be a valid symbol name.

llvm-svn: 286793

7 years agoFix ABI configuration detection on OS X
Eric Fiselier [Mon, 14 Nov 2016 03:03:13 +0000 (03:03 +0000)]
Fix ABI configuration detection on OS X

llvm-svn: 286792

7 years agoFix CMake set syntax
Eric Fiselier [Mon, 14 Nov 2016 02:51:30 +0000 (02:51 +0000)]
Fix CMake set syntax

llvm-svn: 286791