platform/upstream/llvm.git
8 years agoUnbreak the NetBSD build after recent changes
Kamil Rytarowski [Tue, 20 Sep 2016 22:26:29 +0000 (22:26 +0000)]
Unbreak the NetBSD build after recent changes

Similar to r281922 "Try to fix freebsd and android builds."

Replace .AppendArgument(cstr) with .AppendArgument(llvm::StringRef(cstr))

llvm-svn: 282032

8 years agoRemove the default subtarget from the x86 port as it isn't necessary (or
Eric Christopher [Tue, 20 Sep 2016 22:19:33 +0000 (22:19 +0000)]
Remove the default subtarget from the x86 port as it isn't necessary (or
correct) anymore.

llvm-svn: 282031

8 years ago[scudo] Fix a bug in the new Secondary Allocator
Kostya Kortchinsky [Tue, 20 Sep 2016 22:17:59 +0000 (22:17 +0000)]
[scudo] Fix a bug in the new Secondary Allocator

Summary:
GetActuallyAllocatedSize() was not accounting for the last page of the mapping
being a guard page, and was returning the wrong number of actually allocated
bytes, which in turn would mess up with the realloc logic. Current tests didn't
find this as the size exercised was only serviced by the Primary.

Correct the issue by subtracting PageSize, and update the realloc test to
exercise paths in both the Primary and the Secondary.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 282030

8 years agoEnable clang attributes when using clang-cl.
Zachary Turner [Tue, 20 Sep 2016 22:15:07 +0000 (22:15 +0000)]
Enable clang attributes when using clang-cl.

llvm-svn: 282029

8 years agoRevert "Remove extra argument used once on
Eric Christopher [Tue, 20 Sep 2016 22:03:28 +0000 (22:03 +0000)]
Revert "Remove extra argument used once on
TargetMachine::getNameWithPrefix and inline the result into the singular
caller." and "Remove more guts of TargetMachine::getNameWithPrefix and
migrate one check to the TLOF mach-o version." temporarily until I can
get the whole call migrated out of the TargetMachine as we could hit
places where TLOF isn't valid.

This reverts commits r281981 and r281983.

llvm-svn: 282028

8 years ago[CMake] Fix error preventing simulator sanitizers from building
Chris Bieneman [Tue, 20 Sep 2016 21:36:33 +0000 (21:36 +0000)]
[CMake] Fix error preventing simulator sanitizers from building

This should be checking for sim archs not target archs. This bug has
been around for a long time.

llvm-svn: 282025

8 years ago[CMake] Explicitly add --target option to compiler flags
Chris Bieneman [Tue, 20 Sep 2016 21:36:30 +0000 (21:36 +0000)]
[CMake] Explicitly add --target option to compiler flags

Summary:
Much of the non-Darwin build system assumes that COMPILER_RT_DEFAULT_TARGET_TRIPLE is the default target triple for the compiler being used. With clang as your compiler this isn't necessarily true.

To ensure that the rest of the build system behaves as expected this patch adds "--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" to the compiler flags for C, CXX and ASM sources.

Reviewers: compnerd, rengolin, fjricci

Subscribers: llvm-commits

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

llvm-svn: 282024

8 years ago[RS4GC] Refactor code for Rematerializing in presence of phi. NFC
Anna Thomas [Tue, 20 Sep 2016 21:36:02 +0000 (21:36 +0000)]
[RS4GC] Refactor code for Rematerializing in presence of phi. NFC

Summary:
This is an NFC refactoring change as a precursor to the actual fix for rematerializing in
presence of phi.
https://reviews.llvm.org/D24399

Pasted from review:
findRematerializableChainToBasePointer changed to return the root of the
chain. instead of true or false.
move the PHI matching logic into the caller by inspecting the root return value.
This includes an assertion that the alternate root is in the liveset for the
call.

Tested with current RS4GC tests.

Reviewers: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 282023

8 years ago[CodeGen] stop short-circuiting the SSP code for sspstrong.
George Burgess IV [Tue, 20 Sep 2016 21:30:01 +0000 (21:30 +0000)]
[CodeGen] stop short-circuiting the SSP code for sspstrong.

This check caused us to skip adding layout information for calls to
alloca in sspreq/sspstrong mode. We check properly for sspstrong later
on (and add the correct layout info when doing so), so removing this
shouldn't hurt.

No test is included, since testing this using lit seems to require
checking for exact offsets in asm, which is something that the lit tests
for this avoid. If someone cares deeply, I'm happy to write a unittest
or something to cover this, but that feels like overkill.

Patch by Daniel Micay.

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

llvm-svn: 282022

8 years agoRevert "Only restrict order if both sections are in the script."
Rafael Espindola [Tue, 20 Sep 2016 21:28:19 +0000 (21:28 +0000)]
Revert "Only restrict order if both sections are in the script."

This reverts commit r282015. It broke some bots.

llvm-svn: 282021

8 years ago[llvm-cov] Demangle names for hidden instantiation views
Vedant Kumar [Tue, 20 Sep 2016 21:27:48 +0000 (21:27 +0000)]
[llvm-cov] Demangle names for hidden instantiation views

llvm-svn: 282020

