Commit Graph

282682 Commits

Author SHA1 Message Date
Eugene Leviant 6a77bdb1eb [IRMover] Move type name extraction to a separate function. NFC
llvm-svn: 325110
2018-02-14 10:32:47 +00:00
Pavel Labath 84e59046e1 Fix build broken by r325107
Older gcc versions need an extra pair of {}s to convert a string literal
into llvm::StringLiteral.

llvm-svn: 325109
2018-02-14 10:25:32 +00:00
Pavel Labath f1440978a1 Implement a case-folding version of DJB hash
Summary:
This patch implements a variant of the DJB hash function which folds the
input according to the algorithm in the Dwarf 5 specification (Section
6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18,
"Case Mappings").

To achieve this, I have added a llvm::sys::unicode::foldCharSimple
function, which performs this mapping. The implementation of this
function was generated from the CaseMatching.txt file from the Unicode
spec using a python script (which is also included in this patch). The
script tries to optimize the function by coalescing adjecant mappings
with the same shift and stride (terms I made up). Theoretically, it
could be made a bit smarter and merge adjecant blocks that were
interrupted by only one or two characters with exceptional mapping, but
this would save only a couple of branches, while it would greatly
complicate the implementation, so I deemed it was not worth it.

Since we assume that the vast majority of the input characters will be
US-ASCII, the folding hash function has a fast-path for handling these,
and only whips out the full decode+fold+encode logic if we encounter a
character outside of this range. It might be possible to implement the
folding directly on utf8 sequences, but this would also bring a lot of
complexity for the few cases where we will actually need to process
non-ascii characters.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits

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

llvm-svn: 325107
2018-02-14 10:05:09 +00:00
Henry Wong eb18d772a1 Test commit access
llvm-svn: 325103
2018-02-14 07:32:27 +00:00
Elena Demikhovsky 945b7e5aa6 Adding a width of the GEP index to the Data Layout.
Making a width of GEP Index, which is used for address calculation, to be one of the pointer properties in the Data Layout.
p[address space]:size:memory_size:alignment:pref_alignment:index_size_in_bits.
The index size parameter is optional, if not specified, it is equal to the pointer size.

Till now, the InstCombiner normalized GEPs and extended the Index operand to the pointer width.
It works fine if you can convert pointer to integer for address calculation and all registered targets do this.
But some ISAs have very restricted instruction set for the pointer calculation. During discussions were desided to retrieve information for GEP index from the Data Layout.
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120416.html

I added an interface to the Data Layout and I changed the InstCombiner and some other passes to take the Index width into account.
This change does not affect any in-tree target. I added tests to cover data layouts with explicitly specified index size.

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

