platform/upstream/llvm.git
6 years agoUse delete[] to deallocate array of chars
Serge Pavlov [Wed, 14 Feb 2018 05:14:31 +0000 (05:14 +0000)]
Use delete[] to deallocate array of chars

llvm-svn: 325099

6 years agoRefactor DisassembleInfo in MachODump.cpp
Serge Pavlov [Wed, 14 Feb 2018 03:26:27 +0000 (03:26 +0000)]
Refactor DisassembleInfo in MachODump.cpp

The change implements constructor of DisassembleInfo to avoid duplication
of initialization code and gets rid of malloc/free where possible.

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

llvm-svn: 325098

6 years ago[clangd] Configure clangd tracing with CLANGD_TRACE env instead of -trace flag
Sam McCall [Wed, 14 Feb 2018 03:20:07 +0000 (03:20 +0000)]
[clangd] Configure clangd tracing with CLANGD_TRACE env instead of -trace flag

llvm-svn: 325097

6 years agoFix a couple of places where we assumed that non-type template parameters are always...
Richard Smith [Wed, 14 Feb 2018 02:07:53 +0000 (02:07 +0000)]
Fix a couple of places where we assumed that non-type template parameters are always rvalues.

llvm-svn: 325095

6 years agoUse a stricter return type in buildSectionOrder. NFC.
Rafael Espindola [Wed, 14 Feb 2018 01:42:26 +0000 (01:42 +0000)]
Use a stricter return type in buildSectionOrder. NFC.

We sort inside output sections, so all the sections we see should be
InputSectionBase.

I noticed the patch adding callgraph based section ordering used this
type and changing this separately makes the merge easier.

llvm-svn: 325094

6 years ago[demangler] Support for exception specifications on function types.
Erik Pilkington [Wed, 14 Feb 2018 01:08:20 +0000 (01:08 +0000)]
[demangler] Support for exception specifications on function types.

llvm-svn: 325093

6 years ago[demangler] Simplify the AST for function types, NFC.
Erik Pilkington [Wed, 14 Feb 2018 01:08:17 +0000 (01:08 +0000)]
[demangler] Simplify the AST for function types, NFC.

llvm-svn: 325092

6 years agoFix incorrect indentation.
Bruce Mitchener [Wed, 14 Feb 2018 00:29:38 +0000 (00:29 +0000)]
Fix incorrect indentation.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 325087

6 years ago[X86] Remove dead code from retpoline thunk generation
Reid Kleckner [Wed, 14 Feb 2018 00:24:29 +0000 (00:24 +0000)]
[X86] Remove dead code from retpoline thunk generation

Follow-up to r325049

llvm-svn: 325085

6 years agoImplement function attribute artificial
Erich Keane [Wed, 14 Feb 2018 00:14:07 +0000 (00:14 +0000)]
Implement function attribute artificial

Added support in clang for GCC function attribute 'artificial'. This attribute
is used to control stepping behavior of debugger with respect to inline
functions.

Patch By: Elizabeth Andrews (eandrews)

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

llvm-svn: 325081

6 years ago[gold] Fix error report in thinlto_emit_linked_objects.ll test
Vitaly Buka [Wed, 14 Feb 2018 00:00:43 +0000 (00:00 +0000)]
[gold] Fix error report in thinlto_emit_linked_objects.ll test

Summary:
It's just cleanup after r323818 to avoid irrelevant error message inside the test.
Existing version of test passed but generated unrelated error report about
symbol redefinition.

llvm-svn: 325080

