1. May 17, 2023
    • Alex Langford's avatar
      [lldb][NFCI] Small adjustment to Breakpoint::AddName · d95aec2d
      Alex Langford authored
      m_name_list is a std::unordered_set<std::string>, we can insert the
      string directly instead of grabbing the c_str and creating yet another
      one.
      d95aec2d
    • David Green's avatar
      [AArch64] Combine add(extract v1i64) into v1i64 add · 198f6a9f
      David Green authored
      This helps fix a regression from D148309 where a shift + add was no longer
      combined into a ssra. It looks for add's with v1i64 extract operands and
      converts them to v1i64 adds. The other operand needs to be something that is
      easily converted to a v1i64, in this case it currently just checks for a load.
      
      Some of the code in performAddSubCombine has been cleaned up whilst I was here.
      
      Differential Revision: https://reviews.llvm.org/D148311
      198f6a9f
    • Peter Klausler's avatar
      [flang] Parenthesize RHS arguments to defined assignments (bug #62599) · 01e22dfb
      Peter Klausler authored
      The right-hand sides of assignment statements are always expressions,
      never variables.  When an assignment statement is converted into a call
      to a defined assignment subroutine, and the actual argument being associated
      with the second dummy argument is a variable, and the dummy argument does
      not have the VALUE attribute, wrap it with parentheses so that lowering
      will pass it by means of a temporary.
      
      Fixes https://github.com/llvm/llvm-project/issues/62599.
      
      Differential Revision: https://reviews.llvm.org/D150331
      01e22dfb
    • Guillaume Chatelet's avatar
      [libc] Add optimized bcmp for RISCV · 7c1f2793
      Guillaume Chatelet authored
      [libc] Add optimized bcmp for RISCV
      
      This patch adds two versions of bcmp optimized for architectures where unaligned accesses are either illegal or extremely slow.
      It is currently enabled for RISCV 64 and RISCV 32 but it could be used for ARM 32 architectures as well.
      
      Here is the before / after output of libc.benchmarks.memory_functions.opt_host --benchmark_filter=BM_Bcmp on a quad core Linux starfive RISCV 64 board running at 1.5GHz.
      
      Before
      ```
      Run on (4 X 1500 MHz CPU s)
      CPU Caches:
        L1 Instruction 32 KiB (x4)
        L1 Data 32 KiB (x4)
        L2 Unified 2048 KiB (x1)
      Load Average: 7.03, 5.98, 3.71
      ----------------------------------------------------------------------
      Benchmark            Time             CPU   Iterations UserCounters...
      ----------------------------------------------------------------------
      BM_Bcmp/0/0        102 ns         60.5 ns     11662336 bytes_per_cycle=0.122696/s bytes_per_second=175.518M/s items_per_second=16.5258M/s __llvm_libc::bcmp,memcmp Google A
      BM_Bcmp/1/0        328 ns          172 ns      3737600 bytes_per_cycle=0.15256/s bytes_per_second=218.238M/s items_per_second=5.80575M/s __llvm_libc::bcmp,memcmp Google B
      BM_Bcmp/2/0        199 ns         99.7 ns      7019520 bytes_per_cycle=0.141897/s bytes_per_second=202.986M/s items_per_second=10.032M/s __llvm_libc::bcmp,memcmp Google D
      BM_Bcmp/3/0        173 ns         86.5 ns      8361984 bytes_per_cycle=0.13863/s bytes_per_second=198.312M/s items_per_second=11.5669M/s __llvm_libc::bcmp,memcmp Google L
      BM_Bcmp/4/0        105 ns         51.8 ns     13213696 bytes_per_cycle=0.116399/s bytes_per_second=166.51M/s items_per_second=19.2931M/s __llvm_libc::bcmp,memcmp Google M
      BM_Bcmp/5/0        167 ns         93.9 ns      7853056 bytes_per_cycle=0.139432/s bytes_per_second=199.459M/s items_per_second=10.6503M/s __llvm_libc::bcmp,memcmp Google Q
      BM_Bcmp/6/0        262 ns          165 ns      3931136 bytes_per_cycle=0.151516/s bytes_per_second=216.745M/s items_per_second=6.07091M/s __llvm_libc::bcmp,memcmp Google S
      BM_Bcmp/7/0        168 ns          105 ns      6665216 bytes_per_cycle=0.143159/s bytes_per_second=204.791M/s items_per_second=9.52163M/s __llvm_libc::bcmp,memcmp Google U
      BM_Bcmp/8/0        108 ns         68.0 ns     10175488 bytes_per_cycle=0.125504/s bytes_per_second=179.535M/s items_per_second=14.701M/s __llvm_libc::bcmp,memcmp Google W
      BM_Bcmp/9/0      15371 ns         9007 ns        78848 bytes_per_cycle=0.166128/s bytes_per_second=237.648M/s items_per_second=111.031k/s __llvm_libc::bcmp,uniform 384 to 4096
      ```
      
      After
      ```
      BM_Bcmp/0/0       74.2 ns         49.7 ns     14306304 bytes_per_cycle=0.148927/s bytes_per_second=213.042M/s items_per_second=20.1101M/s __llvm_libc::bcmp,memcmp Google A
      BM_Bcmp/1/0        108 ns         68.1 ns     10350592 bytes_per_cycle=0.411197/s bytes_per_second=588.222M/s items_per_second=14.6849M/s __llvm_libc::bcmp,memcmp Google B
      BM_Bcmp/2/0       80.2 ns         56.0 ns     12386304 bytes_per_cycle=0.258588/s bytes_per_second=369.912M/s items_per_second=17.8585M/s __llvm_libc::bcmp,memcmp Google D
      BM_Bcmp/3/0       92.4 ns         55.7 ns     12555264 bytes_per_cycle=0.206835/s bytes_per_second=295.88M/s items_per_second=17.943M/s __llvm_libc::bcmp,memcmp Google L
      BM_Bcmp/4/0       79.3 ns         46.8 ns     14288896 bytes_per_cycle=0.125872/s bytes_per_second=180.061M/s items_per_second=21.3611M/s __llvm_libc::bcmp,memcmp Google M
      BM_Bcmp/5/0       98.0 ns         57.9 ns     12232704 bytes_per_cycle=0.268815/s bytes_per_second=384.543M/s items_per_second=17.2711M/s __llvm_libc::bcmp,memcmp Google Q
      BM_Bcmp/6/0        132 ns         65.5 ns     10474496 bytes_per_cycle=0.417246/s bytes_per_second=596.875M/s items_per_second=15.2673M/s __llvm_libc::bcmp,memcmp Google S
      BM_Bcmp/7/0        101 ns         60.9 ns     11505664 bytes_per_cycle=0.253733/s bytes_per_second=362.968M/s items_per_second=16.4202M/s __llvm_libc::bcmp,memcmp Google U
      BM_Bcmp/8/0       72.5 ns         50.2 ns     14082048 bytes_per_cycle=0.183262/s bytes_per_second=262.158M/s items_per_second=19.9271M/s __llvm_libc::bcmp,memcmp Google W
      BM_Bcmp/9/0        852 ns          803 ns       854016 bytes_per_cycle=1.85028/s bytes_per_second=2.58481G/s items_per_second=1.24597M/s __llvm_libc::bcmp,uniform 384 to 4096
      ```
      
      For comparison with glibc
      ```
      BM_Bcmp/0/0        106 ns         52.6 ns     12906496 bytes_per_cycle=0.142072/s bytes_per_second=203.235M/s items_per_second=19.0271M/s glibc::bcmp,memcmp Google A
      BM_Bcmp/1/0        132 ns         77.1 ns      8905728 bytes_per_cycle=0.365072/s bytes_per_second=522.239M/s items_per_second=12.9782M/s glibc::bcmp,memcmp Google B
      BM_Bcmp/2/0        122 ns         62.3 ns     10909696 bytes_per_cycle=0.222667/s bytes_per_second=318.527M/s items_per_second=16.0563M/s glibc::bcmp,memcmp Google D
      BM_Bcmp/3/0       99.5 ns         64.2 ns     11074560 bytes_per_cycle=0.185126/s bytes_per_second=264.825M/s items_per_second=15.5674M/s glibc::bcmp,memcmp Google L
      BM_Bcmp/4/0       86.6 ns         50.2 ns     13488128 bytes_per_cycle=0.117941/s bytes_per_second=168.717M/s items_per_second=19.9053M/s glibc::bcmp,memcmp Google M
      BM_Bcmp/5/0        106 ns         61.4 ns     11344896 bytes_per_cycle=0.248968/s bytes_per_second=356.151M/s items_per_second=16.284M/s glibc::bcmp,memcmp Google Q
      BM_Bcmp/6/0        145 ns         71.9 ns     10046464 bytes_per_cycle=0.389814/s bytes_per_second=557.633M/s items_per_second=13.9019M/s glibc::bcmp,memcmp Google S
      BM_Bcmp/7/0        119 ns         65.6 ns     10718208 bytes_per_cycle=0.243756/s bytes_per_second=348.696M/s items_per_second=15.2329M/s glibc::bcmp,memcmp Google U
      BM_Bcmp/8/0       86.4 ns         54.5 ns     13250560 bytes_per_cycle=0.154831/s bytes_per_second=221.488M/s items_per_second=18.3532M/s glibc::bcmp,memcmp Google W
      BM_Bcmp/9/0       1090 ns          604 ns      1186816 bytes_per_cycle=2.53848/s bytes_per_second=3.54622G/s items_per_second=1.65598M/s glibc::bcmp,uniform 384 to 4096
      ```
      
      Reviewed By: sivachandra
      
      Differential Revision: https://reviews.llvm.org/D150567
      7c1f2793
    • Alexey Lapshin's avatar
      [DWARFLinker][DWARFv5] Add handling of DW_OP_addrx and DW_OP_constx expression operands. · bd0dd27b
      Alexey Lapshin authored
      This patch adds handling of DW_OP_addrx and DW_OP_constx expression operands.
      In --update case these operands are preserved as is. Otherwise they are
      converted into the DW_OP_addr and DW_OP_const[*]u correspondingly.
      
      Differential Revision: https://reviews.llvm.org/D147066
      bd0dd27b
    • Sergei Barannikov's avatar
      [clang] Convert a few OpenMP tests to opaque pointers · d225e6f4
      Sergei Barannikov authored
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D150680
      d225e6f4
    • Sergei Barannikov's avatar
      [clang] Convert a few OpenMP tests to opaque pointers · a51641c0
      Sergei Barannikov authored
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D150682
      a51641c0
    • Peiming Liu's avatar
      ad469385
    • Peter Klausler's avatar
      [flang] Apply default module accessibility rules a second time (bug#62598) · 689de4c6
      Peter Klausler authored
      Apply the default PUBLIC/PRIVATE accessibility of a module to its symbols
      a second time after it is known that all symbols, including implicitly typed
      names from NAMELIST groups and specification expressions in module subprograms,
      have been created in its scope.
      
      Fixes https://github.com/llvm/llvm-project/issues/62598.
      
      Differential Revision: https://reviews.llvm.org/D150307
      689de4c6
    • Kazu Hirata's avatar
      Migrate {starts,ends}with_insensitive to {starts,ends}_with_insensitive (NFC) · ed1539c6
      Kazu Hirata authored
      This patch migrates uses of StringRef::{starts,ends}with_insensitive
      to StringRef::{starts,ends}_with_insensitive so that we can use names
      similar to those used in std::string_view.
      
      Note that the llvm/ directory has migrated in commit
      6c3ea866.
      
      I'll post a separate patch to deprecate
      StringRef::{starts,ends}with_insensitive.
      
      Differential Revision: https://reviews.llvm.org/D150506
      ed1539c6
    • Krzysztof Parzyszek's avatar
      [Hexagon] Fix HVX predicates on some intrinsic selection patterns · 41078988
      Krzysztof Parzyszek authored
      Instead of checking arch version, check HVX version when dealing with
      HVX instructions.
      41078988
    • Kadir Cetinkaya's avatar
      ece76dce
    • Peter Klausler's avatar
      [flang] Don't mistakenly tokenize a Hollerith literal from "DO 100 H=..." (bug #58732) · a6569e57
      Peter Klausler authored
      After tokenizing an identifier, don't allow the next token to be a
      Hollerith literal.
      
      Fixes https://github.com/llvm/llvm-project/issues/58732.
      
      Differential Revision: https://reviews.llvm.org/D150406
      a6569e57
    • Andrew Gozillon's avatar
      [Clang][Flang][OpenMP] Add loadOffloadInfoMetadata and... · 48c3ae5c
      Andrew Gozillon authored
      [Clang][Flang][OpenMP] Add loadOffloadInfoMetadata and createOffloadEntriesAndInfoMetadata into OMPIRBuilder's finalize and initialize
      
      This allows the generation of OpenMP offload metadata for the OpenMP
      dialect when lowering to LLVM-IR and moves some of the shared logic
      between the OpenMP Dialect and Clang into the IRBuilder.
      
      Reviewers: jsjodin, jdoerfert, kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D148370
      48c3ae5c
    • Slava Zakharin's avatar
      [flang] Fixed comparison for derived types constants. · e47fbb7c
      Slava Zakharin authored
      The two constants should be equal only if their derived types
      are the same. This fixes regression caused by D150380.
      
      Differential Revision: https://reviews.llvm.org/D150634
      e47fbb7c
    • Viktoriia Bakalova's avatar
      [clangd] Fix test. · 76941b68
      Viktoriia Bakalova authored
      76941b68
    • Craig Topper's avatar
      [RISCV] Rework how implied SP operands work in the disassembler. NFC · 8f43c3f4
      Craig Topper authored
      Previously we added the SP operands when an immediate operand was added
      to certain opcodes.
      
      This patch moves it to a post processing step using the information
      in MCInstrDesc. This avoids an explicit opcode list in RISCVDisassembler.cpp.
      
      In considered using a custom DecoderMethod, but the bit swizzling we
      need to do for the immediates on these instructions made that
      unattractive.
      
      Reviewed By: asb
      
      Differential Revision: https://reviews.llvm.org/D149931
      8f43c3f4
    • Goran Flegar's avatar
      [bazel] Fix build after 0c4d7d14 · 2f4c9609
      Goran Flegar authored
      2f4c9609
    • Jonas Devlieghere's avatar
      [lldb] Define lldbassert based on NDEBUG instead of LLDB_CONFIGURATION_DEBUG · 10a50762
      Jonas Devlieghere authored
      Whether assertions are enabled or not is orthogonal to the build type
      which could lead to surprising behavior for lldbassert. Previously, when
      doing a debug build with assertions disabled, lldbassert would become a
      NOOP, rather than printing an error like it does in a release build. By
      definining lldbassert in terms of NDEBUG, it behaves like a regular
      assert when assertions are enabled, and like a soft assert.
      
      Differential revision: https://reviews.llvm.org/D150639
      10a50762
    • Fangrui Song's avatar
      [llvm-objdump][X86] Add @plt symbols for .plt.got · 9e37a7bd
      Fangrui Song authored
      If a symbol needs both JUMP_SLOT and GLOB_DAT relocations, there is a
      minor linker optimization to keep just GLOB_DAT. This optimization
      is only implemented by GNU ld's x86 port and mold.
      https://maskray.me/blog/2021-08-29-all-about-global-offset-table#combining-.got-and-.got.plt
      
      With the optimizing, the PLT entry is placed in .plt.got and the
      associated GOTPLT entry is placed in .got (ld.bfd -z now) or .got.plt (ld.bfd -z lazy).
      The relocation is in .rel[a].dyn.
      
      This patch synthesizes `symbol@plt` labels for these .plt.got entries.
      
      Example:
      ```
      cat > a.s <<e
      .globl _start; _start:
      mov combined0@gotpcrel(%rip), %rax; mov combined1@gotpcrel(%rip), %rax
      call combined0@plt; call combined1@plt
      call foo0@plt; call foo1@plt
      e
      cat > b.s <<e
      .globl foo0, foo1, combined0, combined1
      foo0: foo1: combined0: combined1:
      e
      gcc -fuse-ld=bfd -shared b.s -o b.so
      gcc -fuse-ld=bfd -pie -nostdlib a.s b.so -o a
      ```
      
      ```
      Disassembly of section .plt:
      
      0000000000001000 <.plt>:
          1000: ff 35 ea 1f 00 00             pushq   0x1fea(%rip)            # 0x2ff0 <_GLOBAL_OFFSET_TABLE_+0x8>
          1006: ff 25 ec 1f 00 00             jmpq    *0x1fec(%rip)           # 0x2ff8 <_GLOBAL_OFFSET_TABLE_+0x10>
          100c: 0f 1f 40 00                   nopl    (%rax)
      
      0000000000001010 <foo1@plt>:
          1010: ff 25 ea 1f 00 00             jmpq    *0x1fea(%rip)           # 0x3000 <_GLOBAL_OFFSET_TABLE_+0x18>
          1016: 68 00 00 00 00                pushq   $0x0
          101b: e9 e0 ff ff ff                jmp     0x1000 <.plt>
      
      0000000000001020 <foo0@plt>:
          1020: ff 25 e2 1f 00 00             jmpq    *0x1fe2(%rip)           # 0x3008 <_GLOBAL_OFFSET_TABLE_+0x20>
          1026: 68 01 00 00 00                pushq   $0x1
          102b: e9 d0 ff ff ff                jmp     0x1000 <.plt>
      
      Disassembly of section .plt.got:
      
      0000000000001030 <combined0@plt>:
          1030: ff 25 a2 1f 00 00             jmpq    *0x1fa2(%rip)           # 0x2fd8 <foo1+0x2fd8>
          1036: 66 90                         nop
      
      0000000000001038 <combined1@plt>:
          1038: ff 25 a2 1f 00 00             jmpq    *0x1fa2(%rip)           # 0x2fe0 <foo1+0x2fe0>
          103e: 66 90                         nop
      ```
      
      For x86-32, with -z now, if we remove `foo0` and `foo1`, the absence of regular
      PLT will cause GNU ld to omit .got.plt, and our code cannot synthesize @plt
      labels. This is an extreme corner case that almost never happens in practice (to
      trigger the case, ensure every PLT symbol has been taken address). To fix it, we
      can get the `_GLOBAL_OFFSET_TABLE_` symbol value, but the complexity is not
      worth it.
      
      Close https://github.com/llvm/llvm-project/issues/62537
      
      Reviewed By: bd1976llvm
      
      Differential Revision: https://reviews.llvm.org/D149817
      9e37a7bd
    • Nikita Popov's avatar
      [AArch64] Use correct IRBuilder in InstCombine hooks · 724f4a5b
      Nikita Popov authored
      These need to use the IRBuilder provided by InstCombine for proper
      worklist management.
      724f4a5b
    • Viktoriia Bakalova's avatar
      5cb2770b
    • Sergei Barannikov's avatar
      [clang] Convert a couple of OpenMP tests to opaque pointers · 25729c87
      Sergei Barannikov authored
      This is a follow-up to D150608.
      25729c87
    • Mikhail R. Gadelha's avatar
  2. May 16, 2023