1. May 19, 2022
    • Michael Jones's avatar
      [libc][windows] fix strlcpy tests · 72f6dfb3
      Michael Jones authored
      Generally, size_t is an alias for unsigned long long. In the strlcpy
      tests, the return value of strlcpy (a size_t) is compared to an unsigned
      long. On Linux unsigned long and unsigned long long are both 64 bits,
      but on windows unsigned long is 32 bits. Since the macros require
      identical types for both sides, this caused a build failure on windows.
      This patch changes the constants to be explicit size_t values.
      
      Differential Revision: https://reviews.llvm.org/D125917
      72f6dfb3
    • Mitch Phillips's avatar
      [NFCI] clang-format gwp-asan files. · f9a3c43e
      Mitch Phillips authored
      f9a3c43e
    • Mogball's avatar
      [mlir] Fix the error message for missing explicit TypeID · 40e242eb
      Mogball authored
      Summary:
      
      The error message was incorrect
      
      Reviewers: rriddle
      
      Subscribers:
      40e242eb
    • Mitch Phillips's avatar
      [NFCI] clang-format scudo standalone · e831ea69
      Mitch Phillips authored
      e831ea69
    • Mitch Phillips's avatar
      Reland "[dwarf] Emit a DIGlobalVariable for constant strings." · 7aa1fa0a
      Mitch Phillips authored
      An upcoming patch will extend llvm-symbolizer to provide the source line
      information for global variables. The goal is to move AddressSanitizer
      off of internal debug info for symbolization onto the DWARF standard
      (and doing a clean-up in the process). Currently, ASan reports the line
      information for constant strings if a memory safety bug happens around
      them. We want to keep this behaviour, so we need to emit debuginfo for
      these variables as well.
      
      Reviewed By: dblaikie, rnk, aprantl
      
      Differential Revision: https://reviews.llvm.org/D123534
      7aa1fa0a
    • Alexey Bataev's avatar
      [SLP]Improve reductions vectorization. · 7d8060bc
      Alexey Bataev authored
      The pattern matching and vectgorization for reductions was not very
      effective. Some of of the possible reduction values were marked as
      external arguments, SLP could not find some reduction patterns because
      of too early attempt to vectorize pair of binops arguments, the cost of
      consts reductions was not correct. Patch addresses these issues and
      improves the analysis/cost estimation and vectorization of the
      reductions.
      
      The most significant changes in SLP.NumVectorInstructions:
      
      Metric: SLP.NumVectorInstructions                                                                                                                                                                                                 [140/14396]
      
      Program                                                                                        results  results0 diff
                     test-suite :: SingleSource/Benchmarks/Adobe-C++/loop_unroll.test   920.00  3548.00 285.7%
                      test-suite :: SingleSource/Benchmarks/BenchmarkGame/n-body.test    66.00   122.00  84.8%
            test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C/miniGMG/miniGMG.test   100.00   128.00  28.0%
       test-suite :: MultiSource/Benchmarks/Prolangs-C/TimberWolfMC/timberwolfmc.test   664.00   810.00  22.0%
                       test-suite :: MultiSource/Benchmarks/mafft/pairlocalalign.test   592.00   687.00  16.0%
        test-suite :: MultiSource/Benchmarks/MiBench/consumer-lame/consumer-lame.test   402.00   426.00   6.0%
                         test-suite :: MultiSource/Applications/JM/lencod/lencod.test  1665.00  1745.00   4.8%
        test-suite :: External/SPEC/CINT2017rate/500.perlbench_r/500.perlbench_r.test   135.00   139.00   3.0%
       test-suite :: External/SPEC/CINT2017speed/600.perlbench_s/600.perlbench_s.test   135.00   139.00   3.0%
                        test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test   388.00   397.00   2.3%
                         test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test   895.00   914.00   2.1%
          test-suite :: MultiSource/Benchmarks/MiBench/telecomm-gsm/telecomm-gsm.test   240.00   244.00   1.7%
                 test-suite :: MultiSource/Benchmarks/mediabench/gsm/toast/toast.test   240.00   244.00   1.7%
                   test-suite :: External/SPEC/CINT2017speed/602.gcc_s/602.gcc_s.test   820.00   832.00   1.5%
                    test-suite :: External/SPEC/CINT2017rate/502.gcc_r/502.gcc_r.test   820.00   832.00   1.5%
             test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 14804.00 14914.00   0.7%
                              test-suite :: MultiSource/Benchmarks/Bullet/bullet.test  8125.00  8183.00   0.7%
                 test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test  1330.00  1338.00   0.6%
                  test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test  1330.00  1338.00   0.6%
               test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test  9832.00  9880.00   0.5%
               test-suite :: External/SPEC/CFP2017rate/511.povray_r/511.povray_r.test  5267.00  5291.00   0.5%
             test-suite :: External/SPEC/CFP2017rate/538.imagick_r/538.imagick_r.test  4018.00  4024.00   0.1%
            test-suite :: External/SPEC/CFP2017speed/638.imagick_s/638.imagick_s.test  4018.00  4024.00   0.1%
                    test-suite :: External/SPEC/CFP2017speed/644.nab_s/644.nab_s.test   426.00   424.00  -0.5%
                     test-suite :: External/SPEC/CFP2017rate/544.nab_r/544.nab_r.test   426.00   424.00  -0.5%
                test-suite :: External/SPEC/CINT2017rate/541.leela_r/541.leela_r.test   201.00   192.00  -4.5%
               test-suite :: External/SPEC/CINT2017speed/641.leela_s/641.leela_s.test   201.00   192.00  -4.5%
      
      644.nab_s and 544.nab_r - reduced number of shuffles but increased number
      of useful vectorized instructions.
      
      641.leela_s and 541.leela_r - the function
      `@_ZN9FastBoard25get_pattern3_augment_specEiib` is not inlined anymore
      but its body gets vectorized successfully. Before, the function was
      inlined twice and vectorized just after inlining, currently it is not
      required. The vector code looks pretty similar, just like as it was before.
      
      Differential Revision: https://reviews.llvm.org/D111574
      7d8060bc
    • Yusra Syeda's avatar
    • Nathan James's avatar
      [clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init... · 35660247
      Nathan James authored
      [clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement or condition variable
      
      Fixes https://github.com/llvm/llvm-project/issues/55553.
      
      Reviewed By: LegalizeAdulthood
      
      Differential Revision: https://reviews.llvm.org/D125874
      35660247
    • zhijian's avatar
      [libc++][CI] fixed a return curr_symbol() for Russian in the... · 4ac05891
      zhijian authored
      [libc++][CI] fixed a return curr_symbol() for Russian in the libcxx/test/support/locale_helpers.h for AIX
      
      Summary:
      
      fixed a return curr_symbol() for Russian in the libcxx/test/support/locale_helpers.h for AIX
      
      Reviewers:  David Tenty,Mark de Wever
      Differential Revision: https://reviews.llvm.org/D125801
      4ac05891
    • David Blaikie's avatar
      42dac47e
    • Fangrui Song's avatar
      [Driver] Refactor /opt/rh detection · d8166e19
      Fangrui Song authored
      Check /opt/rh first to avoid `/opt/rh/*` newfstatat/etc calls on other
      distributions.
      d8166e19
    • Michael Kitzan's avatar
      [GISel] Add new combines for G_FMINNUM/MAXNUM and G_FMINIMUM/MAXIMUM · 29bebb02
      Michael Kitzan authored
      I noticed https://reviews.llvm.org/D87415 added SDAG combines to fold
      FMIN/MAX instrs with NaNs.
      
      The patch implements the same NaN combines for GISel GMIR FMIN/MAX opcodes:
      G_FMINNUM(X, NaN) -> X
      G_FMAXNUM(X, NaN) -> X
      G_FMINIMUM(X, NaN) -> NaN
      G_FMAXIMUM(X, NaN) -> NaN
      
      The patch adds AArch64 tests for these combines as well.
      
      Reviewed by: arsenm
      
      Differential revision: https://reviews.llvm.org/D125819
      29bebb02
    • Sanjay Patel's avatar
      [InstCombine] allow variable shift amount in bswap + shift fold · ebbc3739
      Sanjay Patel authored
      When shifting by a byte-multiple:
      bswap (shl X, Y) --> lshr (bswap X), Y
      bswap (lshr X, Y) --> shl (bswap X), Y
      
      This was limited to constants as a first step in D122010 / 60820e53 ,
      but issue #55327 shows a source example (and there's a test based on that here)
      where a variable shift amount is used in this pattern.
      ebbc3739
    • Sanjay Patel's avatar
      [InstCombine] add tests for bswap with shift op; NFC · a3b30d22
      Sanjay Patel authored
      issue #55327
      a3b30d22
    • Martin Storsjö's avatar
      [llvm-readobj] Improve printing of Windows ARM packed unwind info · d4257fbb
      Martin Storsjö authored
      Fix a couple minor details in the existing logic for calculating
      saved registers and stack adjustment.
      
      Synthesize the corresponding prologues and epilogues and print them.
      (This supersedes the previous printout of one single list of stored
      registers; as there's lots of minor nuance differences in how
      registers are pushed/popped in various corner cases, it's better to
      print the full prologue/epilogue instead of trying to condense it
      into one single list.)
      
      Print the raw values of the fields Reg, R, L (LinkRegister) and C
      (Chaining) instead of only printing the derived values.
      
      Differential Revision: https://reviews.llvm.org/D125644
      d4257fbb
    • LLVM GN Syncbot's avatar
      [gn build] Port 4d8268fb · e60c8c30
      LLVM GN Syncbot authored
      e60c8c30
    • Michael Jones's avatar
      [libc] fix missing semicolon in bsd_ext.td · f8ae591f
      Michael Jones authored
      Fix typo in previous commit
      
      Differential Revision: https://reviews.llvm.org/D125913
      f8ae591f
    • Petr Hosek's avatar
      [CMake][Fuchsia] Build runtimes as universal libraries on OS X · e64722f6
      Petr Hosek authored
      We want to build libunwind, libc++abi and libc++ as universal libraries
      supporting both x86_64 and arm64 architectures.
      
      Differential Revision: https://reviews.llvm.org/D125908
      e64722f6
    • Mark de Wever's avatar
      [libc++][format][5/6] Improve format_to_n. · f0c06c04
      Mark de Wever authored
      Use a specialized buffer wrapper to limit the number of insertions in the
      buffer. After the limit has been reached the buffer only needs to count
      the number of insertions to return the buffer size required to store the
      entire output.
      
      Depends on D110498
      
      Reviewed By: #libc, Mordante
      
      Differential Revision: https://reviews.llvm.org/D110499
      f0c06c04
    • Yusra Syeda's avatar
      5ac411ae
    • Mark de Wever's avatar
      [libc++][format] Improve format-arg-store. · 4d8268fb
      Mark de Wever authored
      This optimizes the __format_arg_store type to allow a more efficient
      storage of the basic_format_args.
      
      It stores the data in two arrays:
      - A struct with the tag of the exposition only variant's type and the
        offset of the element in the data array. Since this array only depends
        on the type information it's calculated at compile time and can be
        shared by different instances of this class.
      - The arguments converted to the types used in the exposition only
        variant of basic_format_arg. This means the packed data can be
        directly copied to an element of this variant.
      
      The new code uses rvalue reference arguments in preparation for P2418.
      The handle class also has some changes to prepare for P2418. The real
      changed for P2418 will be done separately, but these parts make it
      easier to implement that paper.
      
      Some parts of existing test code are removed since they were no longer
      valid after the changes, but new tests have been added.
      
      Implements parts of:
      - P2418 Add support for std::generator-like types to std::format
      
      Completes:
      - LWG3473 Normative encouragement in non-normative note
      
      Depends on D121138
      
      Reviewed By: #libc, vitaut, Mordante
      
      Differential Revision: https://reviews.llvm.org/D121514
      4d8268fb
    • Mark de Wever's avatar
      [libc++][format] Adds formatter<charT[N], charT>. · f0e61029
      Mark de Wever authored
      This formatter isn't in the list of required formatters in
      
      [format.formatter.spec]/2.2
        For each charT, the string type specializations
         template<> struct formatter<charT*, charT>;
        template<> struct formatter<const charT*, charT>;
        template<size_t N> struct formatter<const charT[N], charT>;
        template<class traits, class Allocator>
          struct formatter<basic_string<charT, traits, Allocator>, charT>;
        template<class traits>
          struct formatter<basic_string_view<charT, traits>, charT>;
      
      Since remove_cvref_t<const charT[N]> is charT[N] the formatter is
      required by
      
      [format.functions]/25
        Preconditions: formatter<remove_cvref_t<Ti>, charT> meets the
        BasicFormatter requirements ([formatter.requirements]) for each Ti in
        Args.
      
      Depends on D120921
      
      Reviewed By: #libc, Mordante
      
      Differential Revision: https://reviews.llvm.org/D121138
      f0e61029
    • LLVM GN Syncbot's avatar
      [gn build] Port 15c809e8 · d8de7244
      LLVM GN Syncbot authored
      d8de7244
    • Mark de Wever's avatar
      [libc++][format] Adds a formattable concept. · 15c809e8
      Mark de Wever authored
      The concept is based on P2286R2 Formatting Ranges. It will be used to
      optimise the storage of __format_arg_store as required by LWG-3473.
      
      Depends on D120916
      
      Reviewed By: #libc, Mordante
      
      Differential Revision: https://reviews.llvm.org/D120921
      15c809e8
    • Alex Brachet's avatar
      [libc] Add String to bsd headers · 6adbcd2b
      Alex Brachet authored
      6adbcd2b
    • Alex Brachet's avatar
      [libc] Add strlcpy · fc2c8b23
      Alex Brachet authored
      Differential Revision: https://reviews.llvm.org/D125806
      fc2c8b23
    • Martin Storsjö's avatar
      [MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters · 924defad
      Martin Storsjö authored
      There's an inconsistency regarding the epilogs of packed ARM64
      unwind info with homed parameters; according to the documentation
      (and according to common sense), the epilog wouldn't have a series
      of nop instructions matching the stp x0-x7 in the prolog - however
      in practice, RtlVirtualUnwind still seems to behave as if the epilog
      does have the mirrored nops from the prolog.
      
      In practice, MSVC doesn't seem to produce packed unwind info with
      homed parameters, which might be why this inconsistency hasn't
      been noticed.
      
      Thus, to play it safe, avoid creating such packed unwind info with
      homed parameters. (LLVM's current behaviour matches the current
      runtime behaviour of RtlVirtualUnwind, but if it later is bug fixed
      to match the documentation, such unwind information would be
      incorrect.)
      
      See https://github.com/llvm/llvm-project/issues/54879 for further
      discussion on the matter.
      
      Differential Revision: https://reviews.llvm.org/D125876
      924defad
    • Martin Storsjö's avatar
    • Martin Storsjö's avatar
      [runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows · bedf657d
      Martin Storsjö authored
      (In the case of libunwind, the cmake option is called
      LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
      LIBCXX_HERMETIC_STATIC_LIBRARY and
      LIBCXXABI_HERMETIC_STATIC_LIBRARY.)
      
      Previously, the same issue was dealt with by setting a project wide
      define (_LIBUNWIND_HIDE_SYMBOLS,
      _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
      _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
      library.  If building both static and shared at the same time, this
      wasn't set, and the static library would contain dllexport directives.
      
      The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
      options only apply the defines to the static library in the build,
      even if building both static and shared at the same time.
      
      (This could only be done use after the object libraries were
      enabled, as a shared libcxx needs libcxxabi object files built
      with dllexports included.)
      
      This allows removing inelegant code for deciding how to build the
      libcxxabi static library and a TODO comment that suggested that
      users should need to start setting an option, which they shouldn't
      need to. Finally, this gets rid of two XFAILs in tests.
      
      Differential Revision: https://reviews.llvm.org/D125715
      bedf657d
    • Craig Topper's avatar
      [RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates. · 86f7d707
      Craig Topper authored
      This will remove masks on the shift amount. We usually get this with
      SimplifyDemandedBits in DAGCombine, but that's restricted to cases
      where the AND has a single use. selectShiftMaskXLen does not have
      that restriction.
      86f7d707
    • Craig Topper's avatar
      [RISCV] Add test cases showing failure to remove mask on rotate amounts. · e2f410fe
      Craig Topper authored
      If the masking AND has multiple users we fail to remove it.
      e2f410fe
    • Mogball's avatar
      [mlir][ods] Simplify useDefaultType/AttributePrinterParser · 4957518e
      Mogball authored
      The current behaviour of `useDefaultTypePrinterParser` and `useDefaultAttributePrinterParser` is that they are set by default, but the dialect generator only generates the declarations for the parsing and printing hooks if it sees dialect types and attributes. Same goes for the definitions generated by the AttrOrTypeDef generator.
      
      This can lead to confusing and undesirable behaviour if the dialect generator doesn't see the definitions of the attributes and types, for example, if they are sensibly separated into different files: `Dialect.td`, `Ops.td`, `Attributes.td`, and `Types.td`.
      
      Now, these bits are unset by default. Setting them will always result in the dialect generator emitting the declarations for the parsing hooks. And if the AttrOrTypeDef generator sees it set, it will generate the default implementations.
      
      Reviewed By: rriddle, stellaraccident
      
      Differential Revision: https://reviews.llvm.org/D125809
      4957518e
    • Nico Weber's avatar
      [gn build] port 6694491a · 91a8caa8
      Nico Weber authored
      Needed to link llvm-debuginfod-find after eafa0530.
      91a8caa8
    • Jim Ingham's avatar
      Add a darwin platform setting to specify which exceptions debugserver · bff4673b
      Jim Ingham authored
      should not receive as exceptions (some will get converted to BSD
      signals instead).  This is really the only stable way to ensure that
      a Mach exception gets converted to it's equivalent BSD signal.  For
      programs that rely on BSD signal handlers, this has to happen or you
      can't even get the program to invoke the signal handler when under
      the debugger.
      
      This builds on a previous solution to this problem which required you
      start debugserver with the -U flag.  This was not very discoverable
      and required lldb be the one to launch debugserver, which is not always
      the case.
      
      Differential Revision: https://reviews.llvm.org/D125434
      bff4673b
    • Petr Hosek's avatar
      Partially revert "[CMake] Passthrough OSX CMake options to builtins and runtimes" · ececce1b
      Petr Hosek authored
      This partially reverts commit 9cddfe30,
      specifically passthrough for CMAKE_OSX_* since this can lead to build
      passing through internal variables when it's not intended.
      ececce1b
    • Daniel Thornburgh's avatar
      [Debuginfod] Add --debug-file-directory to llvm-debuginfod-find. · eafa0530
      Daniel Thornburgh authored
      This allows llvm-debuginfod-find to locate binaries in local build ID
      directories configured via --debug-file-directory, the same flag used
      for this purpose by llvm-symbolizer. This provides a consistent lookup
      semantics between the two tools when configured the same way, in
      particular when debug binaries may be located either locally or
      remotely.
      
      Reviewed By: phosek
      
      Differential Revision: https://reviews.llvm.org/D125864
      eafa0530
    • Aaron Ballman's avatar
      Correct the diagnostic behavior for unreachable _Generic associations in C++ · 47b8424a
      Aaron Ballman authored
      New diagnostics were added for unreachable generic selection expression
      associations in ca75ac5f, but it did
      not account for a difference in behavior between C and C++ regarding
      lvalue to rvalue conversions. So we would issue diagnostics about a
      selection being unreachable and then reach it. This corrects the
      diagnostic behavior in that case.
      
      Differential Revision: https://reviews.llvm.org/D125882
      47b8424a
    • Fangrui Song's avatar
      [ObjCopy][NFC] Remove unneeded zero initialization · 087ef34f
      Fangrui Song authored
      getNewMemBuffer has called memset.
      
      Reviewed By: alexander-shaposhnikov
      
      Differential Revision: https://reviews.llvm.org/D125833
      087ef34f
    • Nathan James's avatar
    • Craig Topper's avatar
      [DAGCombiner] Fix bug in MatchBSwapHWordLow. · 46eef768
      Craig Topper authored
      This function tries to match (a >> 8) | (a << 8) as (bswap a) >> 16.
      
      If the SRL isn't masked and the high bits aren't demanded, we still
      need to ensure that bits 23:16 are zero. After the right shift they
      will be in bits 15:8 which is where the important bits from the SHL
      end up. It's only a bswap if the OR on bits 15:8 only takes the bits
      from the SHL.
      
      Fixes PR55484.
      
      Reviewed By: RKSimon
      
      Differential Revision: https://reviews.llvm.org/D125641
      46eef768