8 years ago[asan] Add C++17 aligned new/delete entrypoints. Patch by Jakub Jelinek, see https...
Kostya Serebryany [Tue, 20 Sep 2016 21:27:10 +0000 (21:27 +0000)]
[asan] Add C++17 aligned new/delete entrypoints. Patch by Jakub Jelinek, see https://reviews.llvm.org/D24771

llvm-svn: 282019

8 years agoXFAIL cfi/stats.cpp on Windows until we fix LLD
Reid Kleckner [Tue, 20 Sep 2016 21:09:31 +0000 (21:09 +0000)]
XFAIL cfi/stats.cpp on Windows until we fix LLD

llvm-svn: 282018

8 years ago[Profile] dump ic value profile value/site-count histogram
Xinliang David Li [Tue, 20 Sep 2016 21:04:22 +0000 (21:04 +0000)]
[Profile] dump ic value profile value/site-count histogram

Differential Revision: http://reviews.google.com/D24783

llvm-svn: 282017

8 years agoOnly restrict order if both sections are in the script.
Rafael Espindola [Tue, 20 Sep 2016 20:54:39 +0000 (20:54 +0000)]
Only restrict order if both sections are in the script.

This matches gold and bfd behavior and is required to handle some scripts.

The script has to assume where PT_LOADs start in order to align that
spot. If we don't allow section it doesn't know about to move to the
middle, we can need more PT_LOADs and those will not be aligned.

llvm-svn: 282015

8 years agoMake test less dependent on the section order.
Rafael Espindola [Tue, 20 Sep 2016 20:48:54 +0000 (20:48 +0000)]
Make test less dependent on the section order.

This means either relaxing CHECKs or listing more sections and
addresses in linker scripts.

llvm-svn: 282014

8 years ago[PECOFF] Use the COFF subsystem field when determining the Triple.
Zachary Turner [Tue, 20 Sep 2016 20:44:50 +0000 (20:44 +0000)]
[PECOFF] Use the COFF subsystem field when determining the Triple.

Patch by walter erquinigo
Differential revision: https://reviews.llvm.org/D24284

llvm-svn: 282013

8 years ago[asan] Fix GlobalAddressDescription::Print()
Filipe Cabecinhas [Tue, 20 Sep 2016 20:33:18 +0000 (20:33 +0000)]
[asan] Fix GlobalAddressDescription::Print()

Summary: Check bug_type for nullptr before calling internal_strcmp

Reviewers: kcc, vitalybuka, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 282012

8 years ago[analyzer] Add a checker that detects blocks in critical sections
Anna Zaks [Tue, 20 Sep 2016 20:28:50 +0000 (20:28 +0000)]
[analyzer] Add a checker that detects blocks in critical sections

