platform/upstream/llvm.git
5 years ago[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag
Kristof Umann [Wed, 31 Oct 2018 14:54:27 +0000 (14:54 +0000)]
[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag

This is the first part of the implementation of the inclusion of macro
expansions into the plist output. It adds a new flag that adds a new
"macro_expansions" entry to each report that has PathDiagnosticPieces that were
expanded from a macro. While there's an entry for each macro expansion, both
the name of the macro and what it expands to is missing, and will be implemented
in followup patches.

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

llvm-svn: 345724

5 years ago[LoopUnroll] allow customization for new-pass-manager version of LoopUnroll
Fedor Sergeev [Wed, 31 Oct 2018 14:33:14 +0000 (14:33 +0000)]
[LoopUnroll] allow customization for new-pass-manager version of LoopUnroll

Unlike its legacy counterpart new pass manager's LoopUnrollPass does
not provide any means to select which flavors of unroll to run
(runtime, peeling, partial), relying on global defaults.

In some cases having ability to run a restricted LoopUnroll that
does more than LoopFullUnroll is needed.

Introduced LoopUnrollOptions to select optional unroll behaviors.
Added 'unroll<peeling>' to PassRegistry mainly for the sake of testing.

Reviewers: chandlerc, tejohnson
Differential Revision: https://reviews.llvm.org/D53440

llvm-svn: 345723

5 years ago[InstSimplify] add tests for fcmp and known positive; NFC
Sanjay Patel [Wed, 31 Oct 2018 14:29:21 +0000 (14:29 +0000)]
[InstSimplify] add tests for fcmp and known positive; NFC

llvm-svn: 345722

5 years ago[DAGCombiner] Fold 0 div/rem X to 0
David Bolvansky [Wed, 31 Oct 2018 14:18:57 +0000 (14:18 +0000)]
[DAGCombiner] Fold 0 div/rem X to 0

Reviewers: RKSimon, spatel, javed.absar, craig.topper, t.p.northover

Reviewed By: RKSimon

Subscribers: craig.topper, llvm-commits

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

llvm-svn: 345721

5 years ago[LLDB] - Removed unused variable. NFC.
George Rimar [Wed, 31 Oct 2018 13:49:31 +0000 (13:49 +0000)]
[LLDB] - Removed unused variable. NFC.

Introduced in r344119.

Thanks to Dávid Bolvanský fo reporting.

llvm-svn: 345720

5 years agoAMDGPU: Rewrite SILowerI1Copies to always stay on SALU
Nicolai Haehnle [Wed, 31 Oct 2018 13:27:08 +0000 (13:27 +0000)]
AMDGPU: Rewrite SILowerI1Copies to always stay on SALU

Summary:
Instead of writing boolean values temporarily into 32-bit VGPRs
if they are involved in PHIs or are observed from outside a loop,
we use bitwise masking operations to combine lane masks in a way
that is consistent with wave control flow.

Move SIFixSGPRCopies to before this pass, since that pass
incorrectly attempts to move SGPR phis to VGPRs.

This should recover most of the code quality that was lost with
the bug fix in "AMDGPU: Remove PHI loop condition optimization".

There are still some relevant cases where code quality could be
improved, in particular:

- We often introduce redundant masks with EXEC. Ideally, we'd
  have a generic computeKnownBits-like analysis to determine
  whether masks are already masked by EXEC, so we can avoid this
  masking both here and when lowering uniform control flow.

- The criterion we use to determine whether a def is observed
  from outside a loop is conservative: it doesn't check whether
  (loop) branch conditions are uniform.

Change-Id: Ibabdb373a7510e426b90deef00f5e16c5d56e64b

Reviewers: arsenm, rampitec, tpr

Subscribers: kzhuravl, jvesely, wdng, mgorny, yaxunl, dstuttard, t-tye, eraman, llvm-commits

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

llvm-svn: 345719

5 years agoAMDGPU: Remove PHI loop condition optimization
Nicolai Haehnle [Wed, 31 Oct 2018 13:26:48 +0000 (13:26 +0000)]
AMDGPU: Remove PHI loop condition optimization

Summary:
The optimization to early break out of loops if all threads are dead was
never fully implemented.

But the PHI node analyzing is actually causing a number of problems, so
remove all the extra code for it.

(This does actually regress code quality in a few places because it
 ends up relying more heavily on phi's of i1, which we don't do a
 great job with. However, since it fixes real bugs in the wild, we
 should take this change. I have some prototype changes to improve
 i1 lowering in general -- not just for control flow -- which should
 help recover the code quality, I just need to make those changes
 fit for general consumption. -- Nicolai)

Change-Id: I6fc6c6c8961857ac6009fcfb9f7e5e48dc23fbb1
Patch-by: Christian König <christian.koenig@amd.com>
Reviewers: arsenm, rampitec, tpr

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, llvm-commits

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

llvm-svn: 345718

5 years ago[InstSimplify] fold icmp based on range of abs/nabs
Sanjay Patel [Wed, 31 Oct 2018 13:25:10 +0000 (13:25 +0000)]
[InstSimplify] fold icmp based on range of abs/nabs

This is a fix for PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475

We managed to get some of these patterns using computeKnownBits in D47041, but that
can't be used for nabs(). Instead, put in some range-based logic, so we can fold
both abs/nabs with icmp with a constant value.

Alive proofs:
https://rise4fun.com/Alive/21r

Name: abs_nsw_is_positive
  %cmp = icmp slt i32 %x, 0
  %negx = sub nsw i32 0, %x
  %abs = select i1 %cmp, i32 %negx, i32 %x
  %r = icmp sgt i32 %abs, -1
    =>
  %r = i1 true

Name: abs_nsw_is_not_negative
  %cmp = icmp slt i32 %x, 0
  %negx = sub nsw i32 0, %x
  %abs = select i1 %cmp, i32 %negx, i32 %x
  %r = icmp slt i32 %abs, 0
    =>
  %r = i1 false

Name: nabs_is_negative_or_0
  %cmp = icmp slt i32 %x, 0
  %negx = sub i32 0, %x
  %nabs = select i1 %cmp, i32 %x, i32 %negx
  %r = icmp slt i32 %nabs, 1
    =>
  %r = i1 true

Name: nabs_is_not_over_0
  %cmp = icmp slt i32 %x, 0
  %negx = sub i32 0, %x
  %nabs = select i1 %cmp, i32 %x, i32 %negx
  %r = icmp sgt i32 %nabs, 0
    =>
  %r = i1 false

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

llvm-svn: 345717

5 years ago[clang-tidy] Remove false decoupling in ClangTidyContext. NFC
Sam McCall [Wed, 31 Oct 2018 13:08:19 +0000 (13:08 +0000)]
[clang-tidy] Remove false decoupling in ClangTidyContext. NFC

These getters/setters don't encapsulate any behavior, and can only be
called by friends.

llvm-svn: 345716

5 years agoUpdate generate_netbsd_ioctls.awk for NetBSD 8.99.25
Kamil Rytarowski [Wed, 31 Oct 2018 12:52:08 +0000 (12:52 +0000)]
Update generate_netbsd_ioctls.awk for NetBSD 8.99.25

Add dynamic detection of header files in /usr/include.
Handle "nvlist_ref_t" needed by npf(4) ioctl(2) operations.

llvm-svn: 345715

5 years ago[tblgen][PredicateExpander] Add the ability to describe more complex constraints...
Andrea Di Biagio [Wed, 31 Oct 2018 12:28:05 +0000 (12:28 +0000)]
[tblgen][PredicateExpander] Add the ability to describe more complex constraints on instruction operands.

Before this patch, class PredicateExpander only knew how to expand simple
predicates that performed checks on instruction operands.
In particular, the new scheduling predicate syntax was not rich enough to
express checks like this one:

  Foo(MI->getOperand(0).getImm()) == ExpectedVal;

Here, the immediate operand value at index zero is passed in input to function
Foo, and ExpectedVal is compared against the value returned by function Foo.

While this predicate pattern doesn't show up in any X86 model, it shows up in
other upstream targets. So, being able to support those predicates is
fundamental if we want to be able to modernize all the scheduling models
upstream.

With this patch, we allow users to specify if a register/immediate operand value
needs to be passed in input to a function as part of the predicate check. Now,
register/immediate operand checks all derive from base class CheckOperandBase.

This patch also changes where TIIPredicate definitions are expanded by the
instructon info emitter. Before, definitions were expanded in class
XXXGenInstrInfo (where XXX is a target name).
With the introduction of this new syntax, we may want to have TIIPredicates
expanded directly in XXXInstrInfo. That is because functions used by the new
operand predicates may only exist in the derived class (i.e. XXXInstrInfo).

This patch is a non functional change for the existing scheduling models.
In future, we will be able to use this richer syntax to better describe complex
scheduling predicates, and expose them to llvm-mca.

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

llvm-svn: 345714

5 years ago[NFC] Add tests for loop-simplifycfg for further development
Max Kazantsev [Wed, 31 Oct 2018 11:28:23 +0000 (11:28 +0000)]
[NFC] Add tests for loop-simplifycfg for further development

llvm-svn: 345713

5 years ago[ADT] Remove illegal comparison of singular iterators from SmallSetTest
Florian Hahn [Wed, 31 Oct 2018 11:00:48 +0000 (11:00 +0000)]
[ADT] Remove illegal comparison of singular iterators from SmallSetTest

This removes the assertion that a copy of a moved-from SmallSetIterator
equals the original, which is illegal due to SmallSetIterator including
an instance of a standard `std::set` iterator.

C++ [iterator.requirements.general] states that comparing singular
iterators has undefined result:

> Iterators can also have singular values that are not associated with
> any sequence. [...] Results of most expressions are undefined for
> singular values; the only exceptions are destroying an iterator that
> holds a singular value, the assignment of a non-singular value to an
> iterator that holds a singular value, and, for iterators that satisfy
> the Cpp17DefaultConstructible requirements, using a value-initialized
> iterator as the source of a copy or move operation.

This assertion triggers the following error in the GNU C++ Library in
debug mode under EXPENSIVE_CHECKS:

  /usr/include/c++/8.2.1/debug/safe_iterator.h:518:
  Error: attempt to compare a singular iterator to a singular iterator.

  Objects involved in the operation:
      iterator "lhs" @ 0x0x7fff86420670 {
        state = singular;
      }
      iterator "rhs" @ 0x0x7fff86420640 {
        state = singular;
      }

Patch by Eugene Sharygin.

Reviewers: fhahn, dblaikie, chandlerc

Reviewed By: fhahn, dblaikie

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

llvm-svn: 345712

5 years ago[lldb] Fix race condition in framework installation
Shoaib Meenai [Wed, 31 Oct 2018 10:41:12 +0000 (10:41 +0000)]
[lldb] Fix race condition in framework installation

We need the install-liblldb-stripped target to depend on the
lldb-framework target in order for the installation to be guaranteed to
behave correctly, otherwise it's possible for the lldb-framework and
install-liblldb-stripped targets to run in parallel, resulting in
temporary or partially processed files being copied into the framework.
install-liblldb already depends on lldb-framework for this reason.

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

llvm-svn: 345711

5 years ago[AMDGPU] support image load/store a16
Neil Henning [Wed, 31 Oct 2018 10:34:48 +0000 (10:34 +0000)]
[AMDGPU] support image load/store a16

Our a16 support was only enabled for sample/gather and buffer
load/store, but not for image load/store operations (which take an i16
as the pixel index rather than a half).

Fix our isel lowering and add test cases to prove it out.

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

llvm-svn: 345710

5 years agoFollow-up to r345699: Call CheckStaticLocalForDllExport later for templates
Hans Wennborg [Wed, 31 Oct 2018 10:34:46 +0000 (10:34 +0000)]
Follow-up to r345699: Call CheckStaticLocalForDllExport later for templates

Calling it too early might cause dllimport to get inherited onto the
VarDecl before the initializer got attached. See the test case for an
example where this broke things.

llvm-svn: 345709

5 years ago[IndVars] Strengthen restricton in rewriteLoopExitValues
Max Kazantsev [Wed, 31 Oct 2018 10:30:50 +0000 (10:30 +0000)]
[IndVars] Strengthen restricton in rewriteLoopExitValues

For some unclear reason rewriteLoopExitValues considers recalculation
after the loop profitable if it has some "soft uses" outside the loop (i.e. any
use other than call and return), even if we have proved that it has a user inside
the loop which we think will not be optimized away.

There is no existing unit test that would explain this. This patch provides an
example when rematerialisation of exit value is not profitable but it passes
this check due to presence of a "soft use" outside the loop.

It makes no sense to recalculate value on exit if we are going to compute it
due to some irremovable within the loop. This patch disallows applying this
transform in the described situation.

Differential Revision: https://reviews.llvm.org/D51581
Reviewed By: etherzhhb

llvm-svn: 345708

5 years agoDiable test suppressions-library for NetBSD/i386
Kamil Rytarowski [Wed, 31 Oct 2018 10:16:54 +0000 (10:16 +0000)]
Diable test suppressions-library for NetBSD/i386

This is a part of the ASan test-suite.

llvm-svn: 345707

5 years ago[LLDB] - Add support for DW_FORM_addrx[1-4]? forms.
George Rimar [Wed, 31 Oct 2018 10:14:03 +0000 (10:14 +0000)]
[LLDB] - Add support for DW_FORM_addrx[1-4]? forms.

This adds the support for DW_FORM_addrx, DW_FORM_addrx1,
DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4 forms.

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

llvm-svn: 345706

5 years ago[LV] Support vectorization of interleave-groups that require an epilog under
Dorit Nuzman [Wed, 31 Oct 2018 09:57:56 +0000 (09:57 +0000)]
[LV] Support vectorization of interleave-groups that require an epilog under
optsize using masked wide loads

Under Opt for Size, the vectorizer does not vectorize interleave-groups that
have gaps at the end of the group (such as a loop that reads only the even
elements: a[2*i]) because that implies that we'll require a scalar epilogue
(which is not allowed under Opt for Size). This patch extends the support for
masked-interleave-groups (introduced by D53011 for conditional accesses) to
also cover the case of gaps in a group of loads; Targets that enable the
masked-interleave-group feature don't have to invalidate interleave-groups of
loads with gaps; they could now use masked wide-loads and shuffles (if that's
what the cost model selects).

Reviewers: Ayal, hsaito, dcaballe, fhahn

Reviewed By: Ayal

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

llvm-svn: 345705

5 years ago[llvm-objdump] Mark syms/t flags as NotHidden. NFC.
Kristina Brooks [Wed, 31 Oct 2018 09:35:25 +0000 (09:35 +0000)]
[llvm-objdump] Mark syms/t flags as NotHidden. NFC.

Slight improvement to help output of llvm-objdump that exposes the
shorter -t flag for -syms instead of it being hidden away.

llvm-svn: 345704

5 years ago[llvm-objdump] Add --reloc alias for -r (PR39407)
Kristina Brooks [Wed, 31 Oct 2018 09:34:08 +0000 (09:34 +0000)]
[llvm-objdump] Add --reloc alias for -r (PR39407)

This addresses PR39407 (https://bugs.llvm.org/show_bug.cgi?id=39407)
improving compatibility with GNU binutils counterparts.

Reviewed By: kristina

Patch by Higuoxing (Xing).

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

llvm-svn: 345703

5 years ago[MSan] another take at instrumenting inline assembly - now with calls
Alexander Potapenko [Wed, 31 Oct 2018 09:32:47 +0000 (09:32 +0000)]
[MSan] another take at instrumenting inline assembly - now with calls

Turns out it's not always possible to figure out whether an asm()
statement argument points to a valid memory region.
One example would be per-CPU objects in the Linux kernel, for which the
addresses are calculated using the FS register and a small offset in the
.data..percpu section.
To avoid pulling all sorts of checks into the instrumentation, we replace
actual checking/unpoisoning code with calls to
msan_instrument_asm_load(ptr, size) and
msan_instrument_asm_store(ptr, size) functions in the runtime.

This patch doesn't implement the runtime hooks in compiler-rt, as there's
been no demand in assembly instrumentation for userspace apps so far.

llvm-svn: 345702

5 years ago[ARM64] [Windows] Exception handling support in frame lowering
Sanjin Sijaric [Wed, 31 Oct 2018 09:27:01 +0000 (09:27 +0000)]
[ARM64] [Windows] Exception handling support in frame lowering

Emit pseudo instructions indicating unwind codes corresponding to each
instruction inside the prologue/epilogue.  These are used by the MCLayer to
populate the .xdata section.

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

llvm-svn: 345701

5 years ago[clangd] fix non linux build
David Carlier [Wed, 31 Oct 2018 09:04:15 +0000 (09:04 +0000)]
[clangd] fix non linux build

There is no SCHED_IDLE semantic equivalent in BSD systems.

Reviewers: kadircet, sammccall

Revieweed By: sammccall

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

llvm-svn: 345700

5 years ago[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)
Hans Wennborg [Wed, 31 Oct 2018 08:38:48 +0000 (08:38 +0000)]
[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)

In the course of D51340, @takuto.ikuta discovered that Clang fails to put
dllexport/import attributes on static locals during template instantiation.

For regular functions, this happens in Sema::FinalizeDeclaration(), however for
template instantiations we need to do something in or around
TemplateDeclInstantiator::VisitVarDecl(). This patch does that, and extracts
the code to a utility function.

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

llvm-svn: 345699

5 years ago[AArch64] Mark condition flags and x16/x17 as clobbered when calling __chkstk
Martin Storsjo [Wed, 31 Oct 2018 08:14:09 +0000 (08:14 +0000)]
[AArch64] Mark condition flags and x16/x17 as clobbered when calling __chkstk

This is similar to SVN r311061 for ARM.

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

llvm-svn: 345698

5 years ago[llvm-objdump] support '--syms' as an alias of -t
Kristina Brooks [Wed, 31 Oct 2018 05:45:01 +0000 (05:45 +0000)]
[llvm-objdump] support '--syms' as an alias of -t

This adds support for '--syms' as an alias of '-t' for llvm-objdump,
fixing PR39406 (https://bugs.llvm.org/show_bug.cgi?id=39406).

Patch by Higuoxing (Xing).

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

llvm-svn: 345697

5 years ago[ORC] Fix hex printing of uint64_t values.
Lang Hames [Wed, 31 Oct 2018 05:16:14 +0000 (05:16 +0000)]
[ORC] Fix hex printing of uint64_t values.

A plain "%x" format string will drop the high 32-bits. Use the PRIx64 macro
instead.

llvm-svn: 345696

5 years agoChange "struct" to "class" to avoid warnings
Bill Wendling [Wed, 31 Oct 2018 04:58:34 +0000 (04:58 +0000)]
Change "struct" to "class" to avoid warnings

llvm-svn: 345695

5 years agoFixup the Python-less build of ScriptedRecognizedStackFrame
Kuba Mracek [Wed, 31 Oct 2018 04:43:09 +0000 (04:43 +0000)]
Fixup the Python-less build of ScriptedRecognizedStackFrame

llvm-svn: 345694

5 years ago[lldb] Introduce StackFrameRecognizer [take 3]
Kuba Mracek [Wed, 31 Oct 2018 04:00:22 +0000 (04:00 +0000)]
[lldb] Introduce StackFrameRecognizer [take 3]

This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector).

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

llvm-svn: 345693

5 years agoCreate ConstantExpr class
Bill Wendling [Wed, 31 Oct 2018 03:48:47 +0000 (03:48 +0000)]
Create ConstantExpr class

A ConstantExpr class represents a full expression that's in a context where a
constant expression is required. This class reflects the path the evaluator
took to reach the expression rather than the syntactic context in which the
expression occurs.

In the future, the class will be expanded to cache the result of the evaluated
expression so that it's not needlessly re-evaluated

Reviewed By: rsmith

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

llvm-svn: 345692

5 years agoRevert r345676 due to test failure.
Richard Trieu [Wed, 31 Oct 2018 02:10:51 +0000 (02:10 +0000)]
Revert r345676 due to test failure.

This was causing CodeGen/mingw-long-double.c to start failing.

llvm-svn: 345691

5 years ago2nd attempt to fix ambiguities because of ADL
Matthias Braun [Wed, 31 Oct 2018 01:58:00 +0000 (01:58 +0000)]
2nd attempt to fix ambiguities because of ADL

llvm-svn: 345690

5 years agoTry to fix ambiguities with C++17 headers in unittest
Matthias Braun [Wed, 31 Oct 2018 01:30:41 +0000 (01:30 +0000)]
Try to fix ambiguities with C++17 headers in unittest

llvm-svn: 345689

5 years agoRevert r345686 due to build failures
Kuba Mracek [Wed, 31 Oct 2018 01:22:48 +0000 (01:22 +0000)]
Revert r345686 due to build failures

llvm-svn: 345688

5 years ago[DWARF] Revert r345546: Refactor range list extraction and dumping
Wolfgang Pieb [Wed, 31 Oct 2018 01:12:58 +0000 (01:12 +0000)]
[DWARF] Revert r345546: Refactor range list extraction and dumping

This patch caused some internal tests to break which are being investigated.

llvm-svn: 345687

5 years ago[lldb] Introduce StackFrameRecognizer [take 2]
Kuba Mracek [Wed, 31 Oct 2018 00:36:20 +0000 (00:36 +0000)]
[lldb] Introduce StackFrameRecognizer [take 2]

This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector).

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

llvm-svn: 345686

5 years ago[asan] Remove stale -fno-exceptions flag in sanitizer_common as well
Reid Kleckner [Wed, 31 Oct 2018 00:35:46 +0000 (00:35 +0000)]
[asan] Remove stale -fno-exceptions flag in sanitizer_common as well

llvm-svn: 345685

5 years ago[llvm-objcopy] Delete a redundant override whose base is empty
Fangrui Song [Wed, 31 Oct 2018 00:31:07 +0000 (00:31 +0000)]
[llvm-objcopy] Delete a redundant override whose base is empty

llvm-svn: 345684

5 years agoUse llvm::any_of instead std::any_of. NFC
Fangrui Song [Wed, 31 Oct 2018 00:31:06 +0000 (00:31 +0000)]
Use llvm::any_of instead std::any_of. NFC

llvm-svn: 345683

5 years agoUse the container form llvm::sort(C)
Fangrui Song [Wed, 31 Oct 2018 00:31:06 +0000 (00:31 +0000)]
Use the container form llvm::sort(C)

llvm-svn: 345682

5 years agoDon't duplicate function/class name at the beginning of the comment. NFC
Fangrui Song [Wed, 31 Oct 2018 00:31:02 +0000 (00:31 +0000)]
Don't duplicate function/class name at the beginning of the comment. NFC

llvm-svn: 345681

5 years agoRevert r345678 (build failure on Linux machines).
Kuba Mracek [Wed, 31 Oct 2018 00:29:17 +0000 (00:29 +0000)]
Revert r345678 (build failure on Linux machines).

llvm-svn: 345680

5 years agoADT/STLExtras: Introduce llvm::empty; NFC
Matthias Braun [Wed, 31 Oct 2018 00:23:23 +0000 (00:23 +0000)]
ADT/STLExtras: Introduce llvm::empty; NFC

This is modeled after C++17 std::empty().

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

llvm-svn: 345679

5 years ago[lldb] Introduce StackFrameRecognizer
Kuba Mracek [Wed, 31 Oct 2018 00:21:03 +0000 (00:21 +0000)]
[lldb] Introduce StackFrameRecognizer

This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector).

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

llvm-svn: 345678

5 years ago[asan] Remove flags for clang-cl before it supported EH
Reid Kleckner [Wed, 31 Oct 2018 00:20:41 +0000 (00:20 +0000)]
[asan] Remove flags for clang-cl before it supported EH

Also remove -Wno-undefined-inline, which needed to work around PR19898,
which was fixed.

llvm-svn: 345677

5 years ago[Win64] Handle passing i128 by value
Reid Kleckner [Tue, 30 Oct 2018 23:58:41 +0000 (23:58 +0000)]
[Win64] Handle passing i128 by value

For arguments, pass it indirectly, since the ABI doc says pretty clearly
that arguments larger than 8 bytes are passed indirectly. This makes
va_list handling easier, anyway.

When returning, GCC returns in XMM0, and we match them.

Fixes PR39492.

llvm-svn: 345676

5 years agoDWARFVerifier: make the verifier more comprehensive for objects
Saleem Abdulrasool [Tue, 30 Oct 2018 23:45:27 +0000 (23:45 +0000)]
DWARFVerifier: make the verifier more comprehensive for objects

Make the code do what was mentioned in the comment: only skip the CU types.
This enables the lexical blocks to be verified as well.

llvm-svn: 345675

5 years agoMachineOperand/MIParser: Do not print debug-use flag, infer it
Matthias Braun [Tue, 30 Oct 2018 23:28:27 +0000 (23:28 +0000)]
MachineOperand/MIParser: Do not print debug-use flag, infer it

The debug-use flag must be set exactly for uses on DBG_VALUEs.  This is
so obvious that it can be trivially inferred while parsing. This will
reduce noise when printing while omitting an information that has little
value to the user.

The parser will keep recognizing the flag for compatibility with old
`.mir` files.

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

llvm-svn: 345671

5 years agoCorrect ABI list change wrongly advertised as being in the 7.0 release
Louis Dionne [Tue, 30 Oct 2018 23:24:02 +0000 (23:24 +0000)]
Correct ABI list change wrongly advertised as being in the 7.0 release

llvm-svn: 345670

5 years agoSilence unused variable warnings. NFC
Richard Trieu [Tue, 30 Oct 2018 23:01:15 +0000 (23:01 +0000)]
Silence unused variable warnings.  NFC

llvm-svn: 345669

5 years ago[testsuite] Skip an already failing test on MacOS.
Davide Italiano [Tue, 30 Oct 2018 22:49:22 +0000 (22:49 +0000)]
[testsuite] Skip an already failing test on MacOS.

Due to some libcxx changes to inlining, this now also crashes,
so it gets reported as "failure" by the bot. This commit doesn't
really change the status quo, just placates the bots.

llvm-svn: 345668

5 years agoRevert "Build with -fvisibility=hidden"
Eric Fiselier [Tue, 30 Oct 2018 22:23:01 +0000 (22:23 +0000)]
Revert "Build with -fvisibility=hidden"

I messed it up somewhere and now the tests aren't linking.
Reverting while I investigate.

llvm-svn: 345667

5 years agoDisable BufferOverflowAfterManyFrees for NetBSD
Kamil Rytarowski [Tue, 30 Oct 2018 22:08:47 +0000 (22:08 +0000)]
Disable BufferOverflowAfterManyFrees for NetBSD

This test hangs in the i386 mode.

llvm-svn: 345666

5 years ago[ARM][NFC] Make tests immune to better div optimizations
David Bolvansky [Tue, 30 Oct 2018 22:08:13 +0000 (22:08 +0000)]
[ARM][NFC] Make tests immune to better div optimizations

Summary: Related to D52504

Reviewers: spatel

Reviewed By: spatel

Subscribers: javed.absar, kristof.beyls, chrib, llvm-commits

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

llvm-svn: 345665

5 years agoBuild with -fvisibility=hidden
Eric Fiselier [Tue, 30 Oct 2018 22:07:52 +0000 (22:07 +0000)]
Build with -fvisibility=hidden

Summary:
This change changes the build to use -fvisibility=hidden

The exports this patch removes are symbols that should have never been exported
by the dylib in the first place, and should all be symbols which the linker
won't de-duplicate across SO boundaries, making them safe to remove.

After this change, we should be able to apply `_LIBCPP_HIDDEN` to the versioning namespace without changing the export lists.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: smeenai, mgorny, libcxx-commits

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

llvm-svn: 345664

5 years agoMark breaking asan tests on NetBSD
Kamil Rytarowski [Tue, 30 Oct 2018 22:05:49 +0000 (22:05 +0000)]
Mark breaking asan tests on NetBSD

Failing ones:
 - coverage-reset
 - coverage
 - dlclose-test
 - interception-in-shared-lib-test
 - stack-use-after-return
 - tsd_dtor_leak

llvm-svn: 345663

5 years agoRevert r345542: AMDGPU: Enable code object v3 by default
Konstantin Zhuravlyov [Tue, 30 Oct 2018 22:02:40 +0000 (22:02 +0000)]
Revert r345542: AMDGPU: Enable code object v3 by default

It breaks mesa.

llvm-svn: 345662

5 years ago[NFC][compiler-rt] Cleanup Implicit Conversion Sanitizer tests to use sized types
Roman Lebedev [Tue, 30 Oct 2018 21:59:09 +0000 (21:59 +0000)]
[NFC][compiler-rt] Cleanup Implicit Conversion Sanitizer tests to use sized types

Summary: As requested by @filcab in https://reviews.llvm.org/D50251#1280267

Reviewers: filcab, vsk, #sanitizers, vitalybuka

Reviewed By: filcab, #sanitizers, vitalybuka

Subscribers: vitalybuka, kubamracek, dberris, llvm-commits, filcab

Tags: #sanitizers

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

llvm-svn: 345661

5 years ago[clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part
Roman Lebedev [Tue, 30 Oct 2018 21:58:56 +0000 (21:58 +0000)]
[clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part

This is the second half of Implicit Integer Conversion Sanitizer.
It completes the first half, and finally makes the sanitizer
fully functional! Only the bitfield handling is missing.

Summary:
C and C++ are interesting languages. They are statically typed, but weakly.
The implicit conversions are allowed. This is nice, allows to write code
while balancing between getting drowned in everything being convertible,
and nothing being convertible. As usual, this comes with a price:

```
void consume(unsigned int val);

void test(int val) {
  consume(val);
  // The 'val' is `signed int`, but `consume()` takes `unsigned int`.
  // If val is negative, then consume() will be operating on a large
  // unsigned value, and you may or may not have a bug.

  // But yes, sometimes this is intentional.
  // Making the conversion explicit silences the sanitizer.
  consume((unsigned int)val);
}
```

Yes, there is a `-Wsign-conversion`` diagnostic group, but first, it is kinda
noisy, since it warns on everything (unlike sanitizers, warning on an
actual issues), and second, likely there are cases where it does **not** warn.

The actual detection is pretty easy. We just need to check each of the values
whether it is negative, and equality-compare the results of those comparisons.
The unsigned value is obviously non-negative. Zero is non-negative too.
https://godbolt.org/g/w93oj2

We do not have to emit the check *always*, there are obvious situations
where we can avoid emitting it, since it would **always** get optimized-out.
But i do think the tautological IR (`icmp ult %x, 0`, which is always false)
should be emitted, and the middle-end should cleanup it.

This sanitizer is in the `-fsanitize=implicit-conversion` group,
and is a logical continuation of D48958 `-fsanitize=implicit-integer-truncation`.
As for the ordering, i'we opted to emit the check **after**
`-fsanitize=implicit-integer-truncation`. At least on these simple 16 test cases,
this results in 1 of the 12 emitted checks being optimized away,
as compared to 0 checks being optimized away if the order is reversed.

This is a clang part.
The compiler-rt part is D50251.

Finishes fixing [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=37552 | PR37552 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=35409 | PR35409 ]].
Finishes partially fixing [[ https://bugs.llvm.org/show_bug.cgi?id=9821 | PR9821 ]].
Finishes fixing https://github.com/google/sanitizers/issues/940.

Only the bitfield handling is missing.

Reviewers: vsk, rsmith, rjmccall, #sanitizers, erichkeane

Reviewed By: rsmith

Subscribers: chandlerc, filcab, cfe-commits, regehr

Tags: #sanitizers, #clang

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

llvm-svn: 345660

5 years ago[compiler-rt][ubsan] Implicit Conversion Sanitizer - integer sign change - compiler...
Roman Lebedev [Tue, 30 Oct 2018 21:58:54 +0000 (21:58 +0000)]
[compiler-rt][ubsan] Implicit Conversion Sanitizer - integer sign change - compiler-rt part

Summary:
This is a compiler-rt part.
The clang part is D50250.

See [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], https://github.com/google/sanitizers/issues/940.

Reviewers: vsk, filcab, #sanitizers

Reviewed By: filcab, #sanitizers

Subscribers: mclow.lists, srhines, kubamracek, dberris, rjmccall, rsmith, llvm-commits, regehr

Tags: #sanitizers

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

llvm-svn: 345659

5 years ago[libcxx] Correct link to code review for P1006
Louis Dionne [Tue, 30 Oct 2018 21:50:11 +0000 (21:50 +0000)]
[libcxx] Correct link to code review for P1006

llvm-svn: 345658

5 years agoMake libc++'s versioning namespace customizable
Eric Fiselier [Tue, 30 Oct 2018 21:44:53 +0000 (21:44 +0000)]
Make libc++'s versioning namespace customizable

Summary:
This patch makes the versioning namespace libc++ uses customizable by the user using `-DLIBCXX_ABI_NAMESPACE=__foo`.

This allows users to build custom versions of libc++ which can be linked into binaries with other libc++ versions without causing symbol conflicts or ODR issues.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: kristina, smeenai, mgorny, phosek, libcxx-commits

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

llvm-svn: 345657

5 years ago[GCOV] Make test path generic so it passes on all machines
Marco Castelluccio [Tue, 30 Oct 2018 21:43:47 +0000 (21:43 +0000)]
[GCOV] Make test path generic so it passes on all machines

llvm-svn: 345656

5 years agoSwitch getline_nohang from XFAIL to UNSUPPORTED for NetBSD
Kamil Rytarowski [Tue, 30 Oct 2018 21:41:31 +0000 (21:41 +0000)]
Switch getline_nohang from XFAIL to UNSUPPORTED for NetBSD

This test sometimes works, usually breaks.

llvm-svn: 345655

5 years agoMark vptr-non-unique-typeinfo as a broken test for NetBSD/i386
Kamil Rytarowski [Tue, 30 Oct 2018 21:39:45 +0000 (21:39 +0000)]
Mark vptr-non-unique-typeinfo as a broken test for NetBSD/i386

llvm-svn: 345654

5 years agoAdd link to implementation for P1006R0
Marshall Clow [Tue, 30 Oct 2018 21:27:42 +0000 (21:27 +0000)]
Add link to implementation for P1006R0

llvm-svn: 345653

5 years agoUpdate LLVM version used on Appveyor bot, remove MSVC 2015 bot
Eric Fiselier [Tue, 30 Oct 2018 21:23:31 +0000 (21:23 +0000)]
Update LLVM version used on Appveyor bot, remove MSVC 2015 bot

llvm-svn: 345652

5 years agoMark breaking sanitizer_common tests on NetBSD
Kamil Rytarowski [Tue, 30 Oct 2018 21:20:17 +0000 (21:20 +0000)]
Mark breaking sanitizer_common tests on NetBSD

Set XFAIL with appropriate configuration for:
 - NetBSD/getgroupmembership
 - Posix/dedup_token_length_test
 - Posix/readlinkat
 - get_module_and_offset_for_pc

llvm-svn: 345651

5 years ago[FPEnv] [FPEnv] Add constrained intrinsics for MAXNUM and MINNUM
Cameron McInally [Tue, 30 Oct 2018 21:01:29 +0000 (21:01 +0000)]
[FPEnv] [FPEnv] Add constrained intrinsics for MAXNUM and MINNUM

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

llvm-svn: 345650

5 years agoChanging the command line parameters sent to diff for this test.
Aaron Ballman [Tue, 30 Oct 2018 20:55:18 +0000 (20:55 +0000)]
Changing the command line parameters sent to diff for this test.

On some systems, -U 1 was being interpreted as -U -1. Trying -U1 to see if that's the universally accepted approach instead.

llvm-svn: 345649

5 years ago[ELF] Fallback to sh_link=0 if neither .dynsym nor .symtab exists
Fangrui Song [Tue, 30 Oct 2018 20:54:54 +0000 (20:54 +0000)]
[ELF] Fallback to sh_link=0 if neither .dynsym nor .symtab exists

Summary: .rela.plt may only contain R_*_{,I}RELATIVE relocations and not need a symbol table link. bfd/gold fallbacks to sh_link=0 in this case. Without this patch, ld.lld --strip-all caused lld to dereference a null pointer.

Reviewers: ruiu, grimar, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 345648

5 years ago[InstCombine] use 'match' to reduce code; NFC
Sanjay Patel [Tue, 30 Oct 2018 20:52:25 +0000 (20:52 +0000)]
[InstCombine] use 'match' to reduce code; NFC

llvm-svn: 345647

5 years agoNFC: Merge KEYOBJC and KEYARC
Erik Pilkington [Tue, 30 Oct 2018 20:51:28 +0000 (20:51 +0000)]
NFC: Merge KEYOBJC and KEYARC

We used to only define ARC keywords in -fobjc-arc mode, but now that we define
them in ObjC mode, there isn't any reason to keep them seperate.

llvm-svn: 345646

5 years ago[builtins] Re-enable x86-only long double tests
Reid Kleckner [Tue, 30 Oct 2018 20:51:27 +0000 (20:51 +0000)]
[builtins] Re-enable x86-only long double tests

Summary:
In r81552, the HAS_80_BIT_LONG_DOUBLE macro was added to the unit test
only version of int_lib.h. One month later in r85260 the duplicate
int_lib.h was removed, but the tests still passed because we don't build
with -Werror.

This is the minimal change to bring it back, and I decided to put the
configuration macro next to our 128-bit integer support macro.

Reviewers: joerg, compnerd, mstorsjo

Subscribers: llvm-commits

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

llvm-svn: 345645

5 years ago[InstCombine] Teach the move free before null test opti how to deal with noop casts
Quentin Colombet [Tue, 30 Oct 2018 20:51:04 +0000 (20:51 +0000)]
[InstCombine] Teach the move free before null test opti how to deal with noop casts

InstCombine features an optimization that essentially replaces:
if (a)
  free(a)
into:
free(a)

Right now, this optimization is gated by the minsize attribute and therefore
we only perform it if we can prove that we are going to be able to eliminate
the branch and the destination block.

However when casts are involved the optimization would fail to apply, because
the optimization was not smart enough to realize that it is possible to also
move the casts away from the destination block and that is harmless to the
performance since they are just noops.
E.g.,
foo(int *a)
if (a)
  free((char*)a)

Wouldn't be optimized by instcombine, because
- We would refuse to hoist the `bitcast i32* %a to i8` in the source block
- We would fail to see that `bitcast i32* %a to i8` and %a are the same value.

This patch fixes both these problems:
- It teaches the pattern matching of the comparison how to look
  through casts.
- It checks that whether the additional instruction in the destination block
  can be hoisted and are harmless performance-wise.
- It hoists all the code of the destination block in the source block.

Differential Revision: D53356

llvm-svn: 345644

5 years agoRevert "[ASTImporter] Reorder fields after structure import is finished"
Davide Italiano [Tue, 30 Oct 2018 20:46:29 +0000 (20:46 +0000)]
Revert "[ASTImporter] Reorder fields after structure import is finished"

This reverts commit r345545 because it breaks some lldb tests.

llvm-svn: 345643

5 years ago[x86] try to make test immune to better div optimization; NFCI
Sanjay Patel [Tue, 30 Oct 2018 20:46:23 +0000 (20:46 +0000)]
[x86] try to make test immune to better div optimization; NFCI

llvm-svn: 345642

5 years ago[COFF, ARM64] Make sure to forward arguments from vararg to musttail vararg
Mandeep Singh Grang [Tue, 30 Oct 2018 20:46:10 +0000 (20:46 +0000)]
[COFF, ARM64] Make sure to forward arguments from vararg to musttail vararg

Summary:
    Thunk functions in Windows are varag functions that call a musttail function
    to pass the arguments after the fixup is done.  We need to make sure that we
    forward the arguments from the caller vararg to the callee vararg function.
    This is the same mechanism that is used for Windows on X86.

Reviewers: ssijaric, eli.friedman, TomTan, mgrang, mstorsjo, rnk, compnerd, efriedma

Reviewed By: efriedma

Subscribers: efriedma, kristof.beyls, chrib, javed.absar, llvm-commits

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

llvm-svn: 345641

5 years ago[x86] try to make test immune to better div optimization; NFCI
Sanjay Patel [Tue, 30 Oct 2018 20:44:54 +0000 (20:44 +0000)]
[x86] try to make test immune to better div optimization; NFCI

llvm-svn: 345640

5 years ago[x86] try to make test immune to better div optimization; NFCI
Sanjay Patel [Tue, 30 Oct 2018 20:42:03 +0000 (20:42 +0000)]
[x86] try to make test immune to better div optimization; NFCI

llvm-svn: 345639

5 years ago[ScalarizeMaskedMemIntrin] Limit the scope of some variables that are only used insid...
Craig Topper [Tue, 30 Oct 2018 20:33:58 +0000 (20:33 +0000)]
[ScalarizeMaskedMemIntrin] Limit the scope of some variables that are only used inside loops.

llvm-svn: 345638

5 years agoNFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)
Erik Pilkington [Tue, 30 Oct 2018 20:31:30 +0000 (20:31 +0000)]
NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)

We haven't supported compiling ObjC1 for a long time (and never will again), so
there isn't any reason to keep these separate. This patch replaces
LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC.

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

llvm-svn: 345637

5 years ago[DAGCombiner] Fix for big endian in ForwardStoreValueToDirectLoad
Bjorn Pettersson [Tue, 30 Oct 2018 20:16:39 +0000 (20:16 +0000)]
[DAGCombiner] Fix for big endian in ForwardStoreValueToDirectLoad

Summary:
Normalize the offset for endianess before checking
if the store cover the load in ForwardStoreValueToDirectLoad.

Without this we missed out on some optimizations for big
endian targets. If for example having a 4 bytes store followed
by a 1 byte load, loading the least significant byte from the
store, the STCoversLD check would fail (see @test4 in
test/CodeGen/AArch64/load-store-forwarding.ll).

This patch also fixes a problem seen in an out-of-tree target.
The target has i40 as a legal type, it is big endian,
and the StoreSize for i40 is 48 bits. So when normalizing
the offset for endianess we need to take the StoreSize into
account (assuming that padding added when storing into
a larger StoreSize always is added at the most significant
end).

Reviewers: niravd

Reviewed By: niravd

Subscribers: javed.absar, kristof.beyls, llvm-commits, uabelho

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

llvm-svn: 345636

5 years agoSpeculatively attempt to fix a failing testbot.
Aaron Ballman [Tue, 30 Oct 2018 19:49:17 +0000 (19:49 +0000)]
Speculatively attempt to fix a failing testbot.

A testbot ( http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/54690/) was failing with a complaint about an obsolete option that wasn't present in the command line in the first place. This replaces my guess at the "obsolete option" with a different spelling that will hopefully be more acceptable to this bot without breaking other bots.

llvm-svn: 345635

5 years ago[AArch64] [Windows] SEH opcodes should be scheduling boundaries.
Eli Friedman [Tue, 30 Oct 2018 19:24:51 +0000 (19:24 +0000)]
[AArch64] [Windows] SEH opcodes should be scheduling boundaries.

Prevents the post-RA scheduler from modifying the prologue sequences
emitting by frame lowering. This is roughly similar to what we do for
other targets: TargetInstrInfo::isSchedulingBoundary checks
isPosition(), which checks for CFI_INSTRUCTION.

isSEHInstruction is taken from D50288; it'll land with whatever patch
lands first.

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

llvm-svn: 345634

5 years agoSilencing a -Wunused-variable warning; NFC.
Aaron Ballman [Tue, 30 Oct 2018 19:23:06 +0000 (19:23 +0000)]
Silencing a -Wunused-variable warning; NFC.

llvm-svn: 345633

5 years ago[CMake] Check -ffreestanding as C not C++ flag
Petr Hosek [Tue, 30 Oct 2018 19:19:47 +0000 (19:19 +0000)]
[CMake] Check -ffreestanding as C not C++ flag

When -ffreestanding is used, main() isn't considered special and
when compiled as C++ code it'll get mangled which makes the
compilation fail since main() will be undefined so this check will
never succeed.

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

llvm-svn: 345632

5 years ago[AArch64] Create proper memoperand for multi-vector stores
David Greene [Tue, 30 Oct 2018 19:17:51 +0000 (19:17 +0000)]
[AArch64] Create proper memoperand for multi-vector stores

Re-apply r345315 with testcase fixes.

Include all of the store's source vector operands when creating the
MachineMemOperand. Previously, we were missing the first operand,
making the store size seem smaller than it really is.

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

llvm-svn: 345631

5 years agoFixing some build bot failures from r345628; NFC intended.
Aaron Ballman [Tue, 30 Oct 2018 19:06:58 +0000 (19:06 +0000)]
Fixing some build bot failures from r345628; NFC intended.

llvm-svn: 345630

5 years ago[NativePDB] Add support for dumping global variables of class type.
Zachary Turner [Tue, 30 Oct 2018 18:57:08 +0000 (18:57 +0000)]
[NativePDB] Add support for dumping global variables of class type.

Previous patches added support for dumping global variables of
primitive types, so we now do the same for class types.

For the most part, everything just worked, there was only one
minor bug needing fixed, which was that for variables of modified
types (e.g. const, volatile, etc) we can't resolve the forward
decl in CreateAndCacheType because the PdbSymUid must point to the
LF_MODIFIER which must point to the forward decl.  So when it comes
time to call CompleteType, an assert was firing because we expected
to get a class, struct, union, or enum, but we were getting an
LF_MODIFIER instead.

The other issue is that one the newly added tests is for an array
member, which was not yet supported, so we add support for that
now in this patch.

There's probably room for other interesting layout test cases
here, but this at least should test the basics.

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

llvm-svn: 345629

5 years agoAdd the ability to output static analysis results to SARIF.
Aaron Ballman [Tue, 30 Oct 2018 18:55:38 +0000 (18:55 +0000)]
Add the ability to output static analysis results to SARIF.

This allows users to specify SARIF (https://github.com/oasis-tcs/sarif-spec) as the output from the clang static analyzer so that the results can be read in by other tools, such as extensions to Visual Studio and VSCode, as well as static analyzers like CodeSonar.

llvm-svn: 345628

5 years agoHandle NetBSD alias for pthread_sigmask
Kamil Rytarowski [Tue, 30 Oct 2018 18:49:19 +0000 (18:49 +0000)]
Handle NetBSD alias for pthread_sigmask

Summary:
Add a new helper macro TSAN_INTERCEPTOR_NETBSD_ALIAS_THR2
that handles pthread(3)/libc aliases in scenarios when a name in both
libraries differs not just in prefix namespace.

Handle TSan pthread_sigmask mangling accordingly into __libc_thr_sigsetmask.

Reviewers: vitalybuka, joerg

Reviewed By: vitalybuka

Subscribers: kubamracek, jfb, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

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

llvm-svn: 345627

5 years ago[X86] In lowerVectorShuffleAsBroadcast, make peeking through CONCAT_VECTORS work...
Craig Topper [Tue, 30 Oct 2018 18:48:42 +0000 (18:48 +0000)]
[X86] In lowerVectorShuffleAsBroadcast, make peeking through CONCAT_VECTORS work correctly if we already walked through a bitcast that changed the element size.

The CONCAT_VECTORS case was using the original mask element count to determine how to adjust the broadcast index. But if we looked through a bitcast the original mask size doesn't tell us anything about the concat_vectors.

This patch switchs to using the concat_vectors input element count directly instead.

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

llvm-svn: 345626

5 years ago[GCOV] Add a test for function defined on one line (follow-up of https://reviews...
Calixte Denizet [Tue, 30 Oct 2018 18:41:41 +0000 (18:41 +0000)]
[GCOV] Add a test for function defined on one line (follow-up of https://reviews.llvm.org/D53600)

Summary: Add a test for coverage for function definition like void foo() { }.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

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

llvm-svn: 345625

5 years ago[GCOV] Function counters are wrong when on one line
Calixte Denizet [Tue, 30 Oct 2018 18:41:31 +0000 (18:41 +0000)]
[GCOV] Function counters are wrong when on one line

Summary:
After commit https://reviews.llvm.org/rL344228, the function definitions have a counter but when on one line the counter is wrong (e.g. void foo() { })
I added a test in: https://reviews.llvm.org/D53601

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: llvm-commits, sylvestre.ledru

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

llvm-svn: 345624

5 years ago[DAG] Add const variants for BaseIndexOffset functions.
Nirav Dave [Tue, 30 Oct 2018 18:26:43 +0000 (18:26 +0000)]
[DAG] Add const variants for BaseIndexOffset functions.

llvm-svn: 345623

5 years agoFix printing bug in pdb2yaml.
Zachary Turner [Tue, 30 Oct 2018 18:25:38 +0000 (18:25 +0000)]
Fix printing bug in pdb2yaml.

We were using the wrong enum table when mapping enum values
to strings for public symbol flags.

llvm-svn: 345622