Skip to content
  1. Mar 03, 2020
    • Florian Hahn's avatar
      [VPlan] Add getPlan() to VPBlockBase. · 05afa555
      Florian Hahn authored
      This patch adds a getPlan accessor to VPBlockBase, which finds the entry
      block of the plan containing the block and returns the plan set for this
      block.
      
      VPBlockBase contains a VPlan pointer, but it should only be set for
      the entry block of a plan. This allows moving blocks without updating
      the pointer for each moved block and in the future we might introduce a
      parent relationship between plans and blocks, similar to the one in LLVM IR.
      
      Reviewers: rengolin, hsaito, fhahn, Ayal, dorit, gilr
      
      Reviewed By: gilr
      
      Differential Revision: https://reviews.llvm.org/D74445
      05afa555
    • serge-sans-paille's avatar
      Syndicate, test and fix base64 implementation · 1454c27b
      serge-sans-paille authored
      llvm/Support/Base64, fix its implementation and provide a decent test suite.
      
      Previous implementation code was using + operator instead of | to combine
      
      results, which is a problem when shifting signed values. (0xFF << 16) is
      implicitly converted to a (signed) int, and thus results in 0xffff0000,
      h is
      negative. Combining negative numbers with a + in that context is not what we
      want to do.
      
      This is a recommit of 5a1958f2 with UB removved.
      
      This fixes https://github.com/llvm/llvm-project/issues/149.
      
      Differential Revision: https://reviews.llvm.org/D75057
      1454c27b
    • Hans Wennborg's avatar
      Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) · 916be8fd
      Hans Wennborg authored
      and follow-ups:
      a2ca1c2d "build: disable zlib by default on Windows"
      2181bf40 "[CMake] Link against ZLIB::ZLIB"
      1079c68a "Attempt to fix ZLIB CMake logic on Windows"
      
      This changed the output of llvm-config --system-libs, and more
      importantly it broke stand-alone builds. Instead of piling on more fix
      attempts, let's revert this to reduce the risk of more breakages.
      916be8fd
  2. Mar 02, 2020
  3. Feb 29, 2020
    • Reid Kleckner's avatar
      Avoid including FileSystem.h from MemoryBuffer.h · af450eab
      Reid Kleckner authored
      Lots of headers pass around MemoryBuffer objects, but very few open
      them. Let those that do include FileSystem.h.
      
      Saves ~250 includes of Chrono.h & FileSystem.h:
      
      $ diff -u thedeps-before.txt thedeps-after.txt | grep '^[-+] ' | sort | uniq -c | sort -nr
          254 -    ../llvm/include/llvm/Support/FileSystem.h
          253 -    ../llvm/include/llvm/Support/Chrono.h
          237 -    ../llvm/include/llvm/Support/NativeFormatting.h
          237 -    ../llvm/include/llvm/Support/FormatProviders.h
          192 -    ../llvm/include/llvm/ADT/StringSwitch.h
          190 -    ../llvm/include/llvm/Support/FormatVariadicDetails.h
      ...
      
      This requires duplicating the file_t typedef, which is unfortunate. I
      sunk the choice of mapping mode down into the cpp file using variable
      template specializations instead of class members in headers.
      af450eab
    • Vedant Kumar's avatar
      Reland: [Coverage] Revise format to reduce binary size · dd1ea9de
      Vedant Kumar authored
      Try again with an up-to-date version of D69471 (99317124 was a stale
      revision).
      
      ---
      
      Revise the coverage mapping format to reduce binary size by:
      
      1. Naming function records and marking them `linkonce_odr`, and
      2. Compressing filenames.
      
      This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
      and speeds up end-to-end single-threaded report generation by 10%. For
      reference the compressed name data in llc is 81MB (__llvm_prf_names).
      
      Rationale for changes to the format:
      
      - With the current format, most coverage function records are discarded.
        E.g., more than 97% of the records in llc are *duplicate* placeholders
        for functions visible-but-not-used in TUs. Placeholders *are* used to
        show under-covered functions, but duplicate placeholders waste space.
      
      - We reached general consensus about giving (1) a try at the 2017 code
        coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
        duplicates is simpler than alternatives like teaching build systems
        about a coverage-aware database/module/etc on the side.
      
      - Revising the format is expensive due to the backwards compatibility
        requirement, so we might as well compress filenames while we're at it.
        This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).
      
      See CoverageMappingFormat.rst for the details on what exactly has
      changed.
      
      Fixes PR34533 [2], hopefully.
      
      [1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
      [2] https://bugs.llvm.org/show_bug.cgi?id=34533
      
      Differential Revision: https://reviews.llvm.org/D69471
      dd1ea9de
    • Vedant Kumar's avatar
      Revert "[Coverage] Revise format to reduce binary size" · 33888717
      Vedant Kumar authored
      This reverts commit 99317124. This is
      still busted on Windows:
      
      http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/40873
      
      The llvm-cov tests report 'error: Could not load coverage information'.
      33888717
    • Vedant Kumar's avatar
      [Coverage] Revise format to reduce binary size · 99317124
      Vedant Kumar authored
      Revise the coverage mapping format to reduce binary size by:
      
      1. Naming function records and marking them `linkonce_odr`, and
      2. Compressing filenames.
      
      This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
      and speeds up end-to-end single-threaded report generation by 10%. For
      reference the compressed name data in llc is 81MB (__llvm_prf_names).
      
      Rationale for changes to the format:
      
      - With the current format, most coverage function records are discarded.
        E.g., more than 97% of the records in llc are *duplicate* placeholders
        for functions visible-but-not-used in TUs. Placeholders *are* used to
        show under-covered functions, but duplicate placeholders waste space.
      
      - We reached general consensus about giving (1) a try at the 2017 code
        coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
        duplicates is simpler than alternatives like teaching build systems
        about a coverage-aware database/module/etc on the side.
      
      - Revising the format is expensive due to the backwards compatibility
        requirement, so we might as well compress filenames while we're at it.
        This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).
      
      See CoverageMappingFormat.rst for the details on what exactly has
      changed.
      
      Fixes PR34533 [2], hopefully.
      
      [1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
      [2] https://bugs.llvm.org/show_bug.cgi?id=34533
      
      Differential Revision: https://reviews.llvm.org/D69471
      99317124
  4. Feb 28, 2020
    • Reid Kleckner's avatar
      [ADT] Allow K to be incomplete during DenseMap<K*, V> instantiation · 53f51da0
      Reid Kleckner authored
      DenseMap requires two sentinel values for keys: empty and tombstone
      values. To avoid undefined behavior, LLVM aligns the two sentinel
      pointers to alignof(T). This requires T to be complete, which is
      needlessly restrictive.
      
      Instead, assume that DenseMap pointer keys have a maximum alignment of
      4096, and use the same sentinel values for all pointer keys. The new
      sentinels are:
        empty:     static_cast<uintptr_t>(-1) << 12
        tombstone: static_cast<uintptr_t>(-2) << 12
      
      These correspond to the addresses of -4096 and -8192. Hopefully, such a
      key is never inserted into a DenseMap.
      
      I encountered this while looking at making clang's SourceManager not
      require FileManager.h, but it has several maps keyed on classes defined
      in FileManager.h. FileManager depends on various LLVM FS headers, which
      cumulatively take ~200ms to parse, and are generally not needed.
      
      Reviewed By: hans
      
      Differential Revision: https://reviews.llvm.org/D75301
      53f51da0
    • Hiroshi Yamauchi's avatar
      [CallPromotionUtils] Add missing promotion legality check to tryPromoteCall. · 41e06ae7
      Hiroshi Yamauchi authored
      Summary: This fixes the crash that led to the revert of D69591.
      
      Reviewers: davidxl
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75307
      41e06ae7
    • Jeremy Morse's avatar
      [DebugInfo] Re-implement LexicalScopes dominance method, add unit tests · 6af859dc
      Jeremy Morse authored
      Way back in D24994, the combination of LexicalScopes::dominates and
      LiveDebugValues was identified as having worst-case quadratic complexity,
      but it wasn't triggered by any code path at the time. I've since run into a
      scenario where this occurs, in a very large basic block where large numbers
      of inlined DBG_VALUEs are present.
      
      The quadratic-ness comes from LiveDebugValues::join calling "dominates" on
      every variable location, and LexicalScopes::dominates potentially touching
      every instruction in a block to test for the presence of a scope. We have,
      however, already computed the presence of scopes in blocks, in the
      "InstrRanges" of each scope. This patch switches the dominates method to
      examine whether a block is present in a scope's InsnRanges, avoiding
      walking through the whole block.
      
      At the same time, fix getMachineBasicBlocks to account for the fact that
      InsnRanges can cover multiple blocks, and add some unit tests, as Lexical
      Scopes didn't have any.
      
      Differential revision: https://reviews.llvm.org/D73725
      6af859dc
    • Pavel Labath's avatar
      [DataExtractor] Improve error message when we run off the end of the buffer · 5754a61e
      Pavel Labath authored
      Summary: Include the offset at which this happened.
      
      Reviewers: dblaikie, jhenderson
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D75265
      5754a61e
    • Reid Kleckner's avatar
      [Support] Remove byte swapping from MathExtras.h · e3a9b0f3
      Reid Kleckner authored
      MathExtras.h was just wrapping SwapByteOrder.h functionality, so have
      the callers use it directly.  Use the MathExtras.h name (ByteSwap_NN) as
      the standard naming, since it appears to be the most popular.
      e3a9b0f3
  5. Feb 27, 2020
    • Vedant Kumar's avatar
      unittest: Convert EXPECT_EQ iterator checks to use EXPECT_TRUE instead · 36789388
      Vedant Kumar authored
      Hopefully fixes compile errors on some bots, like:
      
      http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/13383/steps/ninja%20check%201/logs/stdio
      
      /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/unittests/ADT/CoalescingBitVectorTest.cpp:452:3:   required from here
      /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h:377:56: error: ‘const class llvm::CoalescingBitVector<long unsigned int>::const_iterator’ has no member named ‘begin’
         for (typename C::const_iterator it = container.begin();
                                                              ^
      /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h:378:11: error: ‘const class llvm::CoalescingBitVector<long unsigned int>::const_iterator’ has no member named ‘end’
              it != container.end(); ++it, ++count) {
                 ^
      36789388
    • Vedant Kumar's avatar
      unittest: Disable checks to work around compiler errors · 3156b1cf
      Vedant Kumar authored
      On some bots, using gtest asserts to compare iterators does not compile,
      and I'm not sure why (this certainly compiles with clang). Disable the
      checks for now :/.
      
      ```
      C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\llvm\utils\unittest\googletest\include\gtest/gtest-printers.h(377): error C2039: 'begin': is not a member of 'llvm::CoalescingBitVector<unsigned int,16>::const_iterator'
      C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\llvm\include\llvm/ADT/CoalescingBitVector.h(243): note: see declaration of 'llvm::CoalescingBitVector<unsigned int,16>::const_iterator'
      C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\llvm\utils\unittest\googletest\include\gtest/gtest-printers.h(478): note: see reference to function template instantiation 'void testing::internal::DefaultPrintTo<T>(testing::internal::IsContainer,testing::internal::false_type,const C &,std::ostream *)' being compiled
              with
              [
                  T=T1,
                  C=T1
              ]
      ```
      
      http://lab.llvm.org:8011/builders/llvm-clang-x86_64-win-fast/builds/12006/steps/test-check-llvm-unit/logs/stdio
      http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34521/steps/ninja%20check%201/logs/stdio
      3156b1cf
    • Vedant Kumar's avatar
      [ADT] Add CoalescingBitVector, implemented using IntervalMap [1/3] · b0142cd9
      Vedant Kumar authored
      Add CoalescingBitVector to ADT. This is part 1 of a 3-part series to
      address a compile-time explosion issue in LiveDebugValues.
      
      ---
      
      CoalescingBitVector is a bitvector that, under the hood, relies on an
      IntervalMap to coalesce elements into intervals.
      
      CoalescingBitVector efficiently represents sets which predominantly
      contain contiguous ranges (e.g.  the VarLocSets in LiveDebugValues,
      which are very long sequences that look like {1, 2, 3, ...}). OTOH,
      CoalescingBitVector isn't good at representing sets with lots of gaps
      between elements. The first N coalesced intervals of set bits are stored
      in-place (in the initial heap allocation).
      
      Compared to SparseBitVector, CoalescingBitVector offers more predictable
      performance for non-sequential find() operations. This provides a
      crucial speedup in LiveDebugValues.
      
      Differential Revision: https://reviews.llvm.org/D74984
      b0142cd9
    • Alexey Lapshin's avatar
      [Debuginfo][NFC] Unify error reporting routines inside DebugInfoDWARF. · f943443e
      Alexey Lapshin authored
      Summary:
      Error reporting in DebugInfoDWARF library currently done in three ways :
      
      1. Direct calls to WithColor::error()/WithColor::warning()
      2. ErrorPolicy defaultErrorHandler(Error E);
      3. void dumpWarning(Error Warning);
      
      additionally, other locations could have more variations:
      
      lld/ELF/SyntheticSection.cpp
          if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
            error(toString(sec) + ": " + toString(std::move(e)));
      
      DebugInfo/DWARF/DWARFUnit.cpp
        if (Error e = tryExtractDIEsIfNeeded(CUDieOnly))
          WithColor::error() << toString(std::move(e));
      
      Thus error reporting could look inconsistent. To have a consistent error
      messages it is necessary to have a possibility to redefine error
      reporting functions. This patch creates two handlers and allows to
      redefine them. It also patches all places inside DebugInfoDWARF
      to use these handlers.
      
      The intention is always to use following handlers for error reporting
      purposes inside DebugInfoDWARF:
      
      DebugInfo/DWARF/DWARFContext.h
      
      std::function<void(Error E)> RecoverableErrorHandler = WithColor::defaultErrorHandler;
      std::function<void(Error E)> WarningHandler = WithColor::defaultWarningHandler;
      
      This is last patch from series of patches: D74481, D74635, D75118.
      
      Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere
      
      Reviewed By: jhenderson
      
      Subscribers: grimar, hiraditya, llvm-commits
      
      Tags: #llvm, #debug-info
      
      Differential Revision: https://reviews.llvm.org/D74308
      f943443e
  6. Feb 26, 2020
    • Alexey Lapshin's avatar
      [DebugInfo][NFC] Remove handler with ErrorPolicy from DWARFContext. · 949134e2
      Alexey Lapshin authored
      Summary:
      Current LLVM code base does not use error handler with ErrorPolicy.
      This patch removes ErrorPolicy from DWARFContext.
      
      This patch is extracted from the D74308.
      
      Reviewers: jhenderson, dblaikie, grimar, aprantl, JDevlieghere
      
      Reviewed By: grimar
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm, #debug-info
      
      Differential Revision: https://reviews.llvm.org/D75118
      949134e2
    • Pavel Labath's avatar
      Introduce DWARFDataExtractor::getInitialLength · 3c36d8da
      Pavel Labath authored
      Summary:
      This patch introduces a function to house the code needed to do the
      DWARF64 detection dance. The function decodes the initial length field
      and returns it as a pair containing the actual length, and the DWARF
      encoding.
      
      This patch does _not_ attempt to handle the problem of detecting lengths
      which extend past the size of the section, or cases when reads of a
      single contribution accidentally escape beyond its specified length, but
      I think it's useful in its own right.
      
      Reviewers: dblaikie, jhenderson, ikudrin
      
      Subscribers: hiraditya, probinson, aprantl, JDevlieghere, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74560
      3c36d8da
    • Lang Hames's avatar
      [ORC] Remove the JITDylib::SymbolTableEntry::isInMaterializingState() method. · b7aa1cc3
      Lang Hames authored
      It was being used inconsistently. Uses have been replaced with direct checks
      on the symbol state.
      b7aa1cc3
    • Quentin Colombet's avatar
      [GISel][KnownBits] Update a comment regarding the effect of cache on PHIs · 5bf0023b
      Quentin Colombet authored
      Unlike what I claimed in my previous commit. The caching is
      actually not NFC on PHIs.
      
      When we put a big enough max depth, we end up simulating loops.
      The cache is effectively cutting the simulation short and we
      get less information as a result.
      E.g.,
      ```
      v0 = G_CONSTANT i8 0xC0
      jump
      v1 = G_PHI i8 v0, v2
      v2 = G_LSHR i8 v1, 1
      ```
      
      Let say we want the known bits of v1.
      - With cache:
      Set v1 cache to we know nothing
      v1 is v0 & v2
      v0 gives us 0xC0
      v2 gives us known bits of v1 >> 1
      v1 is in the cache
      => v1 is 0, thus v2 is 0x80
      Finally v1 is v0 & v2 => 0x80
      
      - Without cache and enough depth to do two iteration of the loop:
      v1 is v0 & v2
      v0 gives us 0xC0
      v2 gives us known bits of v1 >> 1
      v1 is v0 & v2
      v0 is 0xC0
      v2 is v1 >> 1
      Reach the max depth for v1...
      unwinding
      v1 is know nothing
      v2 is 0x80
      v0 is 0xC0
      v1 is 0x80
      v2 is 0xC0
      v0 is 0xC0
      v1 is 0xC0
      
      Thus now v1 is 0xC0 instead of 0x80.
      
      I've added a unittest demonstrating that.
      
      NFC
      5bf0023b
  7. Feb 25, 2020
  8. Feb 24, 2020
  9. Feb 22, 2020
  10. Feb 21, 2020
    • Fangrui Song's avatar
    • Pavel Labath's avatar
      [Error/unittests] Add a FailedWithMessage gtest matcher · b55c58a2
      Pavel Labath authored
      Summary:
      We already have a "Failed" matcher, which can be used to check any
      property of the Error object. However, most frequently one just wants to
      check the error message, and while this is possible with the "Failed"
      matcher, it is also very convoluted
      (Failed<ErrorInfoBase>(testing::Property(&ErrorInfoBase::message, "the
      message"))).
      
      Now, one can just write: FailedWithMessage("the message"). I expect that
      most of the usages will remain this simple, but the argument of the
      matcher is not limited to simple strings -- the argument of the matcher
      can be any other matcher, so one can write more complicated assertions
      if needed (FailedWithMessage(ContainsRegex("foo|bar"))). If one wants to
      match multiple error messages, he can pass multiple arguments to the
      matcher.
      
      If one wants to match the message list as a whole (perhaps to check the
      message count), I've also included a FailedWithMessageArray matcher,
      which takes a single matcher receiving a vector of error message
      strings.
      
      Reviewers: sammccall, dblaikie, jhenderson
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74898
      b55c58a2
Loading