1. Feb 11, 2023
    • Yitzhak Mandelbaum's avatar
      [clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`. · e7e577f6
      Yitzhak Mandelbaum authored
      Removes a reference to google-internal document and expands the relevant material in place.
      
      Fixes: #60633.
      
      Differential Revision: https://reviews.llvm.org/D143750
      e7e577f6
    • OCHyams's avatar
      [Assignment Tracking] Fix migrateDebuginfo in SROA · 295f5faf
      OCHyams authored
      Without this patch, migrateDebugInfo doesn't understand how to handle existing
      fragments that are smaller than the to-be-split store. This can occur
      if. e.g. a vector store (1 dbg.assign) is split (many dbg.assigns - 1 fragment
      for each scalar) and later those stores are re-vectorized (many dbg.assigns),
      and then SROA runs on that.
      
      The approach taken in this patch is to drop intrinsics with fragments outside
      of the slice.
      
      For example, starting with:
      
        store <2 x float> %v, ptr %dest !DIAssignID !1
        call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !1, ...)
        call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !1, ...)
      
      When visiting the slice of bits 0 to 31 we get:
      
        store float %v.extract.0, ptr %dest !DIAssignID !2
        call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !2, ...)
      
      The other dbg.assign associated with the currently-split store is dropped for
      this split part. And visiting bits 32 to 63 we get the following:
      
        store float %v.extract.1, ptr %adjusted.dest !DIAssignID !3
        call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !3, ...)
      
      I've added two tests that cover this case.
      
      Implementing this meant re-writing the fragment-calculation part of
      migrateDebugInfo to work with the absolute offset of the new slice in terms of
      the base alloca (instead of the offset of the slice into the new alloca), the
      fragment (if any) of the variable associated with the base alloca, and the
      fragment associated with the split store. Because we need the offset into the
      base alloca for the variables being split, some careful wiring is required for
      memory intrinsics due to the fact that memory intrinsics can be split when
      either the source or dest allocas are split. In the case where the source
      alloca drives the splitting, we need to be careful to pass migrateDebugInfo the
      information in relation to the dest alloca.
      
      Reviewed By: StephenTozer
      
      Differential Revision: https://reviews.llvm.org/D143146
      295f5faf
    • David Green's avatar
      [AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2) · c52255d2
      David Green authored
      The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This
      reassociates it back to allow the creation of more mls instructions.
      
      Differential Revision: https://reviews.llvm.org/D143143
      c52255d2
    • Craig Topper's avatar
      [X86] Attempt to fix ubsan failure. · d37a31cf
      Craig Topper authored
      operator~ promote the single bit input to int. The ~ will cause the upper
      31 bits to become 1s making it a negative value. This is undefined for
      shift.
      
      Mask it back down to a single bit.
      
      The extra 1s were being shifted to bit 8 and above and the they aren't
      used by the emitByte call so this shouldn't be a functional change.
      d37a31cf
    • Benjamin Kramer's avatar
      [bazel] Port 81a79ee4 · 185dbf9d
      Benjamin Kramer authored
      185dbf9d
    • Johannes Doerfert's avatar
      1763c632
    • Johannes Doerfert's avatar
      [Attributor][NFCI] Avoid AAIntraFnReachability updates if possible · 86cce90e
      Johannes Doerfert authored
      Even if liveness changed, we only care about certain dead edges in
      AAIntraFnReachability. If those are still dead, we can avoid an update.
      86cce90e
    • Johannes Doerfert's avatar
      [Attributor][NFCI] Use queries without exclusion set whenever possible · a9557aac
      Johannes Doerfert authored
      If a query uses an exclusion set but we haven't used it to determine the
      result, we can cache the query without exclusion set too. When we lookup
      a cached result we can check for the non-exclusion set version first.
      a9557aac
    • Johannes Doerfert's avatar
    • Johannes Doerfert's avatar
      [Attributor][NFC] Avoid unnecessary string operations · 76a19190
      Johannes Doerfert authored
      This caused multiple string operations which we don't need if we do not
      create a profile.
      76a19190
    • Johannes Doerfert's avatar
    • Johannes Doerfert's avatar
      [Attributor][NFCI] Avoid a temporary vector and exit early · 8bc0bee2
      Johannes Doerfert authored
      This change simply avoids the temporary vector and processes the elments
      right away.
      8bc0bee2
    • Louis Dionne's avatar
      [libc++][NFC] Reorganize hash.h · 91e38bc7
      Louis Dionne authored
      - Add missing _LIBCPP_HIDE_FROM_ABI
      - Implement inline functions in the class to simplify the code
      - Add missing `const` to `operator()`
      - Move _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK to the usual location for function attributes
      
      Differential Revision: https://reviews.llvm.org/D143668
      91e38bc7
    • Michael Buch's avatar
      [lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing · b296ddd9
      Michael Buch authored
      **Summary**
      
      This patch addresses the case where we have a `DW_AT_external`
      subprogram for a constructor (and/or destructor) that doesn't carry
      a `DW_AT_linkage_name` attribute. The corresponding DIE(s) that
      represent the definition will have a linkage name, but if the name
      contains constructs that LLDBs fallback mechanism for guessing mangled
      names to resolve external symbols doesn't support (e.g., abi-tags)
      then we end up failing to resolve the function call.
      
      We address this by trying to find the linkage name before we create
      the constructor/destructor decl, which will get attached using
      an `AsmLabelAttr` to make symbol resolution easier.
      
      **Testing**
      
      * Added API test
      
      Differential Revision: https://reviews.llvm.org/D143652
      b296ddd9
    • Michael Buch's avatar
      Reland "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table" · b8ef007f
      Michael Buch authored
      This relands the commit previously reverted in
      `8570bee5` due to failures on linux.
      
      The problem was that the test executable was built with absolute
      OSO prefix paths. This re-commit adds a modified version of the
      executable that strips the absolute OSO prefix paths and makes
      sure the test appends the OSO prefix appropriately (via the appropriate
      dsymutil flags).
      
      Differential Revision: https://reviews.llvm.org/D143458
      b8ef007f
    • Florian Hahn's avatar
      [ConstraintElim] Update getLastConstraint to return to last row. (NFC) · 94976800
      Florian Hahn authored
      The current code incorrectly returned the first instead of the last row.
      This fixes the debug output.
      94976800
    • Slava Zakharin's avatar
      [flang] Fixed selective TargetRewrite. · ff8742df
      Slava Zakharin authored
      Some conversions were still happening under no-complex/character-conversion
      options. This change fixes that and adds a LIT test.
      
      Differential Revision: https://reviews.llvm.org/D143685
      ff8742df
    • Markus Böck's avatar
      [mlir][OpenMP] Add support for using Opaque Pointers in the OpenMP Dialect · 81767f52
      Markus Böck authored
      The current OpenMP implementation assumes the use of typed pointers (or rather typed pointer like types). Given the support for typed pointers in LLVM is now pending removal, the OpenMP Dialect should be able to support opaque pointers as well, given that any users of it must lower OpenMP through the LLVM Dialect.
      
      This patch fixes the above and adds support for using LLVM opaque pointers with the OpenMP dialect. This is implemented by making all related code not make use of the element type of pointer arguments. The few (one) op requiring a pointer element type now use an explicit `TypeAttr` for representing the element type.
      More concretely, the list of changes are:
      * `omp.atomic.read` now has an extra `TypeAttr` (also in syntax) which is the element type of the values read and stored from the operands
      * `omp.reduction` now has an type argument in the syntax for both the accmulator and operand since the operand type can no longer be inferred from the accumulator
      * `OpenMPToLLVMIRTranslation.cpp` was rewritten to never query element types of pointers
      * Adjusted the verifier to be able to handle pointers without element types
      
      Differential Revision: https://reviews.llvm.org/D143582
      81767f52
    • Markus Böck's avatar
      [mlir][Async] Add option to LLVM lowering to use opaque pointers · 2ca46421
      Markus Böck authored
      Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
      
      This patch adds the pass option 'use-opaque-pointers' to allow the dialect conversion from async to LLVM to create LLVM opaque pointers instead of typed pointers.
      The gist of the changes boil down to having to propagate the choice of whether opaque or typed pointers should be used, to various helper functions that then either create typed pointers or opaque pointers.
      This sadly creates a bit of a code duplication in comparison to other patches in this series, which I think is mostly unavoidable however, since a lot of the patterns in this lowering require the use of the AsyncTypeConverter, instead of the LLVMTypeConverter.
      
      Besides that, the tests have been converter to opaque pointers with one file with typed pointer support having been created as regression tests.
      
      Differential Revision: https://reviews.llvm.org/D143661
      2ca46421
    • Daniel Grumberg's avatar
      [clang] [extract-api] Don't crash for category in libclang APIs · 7da2d644
      Daniel Grumberg authored
      Remove failure conditions for categories in libclang and return empty
      content instead.
      
      Differential Revision: https://reviews.llvm.org/D142101
      7da2d644
    • Florian Hahn's avatar
      [ConstraintElim] Improve debug test to show removed constraints (NFC). · 57606bb3
      Florian Hahn authored
      The current checks show incorrect debug output.
      57606bb3
    • Tom Eccles's avatar
      [mlir] Add function for checking if a block is inside a loop · 81a79ee4
      Tom Eccles authored
      This function returns whether a block is nested inside of a loop. There
      can be three kinds of loop:
        1) The block is nested inside of a LoopLikeOpInterface
        2) The block is nested inside another block which is in a loop
        3) There is a cycle in the control flow graph
      
      This will be useful for Flang's stack arrays pass, which moves array
      allocations from the heap to the stack. Special handling is needed when
      allocations occur inside of loops to ensure additional stack space is
      not allocated on each loop iteration.
      
      Differential Revision: https://reviews.llvm.org/D141401
      81a79ee4
  2. Feb 10, 2023