This checker should find the calls to blocking functions (for example: sleep, getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called while a mutex is held, other threads cannot lock the same mutex. This might take some time, leading to bad performance or even deadlock.

Example:

mutex_t m;

void f() {
  sleep(1000); // Error: sleep() while m is locked! [f() is called from foobar() while m is locked]
  // do some work
}

void foobar() {
  lock(m);
  f();
  unlock(m);
}

A patch by zdtorok (Zoltán Dániel Török)!

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

llvm-svn: 282011

8 years agoMark ELF sections whose name start with .note as note
Petr Hosek [Tue, 20 Sep 2016 20:21:13 +0000 (20:21 +0000)]
Mark ELF sections whose name start with .note as note

Previously, such section would be marked as SHT_PROGBITS which
makes it impossible to use an initialized C variable declaration
to emit an (allocated) ELF note. The new behavior is also consistent
with ELF assembly parser.

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

llvm-svn: 282010

8 years ago[Profile] Do not annotate select insts not covered in profile.
Xinliang David Li [Tue, 20 Sep 2016 20:20:01 +0000 (20:20 +0000)]
[Profile] Do not annotate select insts not covered in profile.

Fixed PR/30466

llvm-svn: 282009

8 years agoNext set of additional error checks for invalid Mach-O files for bad load commands
Kevin Enderby [Tue, 20 Sep 2016 20:14:14 +0000 (20:14 +0000)]
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::dylib_command type for the load commands that are
currently used in the MachOObjectFile constructor.

This contains the missing checks for LC_ID_DYLIB, LC_ID_DYLIB, etc.
load commands and the fields for the Mach::dylib_command type.

Also checks that only an MH_DYLIB or MH_STUB_DYLIB has an
LC_ID_DYLIB load command (and others filetype don’t) and there
is not more than one of these load commands.

llvm-svn: 282008

8 years agoRemove some boilerplate comments that don't explain anything.
Eric Christopher [Tue, 20 Sep 2016 19:45:06 +0000 (19:45 +0000)]
Remove some boilerplate comments that don't explain anything.

llvm-svn: 282007

8 years agoSimplify SORT and --sort-section command line option handling.
Rui Ueyama [Tue, 20 Sep 2016 19:42:41 +0000 (19:42 +0000)]
Simplify SORT and --sort-section command line option handling.

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

llvm-svn: 282006

8 years ago[x86] split up tests, regenerate checks
Sanjay Patel [Tue, 20 Sep 2016 19:31:30 +0000 (19:31 +0000)]
[x86] split up tests, regenerate checks

Note that we fail to eliminate 'or' with 0!

llvm-svn: 282005

8 years agoFix a regex error breaking tests.
Zachary Turner [Tue, 20 Sep 2016 19:10:56 +0000 (19:10 +0000)]
Fix a regex error breaking tests.

llvm-svn: 282004

8 years ago[CMake] Support overriding CLANG_VERSION_*
Chris Bieneman [Tue, 20 Sep 2016 19:09:21 +0000 (19:09 +0000)]
[CMake] Support overriding CLANG_VERSION_*

As with how we handle LLVM_VERSION_* variables we should support
overriding clang version variables.

llvm-svn: 282003

8 years ago[Profile] code refactoring: make getStep a method in base class
Xinliang David Li [Tue, 20 Sep 2016 19:07:22 +0000 (19:07 +0000)]
[Profile] code refactoring: make getStep a method in base class

llvm-svn: 282002

8 years agoRevert part of "AArch64: Do not test for CPUs, use SubtargetFeatures"
Evandro Menezes [Tue, 20 Sep 2016 19:02:09 +0000 (19:02 +0000)]
Revert part of "AArch64: Do not test for CPUs, use SubtargetFeatures"

This reverts part of commit 119e358d9635c8d1f3e7aee67e3ea3b8a62f8db6 by
removing FeatureUseRSqrt et al per request by Eric Christopher
<echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 282001

8 years agoRevert "[AArch64] Use the reciprocal estimation machinery"
Evandro Menezes [Tue, 20 Sep 2016 19:02:06 +0000 (19:02 +0000)]
Revert "[AArch64] Use the reciprocal estimation machinery"

This reverts commit b7d42b0048f65346e9fa37fb65defeea7ce8c337 per request by
Eric Christopher <echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 282000

8 years agoRevert "[AArch64] Properly validate the reciprocal estimation."
Evandro Menezes [Tue, 20 Sep 2016 19:02:02 +0000 (19:02 +0000)]
Revert "[AArch64] Properly validate the reciprocal estimation."

This reverts commit ad8ca1528242e2a4cb363e3779309e70eb7a430e per request by
Eric Christopher <echristo@gmail.com> (v. http://bit.ly/2cmz6kW).

llvm-svn: 281999

8 years agoAdd some entropy to the folder name in Driver/warning-options.cpp.
Zachary Turner [Tue, 20 Sep 2016 18:41:19 +0000 (18:41 +0000)]
Add some entropy to the folder name in Driver/warning-options.cpp.

It was trying to check that things behave correctly when a
non-existant folder was specified for -isysroot.  Incidentally,
I have a folder named FOO in the root of my drive, so this test
was failing.  Make this impossible by using %T to refer to a
definitely non-existant folder.:

llvm-svn: 281998

8 years agoCodeGen: further merge cstring literal construction
Saleem Abdulrasool [Tue, 20 Sep 2016 18:38:54 +0000 (18:38 +0000)]
CodeGen: further merge cstring literal construction

Use the new CreateCStringLiteral in an additional site.  Now all the C string
literals are created in one function.  Furthermore, mark the additional literal
as an `unnamed_addr constant`.

llvm-svn: 281997

8 years agoFix typo in documentation.
Nick Lewycky [Tue, 20 Sep 2016 18:37:25 +0000 (18:37 +0000)]
Fix typo in documentation.

Since this is a header it will break links to this section.

llvm-svn: 281996

8 years ago[cleanup] Remove excessive padding from TextTokenRetokenizer::Position
Alexander Shaposhnikov [Tue, 20 Sep 2016 18:32:48 +0000 (18:32 +0000)]
[cleanup] Remove excessive padding from TextTokenRetokenizer::Position

Reorder the fields of the struct TextTokenRetokenizer::Position to remove excessive padding.
Test plan: make -j8 check-clang

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

llvm-svn: 281995

8 years agoASAN: Don't drop debug info attachements for global variables.
Adrian Prantl [Tue, 20 Sep 2016 18:28:42 +0000 (18:28 +0000)]
ASAN: Don't drop debug info attachements for global variables.
This is a follow-up to r281284. Global Variables now can have
!dbg attachements, so ASAN should clone these when generating a
sanitized copy of a global variable.

<rdar://problem/24899262>

llvm-svn: 281994

8 years agoMake it so that one can register prefix matches as well as identical matches as extra...
Enrico Granata [Tue, 20 Sep 2016 18:26:30 +0000 (18:26 +0000)]
Make it so that one can register prefix matches as well as identical matches as extra cases for NSDictionary data formatting

llvm-svn: 281993

8 years agotsan: revert r281970
Dmitry Vyukov [Tue, 20 Sep 2016 18:05:06 +0000 (18:05 +0000)]
tsan: revert r281970

r281970 extended the check in a useful way,
but caused (true) failures on aarch64.
Revert it for now.

llvm-svn: 281992

8 years agoFix syntactical nit from r281990.
Adrian McCarthy [Tue, 20 Sep 2016 17:42:13 +0000 (17:42 +0000)]
Fix syntactical nit from r281990.

llvm-svn: 281991

8 years agoEmit S_COMPILE3 CodeView record
Adrian McCarthy [Tue, 20 Sep 2016 17:20:51 +0000 (17:20 +0000)]
Emit S_COMPILE3 CodeView record

CodeView has an S_COMPILE3 record to identify the compiler and source language of the compiland.  This record comes first in the debug$S section for the compiland. The debuggers rely on this record to know the source language of the code.

There was a little test fallout from introducing a new record into the symbols subsection.

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

llvm-svn: 281990

8 years agoDon't produce an error for undefined entry symbol.
Rafael Espindola [Tue, 20 Sep 2016 17:14:16 +0000 (17:14 +0000)]
Don't produce an error for undefined entry symbol.

This is particularly important when the symbol comes from a linker
script. It is common to use the same linker script for shared
libraries and executables. Without this we would always fail to link
shared libraries with -z,defs and a linker script with an ENTRY
directive.

llvm-svn: 281989

8 years ago[docs] Extend the code coverage docs some more
Vedant Kumar [Tue, 20 Sep 2016 17:11:18 +0000 (17:11 +0000)]
[docs] Extend the code coverage docs some more

Flesh out the section on interpreting coverage reports, mention the
coverage export feature, and add notes on how to build llvm with
coverage turned on.

llvm-svn: 281988

8 years ago[ScopDetection] Remove redundant checks for endless loops
Tobias Grosser [Tue, 20 Sep 2016 17:05:22 +0000 (17:05 +0000)]
[ScopDetection] Remove redundant checks for endless loops

Summary:
Both `canUseISLTripCount()` and `addOverApproximatedRegion()` contained checks
to reject endless loops which are now removed and replaced by a single check
in `isValidLoop()`.

For reporting such loops the `ReportLoopOverlapWithNonAffineSubRegion` is
renamed to `ReportLoopHasNoExit`. The test case
`ReportLoopOverlapWithNonAffineSubRegion.ll` is adapted and renamed as well.

The schedule generation in `buildSchedule()` is based on the following
assumption:

Given some block B that is contained in a loop L and a SESE region R,
we assume that L is contained in R or the other way around.

However, this assumption is broken in the presence of endless loops that are
nested inside other loops. Therefore, in order to prevent erroneous behavior
in `buildSchedule()`, r265280 introduced a corresponding check in
`canUseISLTripCount()` to reject endless loops. Unfortunately, it was possible
to bypass this check with -polly-allow-nonaffine-loops which was fixed by adding
another check to reject endless loops in `allowOverApproximatedRegion()` in
r273905. Hence there existed two separate locations that handled this case.

Thank you Johannes Doerfert for helping to provide the above background
information.

Reviewers: Meinersbur, grosser

Subscribers: _jdoerfert, pollydev

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

Contributed-by: Matthias Reisinger <d412vv1n@gmail.com>
llvm-svn: 281987

8 years agoX86: loosen an overly aggressive MachO assertion
Saleem Abdulrasool [Tue, 20 Sep 2016 17:05:04 +0000 (17:05 +0000)]
X86: loosen an overly aggressive MachO assertion

We would assert that the FP setup CFI used esp/rsp always.  This held up in
practice when the code was generated from IR.  However, with the integrated
assembler, it is possible to have the input be user specified assembly.  In such
a case, we cannot assume that the function implementation has a compact unwind
representation.  Loosen the assertion into a check and bail if we cannot
represent the frame pointer in the compact unwinding.

Addresses PR30453!

llvm-svn: 281986

8 years agoRedirect stderr to /dev/null. NFC.
Rafael Espindola [Tue, 20 Sep 2016 17:02:38 +0000 (17:02 +0000)]
Redirect stderr to /dev/null. NFC.

Makes the error output less confusing when this test fails.

llvm-svn: 281985

8 years ago[Writer] Fix a typo. NFC.
Davide Italiano [Tue, 20 Sep 2016 16:57:02 +0000 (16:57 +0000)]
[Writer] Fix a typo. NFC.

llvm-svn: 281984

8 years agoRemove more guts of TargetMachine::getNameWithPrefix and migrate one check to the...
Eric Christopher [Tue, 20 Sep 2016 16:05:02 +0000 (16:05 +0000)]
Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version.

NFC intended.

llvm-svn: 281983

8 years agoRemove a use of subtarget initialization in the X86 backend so we can get rid of...
Eric Christopher [Tue, 20 Sep 2016 16:04:59 +0000 (16:04 +0000)]
Remove a use of subtarget initialization in the X86 backend so we can get rid of the default subtarget.

NFC intended.

llvm-svn: 281982

8 years agoRemove extra argument used once on TargetMachine::getNameWithPrefix and inline the...
Eric Christopher [Tue, 20 Sep 2016 16:04:50 +0000 (16:04 +0000)]
Remove extra argument used once on TargetMachine::getNameWithPrefix and inline the result into the singular caller.

llvm-svn: 281981

8 years agoImprove the -debug output for Debug Range Extension (NFC)
Keith Walker [Tue, 20 Sep 2016 16:04:31 +0000 (16:04 +0000)]
Improve the -debug output for Debug Range Extension (NFC)

Include header messages and remove unnecessary blank lines.

llvm-svn: 281980

8 years agoReplace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles...
Nick Lewycky [Tue, 20 Sep 2016 15:49:58 +0000 (15:49 +0000)]
Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles more cases. Noticed by inspection.

Because of how the IR generation works, this isn't expected to cause an observable difference.

llvm-svn: 281979

8 years agoDisable --rosegment when we have linker scripts.
Rafael Espindola [Tue, 20 Sep 2016 15:22:27 +0000 (15:22 +0000)]
Disable --rosegment when we have linker scripts.

Linker scripts are responsible for aliging '.'. Since they are
designed for bfd which has no --rosegment, they don't align the RO to
RX transition.

llvm-svn: 281978

8 years agoGlobalISel: split aggregates for PCS lowering
Tim Northover [Tue, 20 Sep 2016 15:20:36 +0000 (15:20 +0000)]
GlobalISel: split aggregates for PCS lowering

This should match the existing behaviour for passing complicated struct and
array types, in particular HFAs come through like that from Clang.

For C & C++ we still need to somehow support all the weird ABI flags, or at
least those that are present in the IR (signext, byval, ...), and stack-based
parameter passing.

llvm-svn: 281977

8 years agoMake tests less dependent on the exact layout.
Rafael Espindola [Tue, 20 Sep 2016 15:08:24 +0000 (15:08 +0000)]
Make tests less dependent on the exact layout.

In most cases that means just not checking the address when we don't
need it.

For some tests it is easier to just set . to a known value.

llvm-svn: 281976

8 years ago[mips] MSA intrinsics header file
Simon Dardis [Tue, 20 Sep 2016 15:07:36 +0000 (15:07 +0000)]
[mips] MSA intrinsics header file

This patch adds the msa.h header file containing the shorter names for the
MSA instrinsics, e.g. msa_sll_b for builtin_msa_sll_b.

Reviewers: vkalintiris, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D24674

llvm-svn: 281975

8 years agoMove test to the correct directory. NFC.
Rafael Espindola [Tue, 20 Sep 2016 14:49:18 +0000 (14:49 +0000)]
Move test to the correct directory. NFC.

llvm-svn: 281974

8 years ago[X86][SSE] Regenerate multiple combine tests
Simon Pilgrim [Tue, 20 Sep 2016 14:42:45 +0000 (14:42 +0000)]
[X86][SSE] Regenerate multiple combine tests

llvm-svn: 281973

8 years agomove variables closer to their uses; add FIXMEs; NFC
Sanjay Patel [Tue, 20 Sep 2016 14:36:14 +0000 (14:36 +0000)]
move variables closer to their uses; add FIXMEs; NFC

llvm-svn: 281972

8 years ago[XRay] ARM 32-bit no-Thumb support in compiler-rt
Dean Michael Berris [Tue, 20 Sep 2016 14:35:57 +0000 (14:35 +0000)]
[XRay] ARM 32-bit no-Thumb support in compiler-rt

This is a port of XRay to ARM 32-bit, without Thumb support yet.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

https://reviews.llvm.org/D23931 (LLVM)
https://reviews.llvm.org/D23932 (Clang test)

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

llvm-svn: 281971

8 years agotsan: check more addresses in CheckShadowMapping
Dmitry Vyukov [Tue, 20 Sep 2016 13:30:01 +0000 (13:30 +0000)]
tsan: check more addresses in CheckShadowMapping

There is still a handful of them, so should not slow down
tsan apps. But gives assurance if we change/complicate
shadow mappings.

llvm-svn: 281970

8 years agotsan: make CHECK more robust
Dmitry Vyukov [Tue, 20 Sep 2016 13:28:20 +0000 (13:28 +0000)]
tsan: make CHECK more robust

Enable more ignores when we start crashing.
Unwind in CHECK SIGSEGVs if happens early:

FATAL: ThreadSanitizer CHECK failed: ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:105 "((beg)) <= ((end))" (0x8000000000, 0x4000000000)
Program received signal SIGSEGV, Segmentation fault.
__tsan::MetaMap::GetAndLock (this=0x1337c88 <__tsan::ctx_placeholder+8>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true,
    create=create@entry=true) at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:208
208   u32 idx0 = *meta;
(gdb) bt
#0  __tsan::MetaMap::GetAndLock (this=0x1337c88 <__tsan::ctx_placeholder+8>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true,
    create=create@entry=true) at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:208
#1  0x00000000004a965f in __tsan::MetaMap::GetOrCreateAndLock (this=<optimized out>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:198
#2  0x00000000004a162a in __tsan::Release (thr=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc:395
#3  0x000000000046cc40 in __interceptor_pthread_once (o=0x7ffff71a5890 <once_regsizes>, f=0x7ffff6f9d9c0 <init_dwarf_reg_size_table>) at ../projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1334
#4  0x00007ffff6f9fe86 in __gthread_once (__func=0x7ffff6f9d9c0 <init_dwarf_reg_size_table>, __once=0x7ffff71a5890 <once_regsizes>) at ./gthr-default.h:699
#5  uw_init_context_1 (context=context@entry=0x7fffffffd6d0, outer_cfa=outer_cfa@entry=0x7fffffffd980, outer_ra=0x437d13 <__sanitizer::BufferedStackTrace::SlowUnwindStack(unsigned long, unsigned int)+67>)
    at ../../../src/libgcc/unwind-dw2.c:1572
#6  0x00007ffff6fa06a8 in _Unwind_Backtrace (trace=0x437c30 <__sanitizer::Unwind_Trace(_Unwind_Context*, void*)>, trace_argument=0x7fffffffd980) at ../../../src/libgcc/unwind.inc:283
#7  0x0000000000437d13 in __sanitizer::BufferedStackTrace::SlowUnwindStack (this=0x7ffff6103208, pc=pc@entry=4863574, max_depth=max_depth@entry=256)
    at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:125
#8  0x0000000000434f4a in __sanitizer::BufferedStackTrace::Unwind (this=this@entry=0x7ffff6103208, max_depth=max_depth@entry=256, pc=pc@entry=4863574, bp=bp@entry=0, context=context@entry=0x0,
    stack_top=stack_top@entry=0, stack_bottom=stack_bottom@entry=0, request_fast_unwind=request_fast_unwind@entry=false) at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:76
