1. Mar 03, 2024
  2. Mar 02, 2024
    • Hui's avatar
      [libc++] refactor `cxx_atomic_wait` to make it reusable for atomic_ref (#81427) · 1f613bce
      Hui authored
      The goal of this patch is to make `atomic`'s wait functions to be
      reusable by `atomic_ref`.
      https://github.com/llvm/llvm-project/pull/76647
      
      First, this patch is built on top of
      https://github.com/llvm/llvm-project/pull/80596 , to reduce the future
      merge conflicts.
      
      This patch made the following functions as "API"s to be used by
      `atomic`, `atomic_flag`, `semaphore`, `latch`, `atomic_ref`
      
      ```
      __atomic_wait
      __atomic_wait_unless
      __atomic_notify_one
      __atomic_notify_all
      ```
      
      These functions are made generic to support `atomic` type and
      `atomic_ref`. There are two customisation points.
      
      ```
      // How to load the value from the given type (with a memory order)
      __atomic_load
      ```
      
      
      ```
      // what is the contention address that the platform `wait` function is going to monitor
      __atomic_contention_address
      ```
      
      
      For `atomic_ref` (not implemented in this patch), the `load` and
      `address` function will be differen...
      1f613bce
    • David Green's avatar
      [Flang] Allow Intrinsic simpification with min/maxloc dim and scalar result (#81619) · 2a95fe48
      David Green authored
      This makes an adjustment to the existing fir minloc/maxloc generation
      code to handle functions with a dim=1 that produce a scalar result. This
      should allow us to get the same benefits as the existing generated
      minmax reductions.
      
      This is a recommit of #76194 with an extra alteration to the end of
      genRuntimeMinMaxlocBody to make sure we convert the output array to the
      correct type (a `box<heap<i32>>`, not `box<heap<array<1xi32>>>`) to
      prevent writing the wrong type of box into it. This still allocates the
      data as a `array<1xi32>`, converting it into a i32 assuming that is
      safe. An alternative would be to allocate the data as a i32 and change
      more of the accesses to it throughout genRuntimeMinMaxlocBody.
      2a95fe48
    • Simon Pilgrim's avatar
      [X86] Convert logicalshift(x, C) -> and(x, M) iff x is allsignbits (#83596) · ca827d53
      Simon Pilgrim authored
      If we're logical shifting an all-signbits value, then we can just mask out the shifted bits.
      
      This helps removes some unnecessary bitcasted vXi16 shifts used for vXi8 shifts (which SimplifyDemandedBits will struggle to remove through the bitcast), and allows some AVX1 shifts of 256-bit values to stay as a YMM instruction.
      
      Noticed in codegen from #82290
      ca827d53
    • Florian Hahn's avatar
      [DSE] Delay deleting non-memory-defs until end of DSE. (#83411) · 10f5e983
      Florian Hahn authored
      DSE uses BatchAA, which caches queries using pairs of MemoryLocations.
      At the moment, DSE may remove instructions that are used as pointers in
      cached MemoryLocations. If a new instruction used by a new MemoryLoation
      and this instruction gets allocated at the same address as a previosuly
      cached and then removed instruction, we may access an incorrect entry in
      the cache.
      
      To avoid this delay removing all instructions except MemoryDefs until
      the end of DSE. This should avoid removing any values used in BatchAA's
      cache.
      
      Test case by @vporpo from
      https://github.com/llvm/llvm-project/pull/83181.
      (Test not precommitted because the results are non-determinstic - memset
      only sometimes gets removed)
      
      PR: https://github.com/llvm/llvm-project/pull/83411
      10f5e983
    • Daniil Kovalev's avatar
      Revert "[Dwarf] Support `__ptrauth` qualifier in metadata nodes" (#83672) · bf08d028
      Daniil Kovalev authored
      Reverts llvm/llvm-project#82363
      
      See a build failure related to an issue discovered by memory sanitizer
      (use of uninitialized value):
      https://lab.llvm.org/buildbot/#/builders/37/builds/31965
      bf08d028
    • Michael Spencer's avatar
      [llvm][Support] Call clear_error in LockFileManager to avoid report_fatal_error (#83655) · c4f59937
      Michael Spencer authored
      As per the comment in `raw_fd_ostream`'s destructor, you must call
      `clear_error()` to prevent a call to `report_fatal_error()`. There's not
      really a way to test this, but we did encounter it in the wild.
      
      rdar://117347895
      c4f59937
    • Daniil Kovalev's avatar
      [lldb][X86] Fix setting target features in ClangExpressionParser (#82364) · b14220e0
      Daniil Kovalev authored
      Currently, for x86 and x86_64 triples, "+sse" and "+sse2" are appended
      to `Features` vector of `TargetOptions` unconditionally. This vector is
      later reset in `TargetInfo::CreateTargetInfo` and filled using info from
      `FeaturesAsWritten` vector, so previous modifications of the `Features`
      vector have no effect. For x86_64 triple, we append "sse2"
      unconditionally in `X86TargetInfo::initFeatureMap`, so despite the
      `Features` vector reset, we still have the desired sse features enabled.
      The corresponding code in `X86TargetInfo::initFeatureMap` is marked as
      FIXME, so we should not probably rely on it and should set desired
      features properly in `ClangExpressionParser`.
      
      This patch changes the vector the features are appended to from
      `Features` to `FeaturesAsWritten`. It's not reset later and is used to
      compute resulting `Features` vector.
      b14220e0