1. Dec 08, 2023
    • Thurston Dang's avatar
      [hwasan] Add fixed_shadow_base flag (#73980) · ea991a11
      Thurston Dang authored
      
      
      When set to non-zero, the HWASan runtime will map the shadow base at the
      specified constant address.
      
      This is particularly useful in conjunction with the existing compiler
      option
      'hwasan-mapping-offset', which bakes a hardcoded constant address into
      the instrumentation.
      
      ---------
      
      Co-authored-by: default avatarThurston Dang <thurston@google.com>
      ea991a11
    • Jay Foad's avatar
      [AArch64][SME2] Add REQUIRES to new test · fb2b907f
      Jay Foad authored
      fb2b907f
    • Tom Honermann's avatar
      [Clang] Mark WG14 N2939 (Identifier Syntax Fixes) as available in Clang 15 (#74666) · 53b46890
      Tom Honermann authored
      WG14 N2939 (Identifier Syntax Fixes) corrects a grammar issue in the C
      standard but does not otherwise change intended behavior. This change
      updates the C23 status to note this paper as implemented as of Clang 15;
      the release in which support for N2836 (Identifier Syntax using Unicode
      Standard Annex 31) was implemented.
      53b46890
    • jyu2-git's avatar
      [OpenMP] Fix runtime problem due to wrong map size. (#74692) · 0113722d
      jyu2-git authored
      Currently we are missing set up-boundary address for FinalArraySection
      as highests elements in partial struct data.
      
      Currently for:
      \#pragma omp target map(D.a) map(D.b[:2])
      The size is:
        %a = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 0
        %b = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1
        %arrayidx = getelementptr inbounds [2 x float], ptr %b, i64 0, i64 0
        %2 = getelementptr float, ptr %arrayidx, i32 1
        %3 = ptrtoint ptr %2 to i64
        %4 = ptrtoint ptr %a to i64
        %5 = sub i64 %3, %4
      %6 = sdiv exact i64 %5, ptrtoint (ptr getelementptr (i8, ptr null, i32
      1) to i64)
      
      Where %2 is wrong for (D.b[:2]) is pointer to first element of array
      section. It should pointe to last element of array section.
        
      The fix is to emit the pointer to the last element of array section and
      use this pointer as the highest element in partial struct data.
      
      After change IR:
        %a = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 0
        %b = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1
        %arrayidx = getelementptr inbounds [2 x float], ptr %b, i64 0, i64 0
        %b1 = getelementptr inbounds %struct.DataTy, ptr %D, i32 0, i32 1
        %arrayidx2 = getelementptr inbounds [2 x float], ptr %b1, i64 0, i64 1
        %1 = getelementptr float, ptr %arrayidx2, i32 1
        %2 = ptrtoint ptr %1 to i64
        %3 = ptrtoint ptr %a to i64
        %4 = sub i64 %2, %3
      %5 = sdiv exact i64 %4, ptrtoint (ptr getelementptr (i8, ptr null, i32
      1) to i64)
      0113722d
    • Daniel Grumberg's avatar
    • Maksim Levental's avatar
      db3bc494
    • alex-t's avatar
      AlignmentFromAssumptions should only track pointer operand users (#73370) · d8cd7fc1
      alex-t authored
      AlignmentFromAssumptions uses SCEV to update the load/store alignment.
      It tracks down the use-def chains for the pointer which it takes from
      the assumption cache until it reaches the load or store instruction. It
      mistakenly adds to the worklist the users of the load result
      irrespective of the fact that the load result has no connection with the
      original pointer, moreover, it is not a pointer at all in most cases.
      Thus the def-use chain contains irrelevant load users. When it is a
      store instruction the algorithm attempts to adjust its alignment to the
      alignment of the original pointer. The problem appears when the load and
      store memory operand pointers belong to different address spaces and
      possibly have different sizes.
      The 4bf015c0 was an attempt to address a
      similar problem. The truncation or zero extension was added to make
      pointers the same size. That looks strange to me because the zero
      extension of the pointer is not legal. The test in the
      4bf015c0 does not work any longer as for
      the explicit address spaces conversion the addrspacecast is generated.
      Summarize:
      1. For the alloca to global address spaces conversion addrspacecasts are
      used, so the code added by the 4bf015c0
      is no longer functional.
      2. The AlignmentFromAssumptions algorithm should not add the load users
      to the worklist as they have nothing to do with the original pointer.
      3. Instead we only track users that are: GetelementPtrIns, PHINodes.
      d8cd7fc1
    • Dinar Temirbulatov's avatar
      [AArch64][SME2] Add _x2/_x4 svqrshr builtins. (#74100) · 5416309d
      Dinar Temirbulatov authored
      Patch by: Kerry McLaughlin <kerry.mclaughlin@arm.com>
      5416309d
    • Nick Desaulniers's avatar
      [libc] fix -Wshift-count-overflow in UInt.h (#74649) · 1ee6a1e3
      Nick Desaulniers authored
      Not that I'm very good at SFINAE, but it seems that conversion operators
      are
      perhaps difficult to compose with SFINAE. I saw an example that used one
      layer
      of indirection to have an explicit return type that could then be used
      with
      enable_if_t.
      
      Link: https://stackoverflow.com/a/7604580
      Fixes: #74623
      1ee6a1e3
    • Nikita Popov's avatar
      [AsmParser] Gracefully handle non-existent GV summary reference · dfd36aa7
      Nikita Popov authored
      If the module summary references a global variable that does not
      exist, throw a nice error instead of asserting.
      
      Fixes https://github.com/llvm/llvm-project/issues/74726.
      dfd36aa7
  2. Dec 07, 2023
    • Krzysztof Parzyszek's avatar
      [flang] Use `genOpenMPTerminator` to insert terminator (#74719) · 04c4566c
      Krzysztof Parzyszek authored
      The specific terminator operation depends on what operation it is inside
      of. The function `genOpenMPTerminator` performs these checks and selects
      the appropriate type of terminator.
      
      Remove partial duplication of that code, and replace it with a function
      call. This makes `genOpenMPTerminator` be the sole source of OpenMP
      terminators.
      04c4566c
    • Nikita Popov's avatar
      [InstCombine] Add extra tests for known bits from dominating conds (NFC) · 9026dff3
      Nikita Popov authored
      This adds test coverage for conditions with and/or.
      9026dff3
    • Zack Johnson's avatar
    • Simon Pilgrim's avatar
      [DAG] visitEXTRACT_VECTOR_ELT - constant fold legal fp imm values (#74304) · f1200ca7
      Simon Pilgrim authored
      If we're extracting a constant floating point value, and the constant is a legal fp imm value, then replace the extraction with a fp constant.
      f1200ca7
    • Natalie Chouinard's avatar
      [SPIR-V] Add pre-commit CI workflow (#74092) · 155a0132
      Natalie Chouinard authored
      Add a pre-commit CI workflow for the experimental SPIR-V backend. This
      action should only run when SPIR-V target or test files are modified.
      The `codegen-spirv` tests don't run as part of `check-all` because the
      SPIR-V backend is still experimental.
      
      Depends on #73371 (for a green tree)
      155a0132
    • Natalie Chouinard's avatar
      [SPIR-V] Remove deleted functions (#74660) · d40eb0a5
      Natalie Chouinard authored
      Remove references to functions that were deleted in #74521 which are
      causing SPIR-V backend build failures.
      d40eb0a5
    • Dominik Wójt's avatar
      [libc++] tests with picolibc: handle stdin (#74712) · ed61123f
      Dominik Wójt authored
      Add proper explanation for cin.sh.cpp fail.
      The stdin-is-piped.sh.cpp used to fail with old qemu (4.2.0), but should
      pass now, as the qemu is updated now to 8.1.3 in CI.
      ed61123f
    • Joseph Huber's avatar
      [Libomptarget][Obvious] Fix incorrect if-else in CMake for destination · 52fe16a4
      Joseph Huber authored
      Summary:
      This was added in a previous patch to update how we export the static
      library used for OpenMP offloading. By mistake this if-else was using
      the output incorrectly.
      
      Fixes https://github.com/llvm/llvm-project/issues/74079
      52fe16a4
    • Timm Bäder's avatar
      [clang][Interp][NFC] Remove unused include · 9406d2a3
      Timm Bäder authored
      9406d2a3
    • W-50243's avatar
      [libc++] Fix regex_traits::isctype on big endian platforms (#73200) · 6ea33445
      W-50243 authored
      'isctype' fails in arm64-big-endian because the __regex_word involved
      in mask operation is not changed based on the platform endianness, while
      the character mask does change.
      6ea33445
    • Simon Pilgrim's avatar
      5384fb3d
    • Nhat Nguyen's avatar
    • Nikita Popov's avatar
      [InstCombine] Support or disjoint in displaced shift fold · 6e8b17d8
      Nikita Popov authored
      When I originally added this fold, it did not actually fix my
      motivation case, where the add was represented as an or. Now that
      we have the disjoint flag this can finally be cleanly supported.
      6e8b17d8
    • Nikita Popov's avatar
    • Utkarsh Saxena's avatar
    • Nikita Popov's avatar
      [PatternMatch] Add m_AddLike matcher (NFC) · 5295b12c
      Nikita Popov authored
      This matches either a plain "add" or an "or disjoint" that can
      be converted into an add. The AddLike terminology is adopted from
      the SDAG layer.
      5295b12c
    • Krzysztof Parzyszek's avatar
      [flang] Use `createOpWithBody` for section op, NFC (#74659) · 85e86528
      Krzysztof Parzyszek authored
      Replace explicit calls to
      ```
        op = builder.create<SectionOp>(...)
        createBodyOfOp<SectionOp>(op, ...)
      ```
      with a single call to
      ```
        createOpWithBody<SectionOp>(...)
      ```
      
      This is NFC, that's what the `createOpWithBody` function does.
      85e86528
    • Nikita Popov's avatar
      [LoopVectorize] Regenerate test checks (NFC) · f2f07789
      Nikita Popov authored
      This test contains an annoying mix of generated and hand-written
      check lines. Generate the whole test.
      f2f07789
    • Aaron Ballman's avatar
      Remove dead code; NFC · 3293c088
      Aaron Ballman authored
      This code was added 17 years ago but never enabled or tested. GCC warns
      that -I- is deprecated for them, and Clang gives an error when passed
      -I-, so we may as well remove this code rather than hook it up to the
      driver and maintain it.
      3293c088
    • Nikita Popov's avatar
      [ValueTracking] Add missing check when computing known bits from pointer icmp · 6a1badfe
      Nikita Popov authored
      I'm not sure whether it's possible to cause a miscompile due to
      the missing check right now, as the affected values mechanism
      effectively protects us against this. This becomes a problem for
      an upcoming patch though.
      6a1badfe
    • Shengchen Kan's avatar
    • wanglei's avatar
      [LoongArch] Add codegen support for icmp/fcmp with lsx/lasx fetaures (#74700) · 9ff7d0eb
      wanglei authored
      Mark ISD::SETCC node as legal, and add handling for the vector types
      condition codes.
      9ff7d0eb
    • Pablo Antonio Martinez's avatar
      Reland "[MLIR][Transform] Add attribute in MatchOp to filter by operand type (#67994)" · b396e542
      Pablo Antonio Martinez authored
      Test was failing due to a different transform sequence declaration (transform sequence were used, while now it should be named transform sequence). Test is now fixed.
      b396e542
    • Duo Wang's avatar
      [CMake][Windows] Turn off lld string tail merging when ASAN is turned on (#74207) · 4a4804bf
      Duo Wang authored
      lld string tail merging interacts badly with ASAN on Windows, as is
      reported in https://github.com/llvm/llvm-project/issues/62078.
      A similar error was found when building LLVM with
      `-DLLVM_USE_SANITIZER=Address`:
      ```console
      [2/2] Building GenVT.inc...
      FAILED: include/llvm/CodeGen/GenVT.inc C:/Dev/llvm-project/Build_asan/include/llvm/CodeGen/GenVT.inc
      cmd.exe /C "cd /D C:\Dev\llvm-project\Build_asan && C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe -gen-vt -I C:/Dev/llvm-project/llvm/include/llvm/CodeGen -IC:/Dev/llvm-project/Build_asan/include -IC:/Dev/llvm-project/llvm/include C:/Dev/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o include/llvm/CodeGen/GenVT.inc -d include/llvm/CodeGen/GenVT.inc.d"       
      =================================================================
      ==31944==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7ff6cff80d20 at pc 0x7ff6cfcc7378 bp 0x00e8bcb8e990 sp 0x00e8bcb8e9d8
      READ of size 1 at 0x7ff6cff80d20 thread T0
          #0 0x7ff6cfcc7377 in strlen (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1400a7377)
          #1 0x7ff6cfde50c2 in operator delete(void *, unsigned __int64) (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1401c50c2)
          #2 0x7ff6cfdd75ef in operator delete(void *, unsigned __int64) (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1401b75ef)
          #3 0x7ff6cfde59f9 in operator delete(void *, unsigned __int64) (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1401c59f9)
          #4 0x7ff6cff03f6c in operator delete(void *, unsigned __int64) (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1402e3f6c)
          #5 0x7ff6cfefbcbc in operator delete(void *, unsigned __int64) (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1402dbcbc)
          #6 0x7ffb7f247343  (C:\WINDOWS\System32\KERNEL32.DLL+0x180017343)
          #7 0x7ffb800826b0  (C:\WINDOWS\SYSTEM32\ntdll.dll+0x1800526b0)
      
      0x7ff6cff80d20 is located 31 bytes after global variable '"#error \"ArgKind is not defined\"\n"...' defined in 'C:\Dev\llvm-project\llvm\utils\TableGen\IntrinsicEmitter.cpp' (0x7ff6cff80ce0) of size 33
        '"#error \"ArgKind is not defined\"\n"...' is ascii string '#error "ArgKind is not defined"
      '
      0x7ff6cff80d20 is located 0 bytes inside of global variable '""' defined in 'C:\Dev\llvm-project\llvm\utils\TableGen\IntrinsicEmitter.cpp' (0x7ff6cff80d20) of size 1
        '""' is ascii string ''
      SUMMARY: AddressSanitizer: global-buffer-overflow (C:\Dev\llvm-project\Build_asan\bin\llvm-min-tblgen.exe+0x1400a7377) in strlen
      Shadow bytes around the buggy address:
        0x7ff6cff80a80: 01 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 01 f9 f9 f9
        0x7ff6cff80b00: f9 f9 f9 f9 00 00 00 00 00 00 00 00 01 f9 f9 f9
        0x7ff6cff80b80: f9 f9 f9 f9 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9
        0x7ff6cff80c00: 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
        0x7ff6cff80c80: 00 00 00 00 01 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
      =>0x7ff6cff80d00: 01 f9 f9 f9[f9]f9 f9 f9 00 00 00 00 00 00 00 00
        0x7ff6cff80d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x7ff6cff80e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x7ff6cff80e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x7ff6cff80f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x7ff6cff80f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07
        Heap left redzone:       fa
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==31944==ABORTING
      ```
      This is reproducible with the 17.0.3 release:
      ```console
      $ clang-cl --version
      clang version 17.0.3
      Target: x86_64-pc-windows-msvc
      Thread model: posix
      InstalledDir: C:\Program Files\LLVM\bin
      $ cmake -S llvm -B Build -G Ninja -DLLVM_USE_SANITIZER=Address -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_BUILD_TYPE=Release
      $ cd Build
      $ ninja all
      ```
      4a4804bf
    • Michael Buch's avatar
    • Martin Storsjö's avatar
      [compiler-rt] Fix linking a standalone libatomic for MinGW (#74668) · 76b89759
      Martin Storsjö authored
      Whenever linking with -nodefaultlibs for a MinGW target, we manually
      need to specify a bunch of libraries - listed in ${MINGW_LIBRARIES}; the
      same is already done for sanitizers and libunwind/libcxxabi/libcxx.
      
      Practically speaking, linking with -nodefaultlibs but manually passing
      the libraries in ${MINGW_LIBRARIES} restores most of the libraries that
      are linked by default, except for the potential compiler builtins and
      unwind library; i.e. it has essentially the same effect as linking with
      "--unwindlib=none -rtlib=none", except that -rtlib doesn't accept such a
      value.
      
      When building only compiler-rt/lib/builtins, not all of compiler-rt,
      ${MINGW_LIBRARIES} is unset - set it manually here for that case. This
      matches what is set in
      compiler-rt/cmake/config-ix.cmake, except that the builtins (libgcc or
      compiler-rt builtins) is omitted; the only use within lib/buitlins is
      for the standalone libatomic, which explicitly already links against the
      just-built builtins.
      76b89759
    • Mehdi Amini's avatar
    • Harald van Dijk's avatar
      Implement SoftPromoteHalf for FFREXP. (#74076) · 03edfe61
      Harald van Dijk authored
      `llvm/test/CodeGen/RISCV/llvm.frexp.ll` and
      `llvm/test/CodeGen/X86/llvm.frexp.ll` contain a number of disabled tests
      for unimplemented functionality. This implements one missing part of it.
      03edfe61
    • DonatNagyE's avatar
      [analyzer] EnumCastOutOfRangeChecker: report the value (#74503) · 2f29ded4
      DonatNagyE authored
      ...that is causing the bug report when it's converted to the enum type.
      This commit only improves the diagnostics and does not affect the set of
      reports.
      2f29ded4
    • Tom Eccles's avatar
      [mlir][LLVM] Add nsw and nuw flags (#74508) · e9e1c411
      Tom Eccles authored
      The implementation of these are modeled after the existing fastmath
      flags for floating point arithmetic.
      e9e1c411