1. Jul 28, 2021
  2. Jul 27, 2021
    • Stella Laurenzo's avatar
      Re-engineer MLIR python build support. · 310c9496
      Stella Laurenzo authored
      * Implements all of the discussed features:
        - Links against common CAPI libraries that are self contained.
        - Stops using the 'python/' directory at the root for everything, opening the namespace up for multiple projects to embed the MLIR python API.
        - Separates declaration of sources (py and C++) needed to build the extension from building, allowing external projects to build custom assemblies from core parts of the API.
        - Makes the core python API relocatable (i.e. it could be embedded as something like 'npcomp.ir', 'npcomp.dialects', etc). Still a bit more to do to make it truly isolated but the main structural reset is done.
        - When building statically, installed python packages are completely self contained, suitable for direct setup and upload to PyPi, et al.
        - Lets external projects assemble their own CAPI common runtime library that all extensions use. No more possibilities for TypeID issues.
        - Begins modularizing the API so that external projects that just include a piece pay only for what they use.
      * I also rolled in a re-organization of the native libraries that matches how I was packaging these out of tree and is a better layering (i.e. all libraries go into a nested _mlir_libs package). There is some further cleanup that I resisted since it would have required source changes that I'd rather do in a followup once everything stabilizes.
      * Note that I made a somewhat odd choice in choosing to recompile all extensions for each project they are included into (as opposed to compiling once and just linking). While not leveraged yet, this will let us set definitions controlling the namespacing of the extensions so that they can be made to not conflict across projects (with preprocessor definitions).
      * This will be a relatively substantial breaking change for downstreams. I will handle the npcomp migration and will coordinate with the circt folks before landing. We should stage this and make sure it isn't causing problems before landing.
      * Fixed a couple of absolute imports that were causing issues.
      
      Differential Revision: https://reviews.llvm.org/D106520
      310c9496
    • Aart Bik's avatar
      [mlir][sparse] fixed bug in verification · c2415d67
      Aart Bik authored
      The order of testing in two sparse tensor ops was incorrect,
      which could cause an invalid cast (crashing the compiler instead
      of reporting the error). This revision fixes that bug.
      
      Reviewed By: gussmith23
      
      Differential Revision: https://reviews.llvm.org/D106841
      c2415d67
    • Matt Arsenault's avatar
      AMDGPU: Treat IMPLICIT_DEF like a constant lanemask source · b32d3d9e
      Matt Arsenault authored
      This is partially a workaround. SILowerI1Copies does not understand
      unstructured loops. This would result in inserting instructions to
      merge a mask register in the same block where it was defined in an
      unstructured loop.
      b32d3d9e
    • Thomas Lively's avatar
      [WebAssembly] Codegen for extmul SIMD instructions · 33786576
      Thomas Lively authored
      Replace the clang builtins and LLVM intrinsics for the SIMD extmul instructions
      with normal codegen patterns.
      
      Differential Revision: https://reviews.llvm.org/D106724
      33786576
    • Riccardo Mori's avatar
      Update isl to isl-0.24-69-g54aac5ac · ec3da1a4
      Riccardo Mori authored
      This is needed for having the functions isl_{set,map}_n_basic_{set,map}
      exported to the C++ interface.
      Some tests have been modified to reflect the isl changes.
      ec3da1a4
    • Anastasia Stulova's avatar
      [OpenCL] NULL redefined as nullptr in C++ mode. · e5f47eed
      Anastasia Stulova authored
      Redefines NULL as nullptr instead of ((void*)0)
      in C++ for OpenCL.
      
      Such internal representation of NULL provides
      compatibility with C++11 and later language
      standards.
      
      Patch by Topotuna (Justas Janickas)!
      
      Differential Revision: https://reviews.llvm.org/D105987
      e5f47eed
    • Hans Wennborg's avatar
      Revert "[clang][pp] adds '#pragma include_instead'" · 973de718
      Hans Wennborg authored
      > `#pragma clang include_instead(<header>)` is a pragma that can be used
      > by system headers (and only system headers) to indicate to a tool that
      > the file containing said pragma is an implementation-detail header and
      > should not be directly included by user code.
      >
      > The library alternative is very messy code that can be seen in the first
      > diff of D106124, and we'd rather avoid that with something more
      > universal.
      >
      > This patch takes the first step by warning a user when they include a
      > detail header in their code, and suggests alternative headers that the
      > user should include instead. Future work will involve adding a fixit to
      > automate the process, as well as cleaning up modules diagnostics to not
      > suggest said detail headers. Other tools, such as clangd can also take
      > advantage of this pragma to add the correct user headers.
      >
      > Differential Revision: https://reviews.llvm.org/D106394
      
      This caused compiler crashes in Chromium builds involving PCH and an include
      directive with macro expansion, when Token::getLiteralData() returned null. See
      the code review for details.
      
      This reverts commit e8a64e54.
      973de718
    • Anirudh Prasad's avatar
      [SystemZ][z/OS] Initial code to generate assembly files on z/OS · a8cfa4b9
      Anirudh Prasad authored
      - This patch consists of the bare basic code needed in order to generate some assembly for the z/OS target.
      - Only the .text and the .bss sections are added for now.
      - The relevant MCSectionGOFF/Symbol interfaces have been added. This enables us to print out the GOFF machine code sections.
      - This patch enables us to add simple lit tests wherever possible, and contribute to the testing coverage for the z/OS target
      - Further improvements and additions will be made in future patches.
      
      Reviewed By: tmatheson
      
      Differential Revision: https://reviews.llvm.org/D106380
      a8cfa4b9
    • Anna Thomas's avatar
      Strip undef implying attributes when moving calls · 8ee5759f
      Anna Thomas authored
      When hoisting/moving calls to locations, we strip unknown metadata. Such calls are usually marked `speculatable`, i.e. they are guaranteed to not cause undefined behaviour when run anywhere. So, we should strip attributes that can cause immediate undefined behaviour if those attributes are not valid in the context where the call is moved to.
      
      This patch introduces such an API and uses it in relevant passes. See
      updated tests.
      
      Fix for PR50744.
      
      Reviewed By: nikic, jdoerfert, lebedev.ri
      
      Differential Revision: https://reviews.llvm.org/D104641
      8ee5759f
    • Tres Popp's avatar
      Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI." · d225de60
      Tres Popp authored
      This reverts commit 1cfecf4f.
      
      This commit broke LLVM code generated through XLA by removing a
      conditional on Ld->getExtensionType() == ISD::NON_EXTLOAD
      
      This is not a perfect revert. The new function is left as other uses of
      it exist now.
      d225de60
    • Tres Popp's avatar
      Revert "Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI."" · 70fa9479
      Tres Popp authored
      This reverts commit d7bbb123.
      
      There were follow up uses of a deleted method and I didn't run the
      tests. Undo the revert, so I can do it properly.
      70fa9479
    • Tres Popp's avatar
      Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI." · d7bbb123
      Tres Popp authored
      This reverts commit 1cfecf4f.
      
      This commit broke LLVM code generated through XLA by removing a
      conditional on Ld->getExtensionType() == ISD::NON_EXTLOAD
      d7bbb123
    • Marek Kurdej's avatar
      775caa58
    • David Spickett's avatar
      [lldb][AArch64] Add memory tag writing to lldb · 5ea091a8
      David Spickett authored
      This adds memory tag writing to Process and the
      GDB remote code. Supporting work for the
      "memory tag write" command. (to follow)
      
      Process WriteMemoryTags is similair to ReadMemoryTags.
      It will pack the tags then call DoWriteMemoryTags.
      That function will send the QMemTags packet to the gdb-remote.
      
      The QMemTags packet follows the GDB specification in:
      https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
      
      Note that lldb-server will be treating partial writes as
      complete failures. So lldb doesn't need to handle the partial
      write case in any special way.
      
      Reviewed By: omjavaid
      
      Differential Revision: https://reviews.llvm.org/D105181
      5ea091a8
    • Jeremy Morse's avatar
      [DebugInfo][InstrRef] Correctly update DBG_PHIs during instr scheduling · ec9da517
      Jeremy Morse authored
      Avoid several crashes when DBG_INSTR_REF and DBG_PHI instructions are fed
      to the instruction scheduler. DBG_INSTR_REFs should be treated like
      DBG_LABELs, and just ignored for the purpose of scheduling [0].
      
      DBG_PHIs however behave much more like DBG_VALUEs: they refer to register
      operands, and if some register defs get shuffled around during instruction
      scheduling, there's a risk that the debug instr will refer to the wrong
      value. There's already a facility for updating DBG_VALUEs to reflect this;
      add DBG_PHI to the list of instructions that it will update.
      
      [0] Suboptimal, but it's what instr scheduling does right now.
      
      Differential Revision: https://reviews.llvm.org/D106663
      ec9da517
    • Vassil Vassilev's avatar
      [clang-repl] Build and install clang-repl by default. · da58ca51
      Vassil Vassilev authored
      We have the basic infrastructure in place. We can recover from simple errors
      (recovering from errors in template instantiations is not yet supported). It
      looks like we are in a reasonably functional state for llvm13.
      
      Differential revision: https://reviews.llvm.org/D106813
      da58ca51
    • Louis Dionne's avatar
    • Tres Popp's avatar
      d9e3449a
    • Anna Thomas's avatar
      [IVDescriptors] Fix bug in checkOrderedReduction · 68ffed12
      Anna Thomas authored
      The Exit instruction passed in for checking if it's an ordered reduction need not be
      an FPAdd operation. We need to bail out at that point instead of
      assuming it is an FPAdd (and hence has two operands). See added testcase.
      It crashes without the patch because the Exit instruction is a phi with
      exactly one operand.
      This latent bug was exposed by 95346ba8 which added support for
      multi-exit loops for vectorization.
      
      Reviewed-By: kmclaughlin
      Differential Revision: https://reviews.llvm.org/D106843
      68ffed12
    • Chris Jackson's avatar
      [DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR · 796b84d2
      Chris Jackson authored
      This reapplies commit 76f3ffb2 that was
      reverted due to buildbot failures.
      
      - Update lit tests with REQUIRES condition.
      - Abandon salvage attempt if SCEVUnknown::getValue() returns nullptr.
      
      Differential Revision: https://reviews.llvm.org/D105207
      796b84d2
    • Kadir Cetinkaya's avatar
    • Kadir Cetinkaya's avatar
      Revert "Revert "[clangd] Canonicalize compile flags before applying edits"" · ab714ba0
      Kadir Cetinkaya authored
      Set driver mode before parsing arglist.
      
      Depends on D106789.
      
      Differential Revision: https://reviews.llvm.org/D106794
      ab714ba0
    • Kadir Cetinkaya's avatar
      [clang][Driver] Expose driver mode detection logic · ce90b60b
      Kadir Cetinkaya authored
      Also use it in other places that performed it on their own.
      
      Differential Revision: https://reviews.llvm.org/D106789
      ce90b60b
    • Jeremy Morse's avatar
      [DebugInfo][InstrRef] Handle llvm.frameaddress intrinsics gracefully · 7dc9d737
      Jeremy Morse authored
      When working out which instruction defines a value, the
      instruction-referencing variable location code has a few special cases for
      physical registers:
       * Arguments are never defined by instructions,
       * Constant physical registers always read the same value, are never def'd
      
      This patch adds a third case for the llvm.frameaddress intrinsics: you can
      read the framepointer in any block if you so choose, and use it as a
      variable location, as shown in the added test.
      
      This rather violates one of the assumptions behind instruction referencing,
      that LLVM-ir shouldn't be able to read from an arbitrary register at some
      arbitrary point in the program. The solution for now is to just emit a
      DBG_PHI that reads the register value: this works, but if we wanted to do
      something clever with DBG_PHIs in the future then this would probably get
      in the way. As it stands, this patch avoids a crash.
      
      Differential Revision: https://reviews.llvm.org/D106659
      7dc9d737
    • Chris Jackson's avatar
      [DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR · 1930c441
      Chris Jackson authored
      This reverts commit 76f3ffb2 because
      of a failure on sanitixer-X86-64-linux-autoconf.
      1930c441
    • Sam McCall's avatar
      [clangd] Add platform triple (host & target) to version info · e2559e5d
      Sam McCall authored
      Useful in logs to understand issues around some platforms we don't have much
      experience with (e.g. m1, mingw)
      
      Differential Revision: https://reviews.llvm.org/D105681
      e2559e5d
    • Andrzej Warzynski's avatar
      [flang][driver] Make `flang` ignore `-Mfree/-Mfixed` · cad2affb
      Andrzej Warzynski authored
      `-Mfixed` is not supported by the new driver and hence
      `flang`, the bash wrapper script, forwards it to the host compiler.
      The forwarded options are used by the host compiler when compiling the
      unparsed files. As the unparsed source files are always in the free
      form, forwarding `-Mfixed` is problematic.
      
      With this patch, `-Mfixed` (and `-Mfree` for consistency) will be
      ignored altogether. The user will only see a warning. This is not a
      particularly sound approach, but `flang` is only a temporary solution
      for us and this workaround is a fair compromise.
      
      Differential Revision: https://reviews.llvm.org/D106428
      cad2affb