#9  0x00000000004a36b3 in PrintCurrentStackSlow (pc=4863574) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc:696
#10 __tsan::TsanCheckFailed (file=<optimized out>, line=<optimized out>, cond=<optimized out>, v1=<optimized out>, v2=<optimized out>) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc:44
#11 0x000000000042dfd6 in __sanitizer::CheckFailed (file=file@entry=0x4b9fd0 "../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc", line=line@entry=105,
    cond=cond@entry=0x4ba049 "((beg)) <= ((end))", v1=v1@entry=549755813888, v2=v2@entry=274877906944) at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc:79
#12 0x00000000004aa36c in ProtectRange (end=274877906944, beg=549755813888) at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:105
#13 __tsan::CheckAndProtect () at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:133
#14 0x00000000004a9e95 in __tsan::InitializePlatform () at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc:280
#15 0x0000000000497e73 in __tsan::Initialize (thr=0x7ffff7f91800) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl.cc:343
#16 0x00007ffff7dea25a in _dl_init (main_map=0x7ffff7ffe1c8, argc=1, argv=0x7fffffffdb88, env=0x7fffffffdb98) at dl-init.c:111
#17 0x00007ffff7ddb30a in _dl_start_user () at rtld.c:871

llvm-svn: 281969

8 years agoRemove empty section commands.
Rafael Espindola [Tue, 20 Sep 2016 13:12:07 +0000 (13:12 +0000)]
Remove empty section commands.

