1. Apr 23, 2024
    • LLVM GN Syncbot's avatar
      [gn build] Port 40137ff0 · bcd150d2
      LLVM GN Syncbot authored
      bcd150d2
    • Xu Jun's avatar
      [lldb][dap] always add column field in StackFrame body (#73393) · 99f42e6b
      Xu Jun authored
      
      
      The `column` field is mandatory in StackTraceResponse, otherwise the
      debugger client may raise error (e.g. VSCode can't correctly open an
      editor without the column field)
      
      ---------
      
      Signed-off-by: default avatarXu Jun <693788454@qq.com>
      99f42e6b
    • Krzysztof Parzyszek's avatar
      [Frontend][OpenMP] Refactor getLeafConstructs, add getCompoundConstruct (#87247) · 40137ff0
      Krzysztof Parzyszek authored
      Emit a special leaf construct table in DirectiveEmitter.cpp, which will
      allow both decomposition of a construct into leafs, and composition of
      constituent constructs into a single compound construct (if possible).
      The function `getLeafConstructs` is no longer auto-generated, but
      implemented in OMP.cpp.
      
      The table contains a row for each directive, and each row has the
      following format
      `dir_id, num_leafs, leaf1, leaf2, ..., leafN, -1, ...`
      The rows are sorted lexicographically with respect to the leaf
      constructs. This allows a binary search for the row corresponding to the
      given list of leafs.
      
      There is an auxiliary table that for each directive contains the index
      of the row corresponding to that directive.
      
      Looking up leaf constructs for a directive `dir_id` is of constant time,
      and and consists of two lookups: `LeafTable[Auxiliary[dir_id]]`.
      Finding a compound directive given the set of leafs is of time O(logn),
      and is roughly represented by
      `row = binary_search(LeafTable); return row[0]`.
      
      The functions `getLeafConstructs` and `getCompoundConstruct` use these
      lookup methods internally.
      40137ff0
    • Fangrui Song's avatar
      [llvm-readobj] Remove --raw-relr · 89c95eff
      Fangrui Song authored
      https://reviews.llvm.org/D47919 dumped RELR relocations as
      `R_*_RELATIVE` and added --raw-relr (not in GNU) for testing purposes
      (more readable than `llvm-readelf -x .relr.dyn`). The option is obsolete
      after `llvm-readelf -r` output gets improved (#89162).
      
      Since --raw-relr never seems to get more adoption. Let's remove it to
      avoid some complexity.
      
      Pull Request: https://github.com/llvm/llvm-project/pull/89426
      89c95eff
    • Joseph Huber's avatar
      [Offload] Fix per-target install directory (#89645) · a6f1b3a4
      Joseph Huber authored
      Summary:
      The move from `openmp` to `offload` did not preserve the per-target
      runtime directory installation. This is important because this
      per-target directory is always included first and is likely the de-facto
      way to handle these going forward. Without this installation, old
      installations of the library will be linked against first.
      a6f1b3a4
    • Craig Topper's avatar
      [RISCV][clang] Don't enable -mrelax-all for -O0 on RISC-V (#88538) · 6b1b4c1c
      Craig Topper authored
      -O0 implies -mrelax-all as an assembler compile time optimization.
      -mrelax-all allows the assembler to complete layout in 2 passes instead
      of doing iterative branch relaxation.
      
      Jump offsets larger than +/-1MiB require an indirect jump on RISC-V.
      This can't be done by the assembler, so we use a branch relaxation MIR
      pass and use register scavenging to find a free register.
      
      The conditional branch offsets for RISC-V are also somewhat small so we
      support MC layer branch relaxation to make life easier for assembly
      programmers. This may also cover up bugs in our function size estimation
      in MachineIR.
      
      Enabling -mrelax-all causes the MC layer relaxation to agressively relax
      branches. This increases code size and can create cases where we need an
      indirect jump, but we can't create one. This leads to linker failures.
      
      The easiest way to avoid this is to not default to -mrelax-all for -O0
      and sacrifice the compile time optimization. That's what this patch
      does.
      
      Fixes #87127
      6b1b4c1c
    • Nick Desaulniers's avatar
      [libc][POSIX][pthreads] implement pthread_rwlockattr_t functions (#89322) · dd796323
      Nick Desaulniers authored
      Implement:
      - pthread_rwlockattr_destroy
      - pthread_rwlockattr_getpshared
      - pthread_rwlockattr_init
      - pthread_rwlockattr_setpshared
      dd796323
    • Nick Desaulniers's avatar
      [libc][docs] codify Policy on Assembler Sources (#88185) · 0336116e
      Nick Desaulniers authored
      It would be helpful in future code reviews to document a policy with
      regards to
      where and when Assembler sources are appropriate. That way when
      reviewers point
      out infractions, they can point to this written policy, which may help
      contributors understand that it's not solely the personal preferences of
      individual reviewers but instead rather a previously agreed upon rule by
      maintainers.
      
      Link: https://github.com/llvm/llvm-project/pull/87837
      Link: https://github.com/llvm/llvm-project/pull/88157
      Link:
      https://discourse.llvm.org/t/hand-written-in-assembly-in-libc-setjmp-longjmp/73249/12
      0336116e
    • Théo Degioanni's avatar
      [llvm] Add support for zero-width integers in MathExtras.h (#87193) · a54102a0
      Théo Degioanni authored
      MLIR uses zero-width integers, but also re-uses integer logic from LLVM
      to avoid duplication. This creates issues when LLVM logic is used in
      MLIR on integers which can be zero-width. In order to avoid
      special-casing the bitwidth-related logic in MLIR, this PR adds support
      for zero-width integers in LLVM's MathExtras (and consequently APInt).
      
      While most of the logic in theory works the same way out of the box,
      because bitshifting right by the entire bitwidth in C++ is undefined
      behavior instead of being zero, some special cases had to be added.
      Fortunately, it seems like the performance penalty is small. In x86,
      this usually yields the addition of a predicated conditional move. I
      checked that no branch is inserted in Arm too.
      
      This happens to fix a crash in `arith.extsi` canonicalization in MLIR. I
      think a follow-up PR to add tests for i0 in arith would be beneficial.
      a54102a0
    • Nick Desaulniers's avatar
      [libc] don't over include stdlib in the hdr declaring bsearch (#89471) · 43c26bbc
      Nick Desaulniers authored
      When building overlay mode with GCC in release mode, glibc's stdlib.h
      contains
      an extern inline declaration of bsearch. This breaks our use of the
      gnu::alias
      function attribute in LLVM_LIBC_FUNCTION with GCC because GCC checks
      that the
      aliasee is defined in the same TU (clang does not).
      
      We're looking at also potentially updating our definition of
      LLVM_LIBC_FUNCTION
      from libc/src/__support/common.h. Upon testing, I was able to get
      -Wnonnull-compare diagnostics from GCC in our definition of bsearch
      because
      glibc declares bsearch with the fugly nonnull function attribute.
      
      There's more we can do here though to improve our implementation of
      bsearch.
      7.24.5.1 says:
      
          Pointer arguments on such a call shall still have valid values, as
          described in 7.1.4.
      
      We could also use either function attributes or parameter attributes to
      denote
      these should not be null (for users/callers) and perhaps still check for
      non-null explicitly under some yet to be discussed hardening
      configurations in
      the future.
      
      Link: #60481
      Link:
      https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute
      43c26bbc
    • js324's avatar
      [BitInt] Expose a _BitInt literal suffix in C++ (#86586) · ca1f1c95
      js324 authored
      This exposes _BitInt literal suffixes __wb and u__wb as an extension
      in C++. There is a new Extension warning, and the tests are
      essentially the same as the existing _BitInt literal tests for C but
      with a few additional cases.
      
      Fixes #85223
      ca1f1c95
    • Philip Reames's avatar
      [RISCV] Add freeze when expanding mul by constant to two or more uses (#89290) · 9a359516
      Philip Reames authored
      topperc pointed this out in review of
      https://github.com/llvm/llvm-project/pull/88791, but I believe the
      problem applies
      here as well. Worth noting is that the code I introduced with this bug
      was mostly copied from other targets - which
      also have this bug.
      9a359516
    • Jordan Rupprecht's avatar
      2834e8ad
    • YunQiang Su's avatar
      [MIPS]: Rework atomic max/min expand for subword (#89575) · 758d97dc
      YunQiang Su authored
      The current code is so buggy: it can work for few cases. The problems
      include:
      1. ll/sc works on a whole word, while other parts other than we rmw are
      dropped.
        2. The oprands are not well zero-extended for unsigned ops.
      3. It doesn't work for big-endian, as the postion of subword differs
      with little endian.
      
      And in fact, we can set the return value correct in ll/sc scope, so we
      can skip the sinkMBB.
      758d97dc
    • Félix-Antoine Constantin's avatar
      [clang-tidy] Improved --verify-config when using literal style in config file (#85591) · f94ed6f7
      Félix-Antoine Constantin authored
      Specifying checks using the literal style (|) in the clang-tidy config
      file is currently supported but was not implemented for the
      --verify-config options. This means that clang-tidy would work properly
      but, using the --verify-config option would raise an error due to some
      checks not being parsed properly.
      
      Fixes #53737
      f94ed6f7
    • Krzysztof Parzyszek's avatar
      [flang][OpenMP] Concatenate begin and end clauses into single list (#89090) · 9c9dea94
      Krzysztof Parzyszek authored
      This will remove the distinction between begin clauses and end clauses,
      and process all of them together.
      9c9dea94
    • Michal Paszkowski's avatar
      [SPIR-V] Emit SPIR-V generator magic number and version (#87951) · f352ce36
      Michal Paszkowski authored
      This patch:
      - Adds SPIR-V backend's registered generator magic number to the emitted
      binary. The magic number consists of the generator ID (43) and LLVM
      major version.
      - Adds SPIR-V version to the binary.
      - Allows reading the expected (maximum supported) SPIR-V version from
      the target triple.
      - Uses VersionTuple for representing versions throughout the backend's
      codebase.
      - Registers v1.6 for spirv32 and spirv64 triple.
      
      See more: https://github.com/KhronosGroup/SPIRV-Headers/commit/7d500c
      f352ce36
    • Miro Bucko's avatar
      [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (#88564) · 92631a48
      Miro Bucko authored
      Summary:
      AddMemoryList() was returning the last error status returned by
      ReadMemory(). So if an invalid memory region was read last, the function
      would return an error.
      
      Test Plan:
      ./bin/llvm-lit -sv
      ~/src/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
      
      Reviewers:
      kevinfrei,clayborg 
      
      Subscribers:
      
      Tasks:
      
      Tags:
      92631a48
    • Wentao Zhang's avatar
      [clang][CoverageMapping] do not emit a gap region when either end doesn't have... · c1b6cca1
      Wentao Zhang authored
      [clang][CoverageMapping] do not emit a gap region when either end doesn't have valid source locations (#89564)
      
      Fixes #86998
      c1b6cca1
    • Craig Topper's avatar
      [RISCV] Add extension information to RISCVFeatures.td. NFC (#89326) · a6c02829
      Craig Topper authored
      This adds a new RISCVExtension class that inherits from
      SubtargetFeature. This contains the major/minor version and whether the
      extension is experimental. The plan is to use this to generate the
      tables for RISCVISAInfo.cpp.
      
      The version numbers might not be accurate yet. If there are errors they
      will be fixed before they are used for anything. It will be easier to
      verify once the new tablegen backend is written to generate the
      RISCVISAInfo.cpp table.
      a6c02829
    • Nikolas Klauser's avatar
      [Clang] Fix __is_trivially_equaltiy_comparable documentation (#88528) · 9aa663bb
      Nikolas Klauser authored
      Currently `__is_trivially_equality_comparable` is documented to return
      true if comparing the value representation is equivalent to calling the
      comparison operator, which is not quite what the trait actually checks.
      The traits actually checks that comparing the object representation is
      equivalent, which means that there cannot be padding bytes in the type.
      9aa663bb
    • zibi2's avatar
      [clangd] Fix unittests in TargetDeclTest bucket (#89630) · 180cf4da
      zibi2 authored
      This PR fixes the build errors for one of the `clangd` unit tests bucket
      similar to the following:
      
      ```
      .../clang-tools-extra/clangd/unittests/FindTargetTests.cpp:430:29: error: passing no argument for the '...' parameter of a variadic macro is a C++20 extension [-Werror,-Wc++20-extensions]
        430 |   EXPECT_DECLS("AutoTypeLoc");
            |                             ^
      .../clang-tools-extra/clangd/unittests/FindTargetTests.cpp:98:9: note: macro 'EXPECT_DECLS' defined here
         98 | #define EXPECT_DECLS(NodeType, ...)                                            \
            |         ^
      ```
      
      This happens when using a build compiler with #84520. The fix is to
      include commas to compensate for empty vararg macro arguments in a few
      instances.
      180cf4da
    • Kai Nacke's avatar
      [SystemZ][NFC] Use new getPointerSize function (#89623) · 772863e3
      Kai Nacke authored
      Use the new getPointerSize() function throughout the frame lowering class.
      772863e3
    • ZijunZhaoCCK's avatar
      Carving out -Wformat warning about scoped enums into a subwarning (#88595) · 73ed2153
      ZijunZhaoCCK authored
      Make it part of -Wformat-pedantic.
      
      Fixes #81647
      73ed2153
    • Iman Hosseini's avatar
      [flang][cuda] fix parsing of cuda_kernel (#89613) · 7c20576c
      Iman Hosseini authored
      
      
      Fix parsing of cuda_kernel: it missed a mlir::succeeded check and it was
      not setting up the `types` and causing mismatch between values and types
      of the grid/block (CUFKernelValues). @clementval
      
      ---------
      
      Co-authored-by: default avatarIman Hosseini <imanh@nvidia.com>
      Co-authored-by: default avatarValentin Clement (バレンタイン クレメン) <clementval@gmail.com>
      7c20576c
    • Stephen Tozer's avatar
      [RemoveDIs] Preserve debug info format in llvm-reduce (#89220) · 8128d4b1
      Stephen Tozer authored
      As the goal of LLVM reduce is to simplify the input file, it should not
      modify the debug info format - doing so by default would make it
      impossible to reduce an error that only occurs in the old format, for
      example (as briefly discussed at
      https://github.com/llvm/llvm-project/pull/86275). This patch uses the
      new "preserve debug info format" flag in llvm-reduce to prevent the
      input from being subtly transformed by llvm-reduce itself; this has no
      effect on any tools used for the interestingness check (i.e. if `opt` is
      invoked, it will still convert the reduced input to the new format by
      default), but simply ensures that the reduced file is strictly reduced
      rather than modified.
      8128d4b1
    • Johannes Doerfert's avatar
      [Offload] Move `/openmp/libomptarget` to `/offload` (#75125) · 330d8983
      Johannes Doerfert authored
      In a nutshell, this moves our libomptarget code to populate the offload
      subproject.
      
      With this commit, users need to enable the new LLVM/Offload subproject
      as a runtime in their cmake configuration.
      No further changes are expected for downstream code.
      
      Tests and other components still depend on OpenMP and have also not been
      renamed. The results below are for a build in which OpenMP and Offload
      are enabled runtimes. In addition to the pure `git mv`, we needed to
      adjust some CMake files. Nothing is intended to change semantics.
      
      ```
      ninja check-offload
      ```
      Works with the X86 and AMDGPU offload tests
      
      ```
      ninja check-openmp
      ```
      Still works but doesn't build offload tests anymore.
      
      ```
      ls install/lib
      ```
      Shows all expected libraries, incl.
      - `libomptarget.devicertl.a`
      - `libomptarget-nvptx-sm_90.bc`
      - `libomptarget.rtl.amdgpu.so` -> `libomptarget.rtl.amdgpu.so.18git`
      - `libomptarget.so` -> `libomptarget.so.18git`
      
      Fixe...
      330d8983
    • Sirraide's avatar
      [Clang] Fix crash on invalid size in user-defined `static_assert` message (#89420) · b6628c24
      Sirraide authored
      This addresses two problems observed in #89407 wrt user-defined
      `static_assert` messages:
      
      1. In `Expr::EvaluateCharRangeAsString`, we were calling `getExtValue()`
      instead of `getZExtValue()`, which would assert if a negative or very
      large number was returned from `size()`.
      2. If the value could not be converted to `std::size_t`, attempting to
      diagnose that would crash because `ext_cce_narrowing` was missing two
      `%select` cases.
      
      This fixes #89407.
      b6628c24
    • Farzon Lotfi's avatar
      [SPIRV][HLSL] map lerp to Fmix (#88976) · c4c54af5
      Farzon Lotfi authored
      - `clang/lib/CodeGen/CGBuiltin.cpp` - switch to using
      `getLerpIntrinsic()` to abstract backend intrinsic
      - `clang/lib/CodeGen/CGHLSLRuntime.h` - add `getLerpIntrinsic()` 
      - `llvm/include/llvm/IR/IntrinsicsSPIRV.td` - add SPIRV intrinsic for
      lerp
      - `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - add mapping of
      HLSL's lerp to GLSL's Fmix.
      
      resolves #88940
      c4c54af5
    • Mircea Trofin's avatar
      Revert "[compiler-rt][ctx_instr] Add `ctx_profile` component" (#89625) · 8b2ba6a1
      Mircea Trofin authored
      Reverts llvm/llvm-project#89304
      
      Some build bot failures - will fix and reland.
      
      Example: https://lab.llvm.org/buildbot/#/builders/165/builds/52789
      8b2ba6a1
    • Simon Pilgrim's avatar
      [X86] gfni-funnel-shifts.ll - add vXi8 variable/splat/constant test coverage · 832d3a42
      Simon Pilgrim authored
      Once #89115 has landed, we can handle per-element rotates as well using (V)GF2P8MULB
      832d3a42
    • Alexey Bataev's avatar
      [SLP]Introduce transformNodes() and transform loads + reverse to strided loads. · 0ab0c1d9
      Alexey Bataev authored
      Introduced transformNodes() function to perform transformation of the
      nodes (cost-based, instruction count based, etc.).
      Implemented transformation of consecutive loads + reverse order to
      strided loads with stride -1, if profitable.
      
      Reviewers: RKSimon, preames, topperc
      
      Reviewed By: RKSimon
      
      Pull Request: https://github.com/llvm/llvm-project/pull/88530
      0ab0c1d9
    • Mircea Trofin's avatar
      [compiler-rt][ctx_instr] Add `ctx_profile` component (#89304) · 6ad22c87
      Mircea Trofin authored
      Add the component structure for contextual instrumented PGO and the bump allocator + test.
      
      (Tracking Issue: #89287, RFC referenced there)
      6ad22c87
    • Krystian Stasiowski's avatar
      [Clang][Sema] Remove unused function after #88731 (#89618) · 7c581b55
      Krystian Stasiowski authored
      Removes an unused static function `IsOverloaded` from `SemaOverload.cpp`
      that is unused after #88731.
      7c581b55
    • Paul Kirth's avatar
      [RISCV] Precommit stack protector checks for Linux and Android (#87679) · 60535229
      Paul Kirth authored
      Upcoming patches will add TP relative stack checks for Android, and
      Linux currently uses the default GOT based stack protector.
      60535229
    • Alex MacLean's avatar
      [NVPTX][NFCI] Use DataLayout to determine short shared/local/const pointers (#89404) · 583795e1
      Alex MacLean authored
      Use the datalayout directly to determine the correct `cvta` instruction
      for converting shared/local/const pointers. This is cleaner as it
      eliminates the need to keep a redundant copy of this info in the TM and
      makes clear which address spaces short pointers are applicable for.
      583795e1
  2. Apr 22, 2024
    • Aaron Ballman's avatar
      [C23] Select the correct promoted type for a bit-field (#89254) · 947cd677
      Aaron Ballman authored
      Bit-fields of bit-precise integer type do not promote to int, but
      instead promote to the type of the field.
      
      Fixes #87641
      947cd677
    • Erich Keane's avatar
      [OpenACC] Implement 'num_gangs' sema for compute constructs (#89460) · dc20a0ea
      Erich Keane authored
      num_gangs takes an 'int-expr-list', for 'parallel', and an 'int-expr'
      for 'kernels'. This patch changes the parsing to always parse it as an
      'int-expr-list', then correct the expression count during Sema. It also
      implements the rest of the semantic analysis changes for this clause.
      dc20a0ea
    • Krystian Stasiowski's avatar
      Reapply "[Clang][Sema] Fix crash when 'this' is used in a dependent class... · 5c4b923c
      Krystian Stasiowski authored
      Reapply "[Clang][Sema] Fix crash when 'this' is used in a dependent class scope function template specialization that instantiates to a static member function (#87541, #88311)" (#88731)
      
      Reapplies #87541 and #88311 (again) addressing the bug which caused
      expressions naming overload sets to be incorrectly rebuilt, as well as
      the bug which caused base class members to always be treated as overload
      sets.
      
      The primary change since #88311 is `UnresolvedLookupExpr::Create` is called directly in `BuildPossibleImplicitMemberExpr` with `KnownDependent` as `true` (which causes the expression type to be set to `ASTContext::DependentTy`). This ensures that any further semantic analysis involving the type of the potentially implicit class member access expression is deferred until instantiation. 
      5c4b923c
    • Alexey Bataev's avatar
      [SLP]Fix PR89614: phis can be reordered, if reuses are not empty. · 6bd29d66
      Alexey Bataev authored
      Need to relax assertion and check ReuseShuffleIndices is not empty, if
      the root phi node has reorder indices.
      6bd29d66