1. Oct 06, 2022
    • Vitaly Buka's avatar
      Revert "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests" · 68f4ceaf
      Vitaly Buka authored
      Breaks some bots, details in https://reviews.llvm.org/D91620
      
      This reverts commit 93b1256e.
      68f4ceaf
    • Vitaly Buka's avatar
    • Aart Bik's avatar
      [mlir][sparse] introduce a higher-order tensor mapping · c48e9087
      Aart Bik authored
      This extension to the sparse tensor type system in MLIR
      opens up a whole new set of sparse storage schemes, such as
      block sparse storage (e.g. BCSR) and ELL (aka jagged diagonals).
      
      This revision merely introduces the type extension and
      initial documentation. The actual interpretation of the type
      (reading in tensors, lowering to code, etc.) will follow.
      
      Reviewed By: Peiming
      
      Differential Revision: https://reviews.llvm.org/D135206
      c48e9087
    • Mark de Wever's avatar
      [libc++][chrono] Implements formatter month. · 1522f190
      Mark de Wever authored
      Partially implements:
      - P1361 Integration of chrono with text formatting
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D134138
      1522f190
    • Sam McCall's avatar
      Fix SourceManager::isBeforeInTranslationUnit bug with token-pasting · 41b51007
      Sam McCall authored
      isBeforeInTranslationUnit compares SourceLocations across FileIDs by
      mapping them onto a common ancestor file, following include/expansion edges.
      
      It is possible to get a tie in the common ancestor, because multiple
      "chunks" of a macro arg will expand to the same macro param token in the body:
        #define ID(X) X
        #define TWO 2
        ID(1 TWO)
      Here two FileIDs both expand into `X` in ID's expansion:
       - one containing `1` and spelled on line 3
       - one containing `2` and spelled by the macro expansion of TWO
      isBeforeInTranslationUnit breaks this tie by comparing the two FileIDs:
      the one "on the left" is always created first and is numerically smaller.
      This seems correct so far.
      
      Prior to this patch it also takes a shortcut (unclear if intentionally).
      Instead of comparing the two FileIDs that directly expand to the same location,
      it compares the original FileIDs being compared. These may not be the
      same if there are multiple macro expansions in between.
      This *almost* always yields the right answer, because macro expansion
      yields "trees" of FileIDs allocated in a contiguous range: when comparing tree A
      to tree B, it doesn't matter what representative you pick.
      
      However, the splitting of >> tokens is modeled as macro expansion (as if
      the first '>' was a macro that expands to a '>' spelled a scratch buffer).
      This splitting occurs retroactively when parsing, so the FileID allocated is
      larger than expected if it were a real macro expansion performed during lexing.
      As a result, macro tree A can be on the left of tree B, and yet contain
      a token-split FileID whose numeric value is *greator* than those in B.
      In this case the tiebreak gives the wrong answer.
      
      Concretely:
        #define ID(X) X
        template <typename> class S{};
        ID(
          ID(S<S<int>> x);
          int y;
        )
      
        Given Greater = (typeloc of S<int>).getEndLoc();
              Y       = (decl of y).getLocation();
        isBeforeInTranslationUnit(Greater, Y) should return true, but returns false.
      
      Here the common FileID of (Greater, Y) is the body of the outer ID
      expansion, and they both expand to X within it.
      With the current tiebreak rules, we compare the FileID of Greater (a split)
      to the FileID of Y (a macro arg expansion into X of the outer ID).
      The former is larger because the token split occurred relatively late.
      
      This patch fixes the issue by removing the shortcut. It tracks the immediate
      FileIDs used to reach the common file, and uses these IDs to break ties.
      In the example, we now compare the macro arg expansion of the inner ID()
      to the macro arg expansion of Y, and find that it is smaller.
      
      This requires some changes to the InBeforeInTUCacheEntry (sic).
      We store a little more data so it's probably slightly slower.
      It was difficult to resist more invasive changes:
       - performance: the sizing is very suspicious, and once the cache "fills up"
         we're thrashing a single entry
       - API: the class seems to be needlessly complicated
      However I tried to avoid mixing these with subtle behavior changes, and
      will send a followup instead.
      
      Differential Revision: https://reviews.llvm.org/D134685
      41b51007
    • Xiang Li's avatar
      [HLSL] Support register binding attribute on global variable · 15aa6430
      Xiang Li authored
      Allow register binding attribute on variables.
      
      Report warning when register binding attribute applies to local variable or static variable.
      It will be ignored in this case.
      
      Type check for register binding is tracked with https://github.com/llvm/llvm-project/issues/57886.
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D134617
      15aa6430
    • Ellis Hoag's avatar
      [Dwarf] Reference the correct CU when inlining · 549773f9
      Ellis Hoag authored
      Sometimes when a function is inlined into a different CU, `llvm-dwarfdump --verify` would find an inlined subroutine with an invalid abstract origin. This is because `DwarfUnit::addDIEEntry()` will incorrectly assume the inlined subroutine and the abstract origin are from the same CU if it can't find the CU for the inlined subroutine.
      
      In the added test, the inlined subroutine for `bar()` is created before the CU for `B.swift` is created, so it tries to point to `goo()` in the wrong CU. Interestingly, if we swap the order of the two functions then we don't see a crash since the module for `goo()` is created first.
      
      The fix is to give a parent DIE to `ScopeDIE` before calling `addDIEEntry()` so that its CU can be found. Luckily, `constructInlinedScopeDIE()` is only called once so we can pass it the DIE of the scope's parent and give it a child just after it's created.
      
      `constructInlinedScopeDIE()` should always return a DIE, so assert that it is not null.
      
      Reviewed By: aprantl
      
      Differential Revision: https://reviews.llvm.org/D135114
      549773f9
    • Alexandre Ganea's avatar
      [mlir][unittest] Fix crash when building with MSVC 2022 · 083617af
      Alexandre Ganea authored
      The test Dialect/Affine/ops.mlir was failing when building with
      Visual Studio 2022 version 17.3.5. This was caused by a bad MSVC codegen, when
      capturing a `constexpr` in a lambda. The bug was reported to Microsoft, see
      differential for more information.
      
      Differential revision: https://reviews.llvm.org/D134227
      083617af
    • Alexandre Ganea's avatar
      941f71ad
    • Alexandre Ganea's avatar
      [Orc] Fix the SharedMemoryMapper dtor · 1c25ce17
      Alexandre Ganea authored
      As briefly discussed on https://reviews.llvm.org/rG1134d3a03facccd75efc5385ba46918bef94fcb6, fix the unintended copy while iterating on Reservations and add a mutex guard, to be symmetric with other usages of Reservations.
      
      Differential revision: https://reviews.llvm.org/D134212
      1c25ce17
    • Sam McCall's avatar
      [Syntax] Fix macro-arg handling in TokenBuffer::spelledForExpanded · 67268ee1
      Sam McCall authored
      A few cases were not handled correctly. Notably:
        #define ID(X) X
        #define HIDE a ID(b)
        HIDE
      spelledForExpanded() would claim HIDE is an equivalent range of the 'b' it
      contains, despite the fact that HIDE also covers 'a'.
      
      While trying to fix this bug, I found findCommonRangeForMacroArgs hard
      to understand (both the implementation and how it's used in spelledForExpanded).
      It relies on details of the SourceLocation graph that are IMO fairly obscure.
      So I've added/revised quite a lot of comments and made some naming tweaks.
      
      Fixes https://github.com/clangd/clangd/issues/1289
      
      Differential Revision: https://reviews.llvm.org/D134618
      67268ee1
  2. Oct 05, 2022