6 years ago[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded envir...
George Karpenkov [Tue, 13 Feb 2018 23:36:01 +0000 (23:36 +0000)]
[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment

llvm-svn: 325070

6 years agoFix off-by-one in set_thread_name which causes truncation to fail on Linux
Sam McCall [Tue, 13 Feb 2018 23:23:59 +0000 (23:23 +0000)]
Fix off-by-one in set_thread_name which causes truncation to fail on Linux

llvm-svn: 325069

6 years ago[cmake] Darwin: Copy in the system debugserver if needed
Vedant Kumar [Tue, 13 Feb 2018 23:05:46 +0000 (23:05 +0000)]
[cmake] Darwin: Copy in the system debugserver if needed

This makes the built debugger functional on Darwin when compiling
without code signing (as documented in docs/code-signing.txt).

llvm-svn: 325068

6 years ago[globalisel][legalizerinfo] Follow up on post-commit review comments after r323681
Daniel Sanders [Tue, 13 Feb 2018 23:02:44 +0000 (23:02 +0000)]
[globalisel][legalizerinfo] Follow up on post-commit review comments after r323681

* Document most API's
* Delete a useless function call
* Fix a discrepancy between the single and multi-opcode variants of
  getActionDefinitions().
  The multi-opcode variant now requires that more than one opcode is requested.
  Previously it acted much like the single-opcode form but unnecessarily
  enforced the requirements of the multi-opcode form.

llvm-svn: 325067

6 years ago[InstCombine] put tests of mul with neg operand(s) together; NFC
Sanjay Patel [Tue, 13 Feb 2018 23:02:12 +0000 (23:02 +0000)]
[InstCombine] put tests of mul with neg operand(s) together; NFC

llvm-svn: 325066

6 years agoUse toString to stringize sections and files.
Rui Ueyama [Tue, 13 Feb 2018 22:56:49 +0000 (22:56 +0000)]
Use toString to stringize sections and files.

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

llvm-svn: 325065

6 years agoUse LLVM's SetVector insteead of unordered_set.
Rui Ueyama [Tue, 13 Feb 2018 22:30:52 +0000 (22:30 +0000)]
Use LLVM's SetVector insteead of unordered_set.

SetVector guarantees ordering, so with that we can get a deterministic
output for error messages.

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

llvm-svn: 325064

6 years ago[GVN] Salvage debug info from dead insts
Vedant Kumar [Tue, 13 Feb 2018 22:27:17 +0000 (22:27 +0000)]
[GVN] Salvage debug info from dead insts

This preserves an additional 581 unique source variables in a stage2
build of clang (according to `llvm-dwarfdump --statistics`). It
increases the size of the .debug_loc section by 0.1% (or 87139 bytes).

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

llvm-svn: 325063

6 years ago[InstCombine] (lshr X, 31) * Y --> (ashr X, 31) & Y
Sanjay Patel [Tue, 13 Feb 2018 22:24:37 +0000 (22:24 +0000)]
[InstCombine] (lshr X, 31) * Y --> (ashr X, 31) & Y

This replaces the bit-tracking based fold that did the same thing,
but it only worked for scalars and not directly.

There is no evidence in existing regression tests that the greater
power of bit-tracking was needed here, but we should be aware of
this potential loss of optimization.

llvm-svn: 325062

6 years agoamdgpu/half_recip: Switch implementation to native_recip
Jan Vesely [Tue, 13 Feb 2018 22:09:46 +0000 (22:09 +0000)]
amdgpu/half_recip: Switch implementation to native_recip

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325061

6 years agoamdgpu/half_log2: Switch implementation to native_log2
Jan Vesely [Tue, 13 Feb 2018 22:09:44 +0000 (22:09 +0000)]
amdgpu/half_log2: Switch implementation to native_log2

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325060

6 years agoamdgpu/half_log10: Switch implementation to native_log10
Jan Vesely [Tue, 13 Feb 2018 22:09:42 +0000 (22:09 +0000)]
amdgpu/half_log10: Switch implementation to native_log10

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325059

6 years agoamdgpu/half_log: Switch implementation to native_log
Jan Vesely [Tue, 13 Feb 2018 22:09:41 +0000 (22:09 +0000)]
amdgpu/half_log: Switch implementation to native_log

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325058

6 years agoamdgpu/half_exp2: Switch implementation to native_exp2
Jan Vesely [Tue, 13 Feb 2018 22:09:38 +0000 (22:09 +0000)]
amdgpu/half_exp2: Switch implementation to native_exp2

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325057

6 years agoamdgpu/half_exp10: Switch implementation to native_exp10
Jan Vesely [Tue, 13 Feb 2018 22:09:37 +0000 (22:09 +0000)]
amdgpu/half_exp10: Switch implementation to native_exp10

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325056

6 years agoamdgpu/half_exp: Switch implementation to native_exp
Jan Vesely [Tue, 13 Feb 2018 22:09:35 +0000 (22:09 +0000)]
amdgpu/half_exp: Switch implementation to native_exp

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325055

6 years agoamdgpu/half_sqrt: Switch implementation to native_sqrt
Jan Vesely [Tue, 13 Feb 2018 22:09:33 +0000 (22:09 +0000)]
amdgpu/half_sqrt: Switch implementation to native_sqrt

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325054

6 years agoamdgpu/half_rsqrt: Switch implementation to native_rsqrt
Jan Vesely [Tue, 13 Feb 2018 22:09:31 +0000 (22:09 +0000)]
amdgpu/half_rsqrt: Switch implementation to native_rsqrt

Reviewer: Tom Stellard <tstellar@redhat.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 325053

6 years agoTeach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat...
Nico Weber [Tue, 13 Feb 2018 21:31:47 +0000 (21:31 +0000)]
Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.

Fixes PR29134.
https://reviews.llvm.org/D43221

llvm-svn: 325052

6 years ago[InstCombine] add vector tests, fix comments; NFC
Sanjay Patel [Tue, 13 Feb 2018 21:19:42 +0000 (21:19 +0000)]
[InstCombine] add vector tests, fix comments; NFC

The scalar folds are done indirectly and use potentially
expensive value tracking calls. That can be improved
along with the enhancement to support vector types.

llvm-svn: 325051

6 years ago[libFuzzer] Set -experimental_len_control=1000 as default.
Matt Morehouse [Tue, 13 Feb 2018 20:52:15 +0000 (20:52 +0000)]
[libFuzzer] Set -experimental_len_control=1000 as default.

Summary:
Experiments using
https://github.com/google/fuzzer-test-suite/tree/master/engine-comparison
show a significant increase in coverage and reduction in corpus size
with this option enabled.

Addresses https://llvm.org/pr36371.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 325050

6 years ago[X86] Use EDI for retpoline when no scratch regs are left
Reid Kleckner [Tue, 13 Feb 2018 20:47:49 +0000 (20:47 +0000)]
[X86] Use EDI for retpoline when no scratch regs are left

Summary:
Instead of solving the hard problem of how to pass the callee to the indirect
jump thunk without a register, just use a CSR. At a call boundary, there's
nothing stopping us from using a CSR to hold the callee as long as we save and
restore it in the prologue.

Also, add tests for this mregparm=3 case. I wrote execution tests for
__llvm_retpoline_push, but they never got committed as lit tests, either
because I never rewrote them or because they got lost in merge conflicts.

Reviewers: chandlerc, dwmw2

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

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

llvm-svn: 325049

6 years ago[InstCombine] (bool X) * Y --> X ? Y : 0
Sanjay Patel [Tue, 13 Feb 2018 20:41:22 +0000 (20:41 +0000)]
[InstCombine] (bool X) * Y --> X ? Y : 0

This is both a functional improvement for vectors and an
efficiency improvement for scalars. The existing code below
the new folds does the same thing for scalars, but in an
indirect and expensive way.

llvm-svn: 325048

6 years ago[LLD] Implement /guard:[no]longjmp
Reid Kleckner [Tue, 13 Feb 2018 20:32:53 +0000 (20:32 +0000)]
[LLD] Implement /guard:[no]longjmp

Summary:
This protects calls to longjmp from transferring control to arbitrary
program points. Instead, longjmp calls are limited to the set of
registered setjmp return addresses.

This also implements /guard:nolongjmp to allow users to link in object
files that call setjmp that weren't compiled with /guard:cf. In this
case, the linker will approximate the set of address taken functions,
but it will leave longjmp unprotected.

I used the following program to test, compiling it with different -guard
flags:
  $ cl -c t.c -guard:cf
  $ lld-link t.obj -guard:cf

  #include <setjmp.h>
  #include <stdio.h>
  jmp_buf buf;
  void g() {
    printf("before longjmp\n");
    fflush(stdout);
    longjmp(buf, 1);
  }
  void f() {
    if (setjmp(buf)) {
      printf("setjmp returned non-zero\n");
      return;
    }
    g();
  }
  int main() {
    f();
    printf("hello world\n");
  }

In particular, the program aborts when the code is compiled *without*
-guard:cf and linked with -guard:cf. That indicates that longjmps are
protected.

Reviewers: ruiu, inglorion, amccarth

Subscribers: llvm-commits

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

llvm-svn: 325047

6 years ago[WebAssembly] Unify concepts of discarded and non-live input chunks. NFC.
Sam Clegg [Tue, 13 Feb 2018 20:29:38 +0000 (20:29 +0000)]
[WebAssembly] Unify concepts of discarded and non-live input chunks. NFC.

It seems redundant to store this information twice.  None of the
locations where this bit is checked care about the distinction.

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

llvm-svn: 325046

6 years ago[WebAssembly] Cleanup methods for add synthetic symbols to symbtab. NFC.
Sam Clegg [Tue, 13 Feb 2018 20:14:26 +0000 (20:14 +0000)]
[WebAssembly] Cleanup methods for add synthetic symbols to symbtab. NFC.

These were duplicating (incorrectly) some of the logic for
handling conflicts, but since they are only ever added right
at the start we can assume no existing symbols.

Also rename these methods for clarity.

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

llvm-svn: 325045

6 years ago[GISel]: Add Pattern Matcher for G_FMUL.
Aditya Nandakumar [Tue, 13 Feb 2018 20:09:13 +0000 (20:09 +0000)]
[GISel]: Add Pattern Matcher for G_FMUL.

https://reviews.llvm.org/D43206

llvm-svn: 325044

6 years ago[GISel]: Make Pattern matcher for FADD commutative
Aditya Nandakumar [Tue, 13 Feb 2018 20:09:11 +0000 (20:09 +0000)]
[GISel]: Make Pattern matcher for FADD commutative

llvm-svn: 325043

6 years ago[AMDGPU] Cleanup in memory legalizer tests. NFC.
Stanislav Mekhanoshin [Tue, 13 Feb 2018 20:03:32 +0000 (20:03 +0000)]
[AMDGPU] Cleanup in memory legalizer tests. NFC.

llvm-svn: 325042

6 years agoDocument the shortcomings of DwarfExpression::addMachineReg().
Adrian Prantl [Tue, 13 Feb 2018 19:54:00 +0000 (19:54 +0000)]
Document the shortcomings of DwarfExpression::addMachineReg().

Also make a drive-by-fix of a bug in the subregister scan code that
only triggers with an incomplete or otherwise very irregular machine
description.

rdar://problem/37404493

This re-applies r324972 with an early exit in the case of a complete
failure to make this commit NFC again as intended.

llvm-svn: 325041

6 years agoUpdate StmtProfile.cpp to handle zero template arguments.
Richard Trieu [Tue, 13 Feb 2018 19:53:40 +0000 (19:53 +0000)]
Update StmtProfile.cpp to handle zero template arguments.

Treat having no templates arguments differently than having zero template
arguments when profiling.

llvm-svn: 325040

6 years ago[InstCombine] fix test comment and add vector test; NFC
Sanjay Patel [Tue, 13 Feb 2018 18:48:27 +0000 (18:48 +0000)]
[InstCombine] fix test comment and add vector test; NFC

llvm-svn: 325039

6 years agoFix coding style error.
Rui Ueyama [Tue, 13 Feb 2018 18:40:52 +0000 (18:40 +0000)]
Fix coding style error.

llvm-svn: 325038

6 years ago[InstCombine, InstSimplify] (re)move tests, regenerate checks; NFC
Sanjay Patel [Tue, 13 Feb 2018 18:22:53 +0000 (18:22 +0000)]
[InstCombine, InstSimplify] (re)move tests, regenerate checks; NFC

The InstCombine integer mul test file had tests that belong in InstSimplify
(including fmul tests). Move things to where they belong and auto-generate
complete checks for everything.

llvm-svn: 325037

6 years ago[Debugify] Avoid verifier failure on non-definition subprograms
Vedant Kumar [Tue, 13 Feb 2018 18:15:27 +0000 (18:15 +0000)]
[Debugify] Avoid verifier failure on non-definition subprograms

If a function doesn't have an exact definition, don't apply debugify
metadata as it triggers a DIVerifier failure.

The issue is that it's invalid to have DILocations inside a DISubprogram
which isn't a definition ("scope points into the type hierarchy!").

llvm-svn: 325036

6 years ago[DeadStoreElimination] Salvage debug info from dead insts
Vedant Kumar [Tue, 13 Feb 2018 18:15:26 +0000 (18:15 +0000)]
[DeadStoreElimination] Salvage debug info from dead insts

According to `llvm-dwarfdump --statistics` this salvages 43 additional
unique source variables in a stage2 build of clang. It increases the
size of the .debug_loc section by 0.002% (or 2864 bytes).

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

llvm-svn: 325035

6 years agoRevert r324903 "[AArch64] Refactor identification of SIMD immediates"
Hans Wennborg [Tue, 13 Feb 2018 18:14:38 +0000 (18:14 +0000)]
Revert r324903 "[AArch64] Refactor identification of SIMD immediates"

It caused "Cannot select: t33: f64 = AArch64ISD::FMOV Constant:i32<0>"
in Chromium builds. See PR36369.

> Get rid of icky goto loops and make the code easier to maintain (NFC).
>
> Differential revision: https://reviews.llvm.org/D42723

llvm-svn: 325034

6 years agoUse reinterpret_cast<> instead of C-style cast. NFC.
Rui Ueyama [Tue, 13 Feb 2018 18:11:42 +0000 (18:11 +0000)]
Use reinterpret_cast<> instead of C-style cast. NFC.

It is currently interpreted as reinterpret_cast<>. Make it explicit.

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

llvm-svn: 325033

6 years ago[CodeGen] Print bundled instructions using the MIR syntax in -debug output
Francis Visoiu Mistrih [Tue, 13 Feb 2018 18:08:26 +0000 (18:08 +0000)]
[CodeGen] Print bundled instructions using the MIR syntax in -debug output

Old syntax:

BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2
* %r0 = SOME_OP %r2
* %r1 = ANOTHER_OP internal %r0

New syntax:

BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2 {
  %r0 = SOME_OP %r2
  %r1 = ANOTHER_OP internal %r0
}

llvm-svn: 325032

6 years ago[AMDGPU] Change constant addr space to 4
Yaxun Liu [Tue, 13 Feb 2018 18:01:21 +0000 (18:01 +0000)]
[AMDGPU] Change constant addr space to 4

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

llvm-svn: 325031

6 years ago[AMDGPU] Change constant addr space to 4
Yaxun Liu [Tue, 13 Feb 2018 18:00:25 +0000 (18:00 +0000)]
[AMDGPU] Change constant addr space to 4

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

llvm-svn: 325030

6 years ago[clangd] Fixed findDefinitions to always return absolute paths.
Ilya Biryukov [Tue, 13 Feb 2018 17:47:16 +0000 (17:47 +0000)]
[clangd] Fixed findDefinitions to always return absolute paths.

Relative paths could be returned in some cases, e.g. when relative
path is used in compilation arguments. This led to crash when trying
to convert the path to URI.

llvm-svn: 325029

6 years agoMake the ctype_byname::widen test cases pass on FreeBSD.
Dimitry Andric [Tue, 13 Feb 2018 17:43:24 +0000 (17:43 +0000)]
Make the ctype_byname::widen test cases pass on FreeBSD.

llvm-svn: 325028

6 years agoPut type attributes after class keyword
Dimitry Andric [Tue, 13 Feb 2018 17:40:59 +0000 (17:40 +0000)]
Put type attributes after class keyword

Summary:
Compiling `<functional>` in C++17 or higher mode results in:

```
functional:2500:1: warning: attribute '__visibility__' is ignored, place it after "class" to apply attribute to type declaration [-Wignored-attributes]
_LIBCPP_TYPE_VIS
^
__config:701:46: note: expanded from macro '_LIBCPP_TYPE_VIS'
#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
                                             ^
1 warning generated.
```

Fix it by putting the attribute after the `class` keyword.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 325027

6 years agoCheck that Symbol types are trivially destructible
Sam Clegg [Tue, 13 Feb 2018 17:32:31 +0000 (17:32 +0000)]
Check that Symbol types are trivially destructible

This adds an extra level of static safety to our use of placement
new to allocate Symbol types.  It prevents the accidental addition
on a non-trivially-destructible member that could allocate and
leak memory.

From the spec: Storage occupied by trivially destructible objects
may be reused without calling the destructor.

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

llvm-svn: 325025

6 years ago[clangd] Log if CWD could not be changed. NFC.
Ilya Biryukov [Tue, 13 Feb 2018 17:15:06 +0000 (17:15 +0000)]
[clangd] Log if CWD could not be changed. NFC.

llvm-svn: 325024

6 years ago[demangler] Support for inheriting constructors.
Erik Pilkington [Tue, 13 Feb 2018 17:09:07 +0000 (17:09 +0000)]
[demangler] Support for inheriting constructors.

Fixes PR33223.

llvm-svn: 325023

6 years ago[demangler] Rewrite parse_nested_name in the new style.
Erik Pilkington [Tue, 13 Feb 2018 17:09:03 +0000 (17:09 +0000)]
[demangler] Rewrite parse_nested_name in the new style.

llvm-svn: 325022

6 years ago[clangd] Remove the RealFS layer from test VFS. NFC.
Ilya Biryukov [Tue, 13 Feb 2018 17:08:13 +0000 (17:08 +0000)]
[clangd] Remove the RealFS layer from test VFS. NFC.

It was required before because preambles could only be created on
disk. All tests use in-memory preambles now.

llvm-svn: 325021

6 years ago[sanitizer] Implement GetRSS on Windows
Kostya Kortchinsky [Tue, 13 Feb 2018 17:05:54 +0000 (17:05 +0000)]
[sanitizer] Implement GetRSS on Windows

Summary:
Pretty straightforward, returning the `WorkingSetSize` of a
`PROCESS_MEMORY_COUNTERS` structure. AFAIU, `GetProcessMemoryInfo` is in
`kernel32.lib` for Windows 7 and above. Support for earlier Windows versions
would require `psapi.lib`, but I don't think those are supported by ASan?

Reviewers: alekseyshl, rnk, vitalybuka

Reviewed By: vitalybuka

Subscribers: vitalybuka, kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 325020

6 years ago[DAGCombiner] Add one use check to fold (not (and x, y)) -> (or (not x), (not y))
Craig Topper [Tue, 13 Feb 2018 16:25:27 +0000 (16:25 +0000)]
[DAGCombiner] Add one use check to fold (not (and x, y)) -> (or (not x), (not y))

Summary:
If the and has an additional use we shouldn't invert it. That creates an additional instruction.

While there add a one use check to the transform above that looked similar.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 325019

6 years ago[X86] Add combine to shrink 64-bit ands when one input is an any_extend and the other...
Craig Topper [Tue, 13 Feb 2018 16:25:25 +0000 (16:25 +0000)]
[X86] Add combine to shrink 64-bit ands when one input is an any_extend and the other input guarantees upper 32 bits are 0.

Summary: This gets the shift case from PR35792.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 325018

6 years agoUse RelType in a few more places. NFC.
Rafael Espindola [Tue, 13 Feb 2018 16:06:11 +0000 (16:06 +0000)]
Use RelType in a few more places. NFC.

llvm-svn: 325017

6 years agoAdd a simpler version of addReloc. NFC.
Rafael Espindola [Tue, 13 Feb 2018 16:03:52 +0000 (16:03 +0000)]
Add a simpler version of addReloc. NFC.

Extracted from a patch by Alexander Richardson!

llvm-svn: 325016

6 years ago[clang-tidy] Update fuchsia-multiple-inheritance to not fail
Julie Hockett [Tue, 13 Feb 2018 15:40:40 +0000 (15:40 +0000)]
[clang-tidy] Update fuchsia-multiple-inheritance to not fail

Updating the fuchsia-multiple-inheritance to gracefully handle unknown
record types (e.g. templatized classes) by simply continuing, rather
than asserting and failing.

Fixes PR36052.

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

llvm-svn: 325015

6 years ago[Hexagon] Simplify some code, NFC
Krzysztof Parzyszek [Tue, 13 Feb 2018 15:35:07 +0000 (15:35 +0000)]
[Hexagon] Simplify some code, NFC

llvm-svn: 325014

6 years ago[Hexagon] Remove unnecessary check
Krzysztof Parzyszek [Tue, 13 Feb 2018 15:34:29 +0000 (15:34 +0000)]
[Hexagon] Remove unnecessary check

llvm-svn: 325013

6 years ago[ARM] Allow half types in ConstantPool
Sjoerd Meijer [Tue, 13 Feb 2018 15:34:09 +0000 (15:34 +0000)]
[ARM] Allow half types in ConstantPool

Change ARMConstantIslandPass to:
- accept f16 literals as litpool entries,
- if the litpool needs to be inserted in the middle of a big block, then we
  need to 4-byte align the next instruction in ARM mode.

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

llvm-svn: 325012

6 years agoAn updated test to show the current warnings produced for implicit conversions from...
Andrew V. Tischenko [Tue, 13 Feb 2018 15:20:29 +0000 (15:20 +0000)]
An updated test to show the current warnings produced for implicit conversions from 'double' to 'float'.

llvm-svn: 325011

6 years ago[DAG] fix type of undef returned by getNode()
Sanjay Patel [Tue, 13 Feb 2018 14:55:07 +0000 (14:55 +0000)]
[DAG] fix type of undef returned by getNode()

The bug has been lying dormant, but apparently was never exposed, until
after rL324941 because we didn't return the correct result
for shifts with undef operands.

llvm-svn: 325010

6 years agoRevert r325001: [CallSiteSplitting] Support splitting of blocks with instrs before...
Florian Hahn [Tue, 13 Feb 2018 14:48:39 +0000 (14:48 +0000)]
Revert r325001: [CallSiteSplitting] Support splitting of blocks with instrs before call.

Due to memsan not being happy with the array of ValueToValue maps.

llvm-svn: 325009

6 years ago[IR] Fix creating mutable versions of TBAA access tags
Ivan A. Kosarev [Tue, 13 Feb 2018 14:44:25 +0000 (14:44 +0000)]
[IR] Fix creating mutable versions of TBAA access tags

Due to a typo in D41565, mutable TBAA tags created with
createMutableTBAAAccessTag() lose their base types. This patch
fixes that typo and updates tests respectively.

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

llvm-svn: 325008

6 years ago[CallSiteSplitting] Clear ValueToValue maps.
Florian Hahn [Tue, 13 Feb 2018 14:17:00 +0000 (14:17 +0000)]
[CallSiteSplitting] Clear ValueToValue maps.

llvm-svn: 325006

6 years ago[CallSiteSplitting] Dereference pointer earlier.
Florian Hahn [Tue, 13 Feb 2018 13:51:51 +0000 (13:51 +0000)]
[CallSiteSplitting] Dereference pointer earlier.

This should make the sanitizers happy.

llvm-svn: 325004

6 years ago[InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.
Simon Pilgrim [Tue, 13 Feb 2018 13:16:26 +0000 (13:16 +0000)]
[InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.

llvm-svn: 325003

6 years ago[CallSiteSplitting] Fix new-pm test, as TargetIRAnalysis is run earlier now
Florian Hahn [Tue, 13 Feb 2018 12:22:32 +0000 (12:22 +0000)]
[CallSiteSplitting] Fix new-pm test, as TargetIRAnalysis is run earlier now

llvm-svn: 325002

6 years ago[CallSiteSplitting] Support splitting of blocks with instrs before call.
Florian Hahn [Tue, 13 Feb 2018 12:00:48 +0000 (12:00 +0000)]
[CallSiteSplitting] Support splitting of blocks with instrs before call.

For basic blocks with instructions between the beginning of the block
and a call we have to duplicate the instructions before the call in all
split blocks and add PHI nodes for uses of the duplicated instructions
after the call.

Currently, the threshold for the number of instructions before a call
is quite low, to keep the impact on binary size low.

Reviewers: junbuml, mcrosier, davidxl, davide

Reviewed By: junbuml

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

llvm-svn: 325001

6 years ago[ARM] Don't print "Requires NEON" error message for M-profile
Andre Vieira [Tue, 13 Feb 2018 11:46:38 +0000 (11:46 +0000)]
[ARM] Don't print "Requires NEON" error message for M-profile

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

llvm-svn: 325000

6 years ago[X86] Rename function main->foo in CodeGen/X86/pr35316.ll. NFC
Alexander Ivchenko [Tue, 13 Feb 2018 10:58:19 +0000 (10:58 +0000)]
[X86] Rename function main->foo in CodeGen/X86/pr35316.ll. NFC

Using "void main" might be confusing for some cases.

llvm-svn: 324997

6 years ago[Thumb] Handle addressing mode AddrMode5FP16
Sjoerd Meijer [Tue, 13 Feb 2018 10:29:03 +0000 (10:29 +0000)]
[Thumb] Handle addressing mode AddrMode5FP16

This addressing mode wasn't checked, so we were running in an assert.

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

llvm-svn: 324996

6 years ago[clang-format] Support text proto extensions
Krasimir Georgiev [Tue, 13 Feb 2018 10:20:39 +0000 (10:20 +0000)]
[clang-format] Support text proto extensions

Summary:
This adds support for text proto extensions, like:
```
msg {
  [type.type/ext] {
    key: value
  }
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 324995

6 years ago[LoopInterchange] Check number of latch successors before accessing them.
Florian Hahn [Tue, 13 Feb 2018 10:02:52 +0000 (10:02 +0000)]
[LoopInterchange] Check number of latch successors before accessing them.

In cases where the OuterMostLoopLatchBI only has a single successor,
accessing the second successor will fail.

This fixes a failure when building the test-suite with loop-interchange
enabled.

Reviewers: mcrosier, karthikthecool, davide

Reviewed by: karthikthecool

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

llvm-svn: 324994

6 years ago[clangd] Remove an already-done FIXME, NFC
Haojian Wu [Tue, 13 Feb 2018 09:56:45 +0000 (09:56 +0000)]
[clangd] Remove an already-done FIXME, NFC

llvm-svn: 324993

6 years ago[clangd] SymbolLocation only covers symbol name.
Haojian Wu [Tue, 13 Feb 2018 09:53:50 +0000 (09:53 +0000)]
[clangd] SymbolLocation only covers symbol name.

Summary:
* Change the offset range to half-open, [start, end).
* Fix a few fixmes.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 324992

6 years agoFix for PR32992. Static const classes not exported.
Hans Wennborg [Tue, 13 Feb 2018 09:19:43 +0000 (09:19 +0000)]
Fix for PR32992. Static const classes not exported.

Patch by zahiraam!

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

llvm-svn: 324991

6 years ago[clangd] Stop exposing Futures from ClangdServer operations.
Sam McCall [Tue, 13 Feb 2018 08:59:23 +0000 (08:59 +0000)]
[clangd] Stop exposing Futures from ClangdServer operations.

Summary:
LSP has asynchronous semantics, being able to block on an async operation
completing is unneccesary and leads to tighter coupling with the threading.

In practice only tests depend on this, so we add a general-purpose "block until
idle" function to the scheduler which will work for all operations.

To get this working, fix a latent condition-variable bug in ASTWorker, and make
AsyncTaskRunner const-correct.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 324990

6 years agoFix typos.
Bruce Mitchener [Tue, 13 Feb 2018 08:12:00 +0000 (08:12 +0000)]
Fix typos.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 324989

6 years ago[DebugInfo] Avoid name conflict of generated VLA expression variable.
Sander de Smalen [Tue, 13 Feb 2018 07:49:34 +0000 (07:49 +0000)]
[DebugInfo] Avoid name conflict of generated VLA expression variable.

Summary:
This patch also adds the 'DW_AT_artificial' flag to the generated variable.

Addresses the issues mentioned in http://llvm.org/PR30553.

Reviewers: CarlosAlbertoEnciso, probinson, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 324988

6 years ago[X86] Add a test case showing blcic matching being broken by an and mask applied...
Craig Topper [Tue, 13 Feb 2018 07:28:28 +0000 (07:28 +0000)]
[X86] Add a test case showing blcic matching being broken by an and mask applied to the input. NFC

Playing around with other BMI/TBM instructions after PR35792 and saw this.

llvm-svn: 324987

6 years ago[X86] Add a blsr test case with a shift from PR35792. NFC
Craig Topper [Tue, 13 Feb 2018 05:33:39 +0000 (05:33 +0000)]
[X86] Add a blsr test case with a shift from PR35792. NFC

The blsr pattern here is missed because the add is shrunk, but the and is not. This leaves an any_extend between them.

llvm-svn: 324986

6 years ago[X86] Teach EVEX->VEX pass to turn VRNDSCALE into VROUND when bits 7:4 of the immedia...
Craig Topper [Tue, 13 Feb 2018 04:19:26 +0000 (04:19 +0000)]
[X86] Teach EVEX->VEX pass to turn VRNDSCALE into VROUND when bits 7:4 of the immediate are 0 and the regular EVEX->VEX checks pass.

Bits 7:4 control the scale part of the operation. If the scale is 0 the behavior is equivalent to VROUND.

Fixes PR36246

llvm-svn: 324985

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 13 Feb 2018 04:19:23 +0000 (04:19 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 324984

6 years ago[Utils] Salvage debug info from all no-op casts
Vedant Kumar [Tue, 13 Feb 2018 03:34:23 +0000 (03:34 +0000)]
[Utils] Salvage debug info from all no-op casts

We already try to salvage debug values from no-op bitcasts and inttoptr
instructions: we should handle ptrtoint instructions as well.

This saves an additional 24,444 debug values in a stage2 build of clang,
and (according to llvm-dwarfdump --statistics) provides an additional
289 unique source variables.

llvm-svn: 324982

6 years agoRevert "Rewrite the cached map used for locating the most precise DIE among inlined...
David Blaikie [Tue, 13 Feb 2018 01:52:30 +0000 (01:52 +0000)]
Revert "Rewrite the cached map used for locating the most precise DIE among inlined subroutines for a given address."

Seeing some inlining missing in internal uses of symbolizer. I'll work
on a reproduction, tests, improvements & recommit as soon as possible.

(Chandler would like it to be known that this improvement did make
check-llvm 4x faster... - so there's certainly some fairly good
motivation to push on fixing/figuring this out & getting it back in)

This reverts commit r321345.

llvm-svn: 324981

6 years ago[X86] Use getTypeAction in most places that were checking ExperimentalVectorWideningL...
Craig Topper [Tue, 13 Feb 2018 01:49:58 +0000 (01:49 +0000)]
[X86] Use getTypeAction in most places that were checking ExperimentalVectorWideningLegalization.

This will allow more flexibility in what types we legalize via widening or not. This should help with a couple lines in D41062.

llvm-svn: 324980

6 years ago[X86] Remove duplicate CHECK-LABEL line the update script didn't delete when I conver...
Craig Topper [Tue, 13 Feb 2018 01:36:27 +0000 (01:36 +0000)]
[X86] Remove duplicate CHECK-LABEL line the update script didn't delete when I converted the test.

llvm-svn: 324979

6 years agoAdd REQUIRES: zlib to gdb-index.s test
Reid Kleckner [Tue, 13 Feb 2018 01:19:56 +0000 (01:19 +0000)]
Add REQUIRES: zlib to gdb-index.s test

llvm-svn: 324978

6 years agoRevert "Document the shortcomings of DwarfExpression::addMachineReg()."
Adrian Prantl [Tue, 13 Feb 2018 01:17:35 +0000 (01:17 +0000)]
Revert "Document the shortcomings of DwarfExpression::addMachineReg()."

This reverts commit r324972. This commit broke a bot, so perhaps it is
testable after all?

llvm-svn: 324977

6 years ago[Utils] Salvage debug info of DCE'ed mul/sdiv/srem instructions
Vedant Kumar [Tue, 13 Feb 2018 01:09:52 +0000 (01:09 +0000)]
[Utils] Salvage debug info of DCE'ed mul/sdiv/srem instructions

Here are the number of additional debug values salvaged in a stage2
build of clang:

  63 SALVAGE: MUL
  1250 SALVAGE: SDIV

(No values were salvaged from `srem` instructions in this experiment,
but it's a simple case to handle so we might as well.)

llvm-svn: 324976