1. Feb 23, 2024
    • Michael Maitland's avatar
      [RISCV][NFC] Allow SchedVar to be a def inside our scheduler model files. (#82634) · be083dba
      Michael Maitland authored
      All SchedModel files have a line that looks like:
      
      ```
      def SomeModel : SchedMachineModel;
      let SchedModel = SomeModel in {
        ...
      }
      ```
      
      TableGen requires that all records defined within the top level `let`
      must have a field `SchedModel` somewhere in their nested record
      hierarchy (i.e. the record has a field `SchedModel : SchedMachineModel`
      or recursively, one of its members has a field `SchedModel :
      SchedMachineModel`).
      
      Classes such as `SchedPredicate` have added a field `SchedModel :
      SchedMachineModel`, even though the field is never used, just to supress
      **errors** (not warnings) caused from having the top level let in the
      model files. This decision was made to avoid having hundreds of the same
      `let` statement littered in every scheduler model file.
      
      The reason we have never seen an error for `SchedVar` before is because
      `SchedVar` is never instantiated with a `def`. Instead, it is only
      created as a value that is consumed by `SchedWriteVariant`:
      
      ```
      ... : SchedWriteVariant<[SchedVar<...>, SchedVar<...>]>;
      ```
      
      There is a problem with this style of instantiation. In particular, the
      problem arises as we try to take a class based approach to building
      scheduler models. I will describe the problem from the bottom up.
      
      The `LMULWriteResMXVariant` multiclass takes in a `SchedPredicateBase
      Pred`. Today, the RISCVSchedSiFive7.td file defines `VLDSX0Pred` outside
      the scope of any class. That means that `VLDSX0Pred` exists before
      `LMULWriteResMXVariant` multiclass is instantiated. With this approach,
      there is no error since the predicate is instantated in entirety before
      the variant multiclass is instantiated. However, I have the intention to
      move the definition of both the predicate and the variant multiclass
      records inside a multiclass to factor out common parts between multiple
      scheduler models.
      
      I plan to have something like:
      
      ```
      multiclass SiFive7Base<SiFive7BaseConfig c> {
        def VLDSX0Pred : ...;
        // Need defvar since record is prefixed with NAME.
        defvar VLDSX0Pred = !cast<...>(NAME # VLDSX0Pred);
        defm SiFive7 : LMULWriteResMXVariant<VLDSX0Pred>;
      }
      
      defm "SiFive7Version1" : SiFive7Base<SiFive7BaseConfig<...>>;
      defm "SiFive7Version2" : SiFive7Base<SiFive7BaseConfig<...>>;
      ```
      
      In this scheme, VLDSX0Pred is defined within the same multiclass
      transaction that the `LMULWriteResMXVariant` is defined in. For some
      reason, TableGen does not allow `Values` to reference records that were
      created in the same parent record construction. If the `SchedVar` is not
      a `def`, then it will not be able to find the record `NAME #
      VLDSX0Pred`. Making it a def, allows TableGen to find `NAME #
      VLDSX0Pred` in scope.
      
      The simplest example of this is:
      
      ```
      class A {}
      class B<A a> { A x = a;}
      class C<B b> { B y = b;}
      multiclass D {
        def MyA : A;
        defvar aa = !cast<A>(NAME # MyA);
        // This works
        def : B<aa>;
        // This does not work because constructing B by value cannot find `NAME # MyA`
        // error: Undefined reference to record: 'MyA'
        def : C<B<aa>>;
        // To fix it, define it like such:
        def MyB : B<aa>;
        defvar bb = !cast<B>(NAME # MyB);
        def : C<bb>;
      }
      defm "" : D;
      ```
      
      In summary, in order to use a class based approach to creating scheduler
      resources to promote resusability, `SchedVar`s must be created using
      defs instead of being instantiated by value so that it can resolve
      records that were part of the instantiation of the parent record being
      created. In order to do this without refactoring the top level `let`
      statement that all scheduler model files use, we add an unused field
      `SchedModel : SchedMachineModel` to `SchedVar`, similiar to what has
      been done in `SchedPredicate`.
      be083dba
    • Benoît Amiaux's avatar
      build_llvm_release.bat: add tarball export to x64 release (#79840) · 52ada07e
      Benoît Amiaux authored
      Like linux releases, export a tar.xz files containing most llvm tools,
      including non toolchain utilities, llvm-config, llvm-link and others.
      
      We do this by reconfiguring cmake one last time at the last step,
      running the install target so we do not need to recompile anything.
      
      Fix #51192
      Fix #53052
      52ada07e
    • Orlando Cazalet-Hyams's avatar
      [RemoveDIs] Enable DPLabels conversion [3b/3] (#82639) · 71d47a0b
      Orlando Cazalet-Hyams authored
      Enables conversion between llvm.dbg.label and DPLabel.
      71d47a0b
    • hev's avatar
      c747b242
    • Joseph Huber's avatar
      [LLVM] Fix incorrect GPU triple detection for runtimes builds · b8a7d813
      Joseph Huber authored
      Summary:
      This block of code is used to prevent a GPU-based cross compiling build
      from taking incompatible arguments. However this incorrectly used the
      LLVM default triple instead of the runtimes target. Fix that so the bots
      can continue to default the triple to NVPTX.
      b8a7d813
    • Matthias Springer's avatar
      [mlir] Fix memory leaks after #81759 (#82762) · 492e8ba0
      Matthias Springer authored
      This commit fixes memory leaks that were introduced by #81759. The way
      ops and blocks are erased changed slightly.
      
      The leaks were caused by an incorrect implementation of op builders:
      blocks must be created with the supplied builder object. Otherwise, they
      are not properly tracked by the dialect conversion and can leak during
      rollback.
      492e8ba0
    • Timm Bäder's avatar
      [clang][Interp] Don't return success for already failed global variables · ad49fe3e
      Timm Bäder authored
      We might be visiting them more than once. We used to return true for
      second and subsequent cases, just because we had already visited it
      before.
      ad49fe3e
    • Abhina Sree's avatar
      [libcxx][test] Change UNSUPPORTED to XFAIL for target-related failures (#81513) · 1197fcab
      Abhina Sree authored
      This is a followup from this discussion
      https://github.com/llvm/llvm-project/pull/80735#discussion_r1486586017
      to mark targets that were initially marked as UNSUPPORTED with an XFAIL
      instead.
      1197fcab
    • Yingwei Zheng's avatar
      [ValueTracking] Handle more integer intrinsics in `propagatesPoison` (#82749) · 3b70387c
      Yingwei Zheng authored
      This patch extends `propagatesPoison` to handle more integer intrinsics.
      It will turn more logical ands/ors into bitwise ands/ors.
      
      See also https://reviews.llvm.org/D99671.
      3b70387c
    • tsitdikov's avatar
      Users/tsitdikov (#82757) · e09e0d52
      tsitdikov authored
      Fix Test ARM SME library and build rule.
      e09e0d52
    • r4nt's avatar
      [ClangFormat] Fix indent in child lines within a macro argument. (#82523) · ddb4450a
      r4nt authored
      When reconstructing lines from a macro expansion, make sure that lines
      at different levels in the expanded code get indented correctly as part
      of the macro argument.
      ddb4450a
    • Johannes Reifferscheid's avatar
      [MLIR] Expose approximation patterns for tanh/erf. (#82750) · bcf9826a
      Johannes Reifferscheid authored
      These patterns can already be used via
      populateMathPolynomialApproximationPatterns, but that includes a number
      of other patterns that may not be needed.
      
      There are already similar functions for expansion.
      
      For now only adding tanh and erf since I have a concrete use case for
      these two.
      bcf9826a
    • Sander de Smalen's avatar
      [Clang] Fix acle_sme_zero.c once more. · 3b3d0978
      Sander de Smalen authored
      3b3d0978
    • Garvit Gupta's avatar
      [RISCV] Disable generation of asynchronous unwind tables for RISCV baremetal (#81727) · f1e0392b
      Garvit Gupta authored
      The below culprit patch enabled the generation of asynchronous unwind
      tables (-funwind-tables=2) by default for RISCV for both linux and
      RISCVToolChain baremetal object. However, since there are 2 baremetal
      toolchain objects for RISCV, this created a discrepancy between their
      behavior. Moreover, enabling the generation of asynchronous unwind
      tables based on whether `-gcc-toolchain` option is present or not
      doesn't seem to be the best criteria to decide on the same. This patch
      make the behavior consistent by disabling the unwind tables in
      RISCVToolChain Baremetal object.
      
      Culprit Patch - https://reviews.llvm.org/D145164
      f1e0392b
    • tsitdikov's avatar
      Add TestArmSME dependency to mlir-opt library. · 6ac2c048
      tsitdikov authored
      TestArmSME was added in https://github.com/llvm/llvm-project/commit/e1326434742980b03433464dd9435ea66ad5be47, now we need to add dependency on it.
      6ac2c048
    • Markus Böck's avatar
      [mlir][NFC] Fix format specifier warning on Windows · d9e4309b
      Markus Böck authored
      `%ld` specifier is defined to work on values of type `long`. The parameter given to `fprintf` is of type `intptr_t` whose actual underlying integer type is unspecified. On Unix systems it happens to commonly be `long` but on 64-bit Windows it is defined as `long long`.
      
      The cross-platform way to print a `intptr_t` is to use `PRIdPTR` which expands to the correct format specifier for `intptr_t`. This avoids any undefined behaviour and compiler warnings.
      d9e4309b
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Fix encoding of VOP3P dpp on GFX11 and GFX12 (#82710) · 3dfca24d
      Stanislav Mekhanoshin authored
      The bug affects dpp forms of v_dot2_f32_f16. The encoding does not match
      SP3 and does not set op_sel_hi bits properly.
      3dfca24d
    • tsitdikov's avatar
      Add build rule for MLIRArmSMETestPasses · e1326434
      tsitdikov authored
      MLIRArmSMETestPasses was added in https://github.com/llvm/llvm-project/commit/b39f5660a408b47307e57a0882eb8af85d72e283, we need to add a build rule for it as well.
      e1326434
    • Sander de Smalen's avatar
      [Clang] Fix acle_sme_zero.c (missing aarch64-registered-target) · cdf19d13
      Sander de Smalen authored
      This test was added in #82648
      cdf19d13
    • Orlando Cazalet-Hyams's avatar
      [RemoveDIs] Add DPLabels support [3a/3] (#82633) · 8a164220
      Orlando Cazalet-Hyams authored
      Patch 2 of 3 to add llvm.dbg.label support to the RemoveDIs project. The
      patch stack adds the DPLabel class, which is the RemoveDIs llvm.dbg.label
      equivalent.
      
         1. Add DbgRecord base class for DPValue and the not-yet-added
             DPLabel class.
         2. Add the DPLabel class.
      -> 3. Add support to passes.
      
      The next patch, #82639, will enable conversion between dbg.labels and DPLabels.
      
      AssignemntTrackingAnalysis support could have gone two ways:
      
      1. Have the analysis store a DPLabel representation in its results -
         SelectionDAGBuilder reads the analysis results and ignores all DbgRecord
         kinds.
      2. Ignore DPLabels in the analysis - SelectionDAGBuilder reads the analysis
         results but still needs to iterate over DPLabels from the IR.
      
      I went with option 2 because it's less work and is no less correct than 1. It's
      worth noting that causes labels to sink to the bottom of packs of debug records.
      e.g., [value, label, value] becomes [value, value, label]. This shouldn't be a
      problem because labels and variable locations don't have an ordering requirement.
      The ordering between variable locations is maintained and the label movement is
      deterministic
      8a164220
    • Sander de Smalen's avatar
    • Sander de Smalen's avatar
      [Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. (#82648) · 22734e15
      Sander de Smalen authored
      We previously defined svzero_za as:
      
        void svzero_za();
      
      rather than:
      
        void svzero_za(void);
      
      Which meant that Clang accepted arguments. Compiling for example
      `svzero_za(<non-constant integer>)` ended up with incorrect IR and a
      compiler crash because it couldn't select an instruction for it.
      22734e15
    • Evgenii Kudriashov's avatar
      [GlobalISel] Fix a check that aligned tail call is lowered (#82016) · 790bcecc
      Evgenii Kudriashov authored
      Despite of a valid tail call opportunity, backends still may not
      generate a tail call or such lowering is not implemented yet.
      
      Check that lowering has happened instead of its possibility when
      generating G_ASSERT_ALIGN.
      790bcecc
    • Benjamin Kramer's avatar
      Remove duplicated REQUIRES: asserts · e7c60915
      Benjamin Kramer authored
      e7c60915
    • Timm Bäder's avatar
    • Matthias Springer's avatar
      [mlir][Transforms][NFC] Decouple `ConversionPatternRewriterImpl` from... · 7bb08ee8
      Matthias Springer authored
      [mlir][Transforms][NFC] Decouple `ConversionPatternRewriterImpl` from `ConversionPatternRewriter` (#82333)
      
      `ConversionPatternRewriterImpl` no longer maintains a reference to the
      respective `ConversionPatternRewriter`. An `MLIRContext` is sufficient.
      This commit simplifies the internal state of
      `ConversionPatternRewriterImpl`.
      7bb08ee8
    • kadir çetinkaya's avatar
    • Daniel Krupp's avatar
      [analyzer] Fix core.VLASize checker false positive taint reports (#68140) · de04b7d4
      Daniel Krupp authored
      The checker reported a false positive on this code 
      
      void testTaintedSanitizedVLASize(void) {
        int x;
        scanf("%d", &x);
        if (x<1)
          return;
        int vla[x]; // no-warning
      }
      
      After the fix, the checker only emits tainted warning if the vla size is
      coming from a tainted source and it cannot prove that it is positive.
      de04b7d4
    • Kadir Cetinkaya's avatar
      4419b2c2
    • kadir çetinkaya's avatar
      Reland "[clang] Preserve found-decl when constructing VarTemplateIds" (#82612) · 5cb2ebc0
      kadir çetinkaya authored
      Update include-cleaner tests. Now that we have proper found-decls set up
      for VarTemplates, in case of instationtations we point to primary
      templates and not specializations. To be changed in a follow-up patch.
      5cb2ebc0
    • Matthias Springer's avatar
      [mlir][Transforms] Encapsulate dialect conversion options in `ConversionConfig` (#82250) · 5f1319bb
      Matthias Springer authored
      This commit adds a new `ConversionConfig` struct that allows users to
      customize the dialect conversion. This configuration is similar to
      `GreedyRewriteConfig` for the greedy pattern rewrite driver.
      
      A few existing options are moved to this objects, simplifying the
      dialect conversion API.
      5f1319bb
    • Timm Bäder's avatar
      [clang][Interp] Don't diagnose alread invalid function decls · 13acb3af
      Timm Bäder authored
      They have already been diagnosed before. Also improve that test case.
      13acb3af
    • Benjamin Maxwell's avatar
      [mlir][math] Propagate scalability in `convert-math-to-llvm` (#82635) · 78890904
      Benjamin Maxwell authored
      This also generally increases the coverage of scalable vector types in
      the math-to-llvm tests.
      78890904
    • Cullen Rhodes's avatar
      [mlir][ArmSME] Add test-lower-to-arm-sme pipeline (#81732) · b39f5660
      Cullen Rhodes authored
      The ArmSME compilation pipeline has evolved significantly and is now
      sufficiently complex enough that it warrants a proper lowering pipeline
      that encapsulates the various passes and orderings. Currently the
      pipeline is loosely defined in our integration tests, but these have
      diverged and are not using the same passes or ordering everywhere.
      
      This patch introduces a test-lower-to-arm-sme pipeline mirroring
      test-lower-to-llvm that provides some sanity when running e2e examples
      and can be used a reference for targeting ArmSME in MLIR.
      
      All the integration tests are updated to use this pipeline. The
      intention is to productize the pipeline once it becomes more mature.
      b39f5660
    • Matthias Springer's avatar
      [mlir][Transforms] Make `ConversionPatternRewriter` constructor private (#82244) · a622b21f
      Matthias Springer authored
      `ConversionPatternRewriter` objects should not be constructed outside of
      dialect conversions. Some IR modifications performed through a
      `ConversionPatternRewriter` are reflected in the IR in a delayed fashion
      (e.g., only when the dialect conversion is guaranteed to succeed). Using
      a `ConversionPatternRewriter` outside of the dialect conversion is
      incorrect API usage and can bring the IR in an inconsistent state.
      
      Migration guide: Use `IRRewriter` instead of
      `ConversionPatternRewriter`.
      a622b21f
    • Tobias Gysi's avatar
      [MLIR][LLVM] Fix debug intrinsic import (#82637) · 335d34d9
      Tobias Gysi authored
      This revision handles the case that the translation of a scope fails due
      to cyclic metadata. This mainly affects the import of debug intrinsics
      that indirectly take such a scope as metadata argument (e.g. via local
      variable or label metadata). This commit ensures we drop intrinsics with
      such a dependency on cyclic metadata.
      335d34d9
    • Paschalis Mpeis's avatar
      [AArch64][CostModel] Improve scalar frem cost (#80423) · bbdc62e7
      Paschalis Mpeis authored
      In AArch64 the cost of scalar frem is the cost of a call to 'fmod'.
      bbdc62e7
    • Pierre van Houtryve's avatar
      [ARM][GlobalISel] Remove legacy legalizer rules (#82619) · 2ae8bee8
      Pierre van Houtryve authored
      I've been looking at LegacyLegalizerInfo and what its place in GISel is.
      It seems like it's very close to being deleted so I'm checking if we can
      remove the last remaining uses of it.
      
      Looks like we can do a drop-in replacement with the new legalizer for
      ARM.
      2ae8bee8
    • Daniel Kiss's avatar
    • Matthias Springer's avatar
      [mlir][Transforms][NFC] Turn unresolved materializations into `IRRewrite`s (#81761) · 59ff4d13
      Matthias Springer authored
      This commit is a refactoring of the dialect conversion. The dialect
      conversion maintains a list of "IR rewrites" that can be committed (upon
      success) or rolled back (upon failure).
      
      This commit turns the creation of unresolved materializations
      (`unrealized_conversion_cast`) into `IRRewrite` objects. After this
      commit, all steps in `applyRewrites` and `discardRewrites` are calls to
      `IRRewrite::commit` and `IRRewrite::rollback`.
      59ff4d13