llvm-svn: 325102
2018-02-14 06:58:08 +00:00
Craig Topper 5ecea9fff5 [SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.
This exact code already exists a little further up.

llvm-svn: 325101
2018-02-14 06:51:57 +00:00
Serge Pavlov e51adc57f3 Use delete[] instead of free
llvm-svn: 325100
2018-02-14 06:14:30 +00:00
Serge Pavlov 4dff9f9a39 Use delete[] to deallocate array of chars
llvm-svn: 325099
2018-02-14 05:14:31 +00:00
Serge Pavlov e4e9a1f3b9 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
2018-02-14 03:26:27 +00:00
Sam McCall ed2717ad33 [clangd] Configure clangd tracing with CLANGD_TRACE env instead of -trace flag
llvm-svn: 325097
2018-02-14 03:20:07 +00:00
Richard Smith f1f20e6802 Fix a couple of places where we assumed that non-type template parameters are always rvalues.
llvm-svn: 325095
2018-02-14 02:07:53 +00:00
Rafael Espindola 1d76120d9a 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
2018-02-14 01:42:26 +00:00
Erik Pilkington 0bae6d8c14 [demangler] Support for exception specifications on function types.
llvm-svn: 325093
2018-02-14 01:08:20 +00:00
Erik Pilkington bb0e34558f [demangler] Simplify the AST for function types, NFC.
llvm-svn: 325092
2018-02-14 01:08:17 +00:00
Bruce Mitchener 56f6352354 Fix incorrect indentation.
Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 325087
2018-02-14 00:29:38 +00:00
Reid Kleckner 1631ac1696 [X86] Remove dead code from retpoline thunk generation
Follow-up to r325049

llvm-svn: 325085
2018-02-14 00:24:29 +00:00
Erich Keane 293a0556f3 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
2018-02-14 00:14:07 +00:00
Vitaly Buka 35fa7cdf50 [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
2018-02-14 00:00:43 +00:00
George Karpenkov b7120c944b [analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment
llvm-svn: 325070
2018-02-13 23:36:01 +00:00
Sam McCall 6358064d02 Fix off-by-one in set_thread_name which causes truncation to fail on Linux
llvm-svn: 325069
2018-02-13 23:23:59 +00:00
Vedant Kumar 361b5e1169 [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
2018-02-13 23:05:46 +00:00
Daniel Sanders 7fc87360e9 [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
2018-02-13 23:02:44 +00:00
Sanjay Patel 3ce76ad26f [InstCombine] put tests of mul with neg operand(s) together; NFC
llvm-svn: 325066
2018-02-13 23:02:12 +00:00
Rui Ueyama 2d9e7a8956 Use toString to stringize sections and files.
Differential Revision: https://reviews.llvm.org/D43251

llvm-svn: 325065
2018-02-13 22:56:49 +00:00
Rui Ueyama 7d67dd118a 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
2018-02-13 22:30:52 +00:00
Vedant Kumar 1d5d31b706 [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
2018-02-13 22:27:17 +00:00
Sanjay Patel 7558d860af [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
2018-02-13 22:24:37 +00:00
Jan Vesely b424954682 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
2018-02-13 22:09:46 +00:00
Jan Vesely ed28c4458a 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
2018-02-13 22:09:44 +00:00
Jan Vesely 86cbf56a4b 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
2018-02-13 22:09:42 +00:00
Jan Vesely 65fd65efbf 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
2018-02-13 22:09:41 +00:00
Jan Vesely 2d3b6dfdca 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
2018-02-13 22:09:38 +00:00
Jan Vesely 021264c75a 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
2018-02-13 22:09:37 +00:00
Jan Vesely 4879dd7471 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
2018-02-13 22:09:35 +00:00
Jan Vesely bca92445ba 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
2018-02-13 22:09:33 +00:00
Jan Vesely aad28681c2 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
2018-02-13 22:09:31 +00:00
Nico Weber 758fbacea5 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
2018-02-13 21:31:47 +00:00
Sanjay Patel fdb3b036cc [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
2018-02-13 21:19:42 +00:00
Matt Morehouse 36c89b3c77 [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
2018-02-13 20:52:15 +00:00
Reid Kleckner 91e11a83fc [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
2018-02-13 20:47:49 +00:00
Sanjay Patel cb8ac00f73 [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
2018-02-13 20:41:22 +00:00
Reid Kleckner fd52096259 [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
2018-02-13 20:32:53 +00:00
Sam Clegg 447ae4044d [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
2018-02-13 20:29:38 +00:00
Sam Clegg a189230bf5 [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
2018-02-13 20:14:26 +00:00
Aditya Nandakumar 6250b18831 [GISel]: Add Pattern Matcher for G_FMUL.
https://reviews.llvm.org/D43206

llvm-svn: 325044
2018-02-13 20:09:13 +00:00
Aditya Nandakumar 413495fbe7 [GISel]: Make Pattern matcher for FADD commutative
llvm-svn: 325043
2018-02-13 20:09:11 +00:00
Stanislav Mekhanoshin 127dbdbb02 [AMDGPU] Cleanup in memory legalizer tests. NFC.
llvm-svn: 325042
2018-02-13 20:03:32 +00:00
Adrian Prantl 984251c7cb 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
2018-02-13 19:54:00 +00:00
Richard Trieu 4d06bef38d Update StmtProfile.cpp to handle zero template arguments.
Treat having no templates arguments differently than having zero template
arguments when profiling.

llvm-svn: 325040
2018-02-13 19:53:40 +00:00
Sanjay Patel 2e2958497f [InstCombine] fix test comment and add vector test; NFC
llvm-svn: 325039
2018-02-13 18:48:27 +00:00