1. Feb 08, 2022
    • Clement Courbet's avatar
      [NFC] Fix comment. · 90d2291f
      Clement Courbet authored
      The extra space causes the table to render incorrectly in doxygen.
      90d2291f
    • Marek Kurdej's avatar
      06e42590
    • Marek Kurdej's avatar
      [clang-format] Fix typo. NFC. · 7d639734
      Marek Kurdej authored
      7d639734
    • Alex Zinenko's avatar
      [mlir] Move constBuidlerCall from to ArrayAttrBase · 68784267
      Alex Zinenko authored
      This makes it applicable to both ArrayAttr and its typed subclasses instead of
      only the latter. There is no good reason why ArrayAttr shouldn't be
      const-buildable while its typed subclasses are, this was likely just an
      omission.
      
      Depends On D119113
      
      Reviewed By: rriddle, nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D119114
      68784267
    • Alex Zinenko's avatar
      [mlir] ODS: require DefaultValuedAttr to be const-buildable · 3df6cade
      Alex Zinenko authored
      ODS provides a mechanism for defalut-valued attributes based on a wrapper
      TableGen class that is recognized by mlir-tblgen. Such attributes, if not set
      on the operaiton, can be construted on-the-fly in their getter given a constant
      value. In order for this construction to work, the attribute specificaiton in
      ODS must set the constBuilderCall field correctly. This has not been verified,
      which could lead to invalid C++ code being generated by mlir-tblgen.
      
      Closes #53588.
      
      Reviewed By: rriddle, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D119113
      3df6cade
    • Zi Xuan Wu's avatar
      [CSKY] Add CSKYDisassembler.cpp to construct objdump · ec642cee
      Zi Xuan Wu authored
      CSKYDisassembler tries to disassemble register MC operand from register num for different register class, and
      also handles immediate num and carry flag operand which is not encoded in instruction binary.
      
      Also enhance the printer of instruction to accept sub-option to control the print format. Sometimes, it prefers to
      print number in hex, especially when immediate number represents symbol address.
      ec642cee
    • Zi Xuan Wu's avatar
      [CSKY] Add CK800 series ProcessorModel and complete related SubtargetFeatures · 9ee96aaa
      Zi Xuan Wu authored
      Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
      There are 11 processor family enums for CK series cpus such as CK801, CK802, CK803, CK803S, CK804, CK805,
      CK807, CK810, CK810V, CK860, CK860V.
      
      The SchedMachineModels are not ready for different cpus, so only NoSchedModel is used.
      9ee96aaa
    • Tres Popp's avatar
      Add missing BUILD dependency to ShapeOps · a1f3f1d2
      Tres Popp authored
      a1f3f1d2
    • Rainer Orth's avatar
      [CodeGen][test] XFAIL CodeGen/Generic/ForceStackAlign.ll on SPARC · 541171f0
      Rainer Orth authored
      `CodeGen/Generic/ForceStackAlign.ll` `FAIL`s on SPARC like this:
      
        LLVM ERROR: Function "g" required stack re-alignment, but LLVM couldn't
      handle it (probably because it has a dynamic alloca).
      
      According to the comments in `llvm/lib/Target/Sparc/SparcFrameLowering.cpp`
      (`SparcFrameLowering::emitPrologue`) and `SparcRegisterInfo.cpp`
      (`SparcRegisterInfo::canRealignStack`) this isn't going to change any time
      soon, so this patch `XFAIL`s the test.
      
      Tested on `sparcv9-sun-solaris2.11`.
      
      Differential Revision: https://reviews.llvm.org/D119119
      541171f0
    • Jason Molenda's avatar
      Platform gdb RSP packet doc fixes based on implementation behavior · 9b1cb0e1
      Jason Molenda authored
      Reviewing some recent fixes to the platform packet implementations
      in lldb, I saw the docs were out of sync in a few spots.  Updated them.
      
      Differential Revision: https://reviews.llvm.org/D118842
      9b1cb0e1
    • Mariusz Ceier's avatar
      [lldb][CMake] Fix linking of gdb-remote when LLVM_ENABLE_ZLIB is ON · 385f5c4d
      Mariusz Ceier authored
      When LLVM_ENABLE_ZLIB is ON gdb-remote should link against ZLIB::ZLIB.
      
      This fixes
      ```
      /mnt/b/yoe/master/build/tmp/hosttools/ld: lib/liblldbPluginProcessGDBRemote.a(GDBRemoteCommunication.cpp.o): in function `lldb_private::process_gdb_remote::GDBRemoteCommunication::DecompressPacket() [clone .localalias]':
      GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x59a): undefined reference to `inflateInit2_'
      /mnt/b/yoe/master/build/tmp/hosttools/ld: GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x5af): undefined reference to `inflate'
      ```
      
      Reviewed By: JDevlieghere, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D119186
      385f5c4d
    • Carl Ritson's avatar
      [MachineLICM] Add shouldHoist method to TargetInstrInfo · 42ac4e1a
      Carl Ritson authored
      Add a shouldHoist method to TargetInstrInfo which is queried by
      MachineLICM to override hoisting decisions for a given target.
      This mirrors functionality provided by shouldSink.
      
      Reviewed By: foad
      
      Differential Revision: https://reviews.llvm.org/D118773
      42ac4e1a
    • Lang Hames's avatar
      [ORC-RT] Fix missing #include from f9aef477. · fe2f5c97
      Lang Hames authored
      fe2f5c97
    • Lang Hames's avatar
      [ORC][ORC-RT] Rewrite the MachO platform to use allocation actions. · f9aef477
      Lang Hames authored
      This patch updates the MachO platform (both the ORC MachOPlatform class and the
      ORC-Runtime macho_platform.* files) to use allocation actions, rather than EPC
      calls, to transfer the initializer information scraped from each linked object.
      Interactions between the ORC and ORC-Runtime sides of the platform are
      substantially redesigned to accomodate the change.
      
      The high-level changes in this patch are:
      
      1. The MachOPlatform::setupJITDylib method now calls into the runtime to set up
         a dylib name <-> header mapping, and a dylib state object (JITDylibState).
      
      2. The MachOPlatformPlugin builds an allocation action that calls the
         __orc_rt_macho_register_object_platform_sections and
         __orc_rt_macho_deregister_object_platform_sections functions in the runtime
         to register the address ranges for all "interesting" sections in the object
         being allocated (TLS data sections, initializers, language runtime metadata
         sections, etc.).
      
      3. The MachOPlatform::rt_getInitializers method (the entry point in the
         controller for requests from the runtime for initializer information) is
         replaced by MachOPlatform::rt_pushInitializers. The former returned a data
         structure containing the "interesting" section address ranges, but these are
         now handled by __orc_rt_macho_register_object_platform_sections. The new
         rt_pushInitializers method first issues a lookup to trigger materialization
         of the "interesting" sections, then returns the dylib dependence tree rooted
         at the requested dylib for dlopen to consume. (The dylib dependence tree is
         returned by rt_pushInitializers, rather than being handled by some dedicated
         call, because rt_pushInitializers can alter the dependence tree).
      
      The advantage of these changes (beyond the performance advantages of using
      allocation actions) is that it moves more information about the materialized
      portions of the JITDylib into the executor. This tends to make the runtime
      easier to reason about, e.g. the implementation of dlopen in the runtime is now
      recursive, rather than relying on recursive calls in the controller to build a
      linear data structure for consumption by the runtime. This change can also make
      some operations more efficient, e.g. JITDylibs can be dlclosed and then
      re-dlopened without having to pull all initializers over from the controller
      again.
      
      In addition to the high-level changes, there are some low-level changes to ORC
      and the runtime:
      
      * In ORC, at ExecutionSession teardown time JITDylibs are now destroyed in
      reverse creation order. This is on the assumption that the ORC runtime will be
      loaded into an earlier dylib that will be used by later JITDylibs. This is a
      short-term solution to crashes that arose during testing when the runtime was
      torn down before its users. Longer term we will likely destroy dylibs in
      dependence order.
      
      * toSPSSerializable(Expected<T> E) is updated to explicitly initialize the T
      value, allowing it to be used by Ts that have explicit constructors.
      
      * The ORC runtime now (1) attempts to track ref-counts, and (2) distinguishes
      not-yet-processed "interesting" sections from previously processed ones. (1)
      is necessary for standard dlopen/dlclose emulation. (2) is intended as a step
      towards better REPL support -- it should enable future runtime calls that
      run only newly registered initializers ("dlopen_more", "dlopen_additions",
      ...?).
      f9aef477
    • Fangrui Song's avatar
      [ELF] AArch64ErrataFix: replace std::map with DenseMap. NFC · f237ab0d
      Fangrui Song authored
      There is now no <map> in lld/ELF.
      f237ab0d
    • Fangrui Song's avatar
      [ELF] Clean up headers. NFC · 27bb7990
      Fangrui Song authored
      27bb7990
    • wangpc's avatar
      [RISCV] Split f64 undef into two i32 undefs · c53d99c3
      wangpc authored
      So that no store instruction will be generated.
      
      Reviewed By: asb
      
      Differential Revision: https://reviews.llvm.org/D118222
      c53d99c3
    • Lang Hames's avatar
      [llvm-jitlink] Don't add process symbols to every JITDylib. · adbc7a26
      Lang Hames authored
      The addProcessSymbols function added a generator for process symbols to every
      JITDylib in the session, but this is unhelpful default behavior (e.g. it will
      cause the ORC runtime's definition of __cxa_atexit to be shadowed by the
      process's definition for all JITDylibs except main).
      
      Since the loadProcessSymbols function already added a generator to main we only
      need to drop this function. Other JITDylibs wishing to resolve process symbols
      can link against the main JITDylib by passing `-lmain`.
      adbc7a26
    • Lang Hames's avatar
      [ORC-RT] Make ExecutorAddr hashable. · ea0ce326
      Lang Hames authored
      This will be used in an upcoming macho_platform patch.
      ea0ce326
    • Amir Ayupov's avatar
      [BOLT][CMAKE][NFC] Update runtime/CMakeLists.txt · c840047c
      Amir Ayupov authored
      Summary:
      - Specify compiler flags for runtime libraries as BOLT_RT_FLAGS,
      - Remove redundant CMake definitions.
      
      Reviewers: maksfb
      
      FBD34048561
      c840047c
    • Amir Ayupov's avatar
      [BOLT] Add ld.lld substitution · 03f014c9
      Amir Ayupov authored
      Register ld.lld substition (tests were failing)
      
      Reviewed By: yota9
      
      Differential Revision: https://reviews.llvm.org/D118738
      03f014c9
    • wangpc's avatar
      [RISCV] Pre-commit test for D118222 · cb0fff43
      wangpc authored
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D119212
      cb0fff43
    • Lang Hames's avatar
      [ORC-RT] Add more string_view operations and tests. · 6646832f
      Lang Hames authored
      Adds construction from std::string, an ostream &operator<< and std::hash
      specialization. Also adds unit tests for each of these operations, as well as
      tests for copy construction and assignment.
      
      These new operations will be used in upcoming macho_platform patches.
      6646832f
    • Lang Hames's avatar
      [ORC-RT] Fix typos in testcase. · f8006a0a
      Lang Hames authored
      Replace references to 'span' in string_view tests that were originally copied
      from span tests.
      f8006a0a
    • Keith Smiley's avatar
      [test][llvm-objcopy/mac] Fix invalid strip tests · 4669cc93
      Keith Smiley authored
      I discovered some of these tests had `cmp` statements that weren't
      actually being run. I had also recently copied this broken setup for a
      new test around chained fixups. Fixing this revealed that the binaries
      did differ because of their code signature so I regenerated the fixture
      here with this source:
      
      ```c
      int main() {
         return 0;
      }
      ```
      
      Passing `-Wl,-no_adhoc_codesign` on my M1 machine to make sure it didn't
      get any signature.
      
      Differential Revision: https://reviews.llvm.org/D119203
      4669cc93
    • Keith Smiley's avatar
      c4ac46b9
    • Chuanqi Xu's avatar
      [C++20] [Modules] Don't create multiple global module fragment · 3504937d
      Chuanqi Xu authored
      Since the serialization code would recognize modules by names and the
      name of all global module fragment is <global>, so that the
      serialization code would complain for the same module.
      
      This patch fixes this by using a unique global module fragment in Sema.
      Before this patch, the compiler would fail on an assertion complaining
      the duplicated modules.
      
      Reviewed By: urnathan, rsmith
      
      Differential Revision: https://reviews.llvm.org/D115610
      3504937d
    • Chuanqi Xu's avatar
      [C++20] [Coroutines] Warning for always_inline coroutine · e39ba046
      Chuanqi Xu authored
      See the discussion in https://reviews.llvm.org/D100282. The coroutine
      marked always inline might not be inlined properly in current compiler
      support. Since the coroutine would be splitted into pieces. And the call
      to resume() and destroy() functions might be indirect call. Also the
      ramp function wouldn't get inlined under O0 due to pipeline ordering
      problems. It might be different to what users expects to. Emit a warning
      to tell it.
      
      This is what GCC does too: https://godbolt.org/z/7eajb1Gf8
      
      Reviewed By: Quuxplusone
      
      Differential Revision: https://reviews.llvm.org/D115867
      e39ba046
    • River Riddle's avatar
      [mlir] Finish removing FunctionPass · 7889ff7f
      River Riddle authored
      FunctionPass has been deprecated in favor of OperationPass<FuncOp>
      for a few weeks, and this commit finished the deprecation with deletion.
      The only difference between the two is that FunctionPass filters out function
      declarations. When updating references to FunctionPass, ensure that
      the pass either can handle declarations or explicitly add in filtering.
      
      See https://llvm.discourse.group/t/functionpass-deprecated-in-favor-of-operationpass-funcop
      
      Differential Revision: https://reviews.llvm.org/D118735
      7889ff7f
    • River Riddle's avatar
      [mlir] Update uses of `parser`/`printer` ODS op field to `hasCustomAssemblyFormat` · 2418cd92
      River Riddle authored
      The parser/printer fields are deprecated and in the process of being removed.
      2418cd92
    • River Riddle's avatar
      [mlir] Update Toy operations to use the `hasCustomAssemblyFormat` field · 12bfd159
      River Riddle authored
      The parser/printer fields are deprecated and in the process of being removed.
      12bfd159
    • River Riddle's avatar
      [mlir][NFC] Remove deprecated/old build/fold/parser utilities from OpDefinition · 60cac0c0
      River Riddle authored
      These have generally been replaced by better ODS functionality, and do not
      need to be explicitly provided anymore.
      
      Differential Revision: https://reviews.llvm.org/D119065
      60cac0c0
    • River Riddle's avatar
    • River Riddle's avatar
      [mlir:ODS] Deprecate Op parser/printer fields in favor of a new hasCustomAssemblyFormat field · d7f0083d
      River Riddle authored
      Currently if an operation wants a C++ implemented parser/printer, it specifies inline
      code blocks. This is quite problematic for various reasons, e.g. it requires defining
      C++ inside of Tablegen which is discouraged when possible, but mainly because
      nearly all usages simply forward to static functions (e.g. `static void parseSomeOp(...)`)
      with users devising their own standards for how these are defined.
      
      This commit adds support for a `hasCustomAssemblyFormat` bit field that specifies if
      a C++ parser/printer is needed, and when set to 1 declares the parse/print methods for
      operations to override. For migration purposes, the existing behavior is untouched. Upstream
      usages will be replaced in a followup to keep this patch focused on the new implementation.
      
      Differential Revision: https://reviews.llvm.org/D119054
      d7f0083d
    • Arthur Eubanks's avatar
      [clang] Fix some clang->llvm type cache invalidation issues · 45084eab
      Arthur Eubanks authored
      Take the following as an example
      
        struct z {
          z (*p)();
        };
      
        z f();
      
      When we attempt to get the LLVM type of f, we recurse into z. z itself
      has a function pointer with the same type as f. Given the recursion,
      Clang simply treats z::p as a pointer to an empty struct `{}*`. The
      LLVM type of f is as expected. So we have two different potential
      LLVM types for a given Clang type. If we store one of those into the
      cache, when we access the cache with a different context (e.g. we
      are/aren't recursing on z) we may get an incorrect result. There is some
      attempt to clear the cache in these cases, but it doesn't seem to handle
      all cases.
      
      This change makes it so we only use the cache when we are not in any
      sort of function context, i.e. `noRecordsBeingLaidOut() &&
      FunctionsBeingProcessed.empty()`, which are the cases where we may
      decide to choose a different LLVM type for a given Clang type. LLVM
      types for builtin types are never recursive so they're always ok.
      
      This allows us to clear the type cache less often (as seen with the
      removal of one of the calls to `TypeCache.clear()`). We
      still need to clear it when we use a placeholder type then replace it
      later with the final type and other dependent types need to be
      recalculated.
      
      I've added a check that the cached type matches what we compute. It
      triggered in this test case without the fix. It's currently not
      check-clang clean so it's not on by default for something like expensive
      checks builds.
      
      This change uncovered another issue where the LLVM types for an argument
      and its local temporary don't match. For example in type-cache-3, when
      expanding z::dc's argument into a temporary alloca, we ConvertType() the
      type of z::p which is `void ({}*)*`, which doesn't match the alloca GEP
      type of `{}*`.
      
      No noticeable compile time changes:
      https://llvm-compile-time-tracker.com/compare.php?from=3918dd6b8acf8c5886b9921138312d1c638b2937&to=50bdec9836ed40e38ece0657f3058e730adffc4c&stat=instructions
      
      Fixes #53465.
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D118744
      45084eab
    • Sameer Sahasrabuddhe's avatar
      [AMDGPU] [NFC] refactor the AMDGPU attributor · 02a2e46f
      Sameer Sahasrabuddhe authored
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D119087
      02a2e46f
    • Carl Ritson's avatar
      [AMDGPU] Allow hoisting of some VALU compare instructions · a1fb307b
      Carl Ritson authored
      Conversatively allow hoisting/sinking of VALU comparisons.
      If the result of a comparison is masked with exec, narrowing the
      set of active lanes, then it is safe to hoist it as the masking
      instruction will never by hoisted.
      
      Heuristically this is also true for sinking, as we do not expect
      the result of a sunk comparison that is masked with exec to be
      used outside of the loop.
      
      Reviewed By: rampitec
      
      Differential Revision: https://reviews.llvm.org/D118975
      a1fb307b
    • Johannes Doerfert's avatar
      [Attributor][FIX] Do not use assumed information for UB detection · dd101c80
      Johannes Doerfert authored
      The helper `Attributor::checkForAllReturnedValuesAndReturnInsts`
      simplifies the returned value optimistically. In `AAUndefinedBehavior`
      we cannot use such optimistic values when deducing UB. As a result, we
      assumed UB for the return value of a function because we initially
      (=optimistically) thought the function return is `undef`. While we later
      adjusted this properly, the `AAUndefinedBehavior` was under the
      impression the return value is "known" (=fix) and could never change.
      
      To correct this we use `Attributor::checkForAllInstructions` and then
      manually to perform simplification of the return value, only allowing
      known values to be used. This actually matches the other UB deductions.
      
      Fixes #53647
      dd101c80
    • Johannes Doerfert's avatar
      [MemoryBuiltins][FIX] Adjust index type size properly wrt. AS casts · 29c8ebad
      Johannes Doerfert authored
      Use existing functionality to strip constant offsets that works well
      with AS casts and avoids the code duplication.
      
      Since we strip AS casts during the computation of the offset we also
      need to adjust the APInt properly to avoid mismatches in the bit width.
      This code ensures the caller of `compute` sees APInts that match the
      index type size of the value passed to `compute`, not the value result
      of the strip pointer cast.
      
      Fixes #53559.
      
      Differential Revision: https://reviews.llvm.org/D118727
      29c8ebad
    • Sheng's avatar
      [M68k][GlobalISel] Implement lowerCall based on M68k calling convention · 5aa3af3f
      Sheng authored
      This patch implements CallLowering::lowerCall based on M68k calling
      convention and adds M68kOutgoingValueHandler and CallReturnHandler to
      handle argument passing and returned value.
      5aa3af3f