1. Jan 25, 2024
    • Craig Topper's avatar
      [Docs] Mention RISC-V in the introductory paragraph in ShadowCallStack.rst. (#79241) · e6f576b0
      Craig Topper authored
      RISC-V is mentioned elsewhere in the document it seems like it should be
      mentioned in the introduction.
      e6f576b0
    • Eric's avatar
      Unconditionally lower std::string's alignment requirement from 16 to 8. (#68925) · 04ce0baf
      Eric authored
      Unconditionally change std::string's alignment to 8.
      
      This change saves memory by providing the allocator more freedom to
      allocate the most
      efficient size class by dropping the alignment requirements for
      std::string's
      pointer from 16 to 8. This changes the output of std::string::max_size,
      which makes it ABI breaking.
      
      That said, the discussion concluded that we don't care about this ABI
      break. and would like this change enabled universally.
      
      The ABI break isn't one of layout or "class size", but rather the value
      of "max_size()" changes, which in turn changes whether `std::bad_alloc`
      or `std::length_error` is thrown for large allocations.
      
      This change is the child of PR #68807, which enabled the change behind
      an ABI flag.
      04ce0baf
    • Joseph Huber's avatar
      [Offload] Fix the offloading wrapper when merged multiple times. (#79231) · a551703c
      Joseph Huber authored
      Summary:
      The offloading wrapper is a object file that contains code necessary to
      register offloading entries for the given runtime. Currently, we
      expected only one of these to be present when we make the final
      executable. However, in the case of redistributable linking with `-r` we
      can end up with multiple of these being generated before finally
      creating the executable.
      
      This patch simply changes the defintiions of these globals to be
      mergable. This allows multiples of these to participate in a single link
      job. For ELF, we just make the dummy variable internal and used so it
      sets up the section as expected. For COFF we make the entries weak_odr
      so they merge to a single symbol
      a551703c
    • Joseph Huber's avatar
      [LinkerWrapper] Do not link device code under a relocatable link (#79314) · 0f8b5295
      Joseph Huber authored
      Summary:
      A relocatable link through `clang -r` can go through the
      clang-linker-wrapper if offloading is enabled. This will have the effect
      of linking the device code and creating the wrapper module. It will then
      be merged into the final file. This is useful behavior on its own, but
      is likely not what is expected for a `-r` job.
      
      This patch makes the linker wrapper ignore the device code when doing a
      reloctable link. This has the effect of the linker merging the
      `.llvm.offloading` sections in the output object. These will then be
      parsed as normal when the executable is finally created.
      
      Even though this doesn't actually perform a reloctable link on the
      device code itself, it has a similar effect of combining multiple files
      into a single one.
      0f8b5295
    • Peiming Liu's avatar
      [mlir][sparse] setup `SparseIterator` to help generating code to traverse a... · 298412b5
      Peiming Liu authored
      [mlir][sparse] setup `SparseIterator` to help generating code to traverse a sparse tensor level. (#78345)
      
      298412b5
    • Alexey Bataev's avatar
      [SLP]Fix PR79229: Check that extractelement is used only in a single node · 48bbd765
      Alexey Bataev authored
      before erasing.
      
      Before trying to erase the extractelement instruction, not enough to
      check for single use, need to check that it is not used in several nodes
      because of the preliminary nodes reordering.
      48bbd765
    • Andy Kaylor's avatar
      Move raw_string_ostream back to raw_ostream.cpp (#79224) · bb65f5a5
      Andy Kaylor authored
      The implementation of raw_string_ostream::write_impl() was moved to
      raw_socket_stream.cpp when the raw_socket_ostream support was separated.
      This patch moves it back to facilitate disabling socket support in
      downstream projects.
      bb65f5a5
    • Jonas Paulsson's avatar
      [SystemZ] Require D12 for i128 accesses in isLegalAddressingMode() (#79221) · 84dcf3d3
      Jonas Paulsson authored
      Machines with vector support handle i128 in vector registers and
      therefore only have the small displacement available for memory
      accesses. Update isLegalAddressingMode() to reflect this.
      84dcf3d3
    • Schrodinger ZHU Yifan's avatar
      [libc] remove unstable mincore test for invalid vec (#79348) · 7b11c08c
      Schrodinger ZHU Yifan authored
      The faults on invalid vec range in mincore seems to be handled
      differently by the OS (it is an erroneous edge case after all). Remove
      the tests for now.
      7b11c08c
    • Reid Kleckner's avatar
    • Nico Weber's avatar
      d8a34c25
    • Wei Wang's avatar
      [clang] Make sure the same UsingType is searched and inserted (#79182) · 2e52e13c
      Wei Wang authored
      When creating a new UsingType, the underlying type may change if it is a
      declaration. This creates an inconsistency between the type searched and
      type created. Update member and non-member Profile functions so that
      they return the same ID.
      2e52e13c
    • Mircea Trofin's avatar
      [mlgo] bazel rules for mlgo-utils (#79217) · 123c83dd
      Mircea Trofin authored
      Akin the `py_binary` rules for `lit`, these are scoped to binaries,
      rather than exposing the library - binary split. The latter is available
      to the package (pip package) users.
      
      Tested:
      
      ```
      cd utils/bazel
      bazel build @llvm-project//llvm:extract_ir
      bazel-bin/external/llvm-project/llvm/extract_ir --help
      ```
      ...and observed expected output (rather than import not found errors)
      
      (Same for the other 2 targets).
      123c83dd
    • Nico Weber's avatar
      [gn] port 32f79226 (LLVMOptDriver) · 609695b2
      Nico Weber authored
      609695b2
    • Nico Weber's avatar
      Reland "[CMake/Bazel] Support usage of opt driver as a library (#79205)" · 31359840
      Nico Weber authored
      This reverts commit be08be5d.
      The build error was due to a different change, apologies!
      31359840
    • Michael Maitland's avatar
      [CodeGen][MISched] Rename instance of Cycle -> ReleaseAtCycle · d2d42dcf
      Michael Maitland authored
      b1ae461a renamed Cycle ->
      ReleaseAtCycle.
      
      7e09239e was committed without rebasing
      but used the old Cycle syntax.
      
      This caused a build failure when
      7e09239e was squash-and-merged. This
      patch fixes this problem.
      d2d42dcf
    • Nico Weber's avatar
    • Schrodinger ZHU Yifan's avatar
      [libc] reland mincore (#79309) · 048041f1
      Schrodinger ZHU Yifan authored
      048041f1
    • Michael Maitland's avatar
      [CodeGen][MISched] Handle empty sized resource usage. (#75951) · 7e09239e
      Michael Maitland authored
      TargetSchedule.td explicitly allows the usage of a ProcResource for zero
      cycles, in order to represent that the ProcResource must be available
      but is not consumed by the instruction. On the other hand,
      ResourceSegments explicitly does not allow for a zero sized interval. In
      order to remedy this, this patch handles the special case of when there
      is an empty interval usage of a resource by not adding an empty
      interval.
      
      We ran into this issue downstream, but it makes sense to have
      this upstream since it is explicitly allowed by TargetSchedule.td.
      7e09239e
    • William Moses's avatar
      [CMake/Bazel] Support usage of opt driver as a library (#79205) · 32f79226
      William Moses authored
      In Bazel, Clang current separates the clang executable into a
      clang-driver library, and the actual clang executable. This allows
      downstream users to make their own variations of clang, without having
      to redo/maintain separate build pipelines.
      
      This adds the same for opt for both CMake and Bazel.
      32f79226
    • lntue's avatar
      [libc][NFC] Fix `-DSHOW_INTERMEDIATE_OBJECTS=DEPS` to work properly for entry... · c1cb0b80
      lntue authored
      [libc][NFC] Fix `-DSHOW_INTERMEDIATE_OBJECTS=DEPS` to work properly for entry points and unit tests. (#79254)
      
      c1cb0b80
    • Nikolas Klauser's avatar
      e099e7b2
    • Fangrui Song's avatar
      [Driver] Test ignored target-specific options for AMDGPU/NVPTX (#79222) · ed7cee90
      Fangrui Song authored
      Fix missing test coverage after #70740 #70760
      
      When compiling for CUDA/HIP, the driver creates a cc1 job to compile for
      amdgcn/nvptx triple using most options.
      Certain target-specific options should be ignored, not lead to an error
      (`err_drv_unsupported_opt_for_target`).
      ed7cee90
    • Jeremy Morse's avatar
      [BPI] Transfer value-handles when assign/move constructing BPI (#77774) · 604a6c40
      Jeremy Morse authored
      Background: BPI stores a collection of edge branch-probabilities, and
      also a set of Callback value-handles for the blocks in the
      edge-collection. When a block is deleted, BPI's eraseBlock method is
      called to clear the edge-collection of references to that block, to
      avoid dangling pointers.
      
      However, when move-constructing or assigning a BPI object, the
      edge-collection gets moved, but the value-handles are discarded. This
      can lead to to stale entries in the edge-collection when blocks are
      deleted without the callback -- not normally a problem, but if a new
      block is allocated with the same address as an old block, spurious
      branch probabilities will be recorded about it. The fix is to transfer
      the handles from the source BPI object.
      
      This was exposed by an unrelated debug-info change, it probably just
      shifted around allocation orders to expose this. Detected as
      nondeterminism and reduced by Zequan Wu:
      
      
      https://github.com/llvm/llvm-project/commit/f1b0a544514f3d343f32a41de9d6fb0b6cbb6021#commitcomment-136737090
      
      (No test because IMHO testing for a behaviour that varies with memory
      allocators is likely futile; I can add the reproducer with a CHECK for
      the relevant branch weights if it's desired though)
      604a6c40
    • Nico Weber's avatar
      4a9a1d83
    • Vojislav Tomasevic's avatar
      [clang] Incorrect IR involving the use of bcopy (#79298) · 2a77d92e
      Vojislav Tomasevic authored
      This patch addresses the issue regarding the call of bcopy function in a
      conditional expression.
      It is analogous to the already accepted patch which deals with the same
      problem, just regarding the bzero function [0].
      
      Here is the testcase which illustrates the issue:
      
      ```
      void bcopy(const void *, void *, unsigned long);
      void foo(void);
      
      void test_bcopy() {
        char dst[20];
        char src[20];
        int _sz = 20, len = 20;
        return (_sz
                ? ((_sz >= len)
                   ? bcopy(src, dst, len)
                   : foo())
                : bcopy(src, dst, len));
      }
      ```
      
      When processing it with clang, following issue occurs:
      
      Instruction does not dominate all uses!
      %arraydecay2 = getelementptr inbounds [20 x i8], ptr %dst, i64 0, i64 0,
      !dbg !38
      %cond = phi ptr [ %arraydecay2, %cond.end ], [ %arraydecay5,
      %cond.false3 ], !dbg !33
      fatal error: error in backend: Broken module found, compilation aborted!
      
      This happens because an incorrect phi node is created. It is created
      because bcopy function call is lowered to the call of llvm.memmove
      intrinsic and function memmove returns void *. Since llvm.memmove is
      called in two places in the same return statement, clang creates a phi
      node in the final basic block for the return value and that phi node is
      incorrect. However, bcopy function should return void in the first
      place, so this phi node is unnecessary. This is what this patch
      addresses. An appropriate test is also added and no existing tests fail
      when applying this patch.
      
      Also, this crash only happens when LLVM is configured with
      -DLLVM_ENABLE_ASSERTIONS=On option.
      
      [0] https://reviews.llvm.org/D39746
      2a77d92e
    • Alexey Bataev's avatar
      [SLP]Fix PR79321: SLPVectorizer's PHICompare doesn't provide a strict · ca654acc
      Alexey Bataev authored
      weak ordering.
      
      Compared NumUses to meet the reaquirements of the strict weak ordering.
      ca654acc
    • Alex MacLean's avatar
      [NVPTX] use incomplete aggregate initializers (#79062) · 3b8539c9
      Alex MacLean authored
      The PTX ISA specifies that initializers may be incomplete ([5.4.4.
      Initializers](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#initializers))
      > As in C, array initializers may be incomplete, i.e., the number of
      initializer elements may be less than the extent of the corresponding
      array dimension, with remaining array locations initialized to the
      default value for the specified array type.
      
      Emitting initializers in this form is preferable because it reduces the
      size of the PTX, in some cases significantly, and can improve compile
      time of ptxas as a result.
      3b8539c9
    • Kazu Hirata's avatar
      [ConstraintElimination] Use std::move in the constructor (NFC) (#79259) · 1605bf58
      Kazu Hirata authored
      Moving the contents of Coefficients saves 0.43% of heap allocations
      during the compilation of a large preprocessed file, namely
      X86ISelLowering.cpp, for the X86 target.
      1605bf58
    • Philip Reames's avatar
      [RISCV] Separate single source and dual source lowering code [nfc] · e9311f9c
      Philip Reames authored
      The two single source cases aren't effected by the swap or select matching
      as those are dual operand specific.  Similarly, a two source shuffle can't
      be a rotate.
      
      We can extend this idea for some of the shuffle types above, but some of
      them are validly either single or dual source.  We don't want to loose that
      and the code complexity of versioning early and having to repeat some shuffle
      kinds doesn't (currently) seem worth it.
      e9311f9c
    • Jan Svoboda's avatar
      [clangd] Make sure ninja can clean "ClangdXPC.framework" (#75669) · b801b607
      Jan Svoboda authored
      After building the ClangdXPC target, `ninja clean` fails with the
      following error:
      
      ```
      ninja: error: remove(lib/ClangdXPC.framework): Directory not empty
      ninja: error: remove(<build>/lib/ClangdXPC.framework): Directory not empty
      ```
      
      I did not find better way to make this work. I guess we could list all
      generated files (and directories) in `OUTPUT` of the custom command, but
      that seems fairly tedious/fragile.
      b801b607
    • ostannard's avatar
      [TableGen] Include source location in JSON dump (#79028) · 56602a48
      ostannard authored
      This adds a '!loc' field to each record containing the file name and
      line number of the record declaration.
      56602a48
    • Louis Dionne's avatar
      [ci] Remove unused generate-buildkite-pipeline-scheduled script (#79320) · 5e894771
      Louis Dionne authored
      The "scheduled build" pipeline on BuildKite had been disabled for months
      and doesn't exist anymore, so this script is effectively dead code. When
      we set up a cron-activated build again, we should do it using Github
      actions (which could trigger a BK pipeline if needed).
      
      Keeping this script around just creates additional confusion about
      what's used and what's not used for doing CI.
      5e894771
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc] Lower DO CONCURRENT with acc loop (#79223) · e99c8aef
      Lower basic DO CONCURRENT with acc loop construct. The DO CONCURRENT is
      lowered to an acc.loop operation.
      
      This does not currently cover the DO CONCURRENT with locality specs.
      e99c8aef
    • Fangrui Song's avatar
      [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (#79238) · 8abf8d12
      Fangrui Song authored
      A SHN_ABS symbol has never been considered for
      InputSection::relocateNonAlloc.
      Before #74686, the code did made it work in the absence of `-z
      dead-reloc-in-nonalloc=`.
      There is now a report about such SHN_ABS uses
      
      (https://github.com/llvm/llvm-project/pull/74686#issuecomment-1904101711)
      and I think it makes sense for non-SHF_ALLOC to support SHN_ABS, like
      SHF_ALLOC sections do.
      
      ```
      // clang -g
      __attribute__((weak)) int symbol;
      int *foo() { return &symbol; }
      
      0x00000023:   DW_TAG_variable [2]   (0x0000000c)
                      ...
                      DW_AT_location [DW_FORM_exprloc]        (DW_OP_addrx 0x0)
      
      ```
      
      .debug_addr references `symbol`, which can be redefined by a symbol
      assignment or --defsym to become a SHN_ABS symbol.
      
      The problem is that `!sym.getOutputSection()` cannot discern SHN_ABS
      from a symbol whose section has been discarded. Since commit
      1981b1b6, a symbol relative to a
      discarded section is changed to `Undefined`, so the `SHN_ABS` check
      become trivial.
      
      We currently apply tombstone for a relocation referencing
      `SharedSymbol`. This patch does not change the behavior.
      8abf8d12
    • Philip Reames's avatar
      [RISCV] Sink code into using branch in shuffle lowering [nfc] · fd817249
      Philip Reames authored
      Follow up to 396b6bbc, sink code into consuming branch, and fix one
      comment I realized used the misleading wording.  (Permute is a specific
      sub-type of single source shuffle.)
      fd817249
    • Jan Svoboda's avatar
      [clang] NFC: Remove `{File,Directory}Entry::getName()` (#74910) · 6c1dbd53
      Jan Svoboda authored
      The files and directories that Clang accesses are uniqued by their
      inode. For each inode `FileManager` will create exactly one `FileEntry`
      or `DirectoryEntry` object, which makes answering the question _"Are
      these two files/directories the same?"_ a simple pointer equality check.
      
      However, since the same inode can be accessed through multiple different
      paths, asking the `FileEntry` or `DirectoryEntry` object _"What is your
      name?"_ doesn't have clear semantics. In c0ff9908 we started reporting
      the most recent name used to access the entry, which turned out to be
      necessary for Clang modules. However, the long-term solution has always
      been to explicitly track the as-requested name. This has been
      implemented in 4dc5573a as `FileEntryRef` and `DirectoryEntryRef`.
      
      The `DirectoryEntry::getName()` interface has been deprecated since the
      Clang 17 release and `FileEntry::getName()` since Clang 18. We have
      replaced uses of these deprecated APIs in `main` with
      `DirectoryEntryRef::getName()` and `FileEntryRef::getName()`
      respectively.
      
      This makes it possible to remove `{File,Directory}Entry::getName()` for
      good along with the `FileManager` code that implements them.
      6c1dbd53
    • Nikita Popov's avatar
      Remove fork handling from release issue workflow (#79310) · 56444d56
      Nikita Popov authored
      This is currently broken, because the check is performed on the wrong
      repository. repo here is llvm/llvm-project, which is not a fork (so this
      will always trigger), then we'll push a new branch to
      llvmbot/llvm-project, and then again set the wrong owner, so we'll look
      for the branch in llvm/llvm-project rather than llvmbot/llvm-project.
      
      Rather than fixing this, I'm removing the code entirely, as it shouldn't
      be needed anymore (llvmbot/llvm-project is a fork of llvm/llvm-project).
      56444d56
    • Christian Sigg's avatar
      [llvm][bazel] Fix BUILD · 4079aab8
      Christian Sigg authored
      4079aab8
    • Christian Sigg's avatar
      [llvm][bazel] Fix BUILD. · 611843d2
      Christian Sigg authored
      611843d2