1. Jul 23, 2021
  2. Jul 22, 2021
    • Jon Chesterfield's avatar
      [libomptarget][amdgpu] Implement dlopen of libhsa · 1a965706
      Jon Chesterfield authored
      AMDGPU plugin equivalent of D95155, build without HSA installed locally
      
      Compiles a new file, plugins/amdgpu/dynamic_hsa/hsa.cpp, to an object file that
      exposes the same symbols that the plugin presently uses from hsa. The object
      file contains dlopen of hsa and cached dlsym calls. Also provides header files
      corresponding to the subset that is used.
      
      This is behind a feature flag, LIBOMPTARGET_FORCE_DLOPEN_LIBHSA, default off.
      That allows developers to build against the dlopen/dlsym implementation, e.g.
      while testing this mode.
      
      Enabling by default will cause this plugin to build on a wider variety of
      machines than it does at present so may break some CI builds. That risk can
      be minimised by reviewing the header dependencies of the library and ensuring
      it doesn't use any libraries that are not already used by libomptarget.
      
      Separating the implementation from enabling by default in case the latter needs
      to be rolled back after wider CI results.
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D106559
      1a965706
    • Victor Huang's avatar
      [PowerPC] Add PowerPC "__stbcx" builtin and intrinsic for XL compatibility · 26ea4a44
      Victor Huang authored
      This patch is in a series of patches to provide builtins for compatibility
      with the XL compiler. This patch adds the builtin and intrinsic for "__stbcx".
      
      Reviewed By: nemanjai, #powerpc
      
      Differential revision: https://reviews.llvm.org/D106484
      26ea4a44
    • Anastasia Stulova's avatar
      [OpenCL][NFC] Refactors lang version check in test. · b510e012
      Anastasia Stulova authored
      Fixed test to use predefined version marco instead
      of passing extra macro in the command line.
      
      Patch by Topotuna (Justas Janickas)!
      
      Differential Revision: https://reviews.llvm.org/D106254
      b510e012
    • Alexey Bataev's avatar
      [OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments. · b88a68c4
      Alexey Bataev authored
      Added missed arguments in
      __tgt_target_teams_nowait_mapper/__tgt_target_nowait_mapper runtime
      functions calls.
      
      Differential Revision: https://reviews.llvm.org/D106542
      b88a68c4
    • Nico Weber's avatar
      [lld/mac] Move handling of special undefineds later · 9d43c000
      Nico Weber authored
      treatUndefinedSymbol() was previously called before gatherInputSections()
      and markLive() for these special symbols, but after them for normal
      undefineds.
      
      For PR50760, treatUndefinedSymbol() will have to potentially create
      sections, so it's good to move treatUndefinedSymbol() for special
      undefineds later, so that it can assume that gatherInputSections()
      and markLive() has already been called always.
      
      No intended behavior change, but part of PR50760 (and covered in
      tests in the patch for the full feature).
      
      Differential Revision: https://reviews.llvm.org/D106552
      9d43c000
    • Alexey Bataev's avatar
      Revert "[OPENMP]Fix PR49787: Codegen for calling... · f828f0a9
      Alexey Bataev authored
      Revert "[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments."
      
      This reverts commit b455f7f2 to fix
      buildbots.
      f828f0a9
    • Raphael Isemann's avatar
      [lldb] Remove a wrong assert in TestStructTypes that checks that empty structs... · 3d9a9fa6
      Raphael Isemann authored
      [lldb] Remove a wrong assert in TestStructTypes that checks that empty structs in C always have size 0
      
      D105471 fixes the way we assign sizes to empty structs in C mode. Instead of
      just giving them a size 0, we instead use the size we get from DWARF if possible.
      
      After landing D105471 the TestStructTypes test started failing on Windows. The
      tests checked that the size of an empty C struct is 0 while the size LLDB now
      reports is 4 bytes. It turns out that 4 bytes are the actual size Clang is using
      for C structs with the MicrosoftRecordLayoutBuilder. The commit that introduced
      that behaviour is 00a061dc.
      
      This patch removes that specific check from TestStructTypes. Note that D105471
      added a series of tests that already cover this case (and the added checks
      automatically adjust to whatever size the target compiler chooses for empty
      structs).
      3d9a9fa6
    • Alexey Bataev's avatar
      [OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments. · b455f7f2
      Alexey Bataev authored
      Added missed arguments in
      __tgt_target_teams_nowait_mapper/__tgt_target_nowait_mapper runtime
      functions calls.
      
      Differential Revision: https://reviews.llvm.org/D106542
      b455f7f2
    • Aaron En Ye Shi's avatar
      [HIP] Fix no matching constructor for init of shared_ptr and malloc · 9ce931bd
      Aaron En Ye Shi authored
      Allow standard header versions of malloc and free to be defined
      before introducing the device versions.
      
      Fixes: SWDEV-295901
      
      Reviewed By: yaxunl
      
      Differential Revision: https://reviews.llvm.org/D106463
      9ce931bd
    • Jon Chesterfield's avatar
      [libomptarget][nfc] Improve static assert message in dlwrap · 6e9cd3e9
      Jon Chesterfield authored
      Revision of D102858. Raise dlwrap arity argument to template argument
      so the correct value is given in the error message. E.g. '2 == 1' instead of
      '2 == trait<>::nargs'.
      
      Arity higher than it should be:
      Before diff
      ```
      $/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: error:
            static_assert failed due to requirement '2 == trait<cudaError_enum (*)(unsigned int)>::nargs'
            "Arity Error"
      DLWRAP_INTERNAL(cuInit, 2);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      ...
      $/include/dlwrap.h:166:3: note: expanded from macro
            'DLWRAP_COMMON'
        static_assert(ARITY == trait<decltype(&SYMBOL)>::nargs, "Arity Error");      \
      ```
      
      After diff
      In file included from $/plugins/cuda/dynamic_cuda/cuda.cpp:16:
      ```
      $/include/dlwrap.h:131:3: error: static_assert failed due to
            requirement '2UL == 1UL' "Arity Error"
        static_assert(Requested == Required, "Arity Error");
        ^             ~~~~~~~~~~~~~~~~~~~~~
      $/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: in
            instantiation of function template specialization 'dlwrap::verboseAssert<2UL, 1UL>' requested
            here
      DLWRAP_INTERNAL(cuInit, 2);
      ```
      
      Arity lower than it should be:
      Before diff
      ```
      $/plugins/cuda/dynamic_cuda/cuda.cpp:131:10: error: no
            matching function for call to 'dlwrap_cuInit'
        return dlwrap_cuInit(X);
               ^~~~~~~~~~~~~
      $/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: candidate
            function not viable: requires 0 arguments, but 1 was provided
      DLWRAP_INTERNAL(cuInit, 0);
      ```
      
      After diff
      In file included from $/plugins/cuda/dynamic_cuda/cuda.cpp:16:
      ```
      $/include/dlwrap.h:131:3: error: static_assert failed due to
            requirement '0UL == 1UL' "Arity Error"
        static_assert(Requested == Required, "Arity Error");
        ^             ~~~~~~~~~~~~~~~~~~~~~
      $/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: in
            instantiation of function template specialization 'dlwrap::verboseAssert<0UL, 1UL>' requested
            here
      DLWRAP_INTERNAL(cuInit, 0);
      ```
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D106543
      6e9cd3e9
    • Cullen Rhodes's avatar
      [AArch64][SME] Improve diagnostic for vector select register · 00e87e1c
      Cullen Rhodes authored
      Reviewed By: sdesmalen
      
      Differential Revision: https://reviews.llvm.org/D106540
      00e87e1c
    • Melanie Blower's avatar
    • Raphael Isemann's avatar
      [lldb] Fix TestCompletion by using SIGPIPE instead of SIGINT as test signal · eb61ffbc
      Raphael Isemann authored
      The test I added in commit 07800348 was using
      SIGINT for testing the tab completion. The idea is to have a signal that only
      has one possible completion and I ended up picking SIGIN -> SIGINT for the test.
      However on non-Linux systems there is SIGINFO which is a valid completion for
      `SIGIN' and so the test fails there.
      
      This replaces SIGIN -> SIGINT with SIGPIP -> SIGPIPE completion which according
      to LLDB's signal list in Host.cpp is the only valid completion.
      eb61ffbc
    • Kazu Hirata's avatar
      [Transforms] Remove getOrCreateInitFunction (NFC) · f6413d8a
      Kazu Hirata authored
      The last use was removed on Jan 16, 2019 in commit
      81101de5.
      f6413d8a
    • Joseph Huber's avatar
      [OpenMP] Fix warnings for uninitialized block counts · a158d366
      Joseph Huber authored
      Summary:
      Fixes some warning given for uninitialized block counts if the exection mode is
      not recognized. This shouldn't happen in practice because the execution mode is
      checked when it's read from the device.
      a158d366
    • Nico Weber's avatar
    • Aaron Ballman's avatar
      Implement _ExtInt conversion rules · 6bb042e7
      Aaron Ballman authored
      Clang implemented the _ExtInt datatype as a bit-precise integer type,
      which was then proposed to WG14. WG14 has accepted the proposal
      (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2709.pdf), but Clang
      requires some additional work as a result.
      
      In the original Clang implementation, we elected to disallow implicit
      conversions involving these types until after WG14 finalized the rules.
      This patch implements the rules decided by WG14: no integer promotion
      for bit-precise types, conversions prefer the larger of the two types
      and in the event of a tie (say _ExtInt(32) and a 32-bit int), the
      standard type wins.
      
      There are more changes still needed to conform to N2709, but those will
      be handled in follow-up patches.
      6bb042e7
    • Raphael Isemann's avatar
      [lldb][NFC] Allow range-based for loops over DWARFDIE's children · 77440d64
      Raphael Isemann authored
      This patch adds the ability to get a DWARFDIE's children as an LLVM range.
      
      This way we can use for range loops to iterate over them and we can use LLVM's
      algorithms like `llvm::all_of` to query all children.
      
      The implementation has to do some small shenanigans as the iterator needs to
      store a DWARFDIE, but a DWARFDIE container is also a DWARFDIE so it can't return
      the iterator by value. I just made the `children` getter a templated function to
      avoid the cyclic dependency.
      
      Reviewed By: #lldb, werat, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D103172
      77440d64
    • Med Ismail Bennani's avatar
      [lldb/Plugins] Add ScriptedProcess Process Plugin · 312b43da
      Med Ismail Bennani authored
      This patch introduces Scripted Processes to lldb.
      
      The goal, here, is to be able to attach in the debugger to fake processes
      that are backed by script files (in Python, Lua, Swift, etc ...) and
      inspect them statically.
      
      Scripted Processes can be used in cooperative multithreading environments
      like the XNU Kernel or other real-time operating systems, but it can
      also help us improve the debugger testing infrastructure by writting
      synthetic tests that simulates hard-to-reproduce process/thread states.
      
      Although ScriptedProcess is not feature-complete at the moment, it has
      basic execution capabilities and will improve in the following patches.
      
      rdar://65508855
      
      Differential Revision: https://reviews.llvm.org/D100384
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <medismail.bennani@gmail.com>
      312b43da
    • Melanie Blower's avatar
      [clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on · b9b696bb
      Melanie Blower authored
      Change the ffp-model=precise to enables -ffp-contract=on (previously
      -ffp-model=precise enabled -ffp-contract=fast). This is a follow-up
      to Andy Kaylor's comments in the llvm-dev discussion "Floating Point
      semantic modes". From the same email thread, I put Andy's distillation
      of floating point options and floating point modes into UsersManual.rst
      Also fixes bugs.llvm.org/show_bug.cgi?id=50222
      
      Reviewed By: rjmccall, andrew.kaylor
      
      Differential Revision: https://reviews.llvm.org/D74436
      b9b696bb
    • Raphael Isemann's avatar
      [lldb] Fix that `process signal` completion always returns all signals · 07800348
      Raphael Isemann authored
      `CompletionRequest::AddCompletion` adds the given string as completion of the
      current command token. `CompletionRequest::TryCompleteCurrentArg` only adds it
      if the current token is a prefix of the given string. We're using
      `AddCompletion` for the `process signal` handler which means that `process
      signal SIGIN` doesn't get uniquely completed to `process signal SIGINT` as we
      unconditionally add all other signals (such as `SIGABRT`) as possible
      completions.
      
      By using `TryCompleteCurrentArg` we actually do the proper filtering which will
      only add `SIGINT` (as that's the only signal with the prefix 'SIGIN' in the
      example above).
      
      Reviewed By: mib
      
      Differential Revision: https://reviews.llvm.org/D105028
      07800348
    • Caroline Concatto's avatar
      [LoopVectorize] Fix crash for predicated instruction with scalable VF · 5a4de84d
      Caroline Concatto authored
      This patch avoids computing discounts for predicated instructions  when the
      VF is scalable.
      There is no support for vectorization of loops with division because the
      vectorizer cannot guarantee that zero divisions will not happen.
      
      This loop now does not use VF scalable
      
      ```
      for (long long i = 0; i < n; i++)
          if (cond[i])
            a[i] /= b[i];
      ```
      
      Differential Revision: https://reviews.llvm.org/D101916
      5a4de84d
    • Paulo Matos's avatar
      Add support for zero-sized Scalars as a LowLevelType · 842e718b
      Paulo Matos authored
      Opaque values (of zero size) can be stored in memory with the
      implemention of reference types in the WebAssembly backend. Since
      MachineMemOperand uses LLTs we need to be able to support
      zero-sized scalars types in LLTs.
      
      Differential Revision: https://reviews.llvm.org/D105423
      842e718b
    • Raphael Isemann's avatar
      [lldb][NFCI] Remove redundant accessibility heuristic in the DWARF parser · 12a89e14
      Raphael Isemann authored
      LLDB's DWARF parser has some heuristics for guessing and fixing up the
      accessibility of C++ class/struct members after they were already created in the
      internal Clang AST. The heuristic is that if a struct/class has a base class,
      then it's actually a class and it's members are private unless otherwise
      specified.
      
      From what I can see this heuristic isn't sound and also unnecessary. The idea
      that inheritance implies that the `class` keyword was used and the default
      visibility is `private` is incorrect. Also both GCC and Clang use
      `DW_TAG_structure_type` and `DW_TAG_class_type` for `struct` and `class` types
      respectively, so the default visibility we infer from that information is always
      correct and there is no need to fix it up.
      
      And finally, the access specifiers we set in the Clang AST are anyway unused
      within LLDB. The expression parser explicitly ignores them to give users access
      to private members and there is not SBAPI functionality that exposes this
      information.
      
      This patch removes all the heuristic code for the reasons above and instead
      just relies on the access values we infer from the tag kind and explicit
      annotations in DWARF.
      
      This patch is NFCI.
      
      Reviewed By: werat
      
      Differential Revision: https://reviews.llvm.org/D105463
      12a89e14
    • Raphael Isemann's avatar
      [lldb] Generalize empty record size computation to avoid giving empty C++ structs a size of 0 · 67c588c4
      Raphael Isemann authored
      C doesn't allow empty structs but Clang/GCC support them and give them a size of 0.
      
      LLDB implements this by checking the tag kind and if it's `DW_TAG_structure_type` then
      we give it a size of 0 via an empty external RecordLayout. This is done because our
      internal TypeSystem is always in C++ mode (which means we would give them a size
      of 1).
      
      The current check for when we have this special case is currently too lax as types with
      `DW_TAG_structure_type` can also occur in C++ with types defined using the `struct`
      keyword. This means that in a C++ program with `struct Empty{};`, LLDB would return
      `0` for `sizeof(Empty)` even though the correct size is 1.
      
      This patch removes this special case and replaces it with a generic approach that just
      assigns empty structs the byte_size as specified in DWARF. The GCC/Clang special
      case is handles as they both emit an explicit `DW_AT_byte_size` of 0. And if another
      compiler decides to use a different byte size for this case then this should also be
      handled by the same code as long as that information is provided via `DW_AT_byte_size`.
      
      Reviewed By: werat, shafik
      
      Differential Revision: https://reviews.llvm.org/D105471
      67c588c4