platform/upstream/llvm.git
7 years ago[DAG] disable nsw/nuw for add/sub/mul when simplifying based on demanded bits (PR30841)
Sanjay Patel [Mon, 31 Oct 2016 23:28:45 +0000 (23:28 +0000)]
[DAG] disable nsw/nuw for add/sub/mul when simplifying based on demanded bits (PR30841)

This bug was exposed by using nsw/nuw for more aggressive folds in:
https://reviews.llvm.org/rL284844

The changes mimic the IR demanded bits logic in InstCombiner::SimplifyDemandedUseBits(),
but we can't just flip flag bits in the DAG; we have to create a new node that has the
bits cleared.

This should fix:
https://llvm.org/bugs/show_bug.cgi?id=30841

llvm-svn: 285656

7 years ago[modules] Mark deleted functions as implicitly inline to allow merging
Eric Fiselier [Mon, 31 Oct 2016 23:07:15 +0000 (23:07 +0000)]
[modules] Mark deleted functions as implicitly inline to allow  merging

Summary: When merging definitions with ModulesLocalVisibility enabled it's important to make deleted definitions implicitly inline, otherwise they'll be diagnosed as a redefinition.

Reviewers: silvas, manmanren, rsmith

Subscribers: cfe-commits

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

llvm-svn: 285655

7 years ago[Hexagon] Garbage collect dead code.
Davide Italiano [Mon, 31 Oct 2016 22:56:56 +0000 (22:56 +0000)]
[Hexagon] Garbage collect dead code.

llvm-svn: 285654

7 years ago[clang-tidy] Update cert-err58-cpp to match its new generalised form.
Malcolm Parsons [Mon, 31 Oct 2016 22:47:04 +0000 (22:47 +0000)]
[clang-tidy] Update cert-err58-cpp to match its new generalised form.

Summary:
Aaron modified cert-err58-cpp to include all exceptions thrown before main()
Update the check to match.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 285653

7 years agoFix a typo.
Evgeniy Stepanov [Mon, 31 Oct 2016 22:42:39 +0000 (22:42 +0000)]
Fix a typo.

Found with PVS-Studio here: http://www.viva64.com/en/b/0446/

llvm-svn: 285652

7 years ago[CMake] Populate the build directory's framework
Chris Bieneman [Mon, 31 Oct 2016 22:31:07 +0000 (22:31 +0000)]
[CMake] Populate the build directory's framework

This ensures that the Resources and clang headers are properly symlinked in LLDB's framework. This should fix the modules-related tests when building on Darwin with CMake if you are building a framework.

I have another fix coming which gets them working on Darwin if you're building liblldb instead of a framework.

llvm-svn: 285651

7 years ago[cfi] Fix missing !type annotation.
Evgeniy Stepanov [Mon, 31 Oct 2016 22:28:10 +0000 (22:28 +0000)]
[cfi] Fix missing !type annotation.

CFI (only in the cross-dso mode) fails to set !type annotations when
a function is used before it is defined.

llvm-svn: 285650

7 years agoCodeGen: further loosen -O0 CG for WoA division
Saleem Abdulrasool [Mon, 31 Oct 2016 22:12:37 +0000 (22:12 +0000)]
CodeGen: further loosen -O0 CG for WoA division

Generate the slowest possible codepath for noopt CodeGen.  Even trying to be
clever with the negated jump can cause out-of-range jumps.  Use a wide branch
instead. Although the code is modelled simplistically, the later optimizations
would recombine the branching into `cbz` if possible.  This re-enables the
previous optimization as well as hopefully gives us working code in all cases.

Addresses PR30356!

llvm-svn: 285649

7 years ago[ThinLTO] Disable importing and other cross-module optis at -O0
Teresa Johnson [Mon, 31 Oct 2016 22:12:21 +0000 (22:12 +0000)]
[ThinLTO] Disable importing and other cross-module optis at -O0

Summary:
There is no point to importing at -O0, since we won't inline. We should
also disable other cross-module optimizations.

(Plan to backport this fix to the 3.9 branch to fix PR30774)

Reviewers: pcc

Subscribers: johanengelen, mehdi_amini

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

llvm-svn: 285648

7 years ago[index] Fix repeated visitation of the same InitListExpr for indexing.
Argyrios Kyrtzidis [Mon, 31 Oct 2016 22:12:12 +0000 (22:12 +0000)]
[index] Fix repeated visitation of the same InitListExpr for indexing.

It was visited multiple times unnecessarily.

rdar://28985038

llvm-svn: 285647

7 years ago[Test-Suite] Speculative fix for darwin bots
Chris Bieneman [Mon, 31 Oct 2016 22:06:52 +0000 (22:06 +0000)]
[Test-Suite] Speculative fix for darwin bots

When building with Xcode it looks like some of the logic in my test changes went haywire. This should fix it.

llvm-svn: 285646

7 years ago[Release notes] Highlight reset() as language/library artifact.
Eugene Zelenko [Mon, 31 Oct 2016 22:05:45 +0000 (22:05 +0000)]
[Release notes] Highlight reset() as language/library artifact.

llvm-svn: 285645

7 years ago[ASTMatcher] Add CXXNewExpr support to hasDeclaration
Malcolm Parsons [Mon, 31 Oct 2016 22:04:07 +0000 (22:04 +0000)]
[ASTMatcher] Add CXXNewExpr support to hasDeclaration

