1. Oct 25, 2023
    • David Spickett's avatar
      [lldb] On POSIX, check for duplicate interpreter modules without loading them (#69932) · ff67b68e
      David Spickett authored
      Fixes #68987
      
      Early on we load the interpreter (most commonly ld-linux) in
      LoadInterpreterModule. Then later when we get the first DYLD rendezvous
      we get a list of libraries that commonly includes ld-linux again.
      
      Previously we would load this duplicate, see that it was a duplicate,
      and unload it.
      
      Problem was that this unloaded the section information of the first copy
      of ld-linux. On platforms where you can place a breakpoint using only an
      address, this wasn't an issue.
      
      On ARM you have ARM and Thumb modes. We must know which one the section
      we're breaking in is, otherwise we'll go there in the wrong mode and
      SIGILL. This happened on ARM when lldb tried to call mmap during
      expression evaluation.
      
      To fix this, I am making the assumption that the base address we see in
      the module prior to loading can be compared with what we know the
      interpreter base address is. Then we don't have to load the module to
      know we can ignore it.
      
      This fixes the lldb test suite on Ubuntu versions where
      https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1927192 has been
      fixed. Which was recently done on Jammy.
      ff67b68e
    • David Spickett's avatar
      [lldb][AArch64] Add isAArch64SMEFA64 check to SME testing (#68094) · e7012ba8
      David Spickett authored
      FEAT_SME_FA64 (smefa64 in Linux cpuinfo) allows the use of the full A64
      instruction set while in streaming SVE mode.
      
      See https://developer.arm.com/documentation/ddi0616/latest/ for details.
      
      This means for example if we want to write to the ffr register during or
      use floating point registers while in streaming mode, we need this
      extension.
      
      I initially was using QEMU which has it by default, and switched to
      Arm's FVP which does not. So this change adds a more strict check and
      converts most of the tests to use that. It would be possible in some
      cases to avoid the offending instructions but it would be a lot of
      effort and liable to fail randomly as the C library changes.
      
      It is also my assumption that the majority of systems will have smefa64
      as QEMU has chosen to have. If I turn out to be wrong, we can make the
      effort to get the tests working without smefa64.
      
      `isAArch64SME` remains for some tests, which are as follows:
      * `test_aarch64_dynamic_regset_config` merely checks for the presence of
      a register set, which appears for any SME system not just one with
      smefa64.
      * `test_aarch64_dynamic_regset_config_sme_za_disabled` only needs the ZA
      register and does not enter streaming mode.
      * `test_sme_not_present` tests for the absence of the SME register set,
      so must be skipped if any form of SME is present.
      * Various tests in `TestSVERegisters.py` need to know if SME is present
      at all to generate an expected SVCR value. Earlier in the callstack
      something else checked `isAArch64SMEFA64` already.
      * `TestAArch64LinuxTLSRegisters.py` needs to test the `tpidr2` register
      if any form of SME is present. msr/mrs instructions are used to do this
      and are allowed even if smefa64 is not present.
      e7012ba8
    • David Spickett's avatar
      [lldb][AArch64] Read mte_ctrl register from core files (#69689) · d8abce11
      David Spickett authored
      This register reports the configuration of the AArch64 Linux tagged
      address ABI, part of which is the memory tagging (MTE) settings.
      
      It will always be present in core files because even without MTE, there
      are parts of the tagged address ABI that can be configured (these parts
      use the Top Byte Ignore feature).
      
      I missed adding this when I previously worked on MTE support. Until now
      you could read memory tags from a core file but not this register.
      d8abce11
    • Nikita Popov's avatar
    • Matthias Springer's avatar
      [mlir][NFC] Move `foldAttributesIntoMap` to `IR` build unit (#70155) · 26e35b0f
      Matthias Springer authored
      `foldAttributesIntoMap` is a helper function that folds constant
      `OpFoldResult` into an affine map. This commit moves the function from
      the affine dialect to `AffineMap.h`, so that it can be used without
      depending on the affine dialect.
      26e35b0f
    • David Spickett's avatar
      [llvm][TableGen] Add a README to the main TableGen folder (#69943) · b81bfea9
      David Spickett authored
      Though I doubt that many people will land here directly, I thought it
      odd that we didn't have one we can at least reference in response to questions.
      
      The intro I've copied from the programmer's reference and added a simple
      example. Then some links to resources and tools, which is the main
      reason to have this page.
      b81bfea9
    • Nikita Popov's avatar
      [InstCombine] Remove unnecessary handling of non-canonical predicates (NFCI) · 4baeed80
      Nikita Popov authored
      ule/uge with a constant will be converted to ult/ugt, so there is
      no need to handle these variants.
      4baeed80
    • David Spickett's avatar
      Reland "[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)"" · 1d10369f
      David Spickett authored
      This reverts commit 8d80a452.
      
      The pointer to the invalidates lists needs to be non-const. Though in this case
      I don't think it's ever modified.
      
      Also I realised that the invalidate list was being set on svg not vg.
      Should be the other way around.
      1d10369f
    • Nikita Popov's avatar
    • Nikita Popov's avatar
      [InstCombine] Remove redundant icmp gep fold (NFCI) · 7df92fbe
      Nikita Popov authored
      Gep with zero indices will be folded away independently. It will
      only be retained for splat geps, for which the transform is not
      applicable anyway.
      7df92fbe
    • David Spickett's avatar
      Revert "[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)" · 8d80a452
      David Spickett authored
      This reverts commit f2c09e5e, due to compilation
      failures on buildbots.
      8d80a452
    • Wang Pengcheng's avatar
      0e27cbe1
    • David Spickett's avatar
      [lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768) · f2c09e5e
      David Spickett authored
      This fixes a bug where writing vg during streaming mode
      could prevent you reading za directly afterwards.
      
      vg is invalidated just prior to us reading it in AArch64Reconfigure,
      but svg was not. This lead to some situations where vg would be
      updated or cleared and re-read, but svg would not be.
      
      This meant it had some undefined value which lead to errors
      that prevented us reading ZA. Likely we received a lot more
      data than we were expecting.
      
      There are at least 2 ways to get into this situation:
      * Explicit write by the user to vg.
      * We have just stopped and need to get the potentially new svg and vg.
      
      The first is handled by invalidating svg client side before fetching the
      new one. This also
      covers some but not all of the second scenario. For the second, I've
      made writes to vg
      invalidate svg by noting this in the register information.
      
      Whichever one of those kicks in, we'll get the latest value of svg.
      
      The bug may depend on timing, I could not find a consistent way
      to trigger it. I originally found it when checking whether za
      is disabled after a vg change, so I've added checks for that
      to TestZAThreadedDynamic.
      
      The SVE VG version of the bug did show up on the buildbot,
      but not consistently. So it's possible that TestZAThreadedDynamic
      does in fact cover this, but I haven't run it enough times to know.
      f2c09e5e
    • David Spickett's avatar
      [lldb][AArch64] Correct type of 32 bit GPR RegisterValues when using core files (#70054) · a7700985
      David Spickett authored
      As ReadRegister always read into a uint64_t, when it called operator=
      with uint64_t it was setting the RegisterValue's type to eTypeUInt64
      regardless of its size.
      
      This mostly works because most registers are 64 bit, and very few bits
      of code rely on the type being correct. However, cpsr, fpsr and fpcr are
      in fact 32 bit, and my upcoming register fields code relies on this type
      being correct.
      
      Which is how I found this bug and unfortunately is the only way to test
      it. As RegisterValue::Type never makes it out via the API anywhere. So
      this change will be tested once I start adding register field
      information.
      a7700985
    • Ingo Müller's avatar
      [mlir][transform] Handle multiple library preloading passes. (#69705) · 99c15eb4
      Ingo Müller authored
      This is a new attempt at #69320.
      
      The transform dialect stores a "library module" that the preload pass
      can populate. Until now, each pass registered an additional module by
      simply pushing it to a vector; however, the interpreter only used the
      first of them. This commit turns the registration into "loading", i.e.,
      each newly added module gets merged into the existing one. This allows
      the loading to be split into several passes, and using the library in
      the interpreter now takes all of them into account. While this design
      avoids repeated merging every time the library is accessed, it requires
      that the implementation of merging modules lives in the
      TransformDialect target (since it at the dialect depend on each
      other).
      
      This resolves https://github.com/llvm/llvm-project/issues/69111.
      99c15eb4
    • Karl-Johan Karlsson's avatar
      [Sema] Fixed faulty shift count warning (#69521) · d25e0aac
      Karl-Johan Karlsson authored
      Constant values of _BitInt have the bitwith to exactly fit the constant
      number. This patch fix a problem in Sema when building an APInt where
      the supplied bitwidth can become too small and simply truncate the value
      leading to a faulty warning.
      d25e0aac
    • jeanPerier's avatar
      [flang][codegen] Update FIR codegen to use mlir.llvm opaque pointers (#69692) · 8a1ce2d6
      jeanPerier authored
      !llvm.ptr<T> typed pointers are depreciated in MLIR LLVM dialects. Flang
      codegen still generated them and relied on mlir.llvm codegen to LLVM to
      turn them into opaque pointers.
      
      This patch update FIR codegen to directly emit and work with LLVM opaque
      pointers.
      
      Addresses https://github.com/llvm/llvm-project/issues/69303
      
      - All places generating GEPs need to add an extra type argument with the
      base type (the T that was previously in the llvm.ptr<T> of the base).
      
      - llvm.alloca must also be provided the object type. In the process, I
      doscovered that we were shamelessly copying all the attribute from
      fir.alloca to the llvm.alloca, which makes no sense for the operand
      segments. The updated code that cannot take an attribute dictionnary in
      the llvm.alloca builder with opaque pointers only propagate the "pinned"
      and "bindc_name" attributes to help debugging the generated IR.
      
      - Updating all the places that rely on g...
      8a1ce2d6
    • Morten Borup Petersen's avatar
    • Simon Tatham's avatar
      [Driver] Add `--` to some test clang-cl command lines. (#70055) · 9ae11a5b
      Simon Tatham authored
      If clang/test/Driver/cl-offload.cu is run on Unix in a directory whose
      absolute pathname starts with `/w`, such as the `/workspace` used by at
      least some Jenkins CI setups, then the file name on the clang command
      line is misinterpreted as some kind of MSVC warning-control option, and
      ignored by the catch-all `_SLASH_w` option in Options.td.
      
      Other clang-cl tests take care to put a `--` before the input file name,
      to force clang to treat it as a filename even if it starts with a / and
      accidentally looks like a cl option. Do the same here.
      9ae11a5b
    • jeanPerier's avatar
      [flang] Allow lowering of sub-expressions to be overridden (#69944) · b6b0756c
      jeanPerier authored
      OpenACC/OpenMP atomic lowering needs a finer control over expression
      lowering. This patch allows mapping evaluate::Expr<T> to mlir::Value so
      that any subsequent expression lowering will use these values when an
      operand is a mapped Expr<T>.
      
      This is an alternative to
      https://github.com/llvm/llvm-project/pull/69866
      
       From which I took the
      test and some of the logic to extract the non-atomic sub-expression.
      
      ---------
      
      Co-authored-by: default avatarNimish Mishra <neelam.nimish@gmail.com>
      b6b0756c
    • Craig Topper's avatar
      [RISCV][GISel] Add G_SEXTLOAD to legalizer and regbank select. Add instruction selection tests. · 34af57c5
      Craig Topper authored
      This updates our G_SEXTLOAD support to the same level as G_ZEXTLOAD.
      Still missing some legalizer rules for both though.
      34af57c5
    • Craig Topper's avatar
      [RISCV][GISel] Fix failure to legalize non-power of 2 shifts between i32 and i64 on RV64. · 35d771fd
      Craig Topper authored
      We weren't legalizing the shift amount to i64.
      35d771fd
    • Kazu Hirata's avatar
      [ADT] Rename llvm::erase_value to llvm::erase (NFC) (#70156) · f9306f6d
      Kazu Hirata authored
      C++20 comes with std::erase to erase a value from std::vector.  This
      patch renames llvm::erase_value to llvm::erase for consistency with
      C++20.
      
      We could make llvm::erase more similar to std::erase by having it
      return the number of elements removed, but I'm not doing that for now
      because nobody seems to care about that in our code base.
      
      Since there are only 50 occurrences of erase_value in our code base,
      this patch replaces all of them with llvm::erase and deprecates
      llvm::erase_value.
      f9306f6d
    • harishch4's avatar
      [Flang][OpenMP] Replace fir.store with hlfir.assign in OpenMP single … (#70164) · f999e1d7
      harishch4 authored
      …test
      
      This fixes failures from a recent merge.
      [Flang][OpenMP] Port OpenMP single tests to hlfir flow
      (https://github.com/llvm/llvm-project/pull/69877)
      f999e1d7
    • Ingo Müller's avatar
      [mlir][python] Clear PyOperations instead of invalidating them. (#70044) · fa19ef7a
      Ingo Müller authored
      `PyOperations` are Python-level handles to `Operation *` instances. When
      the latter are modified by C++, the former need to be invalidated.
      #69746 implements such invalidation mechanism by setting all
      `PyReferences` to `invalid`. However, that is not enough: they also need
      to be removed from the `liveOperations` map since other parts of the
      code (such as `PyOperation::createDetached`) assume that that map only
      contains valid refs.
      
      This is required to actually solve the issue in #69730.
      fa19ef7a
    • Mikhail Gudim's avatar
      [ValueTracking] Analyze `Select` in `isKnownNonEqual`. (#68427) · 9abf3df1
      Mikhail Gudim authored
      Basic way to recursively analyze `select` in `isKnownNonEqual`: `select
      %c, %t, %f` is non-equal to `%x` if `%t` is non-equal to `%x` and `%f`
      is non-equal to `%x`.
      9abf3df1
    • wanglei's avatar
      [LoongArch] Set some operations action for LSX and LASX · f2441a06
      wanglei authored
      First, expand all truncationg stores and extending loads. Second,
      expand everything for `fixedlen_vector_valuetypes`.  Finally, we
      selectively turn on ones that can be effectively codegen'd.
      
      Simultaneously, this patch adds floating-point vector types to
      load/store patterns. Additional test cases will be included in the IR
      instruction test patchs.
      f2441a06
    • harishch4's avatar
    • Walter Erquinigo's avatar
      [lldb-vscode] Allow specifying a custom escape prefix for LLDB commands (#69238) · 10664813
      Walter Erquinigo authored
      We've been using the backtick as our escape character, however that
      leads to a weird experience on VS Code, because on most hosts, as soon
      as you type the backtick on VS Code, the IDE will introduce another
      backtick. As changing the default escape character might be out of
      question because other plugins might rely on it, we can instead
      introduce an option to change this variable upon lldb-vscode
      initialization.
      FWIW, my users will be using : instead ot the backtick.
      10664813
    • Kazu Hirata's avatar
      d72aa10a
    • Matthias Braun's avatar
      BlockFrequencyInfoImpl: Avoid big numbers, increase precision for small spreads · e3cf80c5
      Matthias Braun authored
      BlockFrequencyInfo calculates block frequencies as Scaled64 numbers but as a last step converts them to unsigned 64bit integers (`BlockFrequency`). This improves the factors picked for this conversion so that:
      
      * Avoid big numbers close to UINT64_MAX to avoid users overflowing/saturating when adding multiply frequencies together or when multiplying with integers. This leaves the topmost 10 bits unused to allow for some room.
      * Spread the difference between hottest/coldest block as much as possible to increase precision.
      * If the hot/cold spread cannot be represented loose precision at the lower end, but keep the frequencies at the upper end for hot blocks differentiable.
      e3cf80c5
    • Wang Pengcheng's avatar
      [RISCV][NFC] Fix comments in foldMemoryOperandImpl (#70033) · 69ade08b
      Wang Pengcheng authored
      
      I think the TODO is stale now.
      69ade08b
    • Maksim Levental's avatar
    • Ruiling, Song's avatar
      [LowerSwitch] Don't let pass manager handle the dependency (#68662) · ac242380
      Ruiling, Song authored
      Some passes has limitation that only support simple terminators:
      branch/unreachable/return. Right now, they ask the pass manager to add
      LowerSwitch pass to eliminate `switch`. Let's manage such kind of pass
      dependency by ourselves. Also add the assertion in the related passes.
      ac242380
    • Alex Richardson's avatar
      [builtins] Revert accidental change to PPC implementation in 05a4212c · b745ce95
      Alex Richardson authored
      This commit was supposed to only change the generic implementation.
      Should fix the build bot errors.
      b745ce95
    • Alexander Richardson's avatar
      [builtins] Avoid using long double in generic sources (#69754) · 05a4212c
      Alexander Richardson authored
      Use of long double can be error-prone since it could be one of 80-bit
      extended precision float, IEEE 128-bit float, or IBM 128-bit float.
      Instead use an explicit xf_float typedef for the remaining cases where
      long double is being used in the implementation. This patch does not
      touch
      the PPC specializations which still use long double.
      05a4212c
    • michaelrj-google's avatar
      [libc] Disable -NaN test on float128 systems (#70146) · 2282af26
      michaelrj-google authored
      Some float128 systems (specifically the ones used for aarch64 buildbots)
      don't respect signs for long double NaNs. This patch disables the printf
      test that was failing due to this.
      2282af26
    • Matthias Springer's avatar
      [mlir][tensor][NFC] Simplify `SubsetInsertionOpInterface` implementation (#69999) · 2e3c62b1
      Matthias Springer authored
      `tensor.insert_slice` and `tensor.parallel_insert_slice` can share the
      same implementation.
      2e3c62b1
    • Valery Dmitriev's avatar
      [SLP] Improve gather tree nodes matching when users are PHIs. (#70111) · 3324776d
      Valery Dmitriev authored
      This is re-commit of #69392 and also fixes issue #69670 which was
      uncovered with the prior commit.
      For delayed gather emission it may be incorrect to use stab instruction
      as insertion point if it is a PHI operand. For that case insertion point
      is adjusted to be at the end of block, ensuring that prior dependecy
      vector code is emitted earlier.
      3324776d
    • Min-Yih Hsu's avatar
      [RISCV][GISel] Add ISel support for SHXADD_UW and SLLI.UW (#69972) · cdcaef87
      Min-Yih Hsu authored
      This patch also includes:
        - Remove legacy non_imm12 PatLeaf from RISCVInstrInfoZb.td
      - Implement a custom GlobalISel operand renderer for TrailingZeros
      SDNodeXForm
      cdcaef87