We were already not creating them, and with this other parts of the
code don't have to worry about them.

llvm-svn: 281968

8 years ago[AMDGPU][mc] Add regression tests for Bug 28168
Artem Tamazov [Tue, 20 Sep 2016 11:58:40 +0000 (11:58 +0000)]
[AMDGPU][mc] Add regression tests for Bug 28168

llvm-svn: 281967

8 years agoAVX-512: Fixed a bug in lowering saturated operations on KNL.
Elena Demikhovsky [Tue, 20 Sep 2016 11:02:26 +0000 (11:02 +0000)]
AVX-512: Fixed a bug in lowering saturated operations on KNL.

The generated code is still not optimal.

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

llvm-svn: 281966

8 years ago[AMDGPU] Refactor VOP3 instruction TD definitions
Valery Pykhtin [Tue, 20 Sep 2016 10:41:16 +0000 (10:41 +0000)]
[AMDGPU] Refactor VOP3 instruction TD definitions

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

llvm-svn: 281965

8 years agoMake llvm::ConvertDebugDeclareToDebugValue() be a void function (NFC)
Keith Walker [Tue, 20 Sep 2016 10:36:17 +0000 (10:36 +0000)]
Make llvm::ConvertDebugDeclareToDebugValue() be a void function (NFC)

The routines llvm::ConvertDebugDeclareToDebugValue() always returned
a true value which was never checked at the call site; change the
function return type to void.

