1. Mar 27, 2024
    • Michael Jones's avatar
      [libc] Remove definition of LIBC_NAMESPACE in test (#86704) · 4c72cfa3
      Michael Jones authored
      The canonicalize test added in #85940 defined the LIBC_NAMESPACE macro.
      this macro is intended to be set only by the build system and never in
      the code.
      4c72cfa3
    • Bjorn Pettersson's avatar
      [X86] Pre-commit test case for bug in combineShiftRightArithmetic · 982ebeb2
      Bjorn Pettersson authored
      It has been noticed that combineShiftRightArithmetic isn't dealing
      properly with large shift amounts, as demonstrated by the test
      case added in this commit.
      
      I think the problem partly is related to X86 using i8 as shift amount
      type during ISel. So shift amount larger then 127 may be treated
      as negative shift amounts if not being careful.
      982ebeb2
    • Peter Klausler's avatar
      [flang] Dodge bogus GCC 13.2.0 error message in new code (#86708) · 8a845963
      Peter Klausler authored
      Rearrange some new code a little bit to avoid a bogus error message
      coming out from GCC 13.2.0 about an uninitialized data member in a
      parser.
      8a845963
    • Félix-Antoine Constantin's avatar
      [clang-tidy] Improved modernize-use-using by fixing a false-negative (#82947) · 8ea94b61
      Félix-Antoine Constantin authored
      The check needs a parent decl to match but if the typedef is in a
      function, the parent is a declStmt which is not a decl by itself.
      Improved the matcher to match on either a decl or a declstmt and extract
      the decl from the stmt in the latter case.
      
      Fixes #72179
      8ea94b61
    • Jonas Devlieghere's avatar
      [lldb] Implement coalescing of disjoint progress events (#84854) · 156c2907
      Jonas Devlieghere authored
      This implements coalescing of progress events using a timeout, as
      discussed in the RFC on Discourse [1]. This PR consists of two commits
      which, depending on the feedback, I may split up into two PRs. For now,
      I think it's easier to review this as a whole.
      
      1. The first commit introduces a new generic `Alarm` class. The class
      lets you to schedule a function (callback) to be executed after a given
      timeout expires. You can cancel and reset a callback before its
      corresponding timeout expires. It achieves this with the help of a
      worker thread that sleeps until the next timeout expires. The only
      guarantee it provides is that your function is called no sooner than the
      requested timeout. Because the callback is called directly from the
      worker thread, a long running callback could potentially block the
      worker thread. I intentionally kept the implementation as simple as
      possible while addressing the needs for the `ProgressManager` use case.
      If we want to rely on this somewhere else, we can reassess whether we
      need to address those limitations.
      
      2. The second commit uses the Alarm class to coalesce progress events.
      To recap the Discourse discussion, when multiple progress events with
      the same title execute in close succession, they get broadcast as one to
      `eBroadcastBitProgressCategory`. The `ProgressManager` keeps track of
      the in-flight progress events and when the refcount hits zero, the Alarm
      class is used to schedule broadcasting the event. If a new progress
      event comes in before the alarm fires, the alarm is reset (and the
      process repeats when the new progress event ends). If no new event comes
      in before the timeout expires, the progress event is broadcast.
      
      [1]
      https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717/
      156c2907
    • Piotr Zegar's avatar
      [clang-tidy] Improve performance of google-runtime-int (#86596) · 5e6e40fe
      Piotr Zegar authored
      Main problem with performance of this check is caused by hasAncestor
      matcher, and to be more precise by an llvm::DenseSet and std::deque in
      matchesAnyAncestorOf.
      
      To reduce impact of this matcher, multiple conditions that were checked
      in check method were copied into AST matcher that is now checked before
      hasAncestor.
      
      Using custom getCheckTraversalKind to exclude template instances that
      shouldn't be checked anyway is an additional improvement, but gain from
      that one is low.
      
      Tested on ffl_tests.cc, visible reduction from ~442 seconds to ~15
      seconds (~96% reduction).
      
      Closes #86553
      5e6e40fe
    • Chris B's avatar
      [NFC] Refactor ConstantArrayType size storage (#85716) · 28ddbd4a
      Chris B authored
      In PR #79382, I need to add a new type that derives from
      ConstantArrayType. This means that ConstantArrayType can no longer use
      `llvm::TrailingObjects` to store the trailing optional Expr*.
      
      This change refactors ConstantArrayType to store a 60-bit integer and
      4-bits for the integer size in bytes. This replaces the APInt field
      previously in the type but preserves enough information to recreate it
      where needed.
      
      To reduce the number of places where the APInt is re-constructed I've
      also added some helper methods to the ConstantArrayType to allow some
      common use cases that operate on either the stored small integer or the
      APInt as appropriate.
      
      Resolves #85124.
      28ddbd4a
    • Emil Pedersen's avatar
      [DebugInfo] [SelectionDAG] Fix handling of duplicate dbg values (#86598) · 0e5c504d
      Emil Pedersen authored
      Before this fix, a duplicate llvm.dbg.value intrinsic referring to an
      argument, after an alloca, would be generated with `$noreg`, losing
      debug information. Instead, we silently drop the second debug info, so
      it doesn't break the first one.
      
      rdar://125375717
      0e5c504d
    • Karthika Devi C's avatar
      [polly] Add polly-debug flag to print debug info from all parts of polly (#78549) · 601d7eab
      Karthika Devi C authored
      This flag enable the user to print debug Info from all the passes and
      helpers inside polly at once. This will help a novice user as well to
      work in polly without explicitly having to know which parts of polly has
      actually kicked in and pass them via -debug-only.
      601d7eab
    • Krzysztof Parzyszek's avatar
      [flang][OpenMP] Make OpenMP clause representation language-agnostic (#86289) · 148a5579
      Krzysztof Parzyszek authored
      The clause templates defined in ClauseT.h were originally based on
      flang's parse tree nodes. Since those representations are going to be
      reused for clang (together with the clause splitting code), it makes
      sense to separate them from flang, and instead have them based on the
      actual OpenMP spec (v5.2).
      
      The member names in the templates follow the naming presented in the
      spec, and the representation (e.g. members) is derived from the clause
      definitions as described in the spec.
      
      Since the representations of some clauses has changed (while preserving
      the information), the current code using the clauses (especially the
      code converting parser::OmpClause to omp::Clause) needs to be adjusted.
      
      This patch does not make any functional changes.
      148a5579
    • Craig Topper's avatar
      [RISCV] Split compound if statement to fix a crash. · 2fbc40d3
      Craig Topper authored
      We're not allowed to call getELEN when the vector extension
      is not enabled. If we're looking at a vector type, isTypeLegal would
      only return true if the vector extensions are enabled. So early out
      for non-vector types before we call isTypeLegal and getELEN.
      2fbc40d3
    • Alex Zinenko's avatar
    • Noah Goldstein's avatar
      [IR] Add `m_c_BitwiseLogic` in pattern match; NFC · 8edb12fe
      Noah Goldstein authored
      Just a missing matcher that came up in #73362
      
      Closes #86632
      8edb12fe
    • Simon Pilgrim's avatar
    • Alexey Bataev's avatar
      [SLP]Fix PR86620: check final minbitwidth for truncs/exts before · 342f7d0d
      Alexey Bataev authored
      accepting it.
      
      If the minbitwidth is deduced from the demanded elements, need to check
      the final bitwidthfor trunc/ext instruction, bot blindly accepting
      the used one.
      342f7d0d
    • Alexey Bataev's avatar
      [SLP][NFC]Add a test with truncated loads, but incorrect trunc after · 1ad29a5c
      Alexey Bataev authored
      minbitwidth analysis.
      1ad29a5c
    • Ella Ma's avatar
      [analyzer] Allow egraph rewriter not to open the generated HTML directly (#85515) · 0c3e24f7
      Ella Ma authored
      When developing on a headless device through SSH, we do not have a
      browser or even an X environment. Hence, it would be more convenient if
      the rewriter could stop before attempting to open the generated HTML
      file. Then, it can be opened remotely through an HTML server.
      
      This patch adds a new option `--dump-html-only` to make the rewriter
      stop before opening the generated HTML in a browser. The new option is
      marked in conflict with the existing `--dump-dot-only` option to prevent
      unexpected behaviors.
      0c3e24f7
    • Jason Molenda's avatar
      [lldb] Remove test for add-symbol-file adds unwind source · 29318abe
      Jason Molenda authored
      In
      
      commit 2f63718f
      Author: Jason Molenda <jmolenda@apple.com>
      Date:   Tue Mar 26 09:07:15 2024 -0700
      
          [lldb] Don't clear a Module's UnwindTable when adding a SymbolFile (#86603)
      
      I changed lldb to not clear a Module's UnwindTable when we add a
      SymbolFile to a binary, because the added benefit is marginal, and
      handling this reconstruction correctly is difficult.  This test was
      written to explicitly create a test without unwind info in the
      binary, then add a symbol file with the unwind info, and check that
      it is present.  I've intentionally broken this, so I'm removing the
      test.
      29318abe
    • Thorsten Schütt's avatar
      [CodeGen] Add nneg and disjoint flags (#86650) · da6cc4a2
      Thorsten Schütt authored
      MachineInstr learned the new flags.
      da6cc4a2
    • Kazu Hirata's avatar
      [ArithToSPIRV] Fix a warning (#86702) · d0e97fe3
      Kazu Hirata authored
      mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp:995:11: error:
        unused variable 'converter' [-Werror,-Wunused-variable]
      d0e97fe3
    • Craig Topper's avatar
      [RISCV] Remove unneeded VAESKF_MV_I tablegen class. NFC · 8cb4eb99
      Craig Topper authored
      It is identical to PALUVINoVm so we can use that instead.
      8cb4eb99
    • Kazu Hirata's avatar
      [TosaToTensor] Fix a warning (#86703) · 1eaef445
      Kazu Hirata authored
      This patch fixes:
      
        mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp:76:46: error:
        'multiplies' may not intend to support class template argument
        deduction [-Werror,-Wctad-maybe-unsupported]
      1eaef445
    • Alexey Bataev's avatar
      [SLP]Do not propagate nuw/nsw flags for alt nodes, affected by · 26dd1287
      Alexey Bataev authored
      minbitwidth analysis.
      
      Need to drop nuw/nsw flags, if the alternate node is resized after the
      minbitwidth analysis, to avoid producing poison values in corner cases.
      26dd1287
    • Piotr Zegar's avatar
      [clang-tidy] Fix fix-it overlaps in readability-static-definition-in-anonymous-namespace (#86599) · 31373479
      Piotr Zegar authored
      Because check emitted multiple warnings for every template instance
      fix-it couldn't be applied due to overlaps.
      
      Using TK_IgnoreUnlessSpelledInSource and restricting check to C++ only.
      31373479
    • Peter Klausler's avatar
      [flang] Catch impossible but necessary TBP override (#86558) · f4fc959c
      Peter Klausler authored
      An apparent attempt to override a type-bound procedure is not allowed to
      be interpreted as on override when the procedure is PRIVATE and the
      override attempt appears in another module. However, if the TBP that
      would have been overridden is a DEFERRED procedure in an abstract base
      type, the override must take place. PRIVATE DEFERRED procedures must
      therefore have all of their overrides appear in the same module as the
      abstract base type.
      f4fc959c
    • Ivan Butygin's avatar
      [mlir][spirv] Remove `enableFastMathMode` flag from SPIR-V conversion (#86578) · f050a098
      Ivan Butygin authored
      Most of arith/math ops support fastmath attribute, use it instead of
      global flag.
      f050a098
    • smanna12's avatar
      [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (#85962) · 4c4ea249
      smanna12 authored
      Reported by Static Analyzer Tool:
      In clang::dataflow::Environment::initialize(): Using the auto keyword
      without an & causes the copy of an object of type LambdaCapture
      4c4ea249
    • Jonas Hahnfeld's avatar
      [unittests] Fix `TableGenTests` with `LLVM_LINK_LLVM_DYLIB` (#86664) · 81fc43a3
      Jonas Hahnfeld authored
      Since the restructuring in commit fa3d789d, the option
      DISABLE_LLVM_LINK_LLVM_DYLIB is counter-productive and leads to
      CommandLine Error: Option 'debug-counter' registered more than once!
      81fc43a3
    • Peter Klausler's avatar
      [flang][NFC] Address reported "possible missing return" (#86523) · f92f7752
      Peter Klausler authored
      A function uses "if constexpr" to consider all possible types in a
      variant, but looks as if it can fall out without returning an
      expression. Add a final "else" with a crash to make things more clear
      and to protect against unlikely future extensions of the type.
      
      Fixes https://github.com/llvm/llvm-project/issues/86391.
      f92f7752
    • Andrzej Warzyński's avatar
      [mlir][vector] Refactor linearize.mlir (#86648) · bf4fc00b
      Andrzej Warzyński authored
      This patch refactors the `linearize.mlir` test - currently it contains
      some duplication and can be tricky to follow.
      
      Summary of changes:
        * reduce duplication by introducing a shared check prefix (`ALL`) and
          by introducing `-check-prefixes`,
        * make sure that every "check" line is directly above the
          corresponding line of input MLIR,
        * group check lines corresponding to a particular prefix together (so
          that it's easier to see the expected output for a particular
          prefix),
        * remove `CHECK` from prefix names (with multiple prefixes that's just
          noise that can be avoided) and use a bit more descriptive prefixes
          instead (`CHECK0` -> `BW-0`, where `BW` stands for bitwidth),
        * unify indentation,
        * `nonvec_result` -> `test_tensor_no_linearize` (for consistency with
          `test_index_no_linearize`).
      
      NOTE: This change only updates the format of the "CHECK" lines and
      doesn't affect what's being tested.
      
      This change is intended as preparation for adding support for scalable
      vectors to `LinearizeConstant` and `LinearizeVectorizable` - i.e.
      patterns that `linearlize.mlir` is meant to test.
      bf4fc00b
    • Craig Topper's avatar
    • Peter Klausler's avatar
      [flang] Special-case handling of INTRINSIC in type-decl-stmt (#86518) · 8f01ecae
      Peter Klausler authored
      Fortran allows the INTRINSIC attribute to be specified with a distinct
      attribute statement, and also as part of the attribute list of a
      type-declaration-stmt. This is an odd case (especially as the declared
      type is mandated to be ignored if it doesn't match the type of the
      intrinsic function) that can lead to odd error messages and crashes,
      since the rest of name resolution expects that intrinsics with explicit
      declarations will have been declared with INTRINSIC attribute
      statements. Resolve by handling an "inline" INTRINSIC attribute as a
      special case while processing a type-declaration-stmt, so that
      
        real, intrinsic :: acos, asin, atan
      
      is processed exactly as if it had been
      
        intrinsic acos, asin, atan; real acos, asin, atan
      
      Fixes https://github.com/llvm/llvm-project/issues/86382.
      8f01ecae
    • smanna12's avatar
      [NFC][Clang] Fix potential dereferencing of nullptr (#85944) · e75989e9
      smanna12 authored
      This patch replaces getAs<> with castAs<> to resolve potential static
      analyzer bugs for
      
      1. Dereferencing a pointer issue with nullptr FPT when calling
      ResolveExceptionSpec() in
          checkEscapingByref(clang::VarDecl *, clang::Sema &).
      
      3. Dereferencing a pointer issue with nullptr ElementTy->getAs() when
      calling getElementType() in
      clang::Sema::SemaBuiltinFPClassification(clang::CallExpr *, unsigned
      int).
      
      4. Dereferencing a pointer issue with nullptr ConvType->getAs() when
      calling getKeyword() in
      clang::Sema::ActOnConversionDeclarator(clang::CXXConversionDecl *).
      e75989e9
    • Slava Zakharin's avatar
      [flang][runtime] Use cuda::std::variant in the CUDA build. (#86615) · 7860f970
      Slava Zakharin authored
      Added `FLANG_LIBCUDACXX_PATH` CMake variable to specify
      installation of header-only libcudacxx library.
      If it is specified, the `<cuda/std/variant>` is used to provide
      implementation of `std::variant`.
      7860f970
    • Farzon Lotfi's avatar
      [DXIL] Implement log intrinsic Lowering (#86569) · 5cf1e2e2
      Farzon Lotfi authored
      Completes #86192
      `DXIL.td` - add log2 to dxilop lowering
      `DXILIntrinsicExpansion.cpp` - add log and log10 to log2 expansions
      5cf1e2e2
    • Zahira Ammarguellat's avatar
    • Peter Klausler's avatar
      [flang] Catch non-constant targets for procedure pointer initialization (#86338) · 5a0382ce
      Peter Klausler authored
      Detect attempts to use non-constant targets, including internal
      procedures, as initializers for procedure pointers, including components
      of structure components being used as initializers.
      5a0382ce
    • Peter Klausler's avatar
      [flang][runtime] Runtime support for REDUCE() (#86214) · 3ada883f
      Peter Klausler authored
      Supports the REDUCE() transformational intrinsic function of Fortran
      (see F'2023 16.9.173) in a manner similar to the existing support for
      SUM(), PRODUCT(), &c. There are APIs for total reductions to scalar
      results, and APIs for partial reductions that reduce the rank of the
      argument by one.
      
      This implementation requires more functions than other reductions
      because the various possible types of the user-supplied OPERATION=
      function need to be elaborated.
      
      Once the basic API in reduce.h has been approved, later patches will
      implement lowering.
      
      REDUCE() is primarily for completeness, not portability; only one other
      Fortran compiler implements this F'2018 feature today, and only some
      types work correctly with it.
      3ada883f
    • Simon Pilgrim's avatar
      c8b85add
    • Simon Pilgrim's avatar
      [X86] extractelement-load.ll - use X86 instead of X32 check prefix. NFC · 3140d138
      Simon Pilgrim authored
      X32 should be used for gnux32 triples
      3140d138