1. May 16, 2023
    • Michael Buch's avatar
      [lldb][DWARFASTParserClang][NFC] Simplify unnamed bitfield condition · ca64f9af
      Michael Buch authored
      Minor cleanup of redundant variable initialization and
      if-condition. These are leftovers/oversights from previous
      cleanup in this area:
      * https://reviews.llvm.org/D72953
      * https://reviews.llvm.org/D76808
      
      Differential Revision: https://reviews.llvm.org/D150589
      ca64f9af
    • Andrzej Warzynski's avatar
      c2d55ef5
    • Nikita Popov's avatar
      [InstSimplify] Clarify simplifyWithOpReplaced() refinement requirement (NFC) · 8d2bae8c
      Nikita Popov authored
      In order to justify some of the special cases we have, we need to
      assume that Op/RepOp are non-poison. For the places where this
      function is used, if one of these is poison, then the select result
      is poison anyway.
      8d2bae8c
    • Nikita Popov's avatar
      [SCEV] Regenerate test checks (NFC) · b38bd860
      Nikita Popov authored
      b38bd860
    • Nikita Popov's avatar
      [KnownBits] Handle shifts over wide types · 0b81ff3a
      Nikita Popov authored
      Do not assert if the bit width is larger than 64 bits. This case
      is currently hidden from the IR layer by other checks, but gets
      exposed with future changes.
      0b81ff3a
    • Quentin Colombet's avatar
    • Théo Degioanni's avatar
      [mlir] [mem2reg] Adapt to be pattern-friendly. · ead8e9d7
      Théo Degioanni authored
      This revision modifies the mem2reg interfaces and algorithm to be more
      omfortable to use as a pattern. The motivation behind this is that
      currently the pattern needs to be applied to the scope op of the region
      in which allocators should be promoted. However, a more natural way to
      apply the pattern would be to apply it on the allocator directly. This
      is not only clearer but easier to parallelize.
      
      This revision changes the mem2reg pattern to operate this way. This
      required restraining the interfaces to only mutate IR using
      RewriterBase, as the previously used escape hatch is not granular enough
      to match on the region that is modified only. This has the unfortunate
      cost of preventing batching allocator promotion and making the block
      argument adding logic more complex. Because batching no longer made any
      sense, I made the internal analyzer/promoter decoupling private again.
      
      This also adds statistics to the mem2reg infrastructure.
      
      Reviewed By: gysit
      
      Differential Revision: https://reviews.llvm.org/D150432
      ead8e9d7
    • Nikita Popov's avatar
      [AArch64] Regenerate test checks (NFC) · dadb77b6
      Nikita Popov authored
      dadb77b6
    • Jay Foad's avatar
      [KnownBits] Define and use intersectWith and unionWith · d8229e2f
      Jay Foad authored
      Define intersectWith and unionWith as two complementary ways of
      combining KnownBits. The names are chosen for consistency with
      ConstantRange.
      
      Deprecate commonBits as a synonym for intersectWith.
      
      Differential Revision: https://reviews.llvm.org/D150443
      d8229e2f
    • Jay Foad's avatar
      71ac47f3
    • Alex Zinenko's avatar
      [mlir] update types in remaining Linalg TransformOps test · f52b6381
      Alex Zinenko authored
      All ops now support explicit type specification, update types to use
      `!transform.any_op` instead of `!pdl.operation` for consistency.
      
      Depends On D144515
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D150592
      f52b6381
    • Alex Zinenko's avatar
      [mlir] make structured transform ops use types · 2fe4d90c
      Alex Zinenko authored
      Types have been introduced a while ago and provide for better
      readability and transform-time verification. Use them in the ops from
      the structured transform dialect extension.
      
      In most cases, the types are appended as trailing functional types or a
      derived format of the functional type that allows for an empty right
      hand size without the annoying `-> ()` syntax (similarly to `func.func`
      declaration that may omit the arrow). When handles are used inside mixed
      static/dynamic lists, such as tile sizes, types of those handles follow
      them immediately as in `sizes [%0 : !transform.any_value, 42]`. This
      allows for better readability than matching the trailing type.
      
      Update code to remove hardcoded PDL dependencies and expunge PDL from
      structured transform op code.
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D144515
      2fe4d90c
    • Jay Foad's avatar
      [AMDGPU] Add implicit uses to AGPR copy MIR tests · af0121fb
      Jay Foad authored
      Some tests were using liveins or IMPLICIT_DEFs to add fake live
      registers, but that only works if you track liveness forwards. Add some
      implicit uses too, so that it also works if you track liveness
      backwards.
      
      Some of these tests were using the regmask amdgpu_allvgprs but that is a
      clobber not a use.
      
      Differential Revision: https://reviews.llvm.org/D150570
      af0121fb
    • Jay Foad's avatar
      [RISCV] Avoid RegScavenger::forward in RISCVMakeCompressibleOpt · 8cf5f730
      Jay Foad authored
      RegScavenger::backward is preferred because it does not rely on accurate
      kill flags.
      
      Differential Revision: https://reviews.llvm.org/D150562
      8cf5f730
    • Jonas Paulsson's avatar
      [MachineSink] Don't reject sinking because of dead def in isProfitableToSinkTo(). · 64599ac9
      Jonas Paulsson authored
      An instruction should be sunk (if otherwise legal and profitable) regardless
      of if it has a dead def of a physreg or not. Physreg defs are checked in other
      places and sinking is only done with dead defs of regs that are not live into
      the target MBB.
      
      Differential Revision: https://reviews.llvm.org/D150447
      
      Reviewed By: sebastian-ne, arsenm
      64599ac9
    • Jonas Paulsson's avatar
      Precommit test for D150447. · a27fd12f
      Jonas Paulsson authored
      a27fd12f
    • Gaëtan Bossu's avatar
      FastRegAlloc: Fix implicit operands not rewritten · c4a872ba
      Gaëtan Bossu authored
      This patch fixes a potential crash due to RegAllocFast not rewriting virtual
      registers. This essentially happens because of a call to
      MachineInstr::addRegisterKilled() in the process of allocating a "killed" vreg.
      The former can eventually delete implicit operands without RegAllocFast
      noticing, leading to some operands being "skipped" and not rewritten to use
      physical registers.
      
      Note that I noticed this crash when working on a solution for tying a register
      with one/multiple of its sub-registers within an instruction. (See problem
      description here:
      https://discourse.llvm.org/t/pass-to-tie-an-output-operand-to-a-subregister-of-an-input-operand/67184).
      
      Aside from this fix, I believe there could be further improvements to the
      RegAllocFast when it comes to instructions with multiple uses of a same virtual
      register. You can see it in the added test where the implicit uses have been
      re-written in a somewhat surprising way because of phase ordering. Ultimately,
      when allocating vregs for an instruction, I believe we should iterate on the
      vregs it uses (and then process all the operands that use this vregs), instead
      of directly iterating on operands and somewhat assuming each operand uses a
      different vreg. This would in the end be quite close to what
      greedy+virtregrewriter does. If that makes sense, I would probably spin off
      another patch (after I get more familiar with RegAllocFast).
      
      Differential Revision: https://reviews.llvm.org/D145169
      c4a872ba
    • Andrzej Warzynski's avatar
      [mlir][linalg] Add a test for linalg.matmul --> vector.outerproduct · e4fd46b5
      Andrzej Warzynski authored
      Representing matmuls as a sum of outer products is central to various
      matrix extensions (e.g. Arm's SME). This test demonstrates how to use
      Linalg's vectoriser and Vector's lowerings to represent `linalg.matmul`
      as a chain of `vector.outerproduct` Ops.
      
      Differential Revision: https://reviews.llvm.org/D150457
      e4fd46b5
    • Nikita Popov's avatar
      [KnownBits] Make shl/lshr/ashr implementations optimal · 9d73a8bd
      Nikita Popov authored
      The implementations for shifts were suboptimal in the case where
      the max shift amount was >= bitwidth. In that case we should still
      use the usual code clamped to BitWidth-1 rather than just giving up
      entirely.
      
      Additionally, there was an implementation bug where the known zero
      bits for the individual shift amounts were not set in the shl/lshr
      implementations. I think after these changes, we'll be able to drop
      some of the code in ValueTracking which *also* evaluates all possible
      shift amounts and has been papering over this issue.
      
      For the "all poison" case I've opted to return an unknown value for
      now. It would be better to return zero, but this has fairly
      substantial test fallout, so I figured it's best to not mix it into
      this change. (The "correct" return value would be a conflict, but
      given that a lot of our APIs assert conflict-freedom, that's probably
      not the best idea to actually return.)
      
      Differential Revision: https://reviews.llvm.org/D150587
      9d73a8bd
    • Martin Storsjö's avatar
      [OpenMP] Use CMAKE_CXX_STANDARD for setting the C++ version · d187ceee
      Martin Storsjö authored
      Previously, we tried to check whether the -std=c++17 option was
      supported and manually add the flag. That doesn't work for compilers
      that do support C++17 but use a different option syntax, like
      clang-cl.
      
      OpenMP itself probably doesn't specifically require C++17, therefore
      CXX_STANDARD_REQUIRED is left off, but in some cases, we may
      have code that only works in C++17 mode.
      
      In particular, 46262cab made a
      refactoring that works when built with Clang in C++17 mode, but not
      in C++14 mode. MSVC accepts the construct in both language modes.
      
      For libomptarget, we've had specific checks that require C++17
      (or the -std=c++17 option) to be supported. It's doubtful that
      libomptarget has got any code which more specifically requires C++17;
      this seems to be a remnant from when libomptarget was added
      originally in 2467df6e / D14031.
      At that point, the rest of OpenMP didn't require C++11, while
      libomptarget did require it. Now, it's unlikely that anyone attempts
      building it with a toolchain that doesn't support C++11.
      
      At this point, we could also probably just set CXX_STANDARD_REQUIRED
      to true, requiring C++17 as baseline for all the OpenMP libraries.
      
      This fixes building OpenMP with clang-cl after
      46262cab.
      
      Differential Revision: https://reviews.llvm.org/D149726
      d187ceee
    • Martin Storsjö's avatar
      Reapply [clang] [test] Narrow down MSVC specific behaviours from "any windows"... · c2b256a9
      Martin Storsjö authored
      Reapply [clang] [test] Narrow down MSVC specific behaviours from "any windows" to only MSVC/clang-cl
      
      This fixes running tests with a toolchain that defaults to a MinGW
      target.
      
      After the previous attempt with this patch, this is now changed to
      use !defined(__MINGW32__) instead of defined(_MSC_VER) to distinguish
      between MSVC and MinGW mode; Clang doesn't define _MSC_VER when invoked
      with "clang -cc1" as some of those tests do.
      
      Differential Revision: https://reviews.llvm.org/D149997
      c2b256a9
    • Martin Storsjö's avatar
      Reapply [test] [llvm-config] Assume unix style lib names on mingw targets · 82f7b03d
      Martin Storsjö authored
      Assume the MSVC style naming only for "windows-msvc" targets.
      
      After the previous attempt, this was changed to use the host triple
      instead of the target.
      
      Differential Revision: https://reviews.llvm.org/D149998
      82f7b03d
    • Tobias Gysi's avatar
      [mlir] Add mlir translate flag to print errors only. · 1ade6f36
      Tobias Gysi authored
      The revision adds a flag to mlir translate that suppresses
      any non-error diagnostics. The flag is useful when importing
      LLVM IR to LLVM dialect, which produces a lot of
      warnings due to dropped metadata and debug intrinsics.
      
      Reviewed By: Dinistro
      
      Differential Revision: https://reviews.llvm.org/D150547
      1ade6f36
    • Balázs Kéri's avatar
      [clang][analyzer] Handle special value AT_FDCWD in affected standard functions · 258c9beb
      Balázs Kéri authored
      Some file and directory related functions have an integer file descriptor argument
      that can be a valid file descriptor or a special value AT_FDCWD. This value is
      relatively often used in open source projects and is usually defined as a negative
      number, and the checker reports false warnings (a valid file descriptor is not
      negative) if this fix is not included.
      
      Reviewed By: steakhal
      
      Differential Revision: https://reviews.llvm.org/D149160
      258c9beb
    • Job Noorman's avatar
      [JITLink] Process null symbols · 6c06a079
      Job Noorman authored
      Some relocations (e.g., R_RISCV_ALIGN) don't have a target symbol and
      use a null symbol as a placeholder. These symbols were not processed
      before making it impossible to create edges for them.
      
      This patch tries to detect these null symbols and create absolute
      symbols for them. Note that technically, these null symbols are UND in
      the ELF file, not ABS, so it might make more consistent to create a new
      symbol type for this (local undefined or so). However, since these
      symbols are only used as placeholders (i.e., their values are never
      used), I don't think it's worth the effort of doing this.
      
      Also note that in the binaries that I have inspected, this null symbol
      always has index 0. Could it make sense to add that to the test to avoid
      accidentally adding unnecessary symbols? The reason I didn't do this
      yet, is that I couldn't find any references in the specs that actually
      guarantee this.
      
      Reviewed By: lhames
      
      Differential Revision: https://reviews.llvm.org/D149541
      6c06a079
    • Job Noorman's avatar
      [BOLT][Wrapper] Fix off-by-one in find_section upper limit · 8a5a1205
      Job Noorman authored
      find_section used to match offsets equal to file_offset + size causing
      offsets to sometimes be attributed to the wrong section.
      
      Reviewed By: Amir
      
      Differential Revision: https://reviews.llvm.org/D149047
      8a5a1205
    • esmeyi's avatar
      [XCOFF][DWARF] XCOFF64 should be able to select the dwarf format in intergrated-as mode. · 4054c686
      esmeyi authored
      Summary: DWARF32 is not supported for XCOFF64 under non-integrated-as mode on AIX, because system assembler will fill the debug section lengths according to DWARF64 format. While in intergrated-as mode, XCOFF64 should be able to select the DWARF format.
      
      Reviewed By: shchenz
      
      Differential Revision: https://reviews.llvm.org/D150181
      4054c686
    • Corentin Jabot's avatar
    • Kadir Cetinkaya's avatar
      [clangd] Fix builds after 4ddae8b9 · 9ffef0f2
      Kadir Cetinkaya authored
      9ffef0f2
    • Wang, Xin10's avatar
      Correct the sort logic in AsmMatcherEmmitter.cpp · 9a24ba23
      Wang, Xin10 authored
      The logic from line 633 to 640 is specific for ARM as the comments said, it will make all the targets will prefer to using instruction with more predicates when compiler do AsmMatching.
      And for code from line 642 to 649, X86 want to use the order records written in source file to sort the instructions. So X86 could be affected by this logic. (These code could be arrived only by X86)
      After change this, seems AVX instructions have not be affected but it exposed some other errors for instruction push and call.
      CALLpcrel16 could not be used in 64 bit mode, we need add Predicate for it. And for push instruction, previously because pushi32 has predicates = [Not64bitmode], so it precede pushi16, which is incorrect here, we should get pushw here and it also align with gcc.
      
      Reviewed By: skan
      
      Differential Revision: https://reviews.llvm.org/D150436
      9a24ba23
    • Craig Topper's avatar
      [RISCV] Use mask agnostic policy for masked RISCVISD::VFMADD_VL patterns. · e74bb25d
      Craig Topper authored
      These aren't currently created from anything that has a passthru
      operand. If we need to support this in the future, we should add
      a policy operand to the ISD node definition.
      e74bb25d
    • Corentin Jabot's avatar
      [Clang] Fix parsing of `(auto(x))`. · ef47318e
      Corentin Jabot authored
      Allow auto(x) to appear in a parenthesis
      expression.
      
      The pattern (auto( can appear as part of a declarator,
      so the parser is modified to avoid the ambiguity,
      in a way consistent with the proposed resolution to CWG1223.
      
      Reviewed By: aaron.ballman, #clang-language-wg
      
      Differential Revision: https://reviews.llvm.org/D149276
      ef47318e
    • Muhammad Omair Javaid's avatar
      [LLDB] Fix typo in TestDataFormatterSynthVal.py · 617c31c6
      Muhammad Omair Javaid authored
      This is follow up to 039b28e1 to fix a typo to make sure skipped
      part of test is only skipped for AArch64 Windows platform.
      617c31c6
    • Timm Bäder's avatar
      [clang][NFC] Fix a doc comment mixup · dce89fe7
      Timm Bäder authored
      These are regular comments, use double slashes.
      dce89fe7
    • Craig Topper's avatar
      [RISCV] Update RISCVISD::VFWMADD_VLL isel patterns to allow a mask that isn't all ones. · 46cad213
      Craig Topper authored
      Fixes an isel crash after 6e6bed57.
      
      Add more tests so we have coverage for this.
      46cad213
    • Christudasan Devadasan's avatar
      [AMDGPU] Add optional tied-op for wwm-register's epilog spill restore · 08140d16
      Christudasan Devadasan authored
      The COPY inserted in the epilog block before return instruction as part
      of ABI lowering, can get optimized during machine copy propagation if
      the same register is used earlier in a wwm operation that demands the
      prolog/epilog wwm-spill store/restore to preserve its inactive lanes.
      With the spill restore in the epilog, the preceding COPY appears to be
      dead during machine-cp. To avoid it, mark the same register as a tied-op
      in the spill restore instruction to ensure a usage for the COPY.
      
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D150381
      08140d16
    • Jonas Devlieghere's avatar
      [lldb] Fix lldb_assert -> lldbassert in docs · 9adf60fc
      Jonas Devlieghere authored
      Update the documentation to reference lldbassert rather than
      lldb_assert. The latter is the implementation, which shouldn't be used
      directly. Instead, users should use lldbassert which is the macro that
      expands to assert or lldb_assert depending on the build type.
      9adf60fc
    • Sameer Sahasrabuddhe's avatar
      [LLVM][Uniformity] Improve detection of uniform registers · fbe1c061
      Sameer Sahasrabuddhe authored
      The MachineUA now queries the target to determine if a given register holds a
      uniform value. This is determined using the corresponding register bank if
      available, or by a combination of the register class and value type. This
      assumes that the target is optimizing for performance by choosing registers, and
      the target is responsible for any mismatch with the inferred uniformity.
      
      For example, on AMDGPU, an SGPR is now treated as uniform, except if the
      register bank is VCC (i.e., the register holds a wave-wide vector of 1-bit
      values) or equivalently if it has a value type of s1.
      
       - This does not always work with inline asm, where the register bank or the
         value type might not be present. We assume that the SGPR is uniform, because
         it is not expected to be s1 in the vast majority of cases.
       - The pseudo branch instruction SI_LOOP is now hard-coded to be always
         divergent, although its condition is an SGPR.
      
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D150438
      fbe1c061
    • Joshua Cao's avatar
      [SimpleLoopUnswitch] Skip trivial select conds for selects · fb7c237c
      Joshua Cao authored
      Fixes https://github.com/llvm/llvm-project/issues/62715
      
      If a select's condition is a trivial select:
      ```
      %s = select %cond, i1 true, i1 false
      ```
      Unswitch on %cond, rather than %s. This fixes crashes where there is a
      disparity in finding candidates and and the transformation logic.
      fb7c237c
    • Aiden Grossman's avatar
      [Docs][llvm-exegesis] Specify platform support for different modes · 05cca8a1
      Aiden Grossman authored
      llvm-exegesis has both a capture mode and an analysis mode that can be
      used independently of each other. This patch makes it clear that
      analysis mode will work on other platforms that LLVM supports in the
      documentation which was unclear before.
      
      Reviewed By: courbet
      
      Differential Revision: https://reviews.llvm.org/D150536
      05cca8a1