1. Oct 24, 2023
    • Benjamin Kramer's avatar
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Fix subreg check in the SIFixSGPRCopies (#70007) · 945e943d
      Stanislav Mekhanoshin authored
      It checks for the copy of subregs, but it checks destination which may
      never happen in SSA. It misses the subreg check and happily produces
      S_MOV_B64 out of a subreg COPY.
      
      The affected test should have never been formed in the first place
      because the pass is running in SSA and copies into a subreg shall never
      happen.
      945e943d
    • DonatNagyE's avatar
      [analyzer][NFC] Simplifications in ArrayBoundV2 (#67572) · aceb34c7
      DonatNagyE authored
      I'm planning to improve diagnostics generation in `ArrayBoundCheckerV2`
      but before that I'm refactoring the source code to clean up some
      over-complicated code and an inaccurate comment.
      
      Changes in this commit:
      - Remove the `mutable std::unique_ptr<BugType>` boilerplate, because
      it's no longer needed.
      - Remove the code duplication between the methods `reportOOB()` and
      `reportTaintedOOB()`.
      - Eliminate the class `RegionRawOffsetV2` because it's just a "reinvent
      the wheel" version of `std::pair` and it was used only once, as a
      temporary object that was immediately decomposed. (I suspect that
      `RegionRawOffset` in MemRegion.cpp could also be eliminated.)
      - Flatten the code of `computeOffset()` which had contained six nested
      indentation levels before this commit.
      - Ensure that `computeOffset()` returns `std::nullopt` instead of a
      `{Region, <zero array index>}` pair in the case when it encounters a
      `Location` that is not an `ElementRegion`. This ensures that the
      `checkLocation` callback returns early when it handles a memory access
      where it has "nothing to do" (no subscript operation or equivalent
      pointer arithmetic). Note that this is still NFC because zero is a
      valid index everywhere, so the old logic without this shortcut
      eventually reached the same conclusion.
      - Correct a wrong explanation comment in `getSimplifiedOffsets()`.
      aceb34c7
    • Benjamin Kramer's avatar
      b796eac3
    • Benjamin Maxwell's avatar
      [mlir][VectorOps] Support string literals in `vector.print` (#68695) · 3be3883e
      Benjamin Maxwell authored
      Printing strings within integration tests is currently quite annoyingly
      verbose, and can't be tucked into shared helpers as the types depend on
      the length of the string:
      
      ```
      llvm.mlir.global internal constant @hello_world("Hello, World!\0")
      
      func.func @entry() {
        %0 = llvm.mlir.addressof @hello_world : !llvm.ptr<array<14 x i8>>
        %1 = llvm.mlir.constant(0 : index) : i64
        %2 = llvm.getelementptr %0[%1, %1]
          : (!llvm.ptr<array<14 x i8>>, i64, i64) -> !llvm.ptr<i8>
        llvm.call @printCString(%2) : (!llvm.ptr<i8>) -> ()
        return
      }
      ```
      
      So this patch adds a simple extension to `vector.print` to simplify
      this:
      ```
      func.func @entry() {
         // Print a vector of characters ;)
         vector.print str "Hello, World!"
         return
      }
      ```
      
      Most of the logic for this is now shared with `cf.assert` which already
      does something similar.
      
      Depends on #68694
      3be3883e
    • Yuanfang Chen's avatar
      [flang][driver] support -dumpversion and -dumpmachine (#68896) · 1072fcd2
      Yuanfang Chen authored
      Match GCC driver. GCC has -cc1/-fc1 support too, but this patch does not
      address that.
      1072fcd2
    • Mogball's avatar
      [mlir][ods] Emit bytecode readers with generic Attribute/Type (NFC) · ba468d4d
      Mogball authored
      This aligns the API with the builder API that allows arbitrary
      attributes or types to be returned.
      ba468d4d
    • Nikita Popov's avatar
      [IR] Require that ptrmask mask matches pointer index size (#69343) · eb86de63
      Nikita Popov authored
      Currently, we specify that the ptrmask intrinsic allows the mask to have
      any size, which will be zero-extended or truncated to the pointer size.
      
      However, what semantics of the specified GEP expansion actually imply is
      that the mask is only meaningful up to the pointer type *index* size --
      any higher bits of the pointer will always be preserved. In other words,
      the mask gets 1-extended from the index size to the pointer size. This
      is also the behavior we want for CHERI architectures.
      
      This PR makes two changes:
      * It spells out the interaction with the pointer type index size more
      explicitly.
      * It requires that the mask matches the pointer type index size. The
      intention here is to make handling of this intrinsic more robust, to
      avoid accidental mix-ups of pointer size and index size in code
      generating this intrinsic. If a zero-extend or truncate of the mask is
      desired, it should just be done explicitly in IR. This also cuts down on
      the amount of testing we have to do, and things transforms needs to
      check for.
      
      As far as I can tell, we don't actually support pointers with different
      index type size at the SDAG level, so I'm just asserting the sizes match
      there for now. Out-of-tree targets using different index sizes may need
      to adjust that code.
      eb86de63
    • Timm Baeder's avatar
      [clang][Interp] Only emit function_param_value_unknown in C++11 (#67990) · c45466cd
      Timm Baeder authored
      This is also what the current interpreter does.
      c45466cd
    • Timm Baeder's avatar
      b44763c5
    • Mogball's avatar
      Revert 24633eac and 760e7d00 "Enable FoldImmediate for X86" · 3fb5b18e
      Mogball authored
      This reverts commits 24633eac
      and 760e7d00.
      
      I have confirmed that these commits are introducing a new crash in the
      peephole optimizer. I have minimized a test case, which you can find
      below.
      
      ```llvmir
      ; ModuleID = 'bugpoint-reduced-simplified.bc'
      source_filename = "/mnt/big/modular/Kernels/mojo/Mogg/MOGG.mojo"
      target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
      target triple = "x86_64-unknown-linux-gnu"
      
      declare dso_local void @foo({ { ptr, [4 x i64], [4 x i64], i1 }, { ptr, [4 x i64], [4 x i64], i1 } }, { ptr }, { ptr, i64, i8 })
      
      define dso_local void @bad_fn(ptr %0, ptr %1, ptr %2) {
        %4 = load i64, ptr null, align 8
        %5 = insertvalue [4 x i64] poison, i64 12, 1
        %6 = insertvalue [4 x i64] %5, i64 poison, 2
        %7 = insertvalue [4 x i64] %6, i64 poison, 3
        %8 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } poison, [4 x i64] %7, 1
        %9 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } %8, [4 x i64] poison, 2
        %10 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } %9, i1 poison, 3
        %11 = icmp ne i64 %4, 1
        %12 = or i1 false, %11
        %13 = select i1 %12, i64 %4, i64 0
        %14 = zext i1 %12 to i64
        %15 = insertvalue [4 x i64] poison, i64 12, 1
        %16 = insertvalue [4 x i64] %15, i64 poison, 2
        %17 = insertvalue [4 x i64] %16, i64 %13, 3
        %18 = insertvalue [4 x i64] poison, i64 %14, 3
        %19 = icmp eq i64 0, 0
        %20 = icmp eq i64 0, 0
        %21 = icmp eq i64 %13, 0
        %22 = and i1 %20, %19
        %23 = select i1 %22, i1 %21, i1 false
        %24 = select i1 %23, i1 %12, i1 false
        %25 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } poison, [4 x i64] %17, 1
        %26 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } %25, [4 x i64] %18, 2
        %27 = insertvalue { ptr, [4 x i64], [4 x i64], i1 } %26, i1 %24, 3
        %28 = insertvalue { { ptr, [4 x i64], [4 x i64], i1 }, { ptr, [4 x i64], [4 x i64], i1 } } undef, { ptr, [4 x i64], [4 x i64], i1 } %10, 0
        %29 = insertvalue { { ptr, [4 x i64], [4 x i64], i1 }, { ptr, [4 x i64], [4 x i64], i1 } } %28, { ptr, [4 x i64], [4 x i64], i1 } %27, 1
        br label %31
      
      30:                                               ; preds = %3
        br label %softmax_pass
      
      31:                                               ; preds = %31
        %exitcond.not.i = icmp eq i64 poison, 3
        br i1 %exitcond.not.i, label %37, label %31
      
      32:                                               ; preds = %31
        br i1 poison, label %34, label %33
      
      33:                                               ; preds = %32
        br label %34
      
      34:                                               ; preds = %33, %32
        br i1 poison, label %35, label %36
      
      35:                                               ; preds = %34
        br label %softmax_pass
      
      36:                                               ; preds = %34
        br i1 poison, label %37, label %.critedge.i
      
      37:                                               ; preds = %36
        br i1 poison, label %38, label %.critedge.i
      
      38:                                               ; preds = %37
        br i1 poison, label %40, label %39
      
      39:                                               ; preds = %38
        br label %40
      
      40:                                               ; preds = %39, %38
        br i1 poison, label %.lr.ph28.i, label %._crit_edge.i
      
      .lr.ph28.i:                                       ; preds = %40
        br label %41
      
      41:                                               ; preds = %51, %.lr.ph28.i
        br i1 poison, label %.thread, label %42
      
      42:                                               ; preds = %41
        br i1 poison, label %43, label %44
      
      43:                                               ; preds = %42
        br label %45
      
      44:                                               ; preds = %42
        br label %45
      
      45:                                               ; preds = %44, %43
        br i1 poison, label %46, label %.thread
      
      46:                                               ; preds = %45
        br label %47
      
      .thread:                                          ; preds = %45, %41
        br label %47
      
      47:                                               ; preds = %.thread, %46
        br i1 poison, label %51, label %48
      
      48:                                               ; preds = %47
        br i1 poison, label %49, label %50
      
      49:                                               ; preds = %48
        br label %51
      
      50:                                               ; preds = %48
        br label %51
      
      51:                                               ; preds = %50, %49, %47
        call void @foo({ { ptr, [4 x i64], [4 x i64], i1 }, { ptr, [4 x i64], [4 x i64], i1 } } %29, { ptr } poison, { ptr, i64, i8 } poison)
        br i1 poison, label %._crit_edge.i, label %41
      
      ._crit_edge.i:                                    ; preds = %51, %40
        br label %softmax_pass
      
      .critedge.i:                                      ; preds = %37, %36
        br i1 poison, label %.lr.ph.i, label %softmax_pass
      
      .lr.ph.i:                                         ; preds = %.lr.ph.i, %.critedge.i
        store { ptr, [4 x i64], [4 x i64], i1 } %10, ptr poison, align 8
        br i1 poison, label %.lr.ph.i, label %softmax_pass
      
      softmax_pass:                                     ; preds = %.lr.ph.i, %.critedge.i, %._crit_edge.i, %35, %30
        ret void
      }
      ```
      3fb5b18e
    • Timm Bäder's avatar
      3fe2be75
    • martinboehme's avatar
      [clang][dataflow] Remove `declToLocConsistent()` assertion. (#69819) · 14b039c1
      martinboehme authored
      As described [here](https://discourse.llvm.org/t/70086/6), there are
      legitimate
      non-bug scenarios where two `DeclToLoc` maps to be joined contain
      different
      storage locations for the same declaration. This patch also adds a test
      containing an example of such a situation. (The test fails without the
      other
      changes in this patch.)
      
      With the assertion removed, the existing logic in `intersectDenseMaps()`
      will
      remove the corresponding declaration from the joined DeclToLoc map.
      
      We also remove `removeDecl()`'s precondition (that the declaration must
      be
      associated with a storage location) because this may no longer hold if
      the
      declaration was previously removed during a join, as described above.
      14b039c1
    • Wang Pengcheng's avatar
      [TableGen][NFC] Add record kind to `Record` class (#69919) · d1d3aa34
      Wang Pengcheng authored
      enum `RecordKind` is added to indicate the kind of Record (which
      can be a normal record definition, anonymous record definition,
      class or multiclass).
      
      Some arguments like `IsMC` and `IsDefm` are removed since we can
      get the information from `RecordKind`.
      d1d3aa34
    • Timm Bäder's avatar
      [clang] Add triple to builtin-memcpy test · a76d8400
      Timm Bäder authored
      This is broken on Windows builders, so try to fix it that way.
      a76d8400
    • pvanhout's avatar
      [AMDGPU] Regenerate udiv.ll · 300190ff
      pvanhout authored
      300190ff
    • Pierre van Houtryve's avatar
      2bc93584
    • Carlos Alberto Enciso's avatar
      [IPSCCP] Variable not visible at Og. (#66745) · f3b20cb1
      Carlos Alberto Enciso authored
      https://bugs.llvm.org/show_bug.cgi?id=51559
      https://github.com/llvm/llvm-project/issues/50901
      
      IPSCCP pass removes the global variable and does not create a constant
      expression for the initializer value.
      f3b20cb1
    • Aiden Grossman's avatar
      [Github] Fetch before files changed action on push in docs action · 099ce256
      Aiden Grossman authored
      My previous commit 397f1ce9 switched up
      the docs github action to use the GH API for pull requests. However,
      this breaks the action when pushing to a branch as the Github API can't
      provide diffs for commits. This patch fixes that by creating a local
      checkout beforehand on push events for determining the changed files.
      099ce256
    • Timm Bäder's avatar
      368a3988
    • Timm Bäder's avatar
      aaaece65
    • Aiden Grossman's avatar
      [Github] Use API to fetch PR diff for docs action (#70001) · 397f1ce9
      Aiden Grossman authored
      People are currently running into issues where the files-changed step
      isn't able to find the merge base. This seems to happen more often on
      very out of date branches. This patch side steps the issue by just
      fetching the diff from the GH API.
      397f1ce9
    • Aart Bik's avatar
      [mlir][sparse] extend sparse output test (#69986) · ed2d0b0e
      Aart Bik authored
      This adds COO and loose compressed to output testing. Also prepares BSR
      for output testing, but needs the conversion to work first. Cleanup of
      stale TODOs
      ed2d0b0e
    • Timm Bäder's avatar
      [clang][Interp] Call destructors of local variables · 3671a694
      Timm Bäder authored
      This prevents us from leaking memory if the interpretation of byte code
      fails midway-throug.
      
      Differential Revision: https://reviews.llvm.org/D154581
      3671a694
    • Timm Baeder's avatar
      [clang][Diagnostics] Provide source range to constexpr function diags (#69721) · bb7c515b
      Timm Baeder authored
      Before:
      ```console
      ./array.cpp:290:16: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
        290 | constexpr void neverValid() {
            |                ^
      ./array.cpp:291:3: note: subexpression not valid in a constant expression
        291 |   throw;
            |   ^~~~~
      ```
      
      After:
      ```console
      ./array.cpp:290:16: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
        290 | constexpr void neverValid() {
            |                ^~~~~~~~~~
      ./array.cpp:291:3: note: subexpression not valid in a constant expression
        291 |   throw;
            |   ^~~~~
      ```
      bb7c515b
    • Aiden Grossman's avatar
      [Github] Add libcxx docs to CI (#69828) · 6768a3d4
      Aiden Grossman authored
      This patch adds a step to the documentation Github action to build the
      libc++ docs if they have changed. This enables easily diagnosing build
      failures/warnings in PRs.
      6768a3d4
    • Aiden Grossman's avatar
      [Github] Add libunwind to docs CI (#69830) · d61e9154
      Aiden Grossman authored
      This patch adds the libunwind docs to the Github docs action which
      enables easy triage of docs build failures in Github PRs. There is
      already buildbot coverage of this configuration, but it is much less
      convenient to use in PRs.
      d61e9154
    • huhu233's avatar
      [AArch64] Lower mathlib call ldexp into fscale when sve is enabled (#67552) · dbe8def9
      huhu233 authored
      The function of 'fscale' is equivalent to mathlib call ldexp, but has
      better performance. This patch lowers ldexp into fscale when sve is
      enabled.
      dbe8def9
    • Younan Zhang's avatar
      [clangd] Adapt Inlay Hint support for Deducing This (#68177) · 4a540cee
      Younan Zhang authored
      This is a follow-up for D140828, making Clangd omit the explicit object
      parameter in a call to member function with Deducing This.
      
      Given that the parent patch is still in its infancy and might undergo
      several reverting-relanding processes, one can feel free to revert this
      if encountering any CI failure. And please let me know if I should alter
      anything.
      4a540cee
    • Fangrui Song's avatar
      d5b0ad63
    • Razvan Lupusoru's avatar
      [flang][openacc] Fix post_alloc declare function ordering (#69980) · 54e46ba4
      Razvan Lupusoru authored
      The declare actions were introduced to capture semantics dealing with
      allocation of descriptor-based variable. However, the post_alloc action
      has an ordering error. It needs to update descriptor first before the
      mapping action of the data. The reason for this is that implicit attach
      must occur during mapping action - but updating the descriptor
      synchronizes it with the host copy (which would hold a host pointer).
      54e46ba4
    • Jie Fu's avatar
      [AMDGPU] Fix -Wunused-variable in SIISelLowering.cpp (NFC) · 49893fbf
      Jie Fu authored
      /llvm-project/llvm/lib/Target/AMDGPU/SIISelLowering.cpp:11257:7: error: unused variable 'VT' [-Werror,-Wunused-variable]
        EVT VT = N->getValueType(0);
            ^
      1 error generated.
      49893fbf
    • Louis Dionne's avatar
      4c8f2b01
    • Matthias Springer's avatar
      [mlir][Interfaces] `LoopLikeOpInterface`: Expose mutable inits/yielded values (#69137) · 8fb0d77b
      Matthias Springer authored
      Expose a `MutableArrayRef<OpOperand>` instead of
      `ValueRange`/`OperandRange`. This allows users of this interface to
      change the yielded values and the init values. The names of the
      interface methods are the same as the auto-generated op accessor names
      (`get...()` returns `OperandRange`, `get...Mutable()` returns
      `MutableOperandRange`).
      
      Note: The interface methods return a `MutableArrayRef` instead of a
      `MutableOperandRange` because a loop op may not implement
      `getYieldedValuesMutable` etc. and there is no safe way to return an
      "empty" range with a `MutableOperandRange`.
      8fb0d77b
    • Augusto Noronha's avatar
    • Evgenii Kudriashov's avatar
      [X86][GlobalISel] Reorganize shift scalar tests (NFC) (#68232) · cc455033
      Evgenii Kudriashov authored
      Removed duplicated tests from GlobalISel directory
      cc455033
    • Augusto Noronha's avatar
    • Augusto Noronha's avatar
    • Jeffrey Byrnes's avatar
      [AMDGPU] Accept arbitrary sized sources in CalculateByteProvider · ef336594
      Jeffrey Byrnes authored
      This allows working with e.g. v8i8 / v16i8 sources.
      
      It is generally useful, but is primarily beneficial when allowing e.g. v8i8s to be passed to branches directly through registers. As such, this is the first in a series of patches to enable that work. However, it effects https://reviews.llvm.org/D155995, so it has been implemented on top of that.
      
      Differential Revision: https://reviews.llvm.org/D159036
      
      Change-Id: Idfcb57dacd0c32cab040fe4dd4ac2ec762750664
      ef336594
    • Jon Chesterfield's avatar
      [amdgpu] D2D memcpy via streams and HSA (#69977) · 840d0b7e
      Jon Chesterfield authored
      hsa_amd_memory_async_copy can handle device to device copies if passed
      the corresponding parameters.
      
      No functional change - currently D2D copy goes through a fallback in
      libomptarget that stages through a host malloc, after this it goes
      directly through HSA.
      
      Works under exactly the situations that HSA works. Verified locally on a
      performance benchmark. Hoping to attract further testing from internal
      developers after it lands.
      840d0b7e