1. Oct 02, 2023
    • Martin Storsjö's avatar
      [compiler-rt] Reinstate removal of CRT choice flags from CMAKE_*_FLAGS* (#67935) · 7bc09a47
      Martin Storsjö authored
      This reverts one part of commit
      9f4dfcb7, with a modified comment added
      about the code.
      
      Ideally, this would only be reinstated temporarily - but given the
      situation in vcpkg, it looks likely that they would keep passing the
      duplicate options for quite some time. The conflicting CRT choice
      usually are benign but only would cause warnings about one option
      overriding the other, if passing e.g. "/MDd /MT".
      
      However when vcpkg currently sets these options in CMAKE_*_FLAGS_DEBUG,
      it passes the redundant option /D_DEBUG; thus the compiler finally ends
      up with e.g. "/D_DEBUG /MDd /MT", which has the effect of defining
      _DEBUG while using a release mode CRT, which allegedly breaks the build.
      
      There's a PR up for removing this redundant /D_DEBUG option in vcpkg in
      https://github.com/microsoft/vcpkg/pull/34123. With that in place, this
      change wouldn't be strictly needed.
      7bc09a47
    • Matt Arsenault's avatar
      RegisterCoalescer: Handle implicit-def of a super register when rematerializing · b1295dd5
      Matt Arsenault authored
      Permit an implicit-def of a virtual register when rematerializing if
      it defines a super register of a subregister def. The
      rematerialization pre-legality check should really have been checking
      the implicit operands, but that should be fixed separately.
      
      https://reviews.llvm.org/D156331
      b1295dd5
    • Uday Bondhugula's avatar
      [LIT] NFC. Add missing punctuation on a LIT driver message (#67941) · 4533d474
      Uday Bondhugula authored
      Add missing punctuation on a LIT driver message.
      4533d474
    • David Sherwood's avatar
      [Analysis][SVE] Improve cost model for some extending masked loads (#65957) · fad69a50
      David Sherwood authored
      When performing a masked load of an unpacked SVE vector type, i.e.
      nxv8i8, followed by a zero- or sign-extend to an illegal wide type
      such as nxv8i32 we typically end up with a combination of an
      extending masked load and pair(s) of uunpklo/hi or sunpklo/hi
      instructions. For example, see test @masked_sload_8i8_8i32 in file
      
        CodeGen/AArch64/sve-masked-ldst-sext.ll
      
      where
      
        %aval = call <vscale x 8 x i8> @llvm.masked.load.nxv8i8(...
        %aext = sext <vscale x 8 x i8> %aval to <vscale x 8 x i32>
      
      gets lowered to
      
        ld1sb { z1.h }, ...
        sunpklo z0.s, z1.h
        sunpkhi z1.s, z1.h
      
      Currently the cost for the 'sext' operation in the example above is
      1, whereas this patch changes it to 2 to reflect the pair of
      instructions required. Similarly, when doing a masked load of a
      nxv8i8 and extending to nxv8i64 the cost is changed to 6 to reflect
      the 6 unpacks required.
      fad69a50
    • Matt Arsenault's avatar
      RegisterCoalescer: Add new rematerializing with subregister tests · 274ba2c9
      Matt Arsenault authored
      None of the existing MIR tests seem to be directly targeting this
      situation.
      274ba2c9
    • Nikita Popov's avatar
      [InstCombine] Avoid use of ConstantExpr::getSExt() (NFC) · 9ace23c9
      Nikita Popov authored
      Use the constant folding API instead.
      9ace23c9
    • Nikita Popov's avatar
      [AMDGPUInstCombine] Avoid use of ConstantExpr::getSExt() (NFC) · bc7ca917
      Nikita Popov authored
      Let the IRBuilder handle the constant folding instead.
      bc7ca917
    • Matt Arsenault's avatar
      RegisterCoalescer: Forcibly leave SSA to avoid MIR test errors · 32a23aec
      Matt Arsenault authored
      Not sure how to produce a test that demonstrates the problem
      today. The coalescer would have to introduce a verifier caught SSA
      violation, like multiple defs of a virtual register. I'm not sure what
      would do that now, but an upcoming patch will.
      
      https://reviews.llvm.org/D156271
      32a23aec
    • David Spickett's avatar
      Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's... · ffc67bb3
      David Spickett authored
      Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's runtime LLVM integration"
      
      This reverts commit 6403287e.
      
      This is failing on all but 1 of Linaro's flang builders.
      CMake Error at /home/tcwg-buildbot/worker/clang-aarch64-full-2stage/llvm/flang-rt/unittests/CMakeLists.txt:37 (message):
        Target llvm_gtest not found.
      ffc67bb3
    • Matthias Springer's avatar
      [mlir][bufferization] Better analysis around allocs and block arguments (#67923) · 43198b0a
      Matthias Springer authored
      Values that are the result of buffer allocation ops are guaranteed to
      *not* be the same allocation as block arguments of containing blocks.
      This fact can be used to allow for more aggressive simplification of
      `bufferization.dealloc` ops.
      43198b0a
    • Henrik G. Olsson's avatar
      [clang] Add missing canonicalization in int literal profile (#67822) · 53179129
      Henrik G. Olsson authored
      The addition of the type kind to the profile ID of IntegerLiterals
      results in e.g. size_t and unsigned long literals mismatch even on
      platforms where they are canonically the same type. This patch checks
      the Canonical field to determine whether to canonicalize the type first.
      
      rdar://116063468
      53179129
    • Timm Bäder's avatar
      8245ca99
    • jeanPerier's avatar
      [flang] Zero initialize uninitialized components in saved default init (#67777) · 87e25210
      jeanPerier authored
      Follow up up of https://github.com/llvm/llvm-project/pull/67693
      
      - Zero initialize uninitialized components of saved derived type entity
      with a default initial value.
      - Zero initialize uninitialized storage of common blocks with a member
      with an initial value.
      - Zero initialized uninitialized saved equivalence
      
      This removes all the cases where fir.global are created with an initial
      value that results in an undef in LLVM for part of the global, leading
      in surprising LLVM optimizations at -O2 for Fortran folks that expects
      there saved variables to be zero initialized if there is no explicit or
      default initial value.
      87e25210
    • Owen Pan's avatar
      [clang-format] Fix a bug in mis-annotating arrows (#67780) · c83d64f1
      Owen Pan authored
      Fixed #66923.
      c83d64f1
    • Owen Pan's avatar
      [clang-format] Fix a bug in RemoveParentheses: ReturnStatement (#67911) · 75441a68
      Owen Pan authored
      Don't remove the outermost parentheses surrounding a return statement
      expression when inside a function/lambda that has the decltype(auto)
      return type.
      
      Fixed #67892.
      75441a68
    • David Green's avatar
      aacefaf1
    • Timm Bäder's avatar
      dcb946a1
    • Kai Sasaki's avatar
      [mlir][affine] Check the input vector sizes to be greater than 0 (#65293) · 97829935
      Kai Sasaki authored
      In the process of vectorization of the affine loop, the 0 vector size
      causes the crash with building the invalid AffineForOp. We can catch the
      case beforehand propagating to the assertion.
      
      See: https://github.com/llvm/llvm-project/issues/64262
      97829935
    • Philip Reames's avatar
      [RISCV] Form vredsum from explode_vector + scalar (left) reduce (#67821) · f0505c3d
      Philip Reames authored
      This change adds two related DAG combines which together will take a
      left-reduce scalar add tree of an explode_vector, and will incrementally
      form a vector reduction of the vector prefix. If the entire vector is
      reduced, the result will be a reduction over the entire vector.
      
      Profitability wise, this relies on vredsum being cheaper than a pair of
      extracts and scalar add. Given vredsum is linear in LMUL, and the
      vslidedown required for the extract is *also* linear in LMUL, this is
      clearly true at higher index values. At N=2, it's a bit questionable,
      but I think the vredsum form is probably a better canonical form
      anyways.
      
      Note that this only matches left reduces. This happens to be the
      motivating example I have (from spec2017 x264). This approach could be
      generalized to handle right reduces without much effort, and could be
      generalized to handle any reduce whose tree starts with adjacent
      elements if desired. The approach fails for a reduce such as (A+C)+(B+D)
      because we can't find a root to start the reduce with without scanning
      the entire associative add expression. We could maybe explore using
      masked reduces for the root node, but that seems of questionable
      profitability. (As in, worth questioning - I haven't explored in any
      detail.)
      
      This is covering up a deficiency in SLP. If SLP encounters the scalar
      form of reduce_or(A) + reduce_sum(a) where a is some common
      vectorizeable tree, SLP will sometimes fail to revisit one of the
      reductions after vectorizing the other. Fixing this in SLP is hard, and
      there's no good reason not to handle the easy cases in the backend.
      
      Another option here would be to do this in VectorCombine or generic DAG.
      I chose not to as the profitability of the non-legal typed prefix cases
      is very target dependent. I think this makes sense as a starting point,
      even if we move it elsewhere later.
      
      This is currently restructed only to add reduces, but obviously makes
      sense for any associative reduction operator. Once this is approved, I
      plan to extend it in this manner. I'm simply staging work in case we
      decide to go in another direction.
      f0505c3d
    • Mehdi Amini's avatar
    • Kazu Hirata's avatar
      [BOLT] Fix the initialization of DWARFDataExtractor · a7517e12
      Kazu Hirata authored
      Without this patch, we pass Endian as one of the parameters to the
      constructor of DWARFDataExtractor.  The problem is that Endian is of:
      
        enum endianness {big, little, native};
      
      whereas the constructor is expecting "bool IsLittleEndian".  That is,
      we are relying on an implicit conversion to convert big and little to
      false and true, respectively.
      
      When we migrate llvm::support::endianness to std::endian in future, we
      can no longer rely on an implicit conversion because std::endian is
      declared with "enum class".  Even if we could, the conversion would
      not be guaranteed to work because, for example, libcxx defines:
      
        enum class endian {
          little = 0xDEAD,
          big = 0xFACE,
          :
      
      where big and little are not boolean values.
      
      This patch fixes the problem by properly converting Endian to a
      boolean value.
      a7517e12
    • Kazu Hirata's avatar
      [ExecutionEngine] Fix the call to DWARFContext::create · 8de2ecc2
      Kazu Hirata authored
      Without this patch, we pass G.getEndianness() as one of the parameters
      to DWARFContext::create.  The problem is that G.getEndianness() is of:
      
        enum endianness {big, little, native};
      
      whereas DWARFContext::create is expecting "bool isLittleEndian".  That
      is, we are relying on an implicit conversion to convert big and little
      to false and true, respectively.
      
      When we migrate llvm::support::endianness to std::endian in future, we
      can no longer rely on an implicit conversion because std::endian is
      declared with "enum class".  Even if we could, the conversion would
      not be guaranteed to work because, for example, libcxx defines:
      
        enum class endian {
          little = 0xDEAD,
          big = 0xFACE,
          :
      
      where big and little are not boolean values.
      
      This patch fixes the problem by properly converting G.getEndianness()
      to a boolean value.
      8de2ecc2
    • Zhenyan Zhu's avatar
      [mlir][affine] Enforce each result type to match Reduction ops in affine.parallel verifier · 95804683
      Zhenyan Zhu authored
      This patch updates AffineParallelOp::verify() to check each result type matches
      its corresponding reduction op (i.e, the result type must be a `FloatType` if
      the reduction attribute is `addf`)
      
      affine.parallel will crash on --lower-affine if the corresponding result type
      cannot match the reduction attribute.
      
      ```
            %128 = affine.parallel (%arg2, %arg3) = (0, 0) to (8, 7) reduce ("maxf") -> (memref<8x7xf32>) {
              %alloc_33 = memref.alloc() : memref<8x7xf32>
              affine.yield %alloc_33 : memref<8x7xf32>
            }
      ```
      This will crash and report a type conversion issue when we run `mlir-opt --lower-affine`
      
      ```
      Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 572.
      PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
      Stack dump:
      0.	Program arguments: mlir-opt --lower-affine temp.mlir
       #0 0x0000000102a18f18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspacebin/mlir-opt+0x1002f8f18)
       #1 0x0000000102a171b4 llvm::sys::RunSignalHandlers() (/workspacebin/mlir-opt+0x1002f71b4)
       #2 0x0000000102a195c4 SignalHandler(int) (/workspacebin/mlir-opt+0x1002f95c4)
       #3 0x00000001be7894c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
       #4 0x00000001be771ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
       #5 0x00000001be6ac340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
       #6 0x00000001be6ab754 (/usr/lib/system/libsystem_c.dylib+0x180263754)
       #7 0x0000000106864790 mlir::arith::getIdentityValueAttr(mlir::arith::AtomicRMWKind, mlir::Type, mlir::OpBuilder&, mlir::Location) (.cold.4) (/workspacebin/mlir-opt+0x104144790)
       #8 0x0000000102ba66ac mlir::arith::getIdentityValueAttr(mlir::arith::AtomicRMWKind, mlir::Type, mlir::OpBuilder&, mlir::Location) (/workspacebin/mlir-opt+0x1004866ac)
       #9 0x0000000102ba6910 mlir::arith::getIdentityValue(mlir::arith::AtomicRMWKind, mlir::Type, mlir::OpBuilder&, mlir::Location) (/workspacebin/mlir-opt+0x100486910)
      ...
      ```
      
      Fixes #64068
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D157985
      95804683
    • Martin Storsjö's avatar
      [clang] [MinGW] Tolerate mingw specific linker options during compilation (#67891) · e39de2b8
      Martin Storsjö authored
      Prior to 591c4b64, the mingw specific
      linker options -mthreads, -mconsole, -mwindows and -mdll would be
      tolerated also at compile time, but generating a warning about being
      unused.
      
      After that commit, they were marked as target specific, which means that
      it's an error if they're unused (which would consider them used for the
      wrong target). These specific options are only relevant when linking,
      but we want to tolerate them at compile time too, like before.
      
      This was fixed for -mthreads in
      a79995ca, while the other options didn't
      seem to be commonly used during compilation.
      
      After the 17.x release, we've got more reports about this actually being
      an issue, in #64464. Therefore, apply the same fix for them; marking
      them as tolerated for mingw targets during compilation, even if they're
      unused. Also add a testcase for -mthreads which was already handled.
      
      Thus, this fixes #64464.
      e39de2b8
    • Kazu Hirata's avatar
      [GSYM] Fix the initialization of DataExtractor (#67904) · 95f4b2a7
      Kazu Hirata authored
      Without this patch, we pass Endian as one of the parameters to the
      constructor of DataExtractor.  The problem is that Endian is of:
      
        enum endianness {big, little, native};
      
      whereas the constructor is expecting "bool IsLittleEndian".  That is,
      we are relying on an implicit conversion to convert big and little to
      false and true, respectively.
      
      When we migrate llvm::support::endianness to std::endian in future, we
      can no longer rely on an implicit conversion because std::endian is
      declared with "enum class".  Even if we could, the conversion would
      not be guaranteed to work because, for example, libcxx defines:
      
        enum class endian {
          little = 0xDEAD,
          big = 0xFACE,
          :
      
      where big and little are not boolean values.
      
      This patch fixes the problem by properly converting Endian to a
      boolean value.
      95f4b2a7
    • Matthias Springer's avatar
      [mlir][bufferization] Improve verifier for `bufferization.dealloc` (#67912) · 0ef990d5
      Matthias Springer authored
      Check that the number of retained operands and updated conditions match.
      0ef990d5
    • Timm Bäder's avatar
      [clang][Interp] Disable int128 tests on targets that don't have int128 · c77b2ad0
      Timm Bäder authored
      This broke build bots.
      c77b2ad0
  2. Oct 01, 2023