1. Sep 13, 2022
    • Fangrui Song's avatar
      [ELF] Parallelize relocation scanning · e6aebff6
      Fangrui Song authored
      * Change `Symbol::flags` to a `std::atomic<uint16_t>`
      * Add `llvm::parallel::threadIndex` as a thread-local non-negative integer
      * Add `relocsVec` to part.relaDyn and part.relrDyn so that relative relocations can be added without a mutex
      * Arbitrarily change -z nocombreloc to move relative relocations to the end. Disable parallelism for deterministic output.
      
      MIPS and PPC64 use global states for relocation scanning. Keep serial scanning.
      
      Speed-up with mimalloc and --threads=8 on an Intel Skylake machine:
      
      * clang (Release): 1.27x as fast
      * clang (Debug): 1.06x as fast
      * chrome (default): 1.05x as fast
      * scylladb (default): 1.04x as fast
      
      Speed-up with glibc malloc and --threads=16 on a ThunderX2 (AArch64):
      
      * clang (Release): 1.31x as fast
      * scylladb (default): 1.06x as fast
      
      Reviewed By: andrewng
      
      Differential Revision: https://reviews.llvm.org/D133003
      e6aebff6
    • Jez Ng's avatar
      [lld-macho][docs] Cosmetic changes · 7cfff0f2
      Jez Ng authored
      1. Fixed rST hyperlink syntax
      2. Renamed LD64 -> ld64
      3. Moved up the `-no_deduplicate` section so it is right under the
         section talking about how our default dedup behavior differs; IMO
         it makes more sense to read them in that order
      4. De-bullet-listed some other sections so we have less whitespace in
         the rendered page
      5. Since the Mach-O LLD Port page has only one sub-page, don't render an
         entire toctree with just one item. Use a "See also" box instead.
      6. Wrap lines at 80 chars.
      
      Reviewed By: #lld-macho, thevinster
      
      Differential Revision: https://reviews.llvm.org/D133717
      7cfff0f2
    • LLVM GN Syncbot's avatar
      [gn build] Port cf72ddda · aad516ef
      LLVM GN Syncbot authored
      aad516ef
    • Nico Weber's avatar
      90b36e6b
    • Felipe de Azevedo Piovezan's avatar
      Reland "[lldb] Use just-built libcxx for tests when available" · 67c73d88
      Felipe de Azevedo Piovezan authored
      This commit improves upon cc0b5ebf, which added support for
      specifying which libcxx to use when testing LLDB. That patch honored
      requests by tests that had `USE_LIBCPP=1` defined in their makefiles.
      Now, we also use a non-default libcxx if all conditions below are true:
      
      1. The test is not explicitly requesting the use of libstdcpp
      (USE_LIBSTDCPP=1).
      2. The test is not explicitly requesting the use of the system's
      library (USE_SYSTEM_STDLIB=1).
      3. A path to libcxx was either provided by the user through CMake flags
      or libcxx was built together with LLDB.
      
      Condition (2) is new and introduced in this patch in order to support
      tests that are either:
      
      * Cross-platform (such as API/macosx/macCatalyst and
      API/tools/lldb-server). The just-built libcxx is usually not built for
      platforms other than the host's.
      * Cross-language (such as API/lang/objc/exceptions). In this case, the
      Objective C runtime throws an exceptions that always goes through the
      system's libcxx, instead of the just built libcxx. Fixing this would
      require either changing the install-name of the just built libcxx in Mac
      systems, or tuning the DYLD_LIBRARY_PATH variable at runtime.
      
      Some other tests exposes limitations of LLDB when running with a debug
      standard library. TestDbgInfoContentForwardLists had an assertion
      removed, as it was checking for buggy LLDB behavior (which now
      crashes). TestFixIts had a variable renamed, as the old name clashes
      with a standard library name when debug info is present. This is a known
      issue: https://github.com/llvm/llvm-project/issues/34391.
      
      For `TestSBModule`, the way the "main" module is found was changed to
      look for the "a.out" module, instead of relying on the index being 0. In
      some systems, the index 0 is dyld when a custom standard library is
      used.
      
      Differential Revision: https://reviews.llvm.org/D132940
      67c73d88
    • Sanjay Patel's avatar
    • Sanjay Patel's avatar
    • Zequan Wu's avatar
      [LLDB][NativePDB] Add local variables with no location info. · aedad602
      Zequan Wu authored
      If we don't add local variables with no location info, when trying to print it,
      lldb won't find it in the its parent DeclContext, which makes lldb to spend more
      time to search all the way up in DeclContext hierarchy until found same name
      variable or failed. Dwarf plugin also add local vars even if they don't have
      location info.
      
      Differential Revision: https://reviews.llvm.org/D133626
      aedad602
    • Richard Howell's avatar
      [clang] sort additional module maps when serializing · 3c1b4234
      Richard Howell authored
      Sort additional module maps when serializing pcm files. This ensures
      the `MODULE_MAP_FILE` record is deterministic across repeated builds.
      
      Reviewed By: benlangmuir
      
      Differential Revision: https://reviews.llvm.org/D133611
      3c1b4234
    • Matthias Braun's avatar
      d871bce2
    • Stella Stamenova's avatar
    • Laura Chaparro-Gutierrez's avatar
      [lldb] Add SBBreakpointLocation::SetCallback · 6f5d109f
      Laura Chaparro-Gutierrez authored
      * Include SetCallback in SBBreakpointLocation, similar as in SBBreakpoint.
      * Add test_breakpoint_location_callback test as part of TestMultithreaded.
      
      Reviewed By: werat, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D133689
      
      
      
      Co-authored-by: default avatarAndy Yankovsky <weratt@gmail.com>
      6f5d109f
    • Craig Topper's avatar
      [LegalizeTypes] Improve splitting for urem/udiv by constant for some constants. · 38ffa2bb
      Craig Topper authored
      For remainder:
      If (1 << (Bitwidth / 2)) % Divisor == 1, we can add the high and low halves
      together and use a (Bitwidth / 2) urem. If (BitWidth /2) is a legal integer
      type, this urem will be expand by DAGCombiner using multiply by magic
      constant. We do have to take into account that adding high and low
      together can produce a carry, making it a (BitWidth / 2)+1 bit number.
      So we need to also add back in the carry from the first addition.
      
      For division:
      We can use the above trick to compute the remainder, subtract that
      remainder from the dividend, then multiply by the multiplicative
      inverse of the Divisor modulo (1 << BitWidth).
      
      This is based on the section "Remainder by Summing Digits" in
      Hacker's delight.
      
      The remainder trick is similar to a trick you may have learned for
      determining if a decimal number is divisible by 3. You can add all the
      digits together and see if the sum is divisible by 3. If you're not sure
      if the sum is divisible by 3, you can add its digits together. This
      can be repeated until you have a single decimal digit. If that digit
      is 3, 6, or 9, then the original number is divisible by 3. This works
      because 10 % 3 == 1.
      
      gcc already does this same trick. There are additional tricks gcc
      does urem as well as srem, udiv, and sdiv that I plan to add in
      future patches.
      
      Reviewed By: RKSimon
      
      Differential Revision: https://reviews.llvm.org/D130862
      38ffa2bb
    • Corentin Jabot's avatar
    • Benjamin Kramer's avatar
      [DFSan] Don't crash with the legacy pass manager · 2675c416
      Benjamin Kramer authored
      TargetLibraryInfo isn't optional, so we have to provide it even with the
      lageacy stuff. Ideally we wouldn't need it anymore but there are still
      users out there that are stuck on the legacy PM.
      
      Differential Revision: https://reviews.llvm.org/D133685
      2675c416
    • Aart Bik's avatar
      [mlir][sparse] properly record dimension level type and properties · b22397fe
      Aart Bik authored
      A next step towards supporting the new dimension level types and
      properties. This changes properly records the properties in the
      Merger, so that subsequent computations (lattice optimizations)
      and code generation (during sparsification) can do the right thing.
      
      https://github.com/llvm/llvm-project/issues/51658
      
      Reviewed By: Peiming
      
      Differential Revision: https://reviews.llvm.org/D133620
      b22397fe
    • A-Wadhwani's avatar
      [SROA] Create additional vector type candidates based on store and load slices · de3445e0
      A-Wadhwani authored
      This patch adds additional vector types to be considered when doing
      promotion in SROA, based on the types of the store and load slices. This
      provides more promotion opportunities, by potentially using an optimal
      "intermediate" vector type.
      
      For example, the following code would currently not be promoted to a
      vector, since `__m128i` is a `<2 x i64>` vector.
      
      ```
      
      __m128i packfoo0(int a, int b, int c, int d) {
        int r[4] = {a, b, c, d};
        __m128i rm;
        std::memcpy(&rm, r, sizeof(rm));
        return rm;
      }
      ```
      
      ```
      packfoo0(int, int, int, int):
              mov     dword ptr [rsp - 24], edi
              mov     dword ptr [rsp - 20], esi
              mov     dword ptr [rsp - 16], edx
              mov     dword ptr [rsp - 12], ecx
              movaps  xmm0, xmmword ptr [rsp - 24]
              ret
      ```
      
      By also considering the types of the elements, we could find that the
      `<4 x i32>` type would be valid for promotion, hence removing the memory
      accesses for this function. In other words, we can explore other new
      vector types, with the same size but different element types based on
      the load and store instructions from the Slices, which can provide us
      more promotion opportunities.
      
      Additionally, the step for removing duplicate elements from the
      `CandidateTys` vector was not using an equality comparator, which has
      been fixed.
      
      Differential Revision: https://reviews.llvm.org/D132096
      de3445e0
    • Ben Langmuir's avatar
      [clang][test] Disallow using the default module cache path in lit tests · d96f5261
      Ben Langmuir authored
      Make the default module cache path invalid when running lit tests so
      that tests are forced to provide a cache path. This avoids accidentally
      escaping to the system default location, and would have caught the
      failure recently found in ClangScanDeps/multiple-commands.c.
      
      Differential Revision: https://reviews.llvm.org/D133622
      d96f5261
    • Benjamin Kramer's avatar
      [mlir][linalg] Explicitly instantiate DownscaleSizeOneWindowed2DConvolution · 2b882f84
      Benjamin Kramer authored
      It's not possible to use a template with no definition from another
      translation unit. Fixes the shared library build.
      2b882f84
    • Adrian Prantl's avatar
      Skip crashing test · 8599cb00
      Adrian Prantl authored
      8599cb00
    • Craig Topper's avatar
      [RISCV] Rename WriteFALU* and ReadFALU* to WriteFAdd*/ReadFAdd*. · d49280e0
      Craig Topper authored
      ALU seems a little vague. FAdd felt more precise even though it
      also include FSUB instructions.
      
      Reviewed By: monkchiang
      
      Differential Revision: https://reviews.llvm.org/D133632
      d49280e0
    • Felipe de Azevedo Piovezan's avatar
      [lldb] Fix detection of existing libcxx · fc047499
      Felipe de Azevedo Piovezan authored
      The CMake variable LLDB_HAS_LIBCXX is passed to
      `llvm_canonicalize_cmake_booleans`, which transforms TRUE/FALSE into
      '1'/'0'. It also transforms undefined variables to '0'.
      
      In particular, this means that the configuration script for LLDB API's
      test always has _some_ value for the `has_libcxx` configuration:
      
      ```
      config.has_libcxx = '@LLDB_HAS_LIBCXX@'
      ```
      
      When deciding whether a libcxx exist, the testing scripts would only
      check for the existence of `has_libcxx`, but not for its value. In other
      words, because `if ('0')` is true in python we always think there is a
      libcxx.
      
      This was caught once D132940 was merged and most tests started to use
      libcxx by default if `has_libcxx` is true.  Prior to that, no failures
      were seen because only tests are marked with
      `@add_test_categories(["libc++"])` would require a libcxx, and these
      would be filtered out on builds without the libcxx target. Furthermore,
      the MacOS bots always build libcxx.
      
      We fix this by making `has_libcxx` a boolean (instead of a string) and
      by checking its value in the test configuration.
      
      Differential Revision: https://reviews.llvm.org/D133639
      fc047499
    • Sanjay Patel's avatar
      [Reassociate] prevent partial undef negation replacement · 4ca25c66
      Sanjay Patel authored
      As shown in the examples in issue #57683, we allow matching
      vectors with poison (undef) in this transform (and possibly more),
      but we can't then use the partially defined value as a replacement
      value in other expressions blindly.
      
      This seems to be avoided in simpler examples of reassociation,
      and other passes should be able to clean up the redundant op
      seen in these tests.
      4ca25c66
    • Sanjay Patel's avatar
      [Reassociate] add tests for vector negate with undef elements; NFC · eb2ac0a3
      Sanjay Patel authored
      Reduced/expanded from issue #57683.
      eb2ac0a3
    • Craig Topper's avatar
      [RISCV] Custom type legalize i32 loads by sign extending. · 4186a49d
      Craig Topper authored
      The default is to use extload which can become a zextload or
      sextload if it is followed by an 'and' or sext_inreg.
      
      Sometimes type legalization will introduce an 'and' from promoting
      something like 'srl X, C' and a sext_inreg from from a setcc. The
      'and' could be freely folded with the promoted 'srl' by using srliw,
      but the sext_inreg can't be folded into a compare. DAG combiner
      will see both of these choices and may decide to fold the 'and'
      instead of the 'sext_inreg'. This forces the sext_inreg to become
      a sext.w.
      
      By picking sextload in the type legalizer we take this choice away.
      Looking at spec2006 compiled with Zba and Zbb this appeared to be
      net reduction in lines of code in the objdump disassembly output.
      
      This is similar to what we do with i32 add/sub/mul/shl in
      type legalization where we always emit a sext_inreg.
      
      Reviewed By: asb
      
      Differential Revision: https://reviews.llvm.org/D130397
      4186a49d
    • Matthias Gehre's avatar
      Move TargetTransformInfo::maxLegalDivRemBitWidth -> TargetLowering::maxSupportedDivRemBitWidth · c1502425
      Matthias Gehre authored
      Also remove new-pass-manager version of ExpandLargeDivRem because there is no way
      yet to access TargetLowering in the new pass manager.
      
      Differential Revision: https://reviews.llvm.org/D133691
      c1502425
    • Jay Foad's avatar
      [GlobalISel] Simplify extended add/sub to add/sub with carry · 210e6a99
      Jay Foad authored
      Simplify extended add/sub (with carry-in and carry-out) to add/sub with
      carry (with carry-out only) if carry-in is known to be zero.
      
      Differential Revision: https://reviews.llvm.org/D133702
      210e6a99
  2. Sep 12, 2022