1. Sep 05, 2023
    • Kazu Hirata's avatar
      [mlir] Use a range-based for loop (NFC) · c86bb3d9
      Kazu Hirata authored
      c86bb3d9
    • Kazu Hirata's avatar
      a6fa39da
    • Kazu Hirata's avatar
      [Serialization] Modernize ModuleInfo (NFC) · 23915fe3
      Kazu Hirata authored
      23915fe3
    • Groverkss's avatar
      [MLIR][Presburger] Add Identifier class to store identifiers and their type · d222b690
      Groverkss authored
      This patch adds a new class Identifier to store identifiers in PresburgerSpace
      and their types.
      
      Identifiers were added earlier and were stored as a void pointer, and their type
      in the form of mlir::TypeId in PresburgerSpace. To get an identifier, a user of
      PresburgerSpace needed to know the type of identifiers. This was a problem for
      users of PresburgerSpace like IntegerRelation, which want to work on
      identifiers without knowing their type.
      
      The Identifier class allows users like IntegerRelation to work on identifiers
      without knowing their type, and also exposes an easier way to work with
      Identifiers.
      
      Reviewed By: arjunp
      
      Differential Revision: https://reviews.llvm.org/D146909
      d222b690
    • Jie Fu's avatar
      [clang][dataflow] Fix -Wunused-const-variable in WatchedLiteralsSolver.cpp (NFC) · 5f667a57
      Jie Fu authored
      /data/llvm-project/clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp:62:26: error: unused variable 'NullLit' [-Werror,-Wunused-const-variable]
      static constexpr Literal NullLit = 0;
      5f667a57
    • Karl-Johan Karlsson's avatar
    • iambrj's avatar
      [MLIR][Presburger] Minor bug-fix in PresburgerRelation::intersectRange from 3dd9931c · 6c6a2d34
      iambrj authored
      Fix a typo (incorrectly calling getNumDomainVars instead of
      getNumRangeVars) in intersectRange from 3dd9931c.
      
      Reviewed By: Groverkss
      
      Differential Revision: https://reviews.llvm.org/D159413
      6c6a2d34
    • Burak Emir's avatar
      [clang][dataflow] #llvm #flow-analysis Simplify formula at CNF construction... · b50c87d1
      Burak Emir authored
      [clang][dataflow] #llvm #flow-analysis Simplify formula at CNF construction time, and short-cut solving of known contradictory formulas.
      
      In dataflow analysis, SAT solver: simplify formula during CNF construction and short-cut
      solving when the formula has been recognized as contradictory.
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D158407
      b50c87d1
    • pvanhout's avatar
      [TableGen][GlobalISel] Add MIR Pattern Builtins · 844c0da7
      pvanhout authored
      Adds a new feature to MIR patterns: builtin instructions.
      They offer some additional capabilities that currently cannot be expressed without falling back to C++ code.
      There are two builtins added with this patch, but more can be added later as new needs arise:
       - GIReplaceReg
       - GIEraseRoot
      
      Depends on D158714, D158713
      
      Reviewed By: arsenm, aemerson
      
      Differential Revision: https://reviews.llvm.org/D158975
      844c0da7
    • pvanhout's avatar
      [GlobalISel] Cleanup Combine.td · 4e513f69
      pvanhout authored
      Now that the old backend is gone, clean-up a few things that no longer make sense and tidy up the file a bit.
      
      Depends on D158710
      
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D158714
      4e513f69
    • pvanhout's avatar
      [GlobalISel] Refactor Combiner API · aaf67556
      pvanhout authored
      Remove CodeGen leftovers from the old combiner backend and adapt the API to fit the new backend better.
      It's now quite a bit closer to how InstructionSelector works.
      
      - `CombinerInfo` is now a simple "options" struct.
      - `Combiner` is now the base class of all TableGen'd combiner implementation.
          - Many fields have been moved from derived classes into that class.
          - It has been refactored to create & own the Observer and Builder.
      - `tryCombineAll` TableGen'd method can now be renamed, which allows targets to implement the actual `tryCombineAll` call manually and do whatever they want to do before/after it.
      
      Note: `CombinerHelper` needs to be mutable because none of its methods are const. This can be revisited later.
      
      Depends on D158710
      
      Reviewed By: aemerson, dsanders
      
      Differential Revision: https://reviews.llvm.org/D158713
      aaf67556
    • Cullen Rhodes's avatar
      [mlir][ArmSME] Fix scalable dims check in isValidSMETileVectorType (#65254) · 538f1358
      Cullen Rhodes authored
      Check for allDimsScalable is incorrect and currently permits fixed
      vectors.
      538f1358
    • Christian Sigg's avatar
      4ae0db4e
    • Brad Smith's avatar
      [analyzer][NFC] Use switch statement in MallocChecker::performKernelMalloc · 0a73e1eb
      Brad Smith authored
      Reviewed By: steakhal
      
      Differential Revision: https://reviews.llvm.org/D159397
      0a73e1eb
    • sstwcw's avatar
      [clang-format][doc] Fix the doc format · 1362206e
      sstwcw authored
      There has to be a blank line after a code block.  Otherwise the HTML
      docs can't be built.
      
      The problem was brought in by ddc80637.  How careless I was that the
      same patch broke the build twice.
      1362206e
    • Qiu Chaofan's avatar
      [PowerPC] Implement builtin for mffsl · 082c5d7f
      Qiu Chaofan authored
      mffsl is available since ISA 3.0. The builtin is named with ppc prefix
      to follow our convention. For targets earlier than power9, GCC generates
      extra code to support the functionality, while this patch does not
      implement such behavior.
      
      Reviewed By: nemanjai, tuliom
      
      Differential Revision: https://reviews.llvm.org/D158065
      082c5d7f
    • sstwcw's avatar
      [clang-format] Break long string literals in C#, etc. · ddc80637
      sstwcw authored
      Now strings that are too long for one line in C#, Java, JavaScript, and
      Verilog get broken into several lines.  C# and JavaScript interpolated
      strings are not broken.
      
      A new subclass BreakableStringLiteralUsingOperators is used to handle
      the logic for adding plus signs and commas.  The updateAfterBroken
      method was added because now parentheses or braces may be required after
      the parentheses or commas are added.  In order to decide whether the
      added plus sign should be unindented in the BreakableToken object, the
      logic for it is taken out into a separate function
      shouldUnindentNextOperator.
      
      The logic for finding the continuation indentation when the option
      AlignAfterOpenBracket is set to DontAlign is not implemented yet.  So in
      that case the new line may have the wrong indentation, and the parts may
      have the wrong length if the string needs to be broken more than once
      because finding where to break the string depends on where the string
      starts.
      
      The preambles for the C# and Java unit tests are changed to the newer
      style in order to allow the 3-argument verifyFormat macro.  Some cases
      are changed from verifyFormat to verifyImcompleteFormat because those
      use incomplete code and the new verifyFormat function checks that the
      code is complete.
      
      The line in the doc was changed to being indented by 4 spaces, that is,
      the default continuation indentation.  It has always been the case.  It
      was probably a mistake that the doc showed 2 spaces previously.
      
      This commit was fist committed as 16ccba51.  The tests caused
      assertion failures.  Then it was reverted in 547bce36.
      
      Reviewed By: MyDeveloperDay
      
      Differential Revision: https://reviews.llvm.org/D154093
      ddc80637
    • Takuya Shimizu's avatar
      [clang][Diagnostics] Fix wrong line number display (#65238) · ef5217b3
      Takuya Shimizu authored
      When the caret location is lower than the lowest source range, clang is
      printing wrong line numbers. The first line number should consider caret
      location line even when there are source ranges provided.
      
      Current wrong line example: https://godbolt.org/z/aj4qEjzs4
      ef5217b3
    • Qiu Chaofan's avatar
      [Clang] Enable AIX initial-exec TLS mode · 880f39af
      Qiu Chaofan authored
      Reviewed By: shchenz
      
      Differential Revision: https://reviews.llvm.org/D156076
      880f39af
    • Nicolai Hähnle's avatar
      AMDGPU: Fix test from previous commit · 62790a8d
      Nicolai Hähnle authored
      62790a8d
    • Nicolai Hähnle's avatar
      AMDGPU: Precommit a test file · f5fb6ad2
      Nicolai Hähnle authored
      Demonstrates bad scheduling for private load/store vs. buffer
      intrinsics.
      f5fb6ad2
    • Fabian Mora's avatar
      [mlir][gpu] Fix option parsing in `TargetOptions` · e22f04b5
      Fabian Mora authored
      `TargetOptions` includes a field for passing additional command line options to
      the GPU compilation process. This field is typically used during the 'gpu-module-to-binary`
      pass:
      ```
      --gpu-module-to-binary=opts="-v -c"
      ```
      
      The problem is that `tokenizeCmdOptions` receives the quoted string, which produces an
      incorrect tokenization for `"-v -c"`. This patch removes quotes, fixing this issue.
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D159434
      e22f04b5
    • Amara Emerson's avatar
    • Slava Zakharin's avatar
      [flang][hlfir] Allow expanding realloc assignments with scalar RHS. · 09361b19
      Slava Zakharin authored
      F18 10.2.1.3 p. 3 states:
      If the variable is an unallocated allocatable array, expr shall have the same rank.
      
      So if LHS is an array and RHS is a scalar, then LHS must be allocated and
      the assignment is performed according to F18 10.2.1.3 p. 5:
      If expr is a scalar and the variable is an array,
      the expr is treated as if it were an array of the same shape as the
      variable with every element of the array equal to the scalar value of expr.
      
      This resolves performance regression in CPU2006/437.leslie3d caused
      by extra Assign runtime calls for ALLOCATABLE local arrays.
      Note that the extra calls do not add overhead themselves.
      The problem is that the descriptor for ALLOCATABLE is passed
      to Assign runtime function, and this messes up the points-to
      analysis.
      
      Example:
      ```
            ALLOCATABLE DUDX(:),DUDY(:),DUDZ(:)
      ...
            ALLOCATE( QS(IMAX-1),FSK(IMAX-1,0:KMAX,ND),
           >      QDIFFZ(IMAX-1), RMU(IMAX-1), EKCOEF(IMAX-1),
           >      DUDX(IMAX-1),DUDY(IMAX-1),DUDZ(IMAX-1),
      ...
            DUDZ=0D0
      ...
                     DO I = I1, I2
                        DUDZ(I) =
           >                  DZI * ABD * ((U(I,J,KBD) - U(I,J,KCD)) +
           >                       8.0D0 * (U(I,J, KK) - U(I,J,KBD))) * R6I
      ```
      
      When we are not lowering `DUDZ=0D0` to Assign call, the `base_addr` of
      `DUDZ`'s descriptor is a result of `malloc`, and LLVM is able to figure out
      that the accesses through this `base_addr` cannot overlap with accesses of,
      for exmaple, module (global) variable DZI. This enables CSE and LICM
      for the loop, eventually, resulting in clean vectorization.
      
      When `DUDZ`'s descriptor "escapes" to Assign runtime function,
      there are no guarantees about where `base_addr` can point to.
      I do not think this can be resolved by using any existing LLVM function/argument
      attributes. Maybe we will be able to communicate the no-aliasing information
      to LLVM using `Full Restrict Support` representation.
      
      For the purpose of enabling HLFIR by default, I am just aligning the IR
      with what we have with FIR lowering.
      
      Reviewed By: tblah
      
      Differential Revision: https://reviews.llvm.org/D159391
      09361b19
    • Kazu Hirata's avatar
      [TableGen] Modernize OverloadInfo (NFC) · dd27036f
      Kazu Hirata authored
      dd27036f
    • Kazu Hirata's avatar
    • Kazu Hirata's avatar
      [TableGen] Modernize GroupInfo (NFC) · 232d29ea
      Kazu Hirata authored
      232d29ea
    • Mehdi Amini's avatar
      Fix some mlir CODEOWNERS patterns from the initial release · 76a44747
      Mehdi Amini authored
      These are minor fixes from typos, duplications, etc.
      76a44747
    • Aiden Grossman's avatar
      [Github] Add llvm-exegesis PR subscribers team (#65199) · 404d3066
      Aiden Grossman authored
      This allows for recieving notifications related to the llvm-exegesis
      tool.
      404d3066
    • Egor Zhdan's avatar
      [APINotes] Upstream APINotesWriter · 8dc789a2
      Egor Zhdan authored
      This upstreams more of the Clang API Notes functionality that is
      currently implemented in the Apple fork:
      https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes
      8dc789a2
    • Mark de Wever's avatar
      [libc++][C++20 modules] Fixes CMake include paths. (#65079) · 10343c91
      Mark de Wever authored
      When the modules are used in a bootstrap build the paths
      ${LIBCXX_GENERATED_INCLUDE_DIR} and
      ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR} have a different value and both
      are needed to build modules.
      
      This issue has been reported on Slack.
      10343c91
    • Ivan Murashko's avatar
      [clangd] SIGSEGV at clangd: DiagnosticConsumer Is Used After Free · d03a7f15
      Ivan Murashko authored
      This is a follow-up patch for D148088. The dynamic symbol index (`FileIndex::updatePreamble`) may run in a separate thread, and the `DiagnosticConsumer` that is set up in `buildPreamble` might go out of scope before it is used. This could result in a SIGSEGV when attempting to call any method of the `DiagnosticConsumer` class.
      
      The function `buildPreamble` sets up the `DiagnosticConsumer` as follows:
      ```
      ... buildPreamble(...) {
      ...
        StoreDiags PreambleDiagnostics;
        ...
        llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
          CompilerInstance::createDiagnostics(&CI.getDiagnosticOpts(),
                                              &PreambleDiagnostics,
                                              /*ShouldOwnClient=*/false);
        ...
        // The call might use the diagnostic consumer in a separate thread
        PreambleCallback(...)
        ...
      }
      ```
      `PreambleDiagnostics` might be out of scope for `buildPreamble` function when we call it inside `PreambleCallback` in a separate thread.
      
      The Fix
      The fix involves replacing the client (DiagnosticConsumer) with an `IgnoringDiagConsumer` instance, which will print messages to the clangd log.
      
      Alternatively, we can replace `PreambleDiagnostics` with an object that is owned by `DiagnosticsEngine`.
      
      Note
      There is no corresponding LIT/GTest for this issue, since there is a specific race condition that is difficult to reproduce within a test framework.
      
      Test Plan:
      ```
      ninja check-clangd
      ```
      
      Reviewed By: kadircet, sammccall
      
      Differential Revision: https://reviews.llvm.org/D159363
      d03a7f15
    • Andrzej Warzynski's avatar
      [mlir][nfc] Make `vectorize_nd_extract` optional · 6ca4fe64
      Andrzej Warzynski authored
      Depends on: D157774
      
      Differential Revision: https://reviews.llvm.org/D159360
      6ca4fe64
    • Jay Foad's avatar
    • Jakub Kuderski's avatar
      [mlir][spirv] Add folds for `BitwiseAnd` and `BitwiseOr` · f1162fb6
      Jakub Kuderski authored
      The newly folded patterns get produced by type emulation code, so we
      cannot rely on the Arith folders handling these folds.
      
      Reviewed By: antiagainst
      
      Differential Revision: https://reviews.llvm.org/D159394
      f1162fb6
    • Craig Topper's avatar
      54d6e958
    • Markus Böck's avatar
      [mlir] Add helper method to print and parse cyclic attributes and types (#65210) · b121c266
      Markus Böck authored
      Printing cyclic attributes and types currently has no first-class
      support within the AsmPrinter and AsmParser. The workaround for this
      issue used in all mutable attributes and types upstream has been to
      create a `thread_local static SetVector` keeping track of currently
      parsed and printed attributes.
      
      This solution is not ideal readability wise due to the use of globals
      and keeping track of state. Worst of all, this pattern had to be
      reimplemented for every mutable attribute and type.
      
      This patch therefore adds support for this pattern in `AsmPrinter` and
      `AsmParser` replacing the use of this pattern. By calling
      `tryStartCyclingPrint/Parse`, the mutable attribute or type are
      registered in an internal stack. All subsequent calls to the function
      with the same attribute or type will lead to returning failure. This way
      the nesting can be detected and a short form printed or parsed instead.
      Through the resetter returned by the call, the cyclic printing or
      parsing region automatically ends on return.
      b121c266
    • Guray Ozen's avatar
      [MLIR] Run the TMA test for sm_90 · 8031a088
      Guray Ozen authored
      TMA was introduced to MLIR, however, it needed `ptxas` compiler. Recent work D154117 introduced that!
      
      This work runs the existing integration test.
      
      Reviewed By: fmorac
      
      Differential Revision: https://reviews.llvm.org/D159347
      8031a088
  2. Sep 04, 2023