1. Dec 13, 2023
    • paperchalice's avatar
    • Vitaly Buka's avatar
      [test][sanitizer] Allow fork_threaded test on Msan, Tsan, Ubsan (#75260) · 18b41576
      Vitaly Buka authored
      They already include workarounds.
      18b41576
    • Matt Arsenault's avatar
      llvm-reduce: Handle disjoint flag · b2c7cac3
      Matt Arsenault authored
      b2c7cac3
    • Matt Arsenault's avatar
      llvm-reduce: Handle nneg flag · 82d75023
      Matt Arsenault authored
      82d75023
    • Cyndy Ishida's avatar
      Revert "[TextAPI] Add missing link to libObject" and "[TextAPI] Add DylibReader (#75006)" · 1fef0fac
      Cyndy Ishida authored
      This reverts commit aa217eb0.
      This reverts commit 634feddc.
      
      This breaks buildbots by introducing cycle dependency between libObject
      and TextAPI and breaks gcc compiles on buildbots.
      1fef0fac
    • Vitaly Buka's avatar
      6d8fe3dc
    • Cyndy Ishida's avatar
      [TextAPI] Add missing link to libObject · aa217eb0
      Cyndy Ishida authored
      * Reported in buildbot failures
      aa217eb0
    • Cyndy Ishida's avatar
      [TextAPI] Add DylibReader (#75006) · 634feddc
      Cyndy Ishida authored
      Add support for reading binary Mach-o dynamic libraries. It uses
      libObject APIs for extracting information relavant to TAPI and tbd
      files. This includes but is not limited to load commands encode data
      like install names, current/compat versions and symbols.
      634feddc
    • Nico Weber's avatar
      [gn] port 27259f17 · 53ecd3a2
      Nico Weber authored
      53ecd3a2
    • Craig Topper's avatar
      [RISCV] Reduce the size of the index used for RVV intrinsics. NFC (#74906) · 0523bf1e
      Craig Topper authored
      Rather than using size_t, use uint32_t. We don't have more than 4
      billion intrinsics.
      0523bf1e
    • Greg Clayton's avatar
      [lldb] Make only one function that needs to be implemented when searching for types (#74786) · dd958779
      Greg Clayton authored
      This patch revives the effort to get this Phabricator patch into
      upstream:
      
      https://reviews.llvm.org/D137900
      
      This patch was accepted before in Phabricator but I found some
      -gsimple-template-names issues that are fixed in this patch.
      
      A fixed up version of the description from the original patch starts
      now.
      
      This patch started off trying to fix Module::FindFirstType() as it
      sometimes didn't work. The issue was the SymbolFile plug-ins didn't do
      any filtering of the matching types they produced, and they only looked
      up types using the type basename. This means if you have two types with
      the same basename, your type lookup can fail when only looking up a
      single type. We would ask the Module::FindFirstType to lookup "Foo::Bar"
      and it would ask the symbol file to find only 1 type matching the
      basename "Bar", and then we would filter out any matches that didn't
      match "Foo::Bar". So if the SymbolFile found "Foo::Bar" first, then it
      would work, but if it found "Baz::Bar" first, it would return only that
      type and it would be filtered out.
      
      Discovering this issue lead me to think of the patch Alex Langford did a
      few months ago that was done for finding functions, where he allowed
      SymbolFile objects to make sure something fully matched before parsing
      the debug information into an AST type and other LLDB types. So this
      patch aimed to allow type lookups to also be much more efficient.
      
      As LLDB has been developed over the years, we added more ways to to type
      lookups. These functions have lots of arguments. This patch aims to make
      one API that needs to be implemented that serves all previous lookups:
      
      - Find a single type
      - Find all types
      - Find types in a namespace
      
      This patch introduces a `TypeQuery` class that contains all of the state
      needed to perform the lookup which is powerful enough to perform all of
      the type searches that used to be in our API. It contain a vector of
      CompilerContext objects that can fully or partially specify the lookup
      that needs to take place.
      
      If you just want to lookup all types with a matching basename,
      regardless of the containing context, you can specify just a single
      CompilerContext entry that has a name and a CompilerContextKind mask of
      CompilerContextKind::AnyType.
      
      Or you can fully specify the exact context to use when doing lookups
      like: CompilerContextKind::Namespace "std"
      CompilerContextKind::Class "foo"
      CompilerContextKind::Typedef "size_type"
      
      This change expands on the clang modules code that already used a
      vector<CompilerContext> items, but it modifies it to work with
      expression type lookups which have contexts, or user lookups where users
      query for types. The clang modules type lookup is still an option that
      can be enabled on the `TypeQuery` objects.
      
      This mirrors the most recent addition of type lookups that took a
      vector<CompilerContext> that allowed lookups to happen for the
      expression parser in certain places.
      
      Prior to this we had the following APIs in Module:
      
      ```
      void
      Module::FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
                        llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
                        TypeList &types);
      
      void
      Module::FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
                        llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
                        TypeMap &types);
      
      void Module::FindTypesInNamespace(ConstString type_name,
                                        const CompilerDeclContext &parent_decl_ctx,
                                        size_t max_matches, TypeList &type_list);
      ```
      
      The new Module API is much simpler. It gets rid of all three above
      functions and replaces them with:
      
      ```
      void FindTypes(const TypeQuery &query, TypeResults &results);
      ```
      The `TypeQuery` class contains all of the needed settings:
      
      - The vector<CompilerContext> that allow efficient lookups in the symbol
      file classes since they can look at basename matches only realize fully
      matching types. Before this any basename that matched was fully realized
      only to be removed later by code outside of the SymbolFile layer which
      could cause many types to be realized when they didn't need to.
      - If the lookup is exact or not. If not exact, then the compiler context
      must match the bottom most items that match the compiler context,
      otherwise it must match exactly
      - If the compiler context match is for clang modules or not. Clang
      modules matches include a Module compiler context kind that allows types
      to be matched only from certain modules and these matches are not needed
      when d oing user type lookups.
      - An optional list of languages to use to limit the search to only
      certain languages
      
      The `TypeResults` object contains all state required to do the lookup
      and store the results:
      - The max number of matches
      - The set of SymbolFile objects that have already been searched
      - The matching type list for any matches that are found
      
      The benefits of this approach are:
      - Simpler API, and only one API to implement in SymbolFile classes
      - Replaces the FindTypesInNamespace that used a CompilerDeclContext as a
      way to limit the search, but this only worked if the TypeSystem matched
      the current symbol file's type system, so you couldn't use it to lookup
      a type in another module
      - Fixes a serious bug in our FindFirstType functions where if we were
      searching for "foo::bar", and we found a "baz::bar" first, the basename
      would match and we would only fetch 1 type using the basename, only to
      drop it from the matching list and returning no results
      dd958779
    • paperchalice's avatar
      [CodeGen] Port `CFGuard` to new pass manager (#75146) · 27259f17
      paperchalice authored
      Port `CFGuard` to new pass manager, add a pass parameter to choose guard
      mechanism.
      27259f17
    • Arthur Eubanks's avatar
      Revert "[X86] Set SHF_X86_64_LARGE for globals with explicit well-known large... · 19fff858
      Arthur Eubanks authored
      Revert "[X86] Set SHF_X86_64_LARGE for globals with explicit well-known large section name (#74381)"
      
      This reverts commit 323451ab.
      
      Code with these section names in the wild doesn't compile because
      support for large globals in the small code model is not complete yet.
      19fff858
    • Aart Bik's avatar
      [mlir][sparse] refactor utilities into transform/utils dir (#75250) · 365777ec
      Aart Bik authored
      Separates actual transformation files from supporting utility files in
      the transforms directory. Includes a bazel overlay fix for the build (as
      well as a bit of cleanup of that file to be less verbose and more
      flexible).
      365777ec
    • Stella Laurenzo's avatar
      Add missing dep on MLIRToLLVMIRTranslationRegistration to mlir-opt. (#75111) · 8eff5704
      Stella Laurenzo authored
      I was not able to fully triage why this just started failing on one of
      our bots as it seems that the use was added 4 months ago. I would assume
      that it was accidentally coming in transitively in some way as the dep
      was definitely missing.
      
      For context, this started failing in [our
      byo_llvm](https://github.com/openxla/iree/blob/main/build_tools/llvm/byo_llvm.sh)
      build on a stock build of MLIR on top of an existing LLVM. We were
      getting:
      
      ```
      ld.lld: error: undefined symbol: mlir::registerSPIRVDialectTranslation(mlir::DialectRegistry&)                                                        >>> referenced by mlir-opt.cpp
      >>>               tools/mlir-opt/CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o:(main)
      ```
      8eff5704
    • Vitaly Buka's avatar
      [asan] Switch initialization to "double-checked locking" · 9567b33f
      Vitaly Buka authored
      This allows to remove `asan_init_is_running` which likely had a data
      race.
      
      Simplifies https://github.com/llvm/llvm-project/pull/74086 and reduces a difference between platforms.
      
      Reviewers: zacklj89, eugenis, dvyukov
      
      Reviewed By: zacklj89, dvyukov
      
      Pull Request: https://github.com/llvm/llvm-project/pull/74387
      9567b33f
    • Craig Topper's avatar
      8227072f
    • michaelrj-google's avatar
      [libc] Add bind function (#74014) · 8180ea86
      michaelrj-google authored
      This patch adds the bind function to go with the socket function. It
      also cleans up a lot of socket related data structures.
      8180ea86
    • Fangrui Song's avatar
      [bazel] Port 4b344677 · cd9a6416
      Fangrui Song authored
      cd9a6416
    • Sam Clegg's avatar
      [lld][WebAssembly] Don't set importUndefined when -shared is used. NFC (#75241) · 97b25d91
      Sam Clegg authored
      `importUndefined` is only used a couple of places and both of those
      already handle `isPIC` separately.
      97b25d91
    • Mark de Wever's avatar
      [libc++][module] Fixes std::string UDL. (#75000) · 7d34f8c0
      Mark de Wever authored
      The fix changes the way the validation script determines the qualified
      name of a declaration. Inline namespaces without a reserved name are now
      always part of the name. The Clang code only does this when the names
      are ambigious. This method is often used for the operator""foo for UDLs.
      
      Adjusted the newly flagged issue and removed a work-around in the test
      code that is no longer required.
      
      Fixes https://github.com/llvm/llvm-project/issues/72427
      7d34f8c0
    • Benjamin Chetioui's avatar
      [MLIR] Flatten fused locations when merging constants. (#75218) · 0d1490f0
      Benjamin Chetioui authored
      [PR 74670](https://github.com/llvm/llvm-project/pull/74670) added
      support for merging locations at constant folding time. We have
      discovered that in some cases, the number of locations grows so big as
      to cause a compilation process to OOM. In that case, many of the
      locations end up appearing several times in nested fused locations.
      
      We add here a helper that always flattens fused locations in order to
      eliminate duplicates in the case of nested fused locations.
      0d1490f0
    • Johannes Doerfert's avatar
      [OpenMP][NFC] Move mapping related code into OpenMP/Mapping.cpp (#75239) · fe6f137e
      Johannes Doerfert authored
      DeviceTy provides an abstraction for "middle-level" operations that can
      be done with a offload device. Mapping was tied into it but is not
      strictly necessary. Other languages do not track mapping, and even
      OpenMP can be used completely without mapping. This simply moves the
      relevant code into the OpenMP/Mapping.cpp as part of a new class
      MappingInfoTy. Each device still has one, but it does not clutter the
      device.cpp anymore.
      fe6f137e
    • Abhina Sree's avatar
      [SystemZ][z/OS] Fix build errors on z/OS in the Unix .inc files (#74758) · 61ee9232
      Abhina Sree authored
      This patch resolves the following errors on z/OS:
      
      error: no member named 'wait4' in the global namespace
      error: no member named 'ru_maxrss' in 'rusage'
      error: use of undeclared identifier 'strsignal'
      error: Cannot get usage times on this platform
      error: Cannot get malloc info on this platform
      61ee9232
    • Arthur Eubanks's avatar
      [X86][FastISel] Bail out on large objects when materializing a GlobalValue · 39592316
      Arthur Eubanks authored
      To avoid crashes with explicitly large objects.
      
      I will clean up fast-isel with large objects/medium code model soon.
      39592316
    • Aart Bik's avatar
      047399c2
    • Tacet's avatar
      Add `std::basic_string` test cases (#74830) · c77cdbac
      Tacet authored
      Extend `std::basic_string` tests to cover more buffer situations and
      length in general, particularly non-SSO cases after SSO test cases
      (changing buffers). This commit is a side effect of working on tests for
      ASan annotations.
      
      Related PR: https://github.com/llvm/llvm-project/pull/72677
      c77cdbac
    • Schrodinger ZHU Yifan's avatar
      [libc] fix issues around stack protector (#74567) · 3568521e
      Schrodinger ZHU Yifan authored
      If a function is declared with stack-protector, the compiler may try to
      load the TLS. However, inside certain runtime functions, TLS may not be
      available. This patch disables stack protectors for such routines to fix
      the problem.
      
      Closes #74487.
      3568521e
    • Stanislav Mekhanoshin's avatar
    • jimingham's avatar
      Add a test for evicting unreachable modules from the global module cache (#74894) · 2684281d
      jimingham authored
      When you debug a binary and the change & rebuild and then rerun in lldb
      w/o quitting lldb, the Modules in the Global Module Cache for the old
      binary & .o files if used are now "unreachable". Nothing in lldb is
      holding them alive, and they've already been unlinked. lldb will
      properly discard them if there's not another Target referencing them.
      
      However, this only works in simple cases at present. If you have several
      Targets that reference the same modules, it's pretty easy to end up
      stranding Modules that are no longer reachable, and if you use a
      sequence of SBDebuggers unreachable modules can also get stranded. If
      you run a long-lived lldb process and are iteratively developing on a
      large code base, lldb's memory gets filled with useless Modules.
      
      This patch adds a test for the mode that currently works:
      
      (lldb) target create foo
      (lldb) run
      <rebuild foo outside lldb>
      (lldb) run
      
      In that case, we do delete the unreachable Modules.
      
      The next step will be to add tests for the cases where we fail to do
      this, then see how to safely/efficiently evict unreachable modules in
      those cases as well.
      2684281d
    • Mircea Trofin's avatar
      [NFC][InstrProf] Rename internal `InstrProfiling` to `InstrLowerer` (#75139) · a06c7d9e
      Mircea Trofin authored
      Captures its responsibility a bit better.
      a06c7d9e
    • Yinying Li's avatar
      [mlir][sparse]Make isBlockSparsity more robust (#75113) · 31b72b07
      Yinying Li authored
      1. A single dimension can either be blocked (with floordiv and mod pair)
      or non-blocked. Mixing them would be invalid.
      2. Block size should be non-zero value.
      31b72b07
    • Simon Pilgrim's avatar
      [X86] avx512-vbroadcast.ll - fix orphan check prefixes · 06613095
      Simon Pilgrim authored
      The AVX512F/AVX512BW checks had been removed despite still being used
      06613095
    • Fangrui Song's avatar
    • Boian Petkantchin's avatar
      [mlir][mesh] Add endomorphism simplification for all-reduce (#73150) · 4b344677
      Boian Petkantchin authored
      Does transformations like
      all_reduce(x) + all_reduce(y) -> all_reduce(x + y)
      
      max(all_reduce(x), all_reduce(y)) -> all_reduce(max(x, y))
      when the all_reduce element-wise op is max.
      
      Added general rewrite pattern HomomorphismSimplification and
      EndomorphismSimplification that encapsulate the general algorithm.
      Made specialization for all-reduce with respect to
      addf, addi, minsi, maxsi, minimumf and maximumf
      in the Arithmetic dialect.
      4b344677
    • Jakub Kuderski's avatar
      [mlir][vector] Allow vector distribution with multiple written elements (#75122) · 80636227
      Jakub Kuderski authored
      Add a configuration option to allow vector distribution with multiple
      elements written by a single lane.
      
      This is so that we can perform vector multi-reduction with multiple
      results per workgroup.
      80636227
    • Fangrui Song's avatar
      [ELF] Don't create copy relocation/canonical PLT entry for a defined symbol (#75095) · 42e49671
      Fangrui Song authored
      Copy relocations and canonical PLT entries are for symbols defined in a
      DSO. Currently we create them even for a `Defined`, possibly leading to
      an output that won't work at run-time (e.g. R_X86_64_JUMP_SLOT
      referencing a null symbol).
      ```
      % cat a.s
      .globl _start, main
      .type main, @function
      _start: main: ret
      
      .rodata
      .quad main
      % clang -fuse-ld=lld -pie -nostdlib a.s
      % readelf -Wr a.out
      
      Relocation section '.rela.plt' at offset 0x290 contains 1 entry:
          Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
      00000000000033b8  0000000000000007 R_X86_64_JUMP_SLOT                        12b0
      ```
      
      Report an error instead for the default `-z text` mode. GNU ld reports
      an error in `-z text` mode as well.
      42e49671
    • Mark de Wever's avatar
      [libc++][chrono] Fixes year_month year wrapping. (#74938) · 766bf140
      Mark de Wever authored
      Adding months to a year_month should wrap the year when the month
      becomes greater than twelve or less than one.
      
      This fixes the issue for year_month. Other classes with a year and month
      do not have this issue. This has been verified and tests are added to
      avoid possible regressions.
      
      Also fixes some variable copy-paste errors in the tests.
      
      Fixes https://github.com/llvm/llvm-project/issues/73162
      766bf140
    • Fangrui Song's avatar
      [DebugInfo] Fix duplicate DIFile when main file is preprocessed (#75022) · 831484ef
      Fangrui Song authored
      When the main file is preprocessed and we change `MainFileName` to the
      original source file name (e.g. `a.i => a.c`), the source manager does
      not contain `a.c`, but we incorrectly associate the DIFile(a.c) with
      md5(a.i). This causes CGDebugInfo::emitFunctionStart to create a
      duplicate DIFile and leads to a spurious "inconsistent use of MD5
      checksums" warning.
      
      ```
      % cat a.c
      void f() {}
      % clang -c -g a.c  # no warning
      % clang -E a.c -o a.i && clang -g -S a.i && clang -g -c a.s
      a.s:9:2: warning: inconsistent use of MD5 checksums
              .file   1 "a.c"
              ^
      % grep DIFile a.ll
      !1 = !DIFile(filename: "a.c", directory: "/tmp/c", checksumkind: CSK_MD5, checksum: "c5b2e246df7d5f53e176b097a0641c3d")
      !11 = !DIFile(filename: "a.c", directory: "/tmp/c")
      % grep 'file.*a.c' a.s
              .file   "a.c"
              .file   0 "/tmp/c" "a.c" md5 0x2d14ea70fee15102033eb8d899914cce
              .file   1 "a.c"
      ```
      
      Fix #56378 by disassociating md5(a.i) with a.c.
      831484ef
    • Mark de Wever's avatar
      [libc++][doc] Updates module information. (#75003) · 0e059046
      Mark de Wever authored
      Adds the std.compat module and add support for CMake 3.28.
      0e059046