This NFC cleanup was approved in the review https://reviews.llvm.org/D23715

llvm-svn: 281964

8 years agoAMDGPU: Improve documentation.
Nikolay Haustov [Tue, 20 Sep 2016 09:04:51 +0000 (09:04 +0000)]
AMDGPU: Improve documentation.

Summary:
Add links to ISA manuals and ABI.
Add text about assembler syntax.
Add info about instructions operands.
Add instruction examples for each encoding.
Update directives section, add missing .amdgpu_hsa_kernel.

Reviewers: tstellarAMD, SamWot, vpykhtin

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, artem.tamazov, llvm-commits

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

llvm-svn: 281962

8 years agoReverting revision 281960 due to test failures.
Dorit Nuzman [Tue, 20 Sep 2016 08:27:48 +0000 (08:27 +0000)]
Reverting revision 281960 due to test failures.

llvm-svn: 281961

8 years ago[SROA] Preserve llvm.mem.parallel_loop_access metadata.
Dorit Nuzman [Tue, 20 Sep 2016 07:50:49 +0000 (07:50 +0000)]
[SROA] Preserve llvm.mem.parallel_loop_access metadata.

SROA doesn't preserve the llvm.mem.parallel_loop_access metadata when it
transforms loads/stores. This patch fixes a couple occurences of this
issue.

(Partially addresses PR28981).

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

llvm-svn: 281960

8 years ago[AVX-512] Teach X86InstrInfo::copyPhysReg to use a 512-bit move if XMM16-XMM31 or...
Craig Topper [Tue, 20 Sep 2016 06:49:17 +0000 (06:49 +0000)]
[AVX-512] Teach X86InstrInfo::copyPhysReg to use a 512-bit move if XMM16-XMM31 or YMM16-YMM31 are the source or dest of the copy and VLX is not supported.

This can happen with SUBREG_TO_REG of ZMM16-ZMM31. Fixes PR30430.

llvm-svn: 281959

8 years ago[AVX-512] Use 512-bit vcvtps2ph/vcvtph2ps to implement fp_to_f16/f16_to_fp when F16C...
Craig Topper [Tue, 20 Sep 2016 05:44:47 +0000 (05:44 +0000)]
[AVX-512] Use 512-bit vcvtps2ph/vcvtph2ps to implement fp_to_f16/f16_to_fp when F16C and VLX are not supported.