Reviewers: sbenza, lukasza, aaron.ballman, klimek

Subscribers: lukasza, sbenza, cfe-commits

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

llvm-svn: 285644

7 years agoA compound literal within a global lambda or block is still within
John McCall [Mon, 31 Oct 2016 21:56:26 +0000 (21:56 +0000)]
A compound literal within a global lambda or block is still within
the body of a function for the purposes of computing its storage
duration and deciding whether its initializer must be constant.

There are a number of problems in our current treatment of compound
literals.  C specifies that a compound literal yields an l-value
referring to an object with either static or automatic storage
duration, depending on where it was written; in the latter case,
the literal object has a lifetime tied to the enclosing scope (much
like an ObjC block), not the enclosing full-expression.  To get these
semantics fully correct in our current design, we would need to
collect compound literals on the ExprWithCleanups, just like we do
with ObjC blocks; we would probably also want to identify literals
like we do with materialized temporaries.  But it gets stranger;
GCC adds compound literals to C++ as an extension, but makes them
r-values, which are generally assumed to have temporary storage
duration.  Ignoring destructor ordering, the difference only matters
if the object's address escapes the full-expression, which for an
r-value can only happen with reference binding (which extends
temporaries) or array-to-pointer decay (which does not).  GCC then
attempts to lock down on array-to-pointer decay in ad hoc ways.
Arguably a far superior language solution for C++ (and perhaps even
array r-values in C, which can occur in other ways) would be to
propagate lifetime extension through array-to-pointer decay, so
that initializing a pointer object to a decayed r-value array
extends the lifetime of the complete object containing the array.
But this would be a major change in semantics which arguably ought
to be blessed by the committee(s).

Anyway, I'm not fixing any of that in this patch; I did try, but
it got out of hand.

Fixes rdar://28949016.

llvm-svn: 285643

7 years ago[NVPTX] Remove NVPTXFavorNonGenericAddrSpaces pass.
Justin Lebar [Mon, 31 Oct 2016 21:51:42 +0000 (21:51 +0000)]
[NVPTX] Remove NVPTXFavorNonGenericAddrSpaces pass.

Summary:
This has been replaced by the NVPTXInferAddressSpaces pass.  We've had
the new one as the default with the old one accessible via a flag for
some months now, and we've had no problems.

Reviewers: tra

Subscribers: llvm-commits, jholewinski, jingyue, mgorny

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

llvm-svn: 285642

7 years agoThe expr '.' is not absolute.
Rafael Espindola [Mon, 31 Oct 2016 21:36:23 +0000 (21:36 +0000)]
The expr '.' is not absolute.

With this patch we keep track of the fact that . is a position in the
file and therefore not absolute. This allow us to compute relative
relocations that involve symbol that are defined in linker scripts
with '.'.

This fixes https://llvm.org/bugs/show_bug.cgi?id=30406

There is still more work to track absoluteness over the various
expressions, but this should unblock linking the EFI bootloader.

llvm-svn: 285641

7 years ago[analyzer] Allow undefined values in performTrivialCopy.
Artem Dergachev [Mon, 31 Oct 2016 21:11:20 +0000 (21:11 +0000)]
[analyzer] Allow undefined values in performTrivialCopy.

Reading from a garbage pointer should be modeled as garbage,
and performTrivialCopy should be able to deal with any SVal input.

Patch by Ilya Palachev!

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

llvm-svn: 285640

7 years agodocs: trying to fix the docs bot by removing non-ASCII characters. The docs build...
Kostya Serebryany [Mon, 31 Oct 2016 21:10:26 +0000 (21:10 +0000)]
docs: trying to fix the docs bot by removing non-ASCII characters. The docs build fine on my machine, bot fail on the bot (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/25/steps/docs-llvm-html/logs/stdio)

llvm-svn: 285639

7 years agoRe-commit r285607: Emit Section Map stream."
Rui Ueyama [Mon, 31 Oct 2016 21:09:21 +0000 (21:09 +0000)]
Re-commit r285607: Emit Section Map stream."

Removed some test fields that overspecified test conditions.

llvm-svn: 285638

