1. Sep 28, 2020
    • Simon Pilgrim's avatar
    • Georgii Rymar's avatar
      [yaml2obj][obj2yaml] - Add a support for SHT_ARM_EXIDX section. · dab99171
      Georgii Rymar authored
      This adds the support for SHT_ARM_EXIDX sections to obj2yaml/yaml2obj tools.
      
      SHT_ARM_EXIDX is a ARM specific index table filled with entries.
      Each entry consists of two 4-bytes values (words).
      (https://developer.arm.com/documentation/ihi0038/c/?lang=en#index-table-entries)
      
      Differential revision: https://reviews.llvm.org/D88228
      dab99171
    • Raphael Isemann's avatar
      [lldb] Reference STL types in import-std-module tests · cabee89b
      Raphael Isemann authored
      With the recent patches to the ASTImporter that improve template type importing
      (D87444), most of the import-std-module tests can now finally import the
      type of the STL container they are testing. This patch removes most of the casts
      that were added to simplify types to something the ASTImporter can import
      (for example, std::vector<int>::size_type was casted to `size_t` until now).
      Also adds the missing tests that require referencing the container type (for
      example simply printing the whole container) as here we couldn't use a casting
      workaround.
      
      The only casts that remain are in the forward_list tests that reference
      the iterator and the stack test. Both tests are still failing to import the
      respective container type correctly (or crash while trying to import).
      cabee89b
    • Georgii Rymar's avatar
      [obj2yaml][yaml2obj] - Stop recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets. · ea0f66e8
      Georgii Rymar authored
      Currently we are always recognizing the `SHT_MIPS_ABIFLAGS` section,
      even on non-MIPS targets.
      
      The problem of doing this is briefly discussed in D88228 which does the same for `SHT_ARM_EXIDX`:
      
      "The problem is that `SHT_ARM_EXIDX` shares the value with `SHT_X86_64_UNWIND (0x70000001U)`.
      We might have other machine specific conflicts, e.g.
      `SHT_ARM_ATTRIBUTES` vs `SHT_MSP430_ATTRIBUTES` vs `SHT_RISCV_ATTRIBUTES (0x70000003U)`."
      
      I think we should only recognize target specific sections when the machine type
      matches. I.e. `SHT_MIPS_*` should be recognized only on `MIPS`, `SHT_ARM_*`
      only on `ARM` etc.
      
      This patch stops recognizing `SHT_MIPS_ABIFLAGS` on `non-MIPS` targets.
      
      Note: I had to update `ScalarEnumerationTraits<ELFYAML::MIPS_ISA>::enumeration`, because
      otherwise test crashes, calling `llvm_unreachable`.
      
      Differential revision: https://reviews.llvm.org/D88294
      ea0f66e8
    • Benjamin Kramer's avatar
      7e5a356d
    • Sjoerd Meijer's avatar
      [ARM][MVE] tail-predication: overflow checks for elementcount, cont'd · f39f92c1
      Sjoerd Meijer authored
      This is a reimplementation of the overflow checks for the elementcount,
      i.e. the 2nd argument of intrinsic get.active.lane.mask. The element
      count is lowered in each iteration of the tail-predicated loop, and
      we must prove that this expression doesn't overflow.
      
      Many thanks to Eli Friedman and Sam Parker for all their help with
      this work.
      
      Differential Revision: https://reviews.llvm.org/D88086
      f39f92c1
    • David Green's avatar
      [ARM] Expand cannotInsertWDLSTPBetween to the last instruction · e4b9867c
      David Green authored
      9d9a11c7 added this check for predicatable instructions between the
      D/WLSTP and the loop's start, but it was missing the last instruction in
      the block. Change it to use some iterators instead.
      
      Differential Revision: https://reviews.llvm.org/D88354
      e4b9867c
    • Raphael Isemann's avatar
      [lldb] Remove nothreadallow from SWIG's __str__ wrappers to work around a Python>=3.7 crash · 070a1d56
      Raphael Isemann authored
      Usually when we enter a SWIG wrapper function from Python, SWIG automatically
      adds a `Py_BEGIN_ALLOW_THREADS`/`Py_END_ALLOW_THREADS` around the call to the SB
      API C++ function. This will ensure that Python's GIL is released when we enter
      LLDB and locked again when we return to the wrapper code.
      
      D51569 changed this behaviour but only for the generated `__str__` wrappers. The
      added `nothreadallow` disables the injection of the GIL release/re-acquire code
      and the GIL is now kept locked when entering LLDB and is expected to be still
      locked when returning from the LLDB implementation. The main reason for that was
      that back when D51569 landed the wrapper itself created a Python string. These
      days it just creates a std::string and SWIG itself takes care of getting the GIL
      and creating the Python string from the std::string, so that workaround isn't
      necessary anymore.
      
      This patch just removes `nothreadallow` so that our `__str__` functions now
      behave like all other wrapper functions in that they release the GIL when
      calling into the SB API implementation.
      
      The motivation here is actually to work around another potential bug in LLDB.
      When one calls into the LLDB SB API while holding the GIL and that call causes
      LLDB to interpret some Python script via `ScriptInterpreterPython`, then the GIL
      will be unlocked when the control flow returns from the SB API. In the case of
      the `__str__` wrapper this would cause that the next call to a Python function
      requiring the GIL would fail (as SWIG will not try to reacquire the GIL as it
      isn't aware that LLDB removed it).
      
      The reason for this unexpected GIL release seems to be a workaround for recent
      Python versions:
      ```
          // The only case we should go further and acquire the GIL: it is unlocked.
          if (PyGILState_Check())
            return;
      ```
      
      The early-exit here causes `InitializePythonRAII::m_was_already_initialized` to
      be always false and that causes that `InitializePythonRAII`'s destructor always
      directly unlocks the GIL via `PyEval_SaveThread`. I'm investigating how to
      properly fix this bug in a follow up patch, but for now this straightforward
      patch seems to be enough to unblock my other patches (and it also has the
      benefit of removing this workaround).
      
      The test for this is just a simple test for `std::deque` which has a synthetic
      child provider implemented as a Python script. Inspecting the deque object will
      cause `expect_expr` to create a string error message by calling
      `str(deque_object)`. Printing the ValueObject causes the Python script for the
      synthetic children to execute which then triggers the bug described above where
      the GIL ends up being unlocked.
      
      Reviewed By: JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D88302
      070a1d56
    • Chuanqi Xu's avatar
      [Coroutines] Reuse storage for local variables with non-overlapping lifetimes · b3a722e6
      Chuanqi Xu authored
      bug 45566 shows the process of building coroutine frame won't consider
      that the lifetimes of different local variables are not overlapped,
      which means the compiler could generates smaller frame.
      
      This patch calculate the lifetime range of each alloca by StackLifetime
      class. Then the patch build non-overlapped sets for allocas whose
      lifetime ranges are not overlapped. We use the largest type in a
      non-overlapped set as the field type in the frame. In insertSpills
      process, if we find the type of field is not the same with the alloca,
      we cast the pointer to the field type to the pointer to the alloca type.
      Since the lifetime range of alloca in one non-overlapped set is not
      overlapped with each other, it should be ok to reuse the storage space
      in the frame.
      
      Test plan: check-llvm, check-clang, cppcoro, folly
      
      Reviewers: junparser, lxfind, modocache
      
      Differential Revision: https://reviews.llvm.org/D87596
      b3a722e6
    • David Sherwood's avatar
      [SVE] Replace / operator in TypeSize/ElementCount with divideCoefficientBy · bafdd113
      David Sherwood authored
      After some recent upstream discussion we decided that it was best
      to avoid having the / operator for both ElementCount and TypeSize,
      since this could give the impression that these classes can be used
      in the same way as basic integer integer types. However, division
      for scalable types is a bit odd because we are only dividing the
      minimum quantity by a value, as opposed to something like:
      
        (MinSize * Vscale) / SomeValue
      
      This is why when performing division it's important the caller
      first establishes whether the operation makes sense, perhaps by
      calling isKnownMultipleOf() prior to division. The caller must now
      explictly call divideCoefficientBy() on the class to perform the
      operation.
      
      Differential Revision: https://reviews.llvm.org/D87700
      bafdd113
    • Kai Luo's avatar
      [PowerPC] Add tests for `select` patterns. NFC. · dd3ba720
      Kai Luo authored
      dd3ba720
    • Arthur Eubanks's avatar
      Revert "Reland [CodeGen] emit CG profile for COFF object file" · a2578e92
      Arthur Eubanks authored
      This reverts commit 506b6170.
      
      This still causes link errors, see https://crbug.com/1130780.
      a2578e92
    • Max Kazantsev's avatar
    • Richard Smith's avatar
      Add profiling support for APValues. · df2a1f2a
      Richard Smith authored
      For C++20 P0732R2; unused so far. Will be used and tested by a follow-on
      commit.
      df2a1f2a
    • Richard Smith's avatar
      Canonicalize declaration pointers when forming APValues. · 9dcd96f7
      Richard Smith authored
      References to different declarations of the same entity aren't different
      values, so shouldn't have different representations.
      
      Recommit of e6393ee8 with fixed handling
      for weak declarations. We now look for attributes on the most recent
      declaration when determining whether a declaration is weak. (Second
      recommit with further fixes for mishandling of weak declarations. Our
      behavior here is fundamentally unsound -- see PR47663 -- but this
      approach attempts to not make things worse.)
      9dcd96f7
    • Valentin Clement's avatar
      [mlir][openacc] Add if, deviceptr operands and default attribute · fa08afc3
      Valentin Clement authored
      Add operands to represent if and deviceptr. Default clause is represented with
      an attribute.
      
      Reviewed By: kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D88331
      fa08afc3
    • Valentin Clement's avatar
      [mlir][openacc] Switch to assembly format for acc.data · 12ab4f8a
      Valentin Clement authored
      This patch remove the printer/parser for the acc.data operation since its syntax
      fits nicely with the assembly format. It reduces the maintenance for this op.
      
      Reviewed By: kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D88330
      12ab4f8a
    • Valentin Clement's avatar
      [mlir][openacc] Remove detach and delete operands from acc.data · 3d2bab17
      Valentin Clement authored
      This patch remove the detach and delete operands. Those operands represent the detach
      and delete clauses that will appear in another operation acc.exit_data
      
      Reviewed By: kiranktp, kiranchandramohan
      
      Differential Revision: https://reviews.llvm.org/D88326
      3d2bab17
    • Dávid Bolvanský's avatar
      [BuildLibCalls] Add noalias for strcat and stpcpy · 155ac333
      Dávid Bolvanský authored
      strcat:
      destination and source shall not overlap. (http://www.cplusplus.com/reference/cstring/strcat/)
      
      stpcpy:
      The strings may not overlap, and the destination string dest must be  large enough to receive the copy. (https://man7.org/linux/man-pages/man3/stpcpy.3.html)
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D88335
      155ac333
    • Joseph Huber's avatar
      [OpenMP] Add Missing _static Director for OpenMP Documentation · 0103df79
      Joseph Huber authored
      Summary:
      Adding a missing directory needed for generating Sphinx documentation without
      errors. Directory current contains a placeholder image just to populate the
      directory.
      0103df79
    • Nikita Popov's avatar
      [CVP] Remove unnecessary block splits in tests (NFC) · 01bde731
      Nikita Popov authored
      These are no longer necessary since D69686.
      01bde731
    • Nikita Popov's avatar
      [LVI][CVP] Use block value when simplifying icmps · fe79061b
      Nikita Popov authored
      Add a flag to getPredicateAt() that allows making use of the block
      value. This allows us to take into account range information from
      the current block, rather than only information that is threaded
      over edges, making the icmp simplification in CVP a lot more
      powerful.
      
      I'm not changing getPredicateAt() to use the block value
      unconditionally to avoid any impact on the JumpThreading pass,
      which is somewhat picky about LVI query order.
      
      Most test changes here are just icmps that now get dropped (while
      previously only a result used in a return was replaced). The three
      tests in icmp.ll show some representative improvements. Some of
      the folds this enables have been covered by IPSCCP in the meantime,
      but LVI can reason about some cases which are hard to support in
      IPSCCP, such as in test_br_cmp_with_offset.
      
      The compile-time time cost of doing this is fairly minimal, with
      a ~0.05% CTMark regression for ReleaseThinLTO:
      https://llvm-compile-time-tracker.com/compare.php?from=709d03f8af4da4204849a70f01798e7cebba2e32&to=6236fd503761f43c99f4537121e057a01056f185&stat=instructions
      
      This is because the block values will typically already be queried
      and cached by other CVP optimizations anyway.
      
      Differential Revision: https://reviews.llvm.org/D69686
      fe79061b
    • Fangrui Song's avatar
      [NewPM] Port ConstraintElimination to the new pass manager · 50bd71e1
      Fangrui Song authored
      If -enable-constraint-elimination is specified, add it to the -O2/-O3 pipeline.
      (-O1 uses a separate function now.)
      
      Reviewed By: fhahn, aeubanks
      
      Differential Revision: https://reviews.llvm.org/D88365
      50bd71e1
    • Benjamin Kramer's avatar
      [InstCombine] Simplify code. NFCI. · 7b782062
      Benjamin Kramer authored
      7b782062
    • Nikita Popov's avatar
      [CVP] Make srem test more robust (NFC) · 4f6e1194
      Nikita Popov authored
      D69686 will be able to determine that the icmp is always false.
      As this is not the purpose of the test, use a different modulus
      that doesn't trivialize the condition.
      4f6e1194
    • Nikita Popov's avatar
      [LVI] Clarify getValueAt/getValueInBlock doc comments (NFC) · 709d03f8
      Nikita Popov authored
      The lattice value returned by getValueInBlock() holds at the start
      of the block, not at the end. Also make it clearer what the
      difference between getValueInBlock() and getValueAt() is.
      709d03f8
    • Nikita Popov's avatar
      [LVI] Require context instruction in external API (NFCI) · 9b959b59
      Nikita Popov authored
      Require CxtI in getConstant() and getConstantRange() APIs.
      Accordingly drop the BB parameter, as it is implied by
      CxtI->getParent().
      
      This makes sure we don't forget to pass the context instruction,
      and makes the API contract clearer (also clean up the comments to
      that effect -- the value holds at the context instruction, not
      the end of the block).
      9b959b59
  2. Sep 27, 2020