Fixes PR23941.

llvm-svn: 281958

8 years agoBranchFolder: Fix invalid undef flags after merge.
Matthias Braun [Tue, 20 Sep 2016 01:14:42 +0000 (01:14 +0000)]
BranchFolder: Fix invalid undef flags after merge.

It is legal to merge instructions with different undef flags; However we
must drop the undef flag from the merged instruction if it isn't present
everywhere.

This fixes http://llvm.org/PR30199

llvm-svn: 281957

8 years agoMachine{Instr|Operand}: Clarify some isIdenticalTo() subtleties.
Matthias Braun [Tue, 20 Sep 2016 01:14:39 +0000 (01:14 +0000)]
Machine{Instr|Operand}: Clarify some isIdenticalTo() subtleties.

llvm-svn: 281956

8 years ago[RegisterBankInfo] Avoid heap allocation in InstructionMapping.
Quentin Colombet [Tue, 20 Sep 2016 00:48:44 +0000 (00:48 +0000)]
[RegisterBankInfo] Avoid heap allocation in InstructionMapping.

Use SmallVector instead of dynamically allocated arrays for the mapping of the
operands in the InstructionMapping. That way we avoid heap allocation for most
of the cases. Ultimately, we should not have to rely on such tricky, the
instances of InstructionMapping would be TableGen'ed.

This improves the compilation time of the RegBankSelect pass.

llvm-svn: 281955

8 years agoclang-change-namespace: Update libdeps.
NAKAMURA Takumi [Tue, 20 Sep 2016 00:44:45 +0000 (00:44 +0000)]
clang-change-namespace: Update libdeps.

FIXME: It seems clangFormat is not referred.
llvm-svn: 281954

8 years ago[x86] fix variable names; NFC
Sanjay Patel [Tue, 20 Sep 2016 00:27:22 +0000 (00:27 +0000)]
[x86] fix variable names; NFC

llvm-svn: 281953

8 years ago[sanitizer-coverage] add comdat to coverage guards if needed
Kostya Serebryany [Tue, 20 Sep 2016 00:16:54 +0000 (00:16 +0000)]
[sanitizer-coverage] add comdat to coverage guards if needed

llvm-svn: 281952

8 years agoRemove a use of std::list.
Rui Ueyama [Tue, 20 Sep 2016 00:02:06 +0000 (00:02 +0000)]
Remove a use of std::list.

llvm-svn: 281951

8 years ago[x86] auto-generate checks
Sanjay Patel [Mon, 19 Sep 2016 23:44:50 +0000 (23:44 +0000)]
[x86] auto-generate checks

llvm-svn: 281950

8 years ago[LCSSA] Cache LoopExits to avoid wasted work
Philip Reames [Mon, 19 Sep 2016 23:30:23 +0000 (23:30 +0000)]
[LCSSA] Cache LoopExits to avoid wasted work

When looking at the scribus_1.3 example from https://llvm.org/bugs/show_bug.cgi?id=10584, I noticed that we were spending a large amount of time computing loop exits in LCSSA. This code appears to be written with the assumption that LoopExits are stored in the Loop and thus cheap to query. This is not true, so we should cache the result across the potentially long running loop which tends to visit a small handful of Loops.

On the particular example from 10584, this change drops the time spent in LCSSA computation by about 80%.

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

llvm-svn: 281949

8 years ago[RegisterBankInfo] Adapt call to std::fill due to use of SmallVector.
Quentin Colombet [Mon, 19 Sep 2016 23:18:47 +0000 (23:18 +0000)]
[RegisterBankInfo] Adapt call to std::fill due to use of SmallVector.

This was meant to be commited with my previous commit.

llvm-svn: 281948

8 years agoMerge branch 'ADCE5'
David Callahan [Mon, 19 Sep 2016 23:17:58 +0000 (23:17 +0000)]
Merge branch 'ADCE5'

llvm-svn: 281947

8 years ago[GC] Don't crash when printing the special Discarded GC section.
Davide Italiano [Mon, 19 Sep 2016 23:15:51 +0000 (23:15 +0000)]
[GC] Don't crash when printing the special Discarded GC section.

InputSection<ELFT>::Discarded has no name and it's not backed by
a file. Trying to report it as discared will cause a nullptr
dereference, therefore a crash. Skip it.

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

llvm-svn: 281946

