1. Nov 27, 2021
  2. Nov 26, 2021
    • David Spickett's avatar
      Revert "Reland "[lldb] Remove non address bits when looking up memory regions"" · 0df52296
      David Spickett authored
      This reverts commit fac3f20d.
      
      I found this has broken how we detect the last memory region in
      GetMemoryRegions/"memory region" command.
      
      When you're debugging an AArch64 system with pointer authentication,
      the ABI plugin will remove the top bit from the end address of the last
      user mapped area.
      
      (lldb)
      [0x0000fffffffdf000-0x0001000000000000) rw- [stack]
      
      ABI plugin removes anything above the 48th bit (48 bit virtual addresses
      by default on AArch64, leaving an address of 0.
      
      (lldb)
      [0x0000000000000000-0x0000000000400000) ---
      
      You get back a mapping for 0 and get into an infinite loop.
      0df52296
    • Kirill Bobyrev's avatar
      [clangd] IncludeCleaner: Attribute symbols from non self-contained headers to their parents · 34cc210a
      Kirill Bobyrev authored
      When a symbol comes from the non self-contained header, we recursively uplift
      the file we consider used to the first includer that has a header guard. We
      need to do this while we still have FileIDs because every time a non
      self-contained header is included, it gets a new FileID but is later
      deduplicated by HeaderID and it's not possible to understand where it was
      included from.
      
      Based on D114370.
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D114623
      34cc210a
    • Alexey Bataev's avatar
      [SLP]Improve analysis/emission of vector operands for alternate nodes. · fc0aacf3
      Alexey Bataev authored
      Compiler has an analysis for perfect diamond matching but it does not
      support nodes with main/alternate opcodes. The problem is that the
      scalars themselves are different and might not match directly with other
      nodes, but operands and main/alternate opcodes might match and compiler
      might reuse some previously emitted vector instructions. Need to include
      this analysis in the cost model and actual vector instructions emission
      process.
      
      Differential Revision: https://reviews.llvm.org/D114101
      fc0aacf3
    • Ruslan Arutyunyan's avatar
      [pstl] Fix incorrect usage of std::invoke_result · f824bb0e
      Ruslan Arutyunyan authored
      std::invoke_result takes function object type and arguments separately
      (unlike std::result_of) so, std::invoke_result_t<F()> usage is
      incorrect.
      
      On the other hand, we don't need std::invoke() semantics here at all. So
      just simplifying the code without extra dependency and use trailing
      return type as the fix.
      
      Reviewed By: MikeDvorskiy
      
      Differential Revision: https://reviews.llvm.org/D114624
      f824bb0e
    • Mats Petersson's avatar
      [mlir][OpenMP] Add support for SIMD modifier · 30238c36
      Mats Petersson authored
      Add support for SIMD modifier in OpenMP worksharing loops.
      
      Reviewed By: ftynse
      
      Differential Revision: https://reviews.llvm.org/D111051
      30238c36
    • Alexey Bataev's avatar
    • Venkata Ramanaiah Nalamothu's avatar
      [Bug 49018][lldb] Fix incorrect help text for 'memory write' command · 7f05ff8b
      Venkata Ramanaiah Nalamothu authored
      Certain commands like 'memory write', 'register read' etc all use
      the OptionGroupFormat options but the help usage text for those
      options is not customized to those commands.
      
      One such example is:
      
        (lldb) help memory read
                 -s <byte-size> ( --size <byte-size> )
                     The size in bytes to use when displaying with the selected format.
        (lldb) help memory write
      	   -s <byte-size> ( --size <byte-size> )
                     The size in bytes to use when displaying with the selected format.
      
      This patch allows such commands to overwrite the help text for the options
      in the OptionGroupFormat group as needed and fixes help text of memory write.
      
      llvm.org/pr49018.
      
      Reviewed By: DavidSpickett
      
      Differential Revision: https://reviews.llvm.org/D114448
      7f05ff8b
    • Florian Hahn's avatar
      [SCEV] Turn check in createSimpleAffineAddRec to assertion. (NFC) · b927aa69
      Florian Hahn authored
      Accum is guaranteed to be defined outside L (via Loop::isLoopInvariant
      checks above). I think that should guarantee that the more powerful
      ScalarEvolution::isLoopInvariant also determines that the value is loop
      invariant.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D114634
      b927aa69
    • Matthias Springer's avatar
      [mlir][linalg][bufferize][NFC] InsertSliceOp no-copy detection as PostAnalysis · b62b21b9
      Matthias Springer authored
      There is special logic for InsertSliceOp to check if a memcpy is needed. This change extracts that piece of code and makes it a PostAnalysisStep.
      
      The purpose of this change is to untangle `bufferize` from BufferizationAliasInfo. (Not fully there yet.)
      
      Differential Revision: https://reviews.llvm.org/D114513
      b62b21b9
    • Kirill Bobyrev's avatar
      [clangd] Record information about non self-contained headers in IncludeStructure · cd0ca5a0
      Kirill Bobyrev authored
      This will be useful for IncludeCleaner.
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D114370
      cd0ca5a0
    • Benjamin Kramer's avatar
      Provide a definition for OperationPosition::kDown · 8521850f
      Benjamin Kramer authored
      This isn't necessary in C++17, but C++14 still requires it.
      8521850f
    • Benjamin Kramer's avatar
      1b0312d2
    • Benjamin Kramer's avatar
    • Jan Svoboda's avatar
      [clang][deps] NFC: Extract function · 97e504cf
      Jan Svoboda authored
      This commits extracts a couple of nested conditions into a separate function with early returns, making the control flow easier to understand.
      97e504cf
    • Stanislav Funiak's avatar
      Added line numbers to the debug output of PDL bytecode. · d35f1190
      Stanislav Funiak authored
      This is a small diff that splits out the debug output for PDL bytecode. When running bytecode with debug output on, it is useful to know the line numbers where the PDLIntepr operations are performed. Usually, these are in a single MLIR file, so it's sufficient to print out the line number rather than the entire location (which tends to be quite verbose). This debug output is gated by `LLVM_DEBUG` rather than `#ifndef NDEBUG` to make it easier to test.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D114061
      d35f1190
    • Stanislav Funiak's avatar
      Multi-root PDL matching using upward traversals. · a76ee58f
      Stanislav Funiak authored
      This is commit 4 of 4 for the multi-root matching in PDL, discussed in https://llvm.discourse.group/t/rfc-multi-root-pdl-patterns-for-kernel-matching/4148 (topic flagged for review).
      
      This PR integrates the various components (root ordering algorithm, nondeterministic execution of PDL bytecode) to implement multi-root PDL matching. The main idea is for the pattern to specify mulitple candidate roots. The PDL-to-PDLInterp lowering selects one of these roots and "hangs" the pattern from this root, traversing the edges downwards (from operation to its operands) when possible and upwards (from values to its uses) when needed. The root is selected by invoking the optimal matching multiple times, once for each candidate root, and the connectors are determined form the optimal matching. The costs in the directed graph are equal to the number of upward edges that need to be traversed when connecting the given two candidate roots. It can be shown that, for this choice of the cost function, "hanging" the pattern an inner node is no better than from the optimal root.
      
      The following three main additions were implemented as a part of this PR:
      1. OperationPos predicate has been extended to allow tracing the operation accepting a value (the opposite of operation defining a value).
      2. Predicate checking if two values are not equal - this is useful to ensure that we do not traverse the edge back downwards after we traversed it upwards.
      3. Function for for building the cost graph among the candidate roots.
      4. Updated buildPredicateList, building the predicates optimal branching has been determined.
      
      Testing: unit tests (an integration test to follow once the stack of commits has landed)
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D108550
      a76ee58f
    • Stanislav Funiak's avatar
      Implementation of the root ordering algorithm · 6df7cc7f
      Stanislav Funiak authored
      This is commit 3 of 4 for the multi-root matching in PDL, discussed in https://llvm.discourse.group/t/rfc-multi-root-pdl-patterns-for-kernel-matching/4148 (topic flagged for review).
      
      We form a graph over the specified roots, provided in `pdl.rewrite`, where two roots are connected by a directed edge if the target root can be connected (via a chain of operations) in the underlying pattern to the source root. We place a restriction that the path connecting the two candidate roots must only contain the nodes in the subgraphs underneath these two roots. The cost of an edge is the smallest number of upward traversals (edges) required to go from the source to the target root, and the connector is a `Value` in the intersection of the two subtrees rooted at the source and target root that results in that smallest number of such upward traversals. Optimal root ordering is then formulated as the problem of finding a spanning arborescence (i.e., a directed spanning tree) of minimal weight.
      
      In order to determine the spanning arborescence (directed spanning tree) of minimum weight, we use the [Edmonds' algorithm](https://en.wikipedia.org/wiki/Edmonds%27_algorithm). The worst-case computational complexity of this algorithm is O(_N_^3) for a single root, where _N_ is the number of specified roots. The `pdl`-to-`pdl_interp` lowering calls this algorithm as a subroutine _N_ times (once for each candidate root), so the overall complexity of root ordering is O(_N_^4). If needed, this complexity could be reduced to O(_N_^3) with a more efficient algorithm. However, note that the underlying implementation is very efficient, and _N_ in our instances tends to be very small (<10). Therefore, we believe that the proposed (asymptotically suboptimal) implementation will suffice for now.
      
      Testing: a unit test of the algorithm
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D108549
      6df7cc7f
    • Stanislav Funiak's avatar
      Introduced iterative bytecode execution. · 3eb1647a
      Stanislav Funiak authored
      This is commit 2 of 4 for the multi-root matching in PDL, discussed in https://llvm.discourse.group/t/rfc-multi-root-pdl-patterns-for-kernel-matching/4148 (topic flagged for review).
      
      This commit implements the features needed for the execution of the new operations pdl_interp.get_accepting_ops, pdl_interp.choose_op:
      1. The implementation of the generation and execution of the two ops.
      2. The addition of Stack of bytecode positions within the ByteCodeExecutor. This is needed because in pdl_interp.choose_op, we iterate over the values returned by pdl_interp.get_accepting_ops until we reach finalize. When we reach finalize, we need to return back to the position marked in the stack.
      3. The functionality to extend the lifetime of values that cross the nondeterministic choice. The existing bytecode generator allocates the values to memory positions by representing the liveness of values as a collection of disjoint intervals over the matcher positions. This is akin to register allocation, and substantially reduces the footprint of the bytecode executor. However, because with iterative operation pdl_interp.choose_op, execution "returns" back, so any values whose original liveness cross the nondeterminstic choice must have their lifetime executed until finalize.
      
      Testing: pdl-bytecode.mlir test
      
      Reviewed By: rriddle, Mogball
      
      Differential Revision: https://reviews.llvm.org/D108547
      3eb1647a
    • Igor Kirillov's avatar
      [AArch64][SVEIntrinsicOpts] Fix: predicated SVE mul/fmul are not commutative · 08d45e6f
      Igor Kirillov authored
      We can not swap multiplicand and multiplier because the sve intrinsics
      are predicated. Imagine lanes in vectors having the following values:
               pg = 0
               multiplicand = 1 (from dup)
               multiplier = 2
      The resulting value should be 1, but if we swap multiplicand and multiplier it will become 2,
      which is incorrect.
      
      Differential Revision: https://reviews.llvm.org/D114577
      08d45e6f
    • Bhumitram Kumar's avatar
      [Docs] Removed /Zd flag still mentioned in documentation · a3b099b6
      Bhumitram Kumar authored
      https://reviews.llvm.org/D93458 removed the /Zd flag as MSVC doesn't support that syntax. Instead users should be using -gline-tables-only.
      The /Zd flag is still mentioned at https://clang.llvm.org/docs/UsersManual.html#clang-cl :   /Zd                     Emit debug line number tables only.
      
      Fix PR52571
      
      Reviewed By: xgupta
      
      Differential Revision: https://reviews.llvm.org/D114632
      a3b099b6
    • Stanislav Funiak's avatar
      Defines new PDLInterp operations needed for multi-root matching in PDL. · 842b6861
      Stanislav Funiak authored
      This is commit 1 of 4 for the multi-root matching in PDL, discussed in https://llvm.discourse.group/t/rfc-multi-root-pdl-patterns-for-kernel-matching/4148 (topic flagged for review).
      
      These operations are:
      * pdl.get_accepting_ops: Returns a list of operations accepting the given value or a range of values at the specified position. Thus if there are two operations `%op1 = "foo"(%val)` and `%op2 = "bar"(%val)` accepting a value at position 0, `%ops = pdl_interp.get_accepting_ops of %val : !pdl.value at 0` will return both of them. This allows us to traverse upwards from a value to operations accepting the value.
      * pdl.choose_op: Iteratively chooses one operation from a range of operations. Therefore, writing `%op = pdl_interp.choose_op from %ops` in the example above will select either `%op1`or `%op2`.
      
      Testing: Added the corresponding test cases to mlir/test/Dialect/PDLInterp/ops.mlir.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D108543
      842b6861
    • Daniel Kiss's avatar
      [libunwind][ARM] Handle end of stack during unwind · 632acec7
      Daniel Kiss authored
      When unwind step reaches the end of the stack that means the force unwind should notify the stop function.
      This is not an error, it could mean just the thread is cleaned up completely.
      
      Reviewed By: #libunwind, mstorsjo
      
      Differential Revision: https://reviews.llvm.org/D109856
      632acec7
    • Carl Ritson's avatar
      [AMDGPU] Add SIMemoryLegalizer comments to clarify bit usage · 8967d044
      Carl Ritson authored
      Attempt to further document the intended cache policies requested
      by different combinations of GLC, SLC and DLC bits.
      GFX10 non-temporal stores are updated to set GLC.
      
      Reviewed By: t-tye
      
      Differential Revision: https://reviews.llvm.org/D114351
      8967d044