1. Sep 28, 2017
  2. Sep 27, 2017
    • Roman Lebedev's avatar
      [Support] mapped_file_region: store size as size_t · 7c983671
      Roman Lebedev authored
      Summary:
      Found when testing stage-2 build with D38101.
      
      ```
      In file included from /build/llvm/lib/Support/Path.cpp:1045:
      /build/llvm/lib/Support/Unix/Path.inc:648:14: error: comparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare]
        if (length > std::numeric_limits<size_t>::max()) {
            ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ```
      
      `size_t` is `uint64_t` here, apparently, thus any `uint64_t` value
      always fits into `size_t`.
      
      Initial patch was to use some preprocessor logic to
      not check if the size is known to fit at compile time.
      But Zachary Turner suggested using this approach.
      
      Reviewers: Bigcheese, rafael, zturner, mehdi_amini
      
      Reviewed by (via email): zturner
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D38132
      
      llvm-svn: 314312
      7c983671
    • Alex Shlyapnikov's avatar
      [Sanitizers] Allocator: new "release memory to OS" implementation · 04ce5ac3
      Alex Shlyapnikov authored
      Summary:
      The current implementation of the allocator returning freed memory
      back to OS (controlled by allocator_release_to_os_interval_ms flag)
      requires sorting of the free chunks list, which has two major issues,
      first, when free list grows to millions of chunks, sorting, even the
      fastest one, is just too slow, and second, sorting chunks in place
      is unacceptable for Scudo allocator as it makes allocations more
      predictable and less secure.
      
      The proposed approach is linear in complexity (altough requires quite
      a bit more temporary memory). The idea is to count the number of free
      chunks on each memory page and release pages containing free chunks
      only. It requires one iteration over the free list of chunks and one
      iteration over the array of page counters. The obvious disadvantage
      is the allocation of the array of the counters, but even in the worst
      case we support (4T allocator space, 64 buckets, 16 bytes bucket size,
      full free list, which leads to 2 bytes per page counter and ~17M page
      counters), requires just about 34Mb of the intermediate buffer (comparing
      to ~64Gb of actually allocated chunks) and usually it stays under 100K
      and released after each use. It is expected to be a relatively rare event,
      releasing memory back to OS, keeping the buffer between those runs
      and added complexity of the bookkeeping seems unnesessary here (it can
      always be improved later, though, never say never).
      
      The most interesting problem here is how to calculate the number of chunks
      falling into each memory page in the bucket. Skipping all the details,
      there are three cases when the number of chunks per page is constant:
        1) P >= C, P % C == 0 --> N = P / C
        2) C > P , C % P == 0 --> N = 1
        3) C <= P, P % C != 0 && C % (P % C) == 0 --> N = P / C + 1
      where P is page size, C is chunk size and N is the number of chunks per
      page and the rest of the cases, where the number of chunks per page is
      calculated on the go, during the page counter array iteration.
      
      Among the rest, there are still cases where N can be deduced from the
      page index, but they require not that much less calculations per page
      than the current "brute force" way and 2/3 of the buckets fall into
      the first three categories anyway, so, for the sake of simplicity,
      it was decided to stick to those two variations. It can always be
      refined and improved later, should we see that brute force way slows
      us down unacceptably.
      
      Reviewers: eugenis, cryptoad, dvyukov
      
      Subscribers: kubamracek, mehdi_amini, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D38245
      
      llvm-svn: 314311
      04ce5ac3
    • Sean Eveson's avatar
      [llvm-cov] Create directory structure when filtering using -name*= options · 51b81747
      Sean Eveson authored
      Before this change using any of the -name*= command line options with an output
      directory would result in a single file (functions.txt/functions.html)
      containing the coverage for those specific functions. Now you get the same
      directory structure as when not using any -name*= options.
      
      Differential Revision: https://reviews.llvm.org/D38280
      
      llvm-svn: 314310
      51b81747
    • Marc-Andre Laperle's avatar
      [clangd] Handle InitializeParams and store rootUri · 37de9718
      Marc-Andre Laperle authored
      Summary:
      The root Uri is the workspace location and will be useful in the context of
      indexing. We could also add more things to InitializeParams in order to
      configure Clangd for C/C++ sepecific extensions.
      
      Reviewers: ilya-biryukov, bkramer, krasimir, Nebiroth
      
      Reviewed By: ilya-biryukov
      
      Subscribers: ilya-biryukov
      
      Tags: #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D38093
      
      llvm-svn: 314309
      37de9718
    • Sanjay Patel's avatar
      [SimplifyCFG] add a struct to house optional folds (PR34603) · 0f9b4773
      Sanjay Patel authored
      This was intended to be no-functional-change, but it's not - there's a test diff.
      
      So I thought I should stop here and post it as-is to see if this looks like what was expected 
      based on the discussion in PR34603:
      https://bugs.llvm.org/show_bug.cgi?id=34603
      
      Notes:
       1. The test improvement occurs because the existing 'LateSimplifyCFG' marker is not carried 
          through the recursive calls to 'SimplifyCFG()->SimplifyCFGOpt().run()->SimplifyCFG()'. 
          The parameter isn't passed down, so we pick up the default value from the function signature 
          after the first level. I assumed that was a bug, so I've passed 'Options' down in all of the 
          'SimplifyCFG' calls.
      
       2. I split 'LateSimplifyCFG' into 2 bits: ConvertSwitchToLookupTable and KeepCanonicalLoops. 
          This would theoretically allow us to differentiate the transforms controlled by those params 
          independently.
      
       3. We could stash the optional AssumptionCache pointer and 'LoopHeaders' pointer in the struct too. 
          I just stopped here to minimize the diffs.
      
       4. Similarly, I stopped short of messing with the pass manager layer. I have another question that 
          could wait for the follow-up: why is the new pass manager creating the pass with LateSimplifyCFG 
          set to true no matter where in the pipeline it's creating SimplifyCFG passes?
      
          // Create an early function pass manager to cleanup the output of the
          // frontend.
          EarlyFPM.addPass(SimplifyCFGPass());
      
          -->
      
          /// \brief Construct a pass with the default thresholds
          /// and switch optimizations.
          SimplifyCFGPass::SimplifyCFGPass()
             : BonusInstThreshold(UserBonusInstThreshold),
               LateSimplifyCFG(true) {}   <-- switches get converted to lookup tables and loops may not be in canonical form
      
          If this is unintended, then it's possible that the current behavior of dropping the 'LateSimplifyCFG' 
          setting via recursion was masking this bug.
      
      Differential Revision: https://reviews.llvm.org/D38138
      
      llvm-svn: 314308
      0f9b4773
    • Haicheng Wu's avatar
      [InlineCost] add visitSelectInst() · 3ec848bc
      Haicheng Wu authored
      InlineCost can understand Select IR now.  This patch finds free Select IRs and
      continue the propagation of SimplifiedValues, ConstantOffsetPtrs, and
      SROAArgValues.
      
      Differential Revision: https://reviews.llvm.org/D37198
      
      llvm-svn: 314307
      3ec848bc
    • Gadi Haber's avatar
      [X86][SKX][KNL] Updated regression tests to use -mattr instead of -mcpu flag.NFC. · 87337a2b
      Gadi Haber authored
      NFC.
       Updated 8 regression tests to use -mattr instead of -mcpu flag as follows:
       -mcpu=knl --> -mattr=+avx512f
       -mcpu=skx --> -mattr=+avx512f,+avx512bw,+avx512vl,+avx512dq
      
      The updates are as part of the preparation of a large commit to add all instruction scheduling for the SKX target.
      
      Reviewers: delena, zvi, RKSimon
      Differential Revision: https://reviews.llvm.org/D38222
      
      Change-Id: I2381c9b5bb75ecacfca017243c22d054f6eddd14
      llvm-svn: 314306
      87337a2b
    • Zvi Rackover's avatar
      X86 Tests: Unsigned saturation subtraction tests. NFC. · eb7a0bf8
      Zvi Rackover authored
      Summary:
      Adding tests for D37534.
      
      Commit on behalf of julia.koval@intel.com
      
      Reviewers: n.bozhenov, zvi, spatel, DavidKreitzer
      
      Reviewed By: zvi
      
      Differential Revision: https://reviews.llvm.org/D37510
      
      llvm-svn: 314305
      eb7a0bf8
    • Anastasia Stulova's avatar
      [OpenCL] Handle address space conversion while setting type alignment. · 0a72ed40
      Anastasia Stulova authored
      Added missing addrspacecast case in alignment computation
      logic of pointer type emission in IR generation.
      
      Differential Revision: https://reviews.llvm.org/D37804
      
      llvm-svn: 314304
      0a72ed40
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Add an additional test for D34888 · 965c7e9c
      Gheorghe-Teodor Bercea authored
      Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905
      
      Reviewers: Hahnfeld, carlo.bertolli, caomhin, ABataev
      
      Reviewed By: Hahnfeld
      
      Subscribers: tra, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D38040
      
      llvm-svn: 314303
      965c7e9c
    • Coby Tayree's avatar
      revert rL314300 · d5e7410d
      Coby Tayree authored
      accidently added only tests w/o the respective changes..
      
      llvm-svn: 314302
      d5e7410d
    • Krzysztof Parzyszek's avatar
      d0b6ceb2
    • Coby Tayree's avatar
      [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions · 0b1ed7e1
      Coby Tayree authored
      Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized.
      supersedes D33277, D35775
      Corrsponds with D37412, D37413
      
      llvm-svn: 314300
      0b1ed7e1
    • Mikael Holmen's avatar
      3bcc9f0c
    • Artem Dergachev's avatar
      [analyzer] Fix an outdated comment in a test. NFC. · d85a994c
      Artem Dergachev authored
      llvm-svn: 314298
      d85a994c
    • Hiroshi Inoue's avatar
      [PowerPC] eliminate unconditional branch to the next instruction · ed1ffa49
      Hiroshi Inoue authored
      This patch makes analyzeBranch eliminate unconditional branch to the next instruction.
      After basic blocks are re-organized by optimizers, such as machine block placement, a BB may end with an unconditional branch to the next (fallthrough) BB. This patch removes such redundant branch instruction.
      
      Differential Revision: https://reviews.llvm.org/D37730
      
      llvm-svn: 314297
      ed1ffa49
    • Javed Absar's avatar
      [Misched]: Remove double call getMicroOpFactor.NFC. · 1a77bcc0
      Javed Absar authored
      Reviewed by: @MatzeB
      Differential Revision: https://reviews.llvm.org/D38176
      
      llvm-svn: 314296
      1a77bcc0
    • Coby Tayree's avatar
      [X86][AsmParser] fix PR32035 · 836c50cc
      Coby Tayree authored
      Differential Revision: https://reviews.llvm.org/D37473
      
      llvm-svn: 314295
      836c50cc
    • Jonas Devlieghere's avatar
      [test] Don't verify .debug_line offsets in bitcode tests. · 2bc4c541
      Jonas Devlieghere authored
      The exact values of the .debug_line offsets should not be hard-coded in
      the checks for bitcode tests.
      
      Fixes: http://bb.pgr.jp/builders/test-llvm-i686-linux-RA/builds/543
      llvm-svn: 314294
      2bc4c541
    • Simon Pilgrim's avatar
      [X86][AVX] Improve (i4 bitcast (v4i1 x)) handling for 256-bit vector compare results. · 3b0d9e78
      Simon Pilgrim authored
      As commented on D37849 and rL313547, AVX1 targets were missing a chance to use vmovmskpd for v4f64/v4i64 results for bool vector bitcasts
      
      llvm-svn: 314293
      3b0d9e78
    • Simon Pilgrim's avatar
      Use const where possible. NFCI. · a932bfcc
      Simon Pilgrim authored
      llvm-svn: 314292
      a932bfcc
    • Jonas Devlieghere's avatar