8 years ago[Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.
Lang Hames [Mon, 19 Sep 2016 23:00:27 +0000 (23:00 +0000)]
[Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.

This essentially reverts r251936, minimizing the difference between Chapter2
and Chapter 3, and making Chapter 2's code match the tutorial text.

llvm-svn: 281945

8 years ago[x86] use getSignBit() to simplify code; NFCI
Sanjay Patel [Mon, 19 Sep 2016 22:07:27 +0000 (22:07 +0000)]
[x86] use getSignBit() to simplify code; NFCI

llvm-svn: 281944

8 years agoFixed the build by changing a couple of const char *s to StringRefs.
Sean Callanan [Mon, 19 Sep 2016 22:06:12 +0000 (22:06 +0000)]
Fixed the build by changing a couple of const char *s to StringRefs.

llvm-svn: 281943

8 years agoConvert 3 more functions to use a StringRef.
Zachary Turner [Mon, 19 Sep 2016 21:56:59 +0000 (21:56 +0000)]
Convert 3 more functions to use a StringRef.

This converts Args::Unshift, Args::AddOrReplaceEnvironmentVariable,
and Args::ContainsEnvironmentVariable to use StringRefs.  The code
is also simplified somewhat as a result.

llvm-svn: 281942

8 years agoMove the armv8.1-a ras test to a negative with noras test as ras is
Eric Christopher [Mon, 19 Sep 2016 21:55:04 +0000 (21:55 +0000)]
Move the armv8.1-a ras test to a negative with noras test as ras is
included in armv8.1-a by default and so we weren't testing anything.

llvm-svn: 281941

8 years agoBitcodeWriter: fix emission of invoke when calling a var-arg function with operand...
Mehdi Amini [Mon, 19 Sep 2016 21:27:04 +0000 (21:27 +0000)]
BitcodeWriter: fix emission of invoke when calling a var-arg function with operand bundles

llvm-svn: 281940

8 years agoMisleading comments of SplitBlockAndInsertIfThenElse in BasicBlockUtils.h
Evgeniy Stepanov [Mon, 19 Sep 2016 21:26:05 +0000 (21:26 +0000)]
Misleading comments of SplitBlockAndInsertIfThenElse in BasicBlockUtils.h

The comments of SplitBlockAndInsertIfThenElse say the SplitBefore instruction will stay in the old block.
But according to the implementation(split the block at SplitBefore by using splitBasicBlock), the SplitBefore will be moved to the new block.

This patch fixes the comments.

Patch by Zhe Yu Wu.

llvm-svn: 281939

8 years ago[scudo] Modify Scudo to use its own Secondary Allocator
Kostya Kortchinsky [Mon, 19 Sep 2016 21:11:55 +0000 (21:11 +0000)]
[scudo] Modify Scudo to use its own Secondary Allocator

Summary:
The Sanitizer Secondary Allocator was not entirely ideal was Scudo for several
reasons: decent amount of unneeded code, redundant checks already performed by
the front end, unneeded data structures, difficulty to properly protect the
secondary chunks header.

Given that the second allocator is pretty straight forward, Scudo will use its
own, trimming all the unneeded code off of the Sanitizer one. A significant
difference in terms of security is that now each secondary chunk is preceded
and followed by a guard page, thus mitigating overflows into and from the
chunk.

A test was added as well to illustrate the overflow & underflow situations
into the guard pages.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 281938

8 years ago[X86][SSE] Updated vector abs tests
Simon Pilgrim [Mon, 19 Sep 2016 20:50:35 +0000 (20:50 +0000)]
[X86][SSE] Updated vector abs tests

Renamed and added v2i64 / v4i64 tests

llvm-svn: 281937

8 years agoFix signatures of fallback tow(upper|lower)_l.
Dan Albert [Mon, 19 Sep 2016 20:42:57 +0000 (20:42 +0000)]
Fix signatures of fallback tow(upper|lower)_l.

Summary:
These functions take and return wint_t, not int:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/towupper.html

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 281936

8 years agoAdd missing dependency to change-namespace.
Eric Liu [Mon, 19 Sep 2016 20:41:39 +0000 (20:41 +0000)]
Add missing dependency to change-namespace.

llvm-svn: 281935

8 years ago[analyzer] Calculate extent size for memory regions allocated by new expression.
Gabor Horvath [Mon, 19 Sep 2016 20:39:52 +0000 (20:39 +0000)]
[analyzer] Calculate extent size for memory regions allocated by new expression.

ArrayBoundChecker did not detect out of bounds memory access errors in case an
array was allocated by the new expression. This patch resolves this issue.

Patch by Daniel Krupp!

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

llvm-svn: 281934

8 years ago[libFuzzer] use sleep() instead of std::this_thread::sleep_for to avoid coverage...
Kostya Serebryany [Mon, 19 Sep 2016 20:32:34 +0000 (20:32 +0000)]
[libFuzzer] use sleep() instead of  std::this_thread::sleep_for to  avoid coverage from instrumented libc++

llvm-svn: 281933

8 years agoUse FileCheck variables. NFC.
Rafael Espindola [Mon, 19 Sep 2016 20:23:19 +0000 (20:23 +0000)]
Use FileCheck variables. NFC.

llvm-svn: 281932

8 years agoMap .data.rel.ro correctly.
Rafael Espindola [Mon, 19 Sep 2016 19:59:21 +0000 (19:59 +0000)]
Map .data.rel.ro correctly.

An input section named .data.rel.ro now maps to an output section
named .data.rel.ro. Before we were mapping it to .data.

llvm-svn: 281931

8 years agoMake this test a bit stricter.
Rafael Espindola [Mon, 19 Sep 2016 19:56:51 +0000 (19:56 +0000)]
Make this test a bit stricter.

By making every section on byte and checking the size it now shows how
many sections were concatenated into each output section.

llvm-svn: 281930

8 years agoDon't CHECK the addresses. NFC
Rafael Espindola [Mon, 19 Sep 2016 18:58:30 +0000 (18:58 +0000)]
Don't CHECK the addresses. NFC

That is not what this test is about. This reduces changes in another
patch that changes layout.

llvm-svn: 281929