1. Feb 08, 2024
    • Matt Arsenault's avatar
      Reapply "InstCombine: Introduce SimplifyDemandedUseFPClass"" (#74056) · decbd29f
      Matt Arsenault authored
      This reverts commit ef388334.
      
      The referenced issue violates the spec for finite-only math only by
      using a return value for a constant infinity. If the interpretation
      is results and arguments cannot violate nofpclass, then any
      std::numeric_limits<T>::infinity() result is invalid under
      -ffinite-math-only. Without this interpretation the utility of
      nofpclass is slashed.
      decbd29f
    • Matt Arsenault's avatar
    • martinboehme's avatar
      [clang][dataflow] Add support for `CXXRewrittenBinaryOperator`. (#81086) · a446c9bf
      martinboehme authored
      This occurs in rewritten candidates for binary operators (a C++20
      feature).
      
      The patch modifies UncheckedOptionalAccessModelTest to run in C++20 mode
      (as
      well as C++17 mode, as before) and to use rewritten candidates. The
      modified
      test fails without the newly added support for
      `CXXRewrittenBinaryOperator`.
      a446c9bf
    • Pierre van Houtryve's avatar
      [AMDGPU] Revert Metadata Version Upgrade (#80995) · 9ff3b829
      Pierre van Houtryve authored
      Metadata is still 1.2, not 1.3 after V6.
      I thought that amdhsa.version mapped to the COV version but it's
      separate, and there are no MD changes in V6, hence it doesn't need to be
      updated.
      9ff3b829
    • Yingwei Zheng's avatar
      [InstSimplify] Generalize `simplifyAndOrOfFCmps` (#81027) · e17dded8
      Yingwei Zheng authored
      This patch generalizes `simplifyAndOrOfFCmps` to simplify patterns like:
      ```
      define i1 @src(float %x, float %y) {
        %or.cond.i = fcmp ord float %x, 0.000000e+00
        %cmp.i.i34 = fcmp olt float %x, %y
        %cmp.i2.sink.i = and i1 %or.cond.i, %cmp.i.i34
        ret i1 %cmp.i2.sink.i
      }
      
      define i1 @tgt(float %x, float %y) {
        %cmp.i.i34 = fcmp olt float %x, %y
        ret i1 %cmp.i.i34
      }
      ```
      Alive2: https://alive2.llvm.org/ce/z/9rydcx
      
      This patch and #80986 will fix the regression introduced by #80941.
      See also the IR diff
      https://github.com/dtcxzyw/llvm-opt-benchmark/pull/199#discussion_r1480974120.
      e17dded8
    • Yingwei Zheng's avatar
      [InstCombine] Handle IsInf/IsZero idioms (#80607) · c8ca98a2
      Yingwei Zheng authored
      This patch does the following folds:
      ```
      icmp eq/ne (bitcast X to int), (bitcast +/-inf to int) -> llvm.is.fpclass(X, (~)fcPosInf/fcNegInf)
      icmp eq/ne (bitcast X to int), (bitcast +0/-0 to int) -> llvm.is.fpclass(X, (~)fcPosZero/fcNegZero)
      ```
      Alive2: https://alive2.llvm.org/ce/z/JJmEE9
      c8ca98a2
    • Owen Pan's avatar
      [clang-format] Fix a regression in dumping the config (#80628) · 8f6e13e6
      Owen Pan authored
      Commit d813af73 addressed a regression introduced by commit
      3791b3fc
      but caused `clang-format -dump-config` to "hang".
      
      This patch reverts changes to ClangFormat.cpp by both commits and
      reworks the cleanup.
      
      Fixes #80621.
      8f6e13e6
    • Rageking8's avatar
      [clang][NFC] resolve redundant predicates (#79701) · 351f94d9
      Rageking8 authored
      Fixes #79686
      351f94d9
    • Owen Pan's avatar
      [clang-format] Add Leave to AlwaysBreakTemplateDeclarations (#80569) · d0337990
      Owen Pan authored
      Closes #78067.
      d0337990
    • Mingming Liu's avatar
      [NFC][InstrProf]Generalize getParsedIRPGOFuncName to getParsedIRPGOName (#81054) · 05091aa3
      Mingming Liu authored
      - Function getParsedIRPGOFuncName splits name by delimiter. The `[filename;]mangled-name` format could be generalized for non-function global values (e.g., vtables for type profiling). So rename the
      function.
      - Use kGlobalIdentifierDelimiter rather than semicolon directly for defragmentation.
      05091aa3
    • Jason Eckhardt's avatar
      [TableGen] Remove map CodeGenTarget::InstrToIntMap. (#81079) · d01864eb
      Jason Eckhardt authored
      This patch removes CodeGenTarget::InstrToIntMap, using instead a new
      member CodeGenInstruction::EnumVal to store each enum value. This value
      is computed and set by CodeGenTarget::computeInstrsByEnum and queried by
      CodeGenTarget::getInstrIntValue.
      d01864eb
    • Alexandre Ganea's avatar
      [LLD][ELF] Silence warning when building with latest MSVC · 5c4a630a
      Alexandre Ganea authored
      This fixes:
      ```
      [193/3517] Building CXX object
      tools\lld\ELF\CMakeFiles\lldELF.dir\Arch\LoongArch.cpp.obj
      C:\git\llvm-project\lld\ELF\Arch\LoongArch.cpp(683): warning C4334:
      '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit
      shift intended?
      ```
      5c4a630a
    • Jason Eckhardt's avatar
      [TableGen][NFC] Replace hardcoded opcode numbering. (#81065) · 567d304e
      Jason Eckhardt authored
      This patch uses the recently introduced CodeGenTarget::getInstrIntValue
      to replace hardcoded opcode enum value numbering in a few places.
      567d304e
    • David Green's avatar
    • Jason Molenda's avatar
      [lldb] [NFC] Remove min pkt size for compression setting (#81075) · 2df42fe0
      Jason Molenda authored
      debugserver will not compress small packets; the overhead of the
      compression header makes this useful for larger packets. I default to
      384 bytes in debugserver, and added an option for lldb to request a
      different cutoff. This option has never been used in lldb in the past
      nine years, so I don't think there's any point to keeping it around.
      2df42fe0
    • Luke Lau's avatar
      [SelectionDAG] Add computeKnownBits support for ISD::STEP_VECTOR (#80452) · ece66dbc
      Luke Lau authored
      This handles two cases where we can work out some known-zero bits for
      ISD::STEP_VECTOR.
      
      The first case handles when we know the low bits are zero because the
      step
      amount is a power of two. This is taken from
      https://reviews.llvm.org/D128159
      
      ,
      and even though the original patch didn't end up landing this case due
      to it
      not having any test difference, I've included it here for completeness's
      sake.
      
      The second case handles the case when we have an upper bound on
      vscale_range.
      We can use this to work out the upper bound on the number of elements,
      and thus
      what the maximum step will be. From the maximum step we then know which
      hi bits
      are zero.
      
      On its own, computing the known hi bits results in some small
      improvements for
      RVV with -mrvv-vector-bits=zvl across the llvm-test-suite. However I'm
      hoping
      to be able to use this later to reduce the LMUL in index calculations
      for
      vrgather/indexed accesses.
      
      ---------
      
      Co-authored-by: default avatarPhilip Reames <preames@rivosinc.com>
      ece66dbc
    • dhruvachak's avatar
      [libomptarget] [OMPT] Fixed return address computation for OMPT events. (#80498) · 0d7f232b
      dhruvachak authored
      Currently, __builtin_return_address is used to generate the return
      address when the callback invoker is created. However, this may result
      in the return address pointing to an internal runtime function. This is
      not what a tool would typically want. A tool would want to know the
      corresponding user code from where the runtime entry point is invoked.
      
      This change adds a thread local variable that is assigned the return
      address at the OpenMP runtime entry points. An RAII is used to manage
      the modifications to the thread local variable. Whenever the return
      address is required for OMPT events, it is read from the thread local
      variable.
      0d7f232b
    • YunQiang Su's avatar
      MIPS/libunwind: Use -mfp64 if compiler is FPXX (#68521) · 4520b478
      YunQiang Su authored
      Libunwind supports FP64 and FP32 modes, but not FPXX. The reason is
      that, FP64 and FP32 have different way to save/restore FPRs. If
      libunwind is built as FPXX, we have no idea which one should we use.
      
      It's not due to the code bug, but rather the nature of FPXX.
      FPXX is an ABI which uses only a common subset of FR=1(FP64) and FR=0
      (FP32).
      So that FPXX binaries can link with both FP64 and FP32 ones, aka.
          FPXX + FP32 -> FP32
          FPXX + FP64 -> FP64
      
      While for libunwind, we should save/restore all of FPRs. If we use FPXX,
      we can only save/restore a common subset of FPRs, instead of superset.
      
      If libunwind is built as FP64, it will interoperatable with FPXX/FP64
      APPs, and if it is built as FP32, it will interoperatable with
      FP32/FPXX. Currently most of O32 APPs are FPXX or FP64, while few are
      FP32.
      
      So if the compiler is FPXX, which is the default value of most
      toolchain, let's switch it to FP64.
      
      Co-authored-by: YunQiang Su <yu...
      4520b478
    • quanwanandy's avatar
      Fix Bazel build (#81064) · 78b9dd6b
      quanwanandy authored
      78b9dd6b
    • Arthur Eubanks's avatar
      [NewPM/CodeGen] Move MachineModuleInfo::invalidate() to MachineModuleAnalysis::Result · 43badc0a
      Arthur Eubanks authored
      Missed in #80937 since it's not currently being used.
      43badc0a
    • Daniel Hoekwater's avatar
      [Driver] Allow -fbasic-block-sections for AArch64 ELF (#80916) · ff8c8658
      Daniel Hoekwater authored
      Basic block sections "all" doesn't work on AArch64 since branch
      relaxation may create new basic blocks. However, the other basic
      block section modes should work out of the box since machine function
      splitting already uses the basic block sections pass.
      ff8c8658
    • Yi Kong's avatar
      d6c2cbbc
    • Visoiu Mistrih Francis's avatar
      [RISCV] Add correct Uses, Defs, isReturn to Zcmp (#81039) · 514686ac
      Visoiu Mistrih Francis authored
      * they all do stack adjustments, so they all use and def x2.
      * popret and popretz also return
      * popretz also defines x10
      
      This adds that to the TD file and updates the PushPopOptimizer to
      preserve the extra implicit operands added during frame lowering when
      converting to popret(z).
      514686ac
    • jimingham's avatar
      Don't search for separate debug files for mach-o object files (#81041) · 50ffc53e
      jimingham authored
      mach-o object files never have separate debug info, and in a big app
      there can be quite a large number of object files, so even a few stats
      per object file can slow launches considerably.
      This patch avoids this search for Mach-o symbol files of object type.
      
      I don't have a way to test this, the only effect is that you didn't do a
      bunch of stats that weren't going to do any good anyway.
      50ffc53e
    • Arthur Eubanks's avatar
      [NFC][NewPM/Codegen] Remove unused parameter from verifyMachineFunction · d05bd34a
      Arthur Eubanks authored
      The MachineFunctionAnalysisManager forward declaration is messing with upcoming changes.
      d05bd34a
    • Arnold Schwaighofer's avatar
      [Coro] [async] Disable inlining in async coroutine splitting (#80904) · b1ac052a
      Arnold Schwaighofer authored
      The call to the inlining utility does not update the call graph. Leading
      to assertion failures when calling the call graph utility to update the
      call graph.
      
      Instead rely on an inline pass to run after coro splitting and use
      alwaysinline annotations.
      
      github.com/apple/swift/issues/68708
      b1ac052a
    • Teresa Johnson's avatar
      [MemProf] Switch to DenseMap for performance (NFC) (#81035) · bb3ea6c8
      Teresa Johnson authored
      Some profiling showed that the accesses to this map during bitcode
      reading was incurring over 10% of the time in a large thin link. There
      is no need for it to be std::map, and I measured around 8.5% time
      reduction in the same thin link from switching to DenseMap.
      bb3ea6c8
    • Pranav Kant's avatar
      [NFC][AMDGPU] Fix unused-variable warning (#81040) · c95693c7
      Pranav Kant authored
      This is only used in assert statement.
      c95693c7
    • Vijay Kandiah's avatar
      [flang] Introducing a method to dynamically and conditionally register dialect... · 369b8221
      Vijay Kandiah authored
      
      [flang] Introducing a method to dynamically and conditionally register dialect interfaces.  (#80881)
      
      This change introduces the `addFIRExtensions` method to dynamically and
      conditionally register dialect interfaces. As a use case of
      `addFIRExtensions`, this change moves the static registration of
      `FIRInlinerInterface` out of the constructor of `FIROpsDialect` to be
      dynamically registered while loading the necessary MLIR dialects
      required by Flang. This registration of `FIRInlinerInterface` is also
      guarded by a boolean `addFIRInlinerInterface` which defaults to true.
      
      ---------
      
      Co-authored-by: default avatarVijay Kandiah <vkandiah@nvidia.com>
      369b8221
    • Xing Xue's avatar
      [OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in test cases (#79895) · 7a9b0e4a
      Xing Xue authored
      This patch flips bit-fields in `struct flags` for big-endian in test
      cases to be consistent with the definition of the structure in libomp
      `kmp.h`.
      7a9b0e4a
    • Kolya Panchenko's avatar
      [MLIR][VCIX] Support VCIX intrinsics in LLVMIR dialect (#75875) · 9f6c0056
      Kolya Panchenko authored
      The changeset extends LLVMIR intrinsics with VCIX intrinsics.
      The VCIX intrinsics allow MLIR users to interact with RISC-V
      co-processors that are compatible with `XSfvcp` extension
      
      Source:
      https://www.sifive.com/document-file/sifive-vector-coprocessor-interface-vcix-software
      9f6c0056
    • Stephen Tozer's avatar
      Reapply "[RemoveDIs][DebugInfo] Hoist DPValues in SpeculativeExecution (#80886)" · caf537ea
      Stephen Tozer authored
      Reapply the original commit, 0aacd44a, which had a missing brace resulting in
      an error in compilation.
      
      This reverts commit c76b0eb8.
      caf537ea
    • Derek Schuff's avatar
      [Object][Wasm] Use file offset for section addresses in linked wasm files (#80529) · 8b0f47bf
      Derek Schuff authored
      Wasm has no unified virtual memory space as other object formats and
      architectures do, so previously WasmObjectFile reported 0 for all
      section addresses, and until 428cf71f used section offsets for function
      symbols. Now we use file offsets for function symbols, and this change
      switches section addresses to do the same (in linked files). The main
      result of this is that objdump now reports VMAs in section listings, and
      also uses file offets rather than section offsets when disassembling
      linked binaries (matching the behavior of other disassemblers and stack
      traces produced by browwsers). To make this work, this PR also updates
      objdump's generation of synthetics fallback symbols to match lib/Object
      and also correctly plumbs symbol types for regular and dummy symbols
      through to the backend to avoid needing special knowledge of address 0.
      
      This also paves the way for generating symbols from name sections rather
      than symbol tables or imports (see #76107) by allowing the
      disassembler's synthetic fallback symbols match the name-section
      generated symbols (in a followup PR).
      8b0f47bf
    • lonely eagle's avatar
      [mlir]Fix compose subview (#80551) · 2ecf6088
      lonely eagle authored
      I found a bug in `test-compose-subview`,You can see the example I gave.
      ```
      #map = affine_map<() -> ()>
      module {
        func.func private @fun(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> {
          %c0 = arith.constant 0 : index
          %c5 = arith.constant 5 : index
          %c1 = arith.constant 1 : index
          %subview = memref.subview %arg0[0, 0] [5, 5] [1, 1] : memref<10x10xf32> to memref<5x5xf32, strided<[10, 1]>>
          %alloc = memref.alloc() : memref<5x5xf32>
          scf.for %arg2 = %c0 to %c5 step %c1 {
            scf.for %arg3 = %c0 to %c5 step %c1 {
              %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32, strided<[10, 1]>> to memref<f32, strided<[], offset: ?>>
              %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
              %alloc_2 = memref.alloc() : memref<f32>
              linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref<f32, strided<[], offset: ?>>, memref<f32, strided<[], offset: ?>>) outs(%alloc_2 : memref<f32>) {
              ^bb0(%in: f32, %in_4: f32, %out: f32):
                %0 = arith.addf %in, %in_4 : f32
                linalg.yield %0 : f32
              }
              %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
              memref.copy %alloc_2, %subview_3 : memref<f32> to memref<f32, strided<[], offset: ?>>
            }
          }
          return %alloc : memref<5x5xf32>
        }
        func.func @test(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> {
          %0 = call @fun(%arg0, %arg1) : (memref<10x10xf32>, memref<5x5xf32>) -> memref<5x5xf32>
          return %0 : memref<5x5xf32>
        }
      }
      ```
      When I run `mlir-opt test.mlir ---test-compose-subview`.
      ```
      test.mlir:14:9: error: 'linalg.generic' op expected operand rank (2) to match the result rank of indexing_map #0 (0)
              linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref<f32, strided<[], offset: ?>>, memref<f32, strided<[], offset: ?>>) outs(%alloc_2 : memref<f32>) {
              ^
      test1.mlir:14:9: note: see current operation: 
      "linalg.generic"(%4, %5, %6) <{indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = [], operandSegmentSizes = array<i32: 2, 1>}> ({
      ^bb0(%arg4: f32, %arg5: f32, %arg6: f32):
        %8 = "arith.addf"(%arg4, %arg5) <{fastmath = #arith.fastmath<none>}> : (f32, f32) -> f32
        "linalg.yield"(%8) : (f32) -> ()
      }) : (memref<1x1xf32, strided<[10, 1], offset: ?>>, memref<f32, strided<[], offset: ?>>, memref<f32>) -> ()
      ```
      This PR fixes that.In the meantime I've extended this PR to handle cases
      where stride is greater than 1.
      ```
      func.func private @Unknown0(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32> {
        %c0 = arith.constant 0 : index
        %c5 = arith.constant 5 : index
        %c1 = arith.constant 1 : index
        %subview = memref.subview %arg0[0, 0] [5, 5] [2, 2] : memref<10x10xf32> to memref<5x5xf32, strided<[20, 2]>>
        %alloc = memref.alloc() : memref<5x5xf32>
        scf.for %arg2 = %c0 to %c5 step %c1 {
          scf.for %arg3 = %c0 to %c5 step %c1 {
            %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32, strided<[20, 2]>> to memref<f32, strided<[], offset: ?>>
            %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
            %alloc_2 = memref.alloc() : memref<f32>
            linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%subview_0, %subview_1 : memref<f32, strided<[], offset: ?>>, memref<f32, strided<[], offset: ?>>) outs(%alloc_2 : memref<f32>) {
            ^bb0(%in: f32, %in_4: f32, %out: f32):
              %0 = arith.addf %in, %in_4 : f32
              linalg.yield %0 : f32
            }
            %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
            memref.copy %alloc_2, %subview_3 : memref<f32> to memref<f32, strided<[], offset: ?>>
          }
        }
        return %alloc : memref<5x5xf32>
      }
      $ mlir-opt test.mlir -test-compose-subview
      #map = affine_map<()[s0] -> (s0 * 2)>
      #map1 = affine_map<() -> ()>
      module {
        func.func private @Unknown0(%arg0: memref<10x10xf32>, %arg1: memref<5x5xf32>) -> memref<5x5xf32>  {
          %c0 = arith.constant 0 : index
          %c5 = arith.constant 5 : index
          %c1 = arith.constant 1 : index
          %alloc = memref.alloc() : memref<5x5xf32>
          scf.for %arg2 = %c0 to %c5 step %c1 {
            scf.for %arg3 = %c0 to %c5 step %c1 {
              %0 = affine.apply #map()[%arg2]
              %1 = affine.apply #map()[%arg3]
              %subview = memref.subview %arg0[%0, %1] [1, 1] [2, 2] : memref<10x10xf32> to memref<f32, strided<[], offset: ?>>
              %subview_0 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
              %alloc_1 = memref.alloc() : memref<f32>
              linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = []} ins(%subview, %subview_0 : memref<f32, strided<[], offset: ?>>, memref<f32, strided<[], offset: ?>>) outs(%alloc_1 : memref<f32>) {
              ^bb0(%in: f32, %in_3: f32, %out: f32):
                %2 = arith.addf %in, %in_3 : f32
                linalg.yield %2 : f32
              }
              %subview_2 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref<5x5xf32> to memref<f32, strided<[], offset: ?>>
              memref.copy %alloc_1, %subview_2 : memref<f32> to memref<f32, strided<[], offset: ?>>
            }
          }
          return %alloc : memref<5x5xf32>
        }
      }
      ```
      2ecf6088
    • Ilya Leoshkevich's avatar
      [SystemZ] Implement A, O and R inline assembly format flags (#80685) · 9c75a981
      Ilya Leoshkevich authored
      Implement the following assembly format flags, which are already
      supported by GCC:
      
      	'A': On z14 or higher: If operand is a mem print the alignment
               hint usable with vl/vst prefixed by a comma.
      	'O': print only the displacement of a memory reference or address.
      	'R': print only the base register of a memory reference or address.
      
      Implement 'A' conservatively, since the memory operand alignment
      information is not available for INLINEASM at the moment.
      9c75a981
    • Shourya Goel's avatar
      [Clang][OpenMP] Fix `!isNull() && "Cannot retrieve a NULL type pointer"' fail. (#81015) · b89eb979
      Shourya Goel authored
      Fixes : #69085 , #69200
      
      **PR SUMMARY**: "Added Null check for negative sized array and a test
      for the same"
      b89eb979
    • Jeffrey Byrnes's avatar
      [AMDGPU] Accept arbitrary sized sources in CalculateByteProvider (#70240) · 3115ad89
      Jeffrey Byrnes authored
      Reland the original patch with additional commit containing fix for two
      issues:
      
      1. Attempting to bitcast using MVTs with no corresponding LLVM type.
      getDWordFromOffset now works directly with the original vector to get
      the corresponding elements given the DWordOffset.
      2. Improper bit tracking in CalculateByteProvider for vector types using
      certain ops. Previously, bit tracking for certain ops (e.g.
      ISD::TRUNCATE) assumed operands were scalar types, which is not correct
      since these ops have different semantics depending on vector / scalar.
      CalculateByteProvider / CalculateSrcByte now exit on vector types,
      handling which is a TODO.
      3115ad89
    • Max191's avatar
      [mlir] Add direct vectorization lowering for `tensor.pack` ops (#78660) · 7880b2c8
      Max191 authored
      This PR adds a direct vectorization lowering of `tensor.pack` into
      `mask(vector.transfer_read)`->`vector.shape_cast`->`vector.transpose`->`vector.transfer_write`.
      7880b2c8
    • Joseph Huber's avatar
      347ab99a
    • YAMAMOTO Takashi's avatar