7 years ago[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.
Artem Dergachev [Mon, 31 Oct 2016 21:04:54 +0000 (21:04 +0000)]
[analyzer] MacOSXAPIChecker: Improve warnings for __block vars in dispatch_once.

The checker already warns for __block-storage variables being used as a
dispatch_once() predicate, however it refers to them as local which is not quite
accurate, so we fix that.

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

llvm-svn: 285637

7 years agofix _dyld_find_unwind_sections() for pre-10.7. Patch by Jeremy Sequoia
Nick Kledzik [Mon, 31 Oct 2016 21:04:17 +0000 (21:04 +0000)]
fix _dyld_find_unwind_sections() for pre-10.7.  Patch by Jeremy Sequoia

llvm-svn: 285636

7 years ago[tsan] Enable the tsan/libcxx/ testcase(s) on Darwin
Kuba Brecka [Mon, 31 Oct 2016 20:50:15 +0000 (20:50 +0000)]
[tsan] Enable the tsan/libcxx/ testcase(s) on Darwin

Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it.

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

llvm-svn: 285634

7 years agoRemove llc -jump-table-type option, it hasn't been functional for years.
Joerg Sonnenberger [Mon, 31 Oct 2016 20:35:20 +0000 (20:35 +0000)]
Remove llc -jump-table-type option, it hasn't been functional for years.

llvm-svn: 285633

7 years agoMore additional error checks for invalid Mach-O files when
Kevin Enderby [Mon, 31 Oct 2016 20:29:48 +0000 (20:29 +0000)]
More additional error checks for invalid Mach-O files when
the offsets and sizes of an element of the file overlaps with
another element in the Mach-O file.

This shows the approach to this testing for three elements
and contains for tests for their overlap.  Checking for all the
remain elements will be added next.

llvm-svn: 285632

7 years agoAdd comment explaining this mysterious macro name.
Richard Smith [Mon, 31 Oct 2016 20:25:52 +0000 (20:25 +0000)]
Add comment explaining this mysterious macro name.

llvm-svn: 285631

7 years ago[tsan] Implement WriteMemoryProfile for Darwin
Kuba Brecka [Mon, 31 Oct 2016 20:17:13 +0000 (20:17 +0000)]
[tsan] Implement WriteMemoryProfile for Darwin

TSan’s memory usage profiling currently doesn’t work on Darwin. This patch implements measuring the amount of resident and dirty memory for each memory region. I also removed the GetShadowMemoryConsumption function, which seems to be unused.

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

llvm-svn: 285630

7 years agoRevert "Add a space to work around a Windows CPython / MSys quoting bug"
Reid Kleckner [Mon, 31 Oct 2016 20:13:41 +0000 (20:13 +0000)]
Revert "Add a space to work around a Windows CPython / MSys quoting bug"

This reverts commit r284768.

After LLVM r285237, the lit shell interpreter works around this bug for
us.

llvm-svn: 285629

7 years agoDelay computation of IsAbsolute.
Rafael Espindola [Mon, 31 Oct 2016 19:56:37 +0000 (19:56 +0000)]
Delay computation of IsAbsolute.

We parse linker scripts very early, but whether an expression is
absolute or not can depend on a symbol defined in a .o. Given that, we
have to delay the computation of IsAbsolute. We can do that by storing
an AST when parsing or by also making IsAbsolute a function like we do
for the expression value. This patch implements the second option.

llvm-svn: 285628

7 years ago[PPC] add absolute difference altivec instructions and matching intrinsics
Nemanja Ivanovic [Mon, 31 Oct 2016 19:47:52 +0000 (19:47 +0000)]
[PPC] add absolute difference altivec instructions and matching intrinsics

This patch corresponds to review https://reviews.llvm.org/D26072.
Committing on behalf of Sean Fertile.

llvm-svn: 285627

7 years agoDebugInfo: support for DW_TAG_atomic_type
Victor Leschuk [Mon, 31 Oct 2016 19:09:47 +0000 (19:09 +0000)]
DebugInfo: support for DW_TAG_atomic_type

Mark C11 _Atomic variables with DW_TAG_atomic_type tag.

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

llvm-svn: 285625

7 years agoDebugInfo: make DW_TAG_atomic_type valid
Victor Leschuk [Mon, 31 Oct 2016 19:09:38 +0000 (19:09 +0000)]
DebugInfo: make DW_TAG_atomic_type valid

DW_TAG_atomic_type was already included in Dwarf.defs and emitted correctly,
however Verifier didn't recognize it as valid.
Thus we introduce the following changes:

  * Make DW_TAG_atomic_type valid tag for IR and DWARF (enabled only with -gdwarf-5)
  * Add it to related docs
  * Add DebugInfo tests

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

llvm-svn: 285624

7 years agoNFC - Reorder test case names in a PPC test case
Nemanja Ivanovic [Mon, 31 Oct 2016 19:02:54 +0000 (19:02 +0000)]
NFC - Reorder test case names in a PPC test case

A few recent commits have messed up the order of some tests
in a PPC test case. This just reorders them in a sensible way.

llvm-svn: 285623

7 years agoFix per-processor model scheduler definition completeness check
Ulrich Weigand [Mon, 31 Oct 2016 18:59:52 +0000 (18:59 +0000)]
Fix per-processor model scheduler definition completeness check

The CodeGenSchedModels::checkCompleteness routine in TableGen/
CodeGenSchedule.cpp is supposed to verify for each processor
model that is marked as "complete" that it actually defines a
scheduling class for each instruction.

However, this did not work correctly due to an incorrect
check whether a scheduling class has an itinerary.

Reviewer: atrick
Differential revision: https://reviews.llvm.org/D26156

llvm-svn: 285622

7 years agoSimple numeric constants are absolute.
Rafael Espindola [Mon, 31 Oct 2016 18:56:02 +0000 (18:56 +0000)]
Simple numeric constants are absolute.

llvm-svn: 285621

7 years ago[asan] Move instrumented null-terminated strings to a special section, compiler-rt...
Kuba Brecka [Mon, 31 Oct 2016 18:52:32 +0000 (18:52 +0000)]
[asan] Move instrumented null-terminated strings to a special section, compiler-rt part

On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285620

7 years ago[asan] Move instrumented null-terminated strings to a special section, LLVM part
Kuba Brecka [Mon, 31 Oct 2016 18:51:58 +0000 (18:51 +0000)]
[asan] Move instrumented null-terminated strings to a special section, LLVM part

On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285619

7 years agoRevert r285607: Emit Section Map stream.
Rui Ueyama [Mon, 31 Oct 2016 18:50:13 +0000 (18:50 +0000)]
Revert r285607: Emit Section Map stream.

That change broke buildbots.

llvm-svn: 285618

7 years agoFixing problem with CodeGen/avx512-kconstraints-att_inline_asm.c
Michael Zuckerman [Mon, 31 Oct 2016 18:40:17 +0000 (18:40 +0000)]
Fixing problem with CodeGen/avx512-kconstraints-att_inline_asm.c

llvm-svn: 285617

7 years ago[MC] Make llvm-mc fail cleanly on invalid output asm variant.
Nirav Dave [Mon, 31 Oct 2016 18:36:31 +0000 (18:36 +0000)]
[MC] Make llvm-mc fail cleanly on invalid output asm variant.

Fixes PR28488.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

llvm-svn: 285616

7 years agoGlobalISel: allow truncating pointer casts on AArch64.
Tim Northover [Mon, 31 Oct 2016 18:31:09 +0000 (18:31 +0000)]
GlobalISel: allow truncating pointer casts on AArch64.

llvm-svn: 285615

7 years agoGlobalISel: translate stack protector intrinsics
Tim Northover [Mon, 31 Oct 2016 18:30:59 +0000 (18:30 +0000)]
GlobalISel: translate stack protector intrinsics

llvm-svn: 285614

7 years ago[tsan] Add support for GCD target queues
Kuba Brecka [Mon, 31 Oct 2016 18:28:02 +0000 (18:28 +0000)]
[tsan] Add support for GCD target queues

GCD (libdispatch) has a concept of “target queues”: Each queue has either an implicit or explicit target queue, where the task is handed over to when it’s time to execute it. For example, a concurrent queue can have a serial target queue (effectively making the first queue serial), or multiple queues can have the same serial target queue (which means tasks in all the queues are mutually excluded). Thus we need to acquire-release semantics on the full “chain” of target queues.

This patch changes the way we Acquire() and Release() when executing tasks in queues. Now we’ll walk the chain of target queues and synchronize on each queue that is serial (or when dealing with a barrier block). This should avoid false positives when using dispatch_set_target_queue().

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

llvm-svn: 285613

7 years agoAdd a warning flag for warn_alloca_align_alignof
David Majnemer [Mon, 31 Oct 2016 18:23:02 +0000 (18:23 +0000)]
Add a warning flag for warn_alloca_align_alignof

llvm-svn: 285612

7 years agoMark a few more expressions as absolute.
Rafael Espindola [Mon, 31 Oct 2016 18:20:34 +0000 (18:20 +0000)]
Mark a few more expressions as absolute.

llvm-svn: 285611

7 years agoWhen diagnosing that a defaulted function is ill-formed because it would be
Richard Smith [Mon, 31 Oct 2016 18:18:29 +0000 (18:18 +0000)]
When diagnosing that a defaulted function is ill-formed because it would be
implicitly deleted and overrides a non-deleted function, explain why the
function is deleted. For PR30844.

llvm-svn: 285610

7 years ago[Sema] Warn when alignof is used with __builtin_alloca_with_align
David Majnemer [Mon, 31 Oct 2016 18:07:57 +0000 (18:07 +0000)]
[Sema] Warn when alignof is used with __builtin_alloca_with_align

The second argument to __builtin_alloca_with_align is supposed to be in
bits, not bytes.  Using alignof there would be indicative of a bug.

llvm-svn: 285609

7 years agoMove IsAbsolute from SymbolAssignment to Expr.
Rafael Espindola [Mon, 31 Oct 2016 17:43:38 +0000 (17:43 +0000)]
Move IsAbsolute from SymbolAssignment to Expr.

And as a token of the new feature, make ALIGNOF always absolute.

This is a step in making it possible to have non absolute symbols out
of output sections.

llvm-svn: 285608

7 years agoEmit Section Map stream.
Rui Ueyama [Mon, 31 Oct 2016 17:40:40 +0000 (17:40 +0000)]
Emit Section Map stream.

This is how we use DbiStreamBuilder::addSectionMap.

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

llvm-svn: 285607

7 years agoDefine DbiStreamBuilder::addSectionMap.
Rui Ueyama [Mon, 31 Oct 2016 17:38:56 +0000 (17:38 +0000)]
Define DbiStreamBuilder::addSectionMap.

This change enables LLD to construct a Section Map stream in a PDB file.
I do not understand all these fields in the Section Map yet, but it seems
like a copy of a COFF section header in another format.

With this patch, DbiStreamBuilder can emit a Section Map which
llvm-pdbdump can dump.

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

llvm-svn: 285606

7 years ago[analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.
Artem Dergachev [Mon, 31 Oct 2016 17:27:26 +0000 (17:27 +0000)]
[analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.

Unlike global/static variables, calloc etc. functions that allocate ObjC
objects behave differently in terms of memory barriers, and hacks that make
dispatch_once as fast as it possibly could be start failing.

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

llvm-svn: 285605

7 years ago[x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for...
Michael Zuckerman [Mon, 31 Oct 2016 17:23:52 +0000 (17:23 +0000)]
[x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

Commit on behalf of mharoush

Extending inline assembly support, compatible with GCC as folowing:
 "k" constraint hints the compiler to select any of AVX512 k0-k7 registers.
 "Yk" constraint is a subset of "k" excluding k0 which is not allowd to be used as a mask.

Reviewer: 1. rnk

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

llvm-svn: 285604

7 years agoSingleLinkedListIterator::operator++(int) shouldn't return a reference
David Majnemer [Mon, 31 Oct 2016 17:20:43 +0000 (17:20 +0000)]
SingleLinkedListIterator::operator++(int) shouldn't return a reference

The returned reference is to a local object.  Instead, make a copy.

Found by PVS-Studio.

llvm-svn: 285603

7 years agoRemove usages of TimeValue from gdb-remote process plugin
Pavel Labath [Mon, 31 Oct 2016 17:19:42 +0000 (17:19 +0000)]
Remove usages of TimeValue from gdb-remote process plugin

Summary:
Most of the changes are very straight-forward, the only tricky part was the
"packet speed-test" function, which is very time-heavy. As the function was
completely untested, I added a quick unit smoke test for it.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 285602

7 years agoAdd modernize-use-auto tests for casts inside macros
Malcolm Parsons [Mon, 31 Oct 2016 17:17:45 +0000 (17:17 +0000)]
Add modernize-use-auto tests for casts inside macros

llvm-svn: 285601

7 years ago[ASan] Initialize cloned dynamic runtime global variables earlier
Reid Kleckner [Mon, 31 Oct 2016 17:13:02 +0000 (17:13 +0000)]
[ASan] Initialize cloned dynamic runtime global variables earlier

Otherwise __asan_dynamic_memory_address will be zero during static
initialization and instrumented code will crash immediately.

Fixes PR30810

Patch by David Major

llvm-svn: 285600

7 years agoRemove a couple of old TODOs and don't make a new ConstString each time; none of...
Enrico Granata [Mon, 31 Oct 2016 17:12:16 +0000 (17:12 +0000)]
Remove a couple of old TODOs and don't make a new ConstString each time; none of this is super-critical since it applies to older versions of macOS (or OSX, I guess?) but still..

llvm-svn: 285599

7 years agoFix an unconditional break in checkMachOAndArchFlags
David Majnemer [Mon, 31 Oct 2016 17:11:31 +0000 (17:11 +0000)]
Fix an unconditional break in checkMachOAndArchFlags

Found by PVS-Studio.

llvm-svn: 285598

7 years agoSymbolRef::Type is not a bitfield and must be compared directly
David Majnemer [Mon, 31 Oct 2016 17:11:23 +0000 (17:11 +0000)]
SymbolRef::Type is not a bitfield and must be compared directly

Found by PVS-Studio.

llvm-svn: 285597

7 years agoAdd the new minidump plugin files to the Xcode project
Enrico Granata [Mon, 31 Oct 2016 17:00:54 +0000 (17:00 +0000)]
Add the new minidump plugin files to the Xcode project

llvm-svn: 285596

7 years agoUse toCharUnitsFromBits instead of TargetInfo::getCharWidth
David Majnemer [Mon, 31 Oct 2016 16:48:30 +0000 (16:48 +0000)]
Use toCharUnitsFromBits instead of TargetInfo::getCharWidth

llvm-svn: 285595

7 years agoModify DWARFFormValue to remember the DWARFUnit that it was decoded with.
Greg Clayton [Mon, 31 Oct 2016 16:46:02 +0000 (16:46 +0000)]
Modify DWARFFormValue to remember the DWARFUnit that it was decoded with.

Modifying DWARFFormValue to remember the DWARFUnit that it was encoded with can simplify the usage of instances of this class. Previously users would have to try and pass in the same DWARFUnit that was used to decode the form value and there was a possibility that a different DWARFUnit might be supplied to the functions that extract values (strings, CU relative references, addresses) and cause problems. This fixes this potential issue by storing the DWARFUnit inside the DWARFFormValue so that this mistake can't be made. Instances of DWARFFormValue are not stored permanently and are used as temporary values, so the increase in size of an instance of DWARFFormValue isn't a big deal. This makes decoding form values more bullet proof and is a change that will be used by future modifications.

https://reviews.llvm.org/D26052

llvm-svn: 285594

7 years agoImprove ".." handling in FileSpec normalization
Pavel Labath [Mon, 31 Oct 2016 16:22:07 +0000 (16:22 +0000)]
Improve ".." handling in FileSpec normalization

Summary:
.. handling for windows path was completely broken because the function was
expecting \ as path separators, but we were passing it normalized file paths,
where these have been replaced by forward slashes. Apart from this, the function
was incorrect for posix paths as well in some corner cases, as well as being
generally hard to follow.

The corner cases were:
- /../bar -> should be same as /bar
- /bar/.. -> should be same as / (slightly dodgy as the former depends on /bar actually
  existing, but since we're doing it in an abstract way, I think the
  transformation is reasonable)

I rewrite the function to fix these corner cases and handle windows paths more
correctly. The function should now handle the posix paths (modulo symlinks, but
we cannot really do anything about that without a real filesystem). For windows
paths, there are a couple of corner cases left, mostly to do with drive letter
handling, which cannot be fixed until the rest of the class understands drive
letters better.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 285593

7 years ago[lli] Don't strip away const qualifier. Unbreak the gcc6 build.
Davide Italiano [Mon, 31 Oct 2016 16:21:48 +0000 (16:21 +0000)]
[lli] Don't strip away const qualifier. Unbreak the gcc6 build.

llvm-svn: 285592

7 years ago[x86][inline-asm][AVX512][llvm][PART-2]
Michael Zuckerman [Mon, 31 Oct 2016 16:19:58 +0000 (16:19 +0000)]
[x86][inline-asm][AVX512][llvm][PART-2]
Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

Commit on behalf of mharoush

Extending inline assembly support, compatible with GCC as folowing:
"k" constraint hints the compiler to select any of AVX512 k0-k7 registers.
"Yk" constraint is a subset of "k" excluding k0 which is not allowd to be used as a mask.

Reviewer: 1. rnk

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

llvm-svn: 285591

7 years ago[AMDGPU][MC][gfx8] Support 20-bit immediate offset in SMEM instructions.
Artem Tamazov [Mon, 31 Oct 2016 16:07:39 +0000 (16:07 +0000)]
[AMDGPU][MC][gfx8] Support 20-bit immediate offset in SMEM instructions.

Fixes Bug 30808.
Note that passing subtarget information to predicates seems too complicated, so gfx8-specific def smrd_offset_20 introduced.
Old gfx6/7-specific def renamed to smrd_offset_8 for clarity.
Lit tests updated.

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

llvm-svn: 285590

7 years ago[clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()
Malcolm Parsons [Mon, 31 Oct 2016 15:48:01 +0000 (15:48 +0000)]
[clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

Summary:
Avoid naked new in unique_ptr.reset() by using make_unique

Fixes http://llvm.org/PR27383

Reviewers: alexfh, aaron.ballman

Subscribers: Prazek, cfe-commits

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

llvm-svn: 285589

7 years ago[Hexagon] Don't expand mux instructions with both sources identical
Krzysztof Parzyszek [Mon, 31 Oct 2016 15:45:09 +0000 (15:45 +0000)]
[Hexagon] Don't expand mux instructions with both sources identical

llvm-svn: 285588

7 years agoMinidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in...
Dimitar Vlahovski [Mon, 31 Oct 2016 15:35:18 +0000 (15:35 +0000)]
Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull

Summary:
This plugin resembles the already existing Windows-only Minidump plugin.
The WinMinidumpPlugin uses the Windows API for parsing Minidumps
while this plugin is cross-platform because it includes a Minidump
parser (which is already commited)

It is able to produce a backtrace, to read the general puprose regiters,
inspect local variables, show image list, do memory reads, etc.

For now the only arches that this supports are x86_32 and x86_64.
This is because I have only written register contexts for those.
Others will come in next CLs.

I copied the WinMinidump tests and adapted them a little bit for them to
work with the new plugin (and they pass)
I will add more tests, aiming for better code coverage.

There is still functionality to be added, see TODOs in code.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, modocache, lldb-commits, amccarth

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

llvm-svn: 285587

7 years agoRecommit r285285 - [Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size...
George Rimar [Mon, 31 Oct 2016 15:33:00 +0000 (15:33 +0000)]
Recommit r285285 - [Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is too large.

with fix: edited invalid-section-index2.elf input to pass the new check and
fail on the same place it was intended to fail.

Original commit message:
Elf.h already has code checking that section table does not go past end of file.
Problem is that this check may not work on values greater than UINT64_MAX / Header->e_shentsize
because of calculation overflow.

Parch fixes the issue.

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

llvm-svn: 285586

7 years ago[x86][inline-asm] Add support for curly brackets escape using "%" in extended inline...
Michael Zuckerman [Mon, 31 Oct 2016 15:27:54 +0000 (15:27 +0000)]
[x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

Commit on behalf of mharoush

After LGTM and check all:

This patch is a compatibility fix for clang, matching GCC support for charter escape when using extended in-line assembly (i.e, "%{" ,"%}" --> "{" ,"}" ).
 It is meant to enable support for advanced features such as AVX512 conditional\masked vector instructions/broadcast assembly syntax.

Reviewer: 1. rnk

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

llvm-svn: 285585

7 years agoMinidump plugin: Adding x86_32 register context converter
Dimitar Vlahovski [Mon, 31 Oct 2016 15:26:44 +0000 (15:26 +0000)]
Minidump plugin: Adding x86_32 register context converter

Summary:
This, like the x86_64 case, reads the register values from the minidump
file, and emits a binary buffer that is ordered using the offsets from
the RegisterInfoInterface argument. That way we can reuse an existing
register context.
Added unit tests.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, modocache, amccarth, lldb-commits

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

llvm-svn: 285584

7 years agoAdd -frtti for Windows buildbot.
Malcolm Parsons [Mon, 31 Oct 2016 15:15:00 +0000 (15:15 +0000)]
Add -frtti for Windows buildbot.

llvm-svn: 285583

7 years ago[libc++] Add configuration define for off_t functions
Shoaib Meenai [Mon, 31 Oct 2016 15:09:10 +0000 (15:09 +0000)]
[libc++] Add configuration define for off_t functions

Create this define in __config and use it elsewhere, instead of checking
the operating system/library defines in other files. The aim is to
reduce the usage of _WIN32 outside __config. No functional change.

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

llvm-svn: 285582

7 years agoFix link to check
Malcolm Parsons [Mon, 31 Oct 2016 14:48:49 +0000 (14:48 +0000)]
Fix link to check

llvm-svn: 285581

7 years agoSimplify. NFC.
Rafael Espindola [Mon, 31 Oct 2016 14:44:41 +0000 (14:44 +0000)]
Simplify. NFC.

No need to subtract then add Sec->getVA().

llvm-svn: 285580

7 years ago[clang-tidy] Enhance modernize-use-auto to casts
Malcolm Parsons [Mon, 31 Oct 2016 14:43:37 +0000 (14:43 +0000)]
[clang-tidy] Enhance modernize-use-auto to casts

Summary:
Extend modernize-use-auto to cases when a variable is assigned with a cast.

e.g.
Type *Ptr1 = dynamic_cast<Type*>(Ptr2);

http://llvm.org/PR25499

Reviewers: angelgarcia, aaron.ballman, klimek, Prazek, alexfh

Subscribers: Prazek, Eugene.Zelenko, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 285579

7 years ago[SystemZ] Add -march=archX aliases
Ulrich Weigand [Mon, 31 Oct 2016 14:38:05 +0000 (14:38 +0000)]
[SystemZ] Add -march=archX aliases

For compatibility with other compilers on the platform, allow specifying
levels of the z/Architecture instead of model names with -march.  In
particular, the following aliases are now supported:

  -march=arch8   equals  -march=z10
  -march=arch9   equals  -march=z196
  -march=arch10  equals  -march=zEC12
  -march=arch11  equals  -march=z13

This parallels the equivalent (and prerequisite) LLVM change in r285577.

llvm-svn: 285578

7 years ago[SystemZ] Rework processor feature definitions and add -mcpu=archX support
Ulrich Weigand [Mon, 31 Oct 2016 14:33:29 +0000 (14:33 +0000)]
[SystemZ] Rework processor feature definitions and add -mcpu=archX support

This patch implements two changes:

- Move processor feature definition into a new file SystemZFeatures.td,
  and provide explicit lists of supported and unsupported features for
  each level of the z/Architecture.  This allows specifying unsupported
  features in the scheduler definition files for each processor.

- Add optional aliases for the -mcpu processor names according to the
  level of the z/Architecture, for compatibility with other compilers
  on the platform.  The supported aliases are:
    -mcpu=arch8  equals  -mcpu=z10
    -mcpu=arch9  equals  -mcpu=z196
    -mcpu=arch10 equals  -mcpu=zEC12
    -mcpu=arch11 equals  -mcpu=z13

llvm-svn: 285577

7 years ago[SystemZ] Guard LEFR/LFER with FeatureVector
Ulrich Weigand [Mon, 31 Oct 2016 14:28:43 +0000 (14:28 +0000)]
[SystemZ] Guard LEFR/LFER with FeatureVector

The LEFR/LFER pseudos are aliases for vector instructions and should
therefore be guared by FeatureVector.  If they aren't, the TableGen
scheduler definition checking might complain that there is no data
for those pseudos for pre-z13 machines.

No functional change intended.

llvm-svn: 285576

7 years ago[SystemZ] Correctly diagnose missing features in AsmParser
Ulrich Weigand [Mon, 31 Oct 2016 14:25:05 +0000 (14:25 +0000)]
[SystemZ] Correctly diagnose missing features in AsmParser

Currently, when using an instruction that is not supported on the
currently selected architecture, the LLVM assembler is likely to
diagnose an "invalid operand" instead of a "missing feature".

This is because many operands require a custom parser in order to
be processed correctly, and if an instruction is not available
according to the current feature set, the generated parser code
will also not detect the associated custom operand parsers.

Fixed by temporarily enabling all features while parsing operands.
The missing features will then be correctly detected when actually
parsing the instruction itself.

llvm-svn: 285575

7 years ago[SystemZ] Fix encoding of MVCK and .insn ss
Ulrich Weigand [Mon, 31 Oct 2016 14:21:36 +0000 (14:21 +0000)]
[SystemZ] Fix encoding of MVCK and .insn ss

LLVM currently treats the first operand of MVCK as if it were a
regular base+index+displacement address.  However, it is in fact
a base+displacement combined with a length register field.

While the two might look syntactically similar, there are two
semantic differences:
- %r0 is a valid length register, even though it cannot be used
  as an index register.
- In an expression with just a single register like 0(%rX), the
  register is treated as base with normal addresses, while it is
  treated as the length register (with an empty base) for MVCK.

Fixed by adding a new operand parser class BDRAddr and reworking
the assembler parser to distinguish between address + length
register operands and regular addresses.

llvm-svn: 285574

7 years agosecond attempt at r285565.
Michael Zuckerman [Mon, 31 Oct 2016 14:16:57 +0000 (14:16 +0000)]
second attempt at r285565.

llvm-svn: 285573

7 years agoFix archetypes.hpp under libcpp-no-extensions and std level < 14
Roger Ferrer Ibanez [Mon, 31 Oct 2016 14:14:13 +0000 (14:14 +0000)]
Fix archetypes.hpp under libcpp-no-extensions and std level < 14

Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns
void. This causes a type mismatch in the conditional operator when testing the
library in C++98,03,11 modes.

Use a comma operator to workaround this problem.

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

llvm-svn: 285572

7 years agoSpell libcxxabi-no-threads correctly
Eric Fiselier [Mon, 31 Oct 2016 14:14:04 +0000 (14:14 +0000)]
Spell libcxxabi-no-threads correctly

llvm-svn: 285571

7 years agoSkip over AnnotatedLines with >50 levels of nesting; don't format them.
Daniel Jasper [Mon, 31 Oct 2016 13:23:00 +0000 (13:23 +0000)]
Skip over AnnotatedLines with >50 levels of nesting; don't format them.

Reasoning:
- ExpressionParser uses a lot of stack for these, bad in some environments.
- Our formatting algorithm is N^3 and gets really slow.
- The resulting formatting is unlikely to be any good.
- This is probably generated code we're formatting by accident.

We treat these as unparseable, and signal incomplete formatting. 50 is
an arbitrary number, I've only seen real problems from ~150 levels.

Patch by Sam McCall. Thank you.

llvm-svn: 285570

7 years agoclang-format: [JS] Fix missing space after 'yield'.
Daniel Jasper [Mon, 31 Oct 2016 13:18:25 +0000 (13:18 +0000)]
clang-format: [JS] Fix missing space after 'yield'.

Before:
  class X {
    delete(val) {
      return null;
    }
    * gen() {
      yield[1, 2];
    }
    * gen() {
      yield{a: 1};
    }
  };

After:
  class X {
    delete(val) {
      return null;
    }
    * gen() {
      yield [1, 2];
    }
    * gen() {
      yield {a: 1};
    }
  };

llvm-svn: 285569

7 years agoSecond attempt at r285517.
Dorit Nuzman [Mon, 31 Oct 2016 13:17:31 +0000 (13:17 +0000)]
Second attempt at r285517.

llvm-svn: 285568

7 years agoCorrectly merge visibility of linkerscript created symbols.
Rafael Espindola [Mon, 31 Oct 2016 13:14:53 +0000 (13:14 +0000)]
Correctly merge visibility of linkerscript created symbols.

llvm-svn: 285567

7 years ago[SystemZ] Model 2 VBU units (not 1) in SystemZScheduleZ13.td.
Jonas Paulsson [Mon, 31 Oct 2016 13:05:48 +0000 (13:05 +0000)]
[SystemZ] Model 2 VBU units (not 1) in SystemZScheduleZ13.td.

NFC.

Review: Ulrich Weigand.
llvm-svn: 285566

7 years agorevert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c
Michael Zuckerman [Mon, 31 Oct 2016 12:49:36 +0000 (12:49 +0000)]
revert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c

llvm-svn: 285565

7 years agoImproved cost model for FDIV and FSQRT, by Andrew Tischenko
Alexey Bataev [Mon, 31 Oct 2016 12:10:53 +0000 (12:10 +0000)]
Improved cost model for FDIV and FSQRT, by Andrew Tischenko

There is a bug describing poor cost model for floating point operations:
Bug 29083 - [X86][SSE] Improve costs for floating point operations. This
patch is the second one in series of patches dealing with cost model.

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

llvm-svn: 285564

7 years ago [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage
Michael Zuckerman [Mon, 31 Oct 2016 12:05:41 +0000 (12:05 +0000)]
 [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

 Commit on behalf of mharoush

 After LGTM and check all:
 This patch enables usage of k registers in inline assembly syntax.
 Adding triple

 Reviewer: 1. rnk
           2. delena

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

llvm-svn: 285563

7 years agoUse the right dwarf attributes for parsing location list entries (fixup for r285441)
Pavel Labath [Mon, 31 Oct 2016 11:53:13 +0000 (11:53 +0000)]
Use the right dwarf attributes for parsing location list entries (fixup for r285441)

Note that the parsing code here is still incorrect wrt. the new draft of the
dwarf 5 spec (seconds arguments to DW_LLE_startx_length should be uleb128, not
u32). Once we have compilers actually emitting dwarf conformant with the new
spec, we'll need to revisit this and figure out the proper behavior there.

This should unbreak the linux bot.

llvm-svn: 285562

7 years agoFix this test when we have clang-offload-bundler.exe.
Rafael Espindola [Mon, 31 Oct 2016 11:47:37 +0000 (11:47 +0000)]
Fix this test when we have clang-offload-bundler.exe.

llvm-svn: 285561

7 years agoAdd triple to test so it does not fail on windows.
Manuel Klimek [Mon, 31 Oct 2016 11:40:14 +0000 (11:40 +0000)]
Add triple to test so it does not fail on windows.

llvm-svn: 285560

7 years agoDelete .s file that did not test anything, and check in test that works.
Manuel Klimek [Mon, 31 Oct 2016 11:18:39 +0000 (11:18 +0000)]
Delete .s file that did not test anything, and check in test that works.

In D26098, Davide Italiano submitted a .s file instead of the .ll file
that was the last stage of the review.

llvm-svn: 285559

7 years agoAdd getOffset to ELFSectionRef
Eugene Leviant [Mon, 31 Oct 2016 11:03:01 +0000 (11:03 +0000)]
Add getOffset to ELFSectionRef

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

llvm-svn: 285558

7 years ago[OpenCL] Setting constant address space for array initializers
Alexey Bader [Mon, 31 Oct 2016 10:26:31 +0000 (10:26 +0000)]
[OpenCL] Setting constant address space for array initializers

Summary: Setting constant address space for global constants used for memcpy-initialization of arrays.

Patch by Alexey Sotkin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits, AlexeySotkin

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

llvm-svn: 285557

7 years agoRevert reviosion 285555
Michael Zuckerman [Mon, 31 Oct 2016 10:12:36 +0000 (10:12 +0000)]
Revert reviosion 285555

llvm-svn: 285556

7 years ago[x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage
Michael Zuckerman [Mon, 31 Oct 2016 09:37:59 +0000 (09:37 +0000)]
[x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

Commit on behalf of mharoush

After LGTM and check all:
This patch enables usage of k registers in inline assembly syntax.

Reviewer: 1. rnk
          2. delena

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

llvm-svn: 285555