1. Mar 12, 2021
    • River Riddle's avatar
      [mlir][StorageUniquer] Properly call the destructor on non-trivially destructible storage instances · 31bb8efd
      River Riddle authored
      This allows for storage instances to store data that isn't uniqued in the context, or contain otherwise non-trivial logic, in the rare situations that they occur. Storage instances with trivial destructors will still have their destructor skipped. A consequence of this is that the storage instance definition must be visible from the place that registers the type.
      
      Differential Revision: https://reviews.llvm.org/D98311
      31bb8efd
    • Kadir Cetinkaya's avatar
      [clangd] Make ProjectAwareIndex optionally sync · dc9c0963
      Kadir Cetinkaya authored
      Depends on D98029.
      
      Differential Revision: https://reviews.llvm.org/D98165
      dc9c0963
    • Kadir Cetinkaya's avatar
      [clangd] Add config block for Completion and option for AllScopes · ac292daf
      Kadir Cetinkaya authored
      Depends on D98029
      
      Differential Revision: https://reviews.llvm.org/D98037
      ac292daf
    • Wei Mi's avatar
      [IndirectCallPromotion] Don't strip ".__uniq." suffix when it strips · 90dfbeef
      Wei Mi authored
      ".llvm." suffix.
      
      Currently IndirectCallPromotion simply strip everything after the first "."
      in LTO mode, in order to match the symbol name and the name with ".llvm."
      suffix in the value profile. However, if -funique-internal-linkage-names
      and thinlto are both enabled, the name may have both ".__uniq." suffix and
      ".llvm." suffix, and the current mechanism will strip them both, which is
      unexpected. The patch fixes the problem.
      
      Differential Revision: https://reviews.llvm.org/D98389
      90dfbeef
    • Martin Storsjö's avatar
      [libcxx] Test accessing a directory on windows that gives "access denied" errors · e69c65d5
      Martin Storsjö authored
      Fix handling of skip_permission_denied on windows; after converting
      the return value of GetLastError() to a standard error_code, ec.value()
      is in the standard errc range, not a native windows error code. This
      was missed in 15618072.
      
      The directory "C:\System Volume Information" does seem to exist and
      have these properties on most relevant contempory setups.
      
      Differential Revision: https://reviews.llvm.org/D98166
      e69c65d5
    • LemonBoy's avatar
      [SelectionDAG] Improve scalarization of irregular vector types · cfe69c8e
      LemonBoy authored
      Use a more general strategy when splitting a vector into scalar parts (and vice-versa) to correctly handle vector types whose element size is not a power of 2 (and a multiple of 8).
      
      Reviewed By: atanasyan
      
      Differential Revision: https://reviews.llvm.org/D98273
      cfe69c8e
    • LemonBoy's avatar
      [MIPS] Fix lowering of irregular vector arguments · cc999c95
      LemonBoy authored
      The code deciding how to split the vector in register-sized integers used the integer division operator, thus rounding down the result.
      Correct the computation for irregularly-sized types (non-power-of-two, non multiple of 8) by rounding the division result upwards.
      
      Reviewed By: atanasyan
      
      Differential Revision: https://reviews.llvm.org/D98189
      cc999c95
    • Raphael Isemann's avatar
      [lldb] Fix the man page build · 75f97cda
      Raphael Isemann authored
      In D94489 we changed the way we build the docs and now have some additional
      dependencies to generate the Python API docs. As the same sphinx project is
      generating the man pages for LLDB it should have in theory the same setup code
      that sets up the mocked LLDB module.
      
      However, as we don't have that setup code the man page generation just fails as
      there is no mocked LLDB module and the Python API generation errors out.
      
      The man page anyway doesn't cover the Python API so I don't think there is any
      point of going through the whole process (and requiring the sphinx plugins) just
      to generate the (eventually unused) Python docs.
      
      This patch just skips the relevant Python API generation when we are building
      the man page.
      
      Reviewed By: JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D98441
      75f97cda
    • Diego Caballero's avatar
      [mlir][Vector][Affine] Fix heap-use-after-free in vectorizer · ed193bce
      Diego Caballero authored
      This patch fixes a heap-use-after-free introduced by the recent changes
      in the vectorizer: https://reviews.llvm.org/rG95db7b4aeaad590f37720898e339a6d54313422f
      The problem is due to the way candidate loops are visited. All candidate loops
      are pattern-matched beforehand using the 'NestedMatch' utility. These matches may
      intersect with each other so it may happen that we try to vectorize a loop that
      was previously vectorized. The new vectorization algorithm replaces the original
      loops that are vectorized with new loops and, therefore, any reference to the
      original loops in the pre-computed matches becomes invalid.
      
      This patch fixes the problem by classifying the candidate matches into buckets
      before vectorization. Each bucket contains all the matches that intersect. The
      vectorizer uses these buckets to make sure that we only vectorize *one* match from
      each bucket, at most.
      
      Differential Revision: https://reviews.llvm.org/D98382
      ed193bce
    • LLVM GN Syncbot's avatar
      [gn build] Port 5433a791 · 0cb0c6be
      LLVM GN Syncbot authored
      0cb0c6be
    • Jez Ng's avatar
      29bbbd06
    • Jez Ng's avatar
      [lld-macho] Avoid requiring shell in tests · d1e57ee9
      Jez Ng authored
      There are 3 remaining tests that still have `REQUIRE: shell`:
      * color-diagnostics.test -- seems necessary for ANSI escape sequence support
      * stabs.s -- the shell part could be removed, but I don't think we can support
        the test on Windows anyway due to its reliance on `touch` to set the modtime
      * framework.s -- uses symlinks, I'm not sure this works on Windows
      
      Addresses PR49512.
      
      Reviewed By: #lld-macho, alexshap
      
      Differential Revision: https://reviews.llvm.org/D98395
      d1e57ee9
    • Jez Ng's avatar
      [lld-macho][nfc] Refactor subtractor reloc handling · a723db92
      Jez Ng authored
      SUBTRACTOR relocations are always paired with UNSIGNED
      relocations to indicate a pair of symbols whose address difference we
      want. Functionally they are like a single relocation: only one pointer
      gets written / relocated. Previously, we would handle these pairs by
      skipping over the SUBTRACTOR relocation and writing the pointer when
      handling the UNSIGNED reloc. This diff reverses things, so we write
      while handling SUBTRACTORs and skip over the UNSIGNED relocs instead.
      
      Being able to distinguish between SUBTRACTOR and UNSIGNED relocs in the
      write phase (i.e. inside `relocateOne`) is useful for the upcoming range
      check diff: we want to check that SUBTRACTOR relocs write signed values,
      but UNSIGNED relocs (naturally) write unsigned values.
      
      Reviewed By: #lld-macho, thakis
      
      Differential Revision: https://reviews.llvm.org/D98386
      a723db92
    • Jez Ng's avatar
      [lld-macho] Fix handling of X86_64_RELOC_SIGNED_{1,2,4} · e8a30583
      Jez Ng authored
      The previous implementation miscalculated the addend, resulting
      in an underflow. This meant that every SIGNED_N section relocation would
      be associated with the last subsection (since the addend would now be a
      huge number). We were "lucky" that this mistake was typically cancelled
      out -- 64-to-32-bit-truncation meant that the final value was correct,
      as long as subsections were not rearranged.
      
      Reviewed By: #lld-macho, thakis
      
      Differential Revision: https://reviews.llvm.org/D98385
      e8a30583
    • Jez Ng's avatar
      [lld-macho][nfc] Create Relocations.{h,cpp} for relocation-specific code · 5433a791
      Jez Ng authored
      This more closely mirrors the structure of lld-ELF.
      
      Reviewed By: #lld-macho, thakis
      
      Differential Revision: https://reviews.llvm.org/D98384
      5433a791
    • Jez Ng's avatar
      [lld-macho][nfc] Remove `MachO::` prefix where possible · 1752f285
      Jez Ng authored
      Previously, SyntheticSections.cpp did not have a top-level `using namespace
      llvm::MachO` because it caused a naming conflict: `llvm::MachO::Symbol` would
      collide with `lld::macho::Symbol`.
      
      `MachO::Symbol` represents the symbols defined in InterfaceFiles (TBDs). By
      moving the inclusion of InterfaceFile.h into our .cpp files, we can avoid this
      name collision in other files where we are only dealing with LLD's own symbols.
      
      Along the way, I removed all unnecessary "MachO::" prefixes in our code.
      
      Cons of this approach: If TextAPI/MachO/Symbol.h gets included via some other
      header file in the future, we could run into this collision again.
      
      Alternative 1: Have either TextAPI/MachO or BinaryFormat/MachO.h use a different
      namespace. Most of the benefit of `using namespace llvm::MachO` comes from being
      able to use things in BinaryFormat/MachO.h conveniently; if TextAPI was under a
      different (and fully-qualified) namespace like `llvm::tapi` that would solve our
      problems. Cons: lots of files across llvm-project will need to be updated, and
      folks who own the TextAPI code need to agree to the name change.
      
      Alternative 2: Rename our Symbol to something like `LldSymbol`. I think this is
      ugly.
      
      Personally I think alternative #1 is ideal, but I'm not sure the effort to do it is
      worthwhile, this diff's halfway solution seems good enough to me. Thoughts?
      
      Reviewed By: #lld-macho, oontvoo, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D98149
      1752f285
    • Martin Storsjö's avatar
      [libcxx] [test] Disable a test regarding error behaviour for excessively long paths on windows · 8ba05e14
      Martin Storsjö authored
      Checking for the existence of an invalid long path name isn't
      an error in itself on windows.
      
      Differential Revision: https://reviews.llvm.org/D98141
      8ba05e14
    • Peter Steinfeld's avatar
      [flang] Handle type-bound procedures with alternate returns · 868187df
      Peter Steinfeld authored
      If you specify a type-bound procedure with an alternate return, there
      will be no symbol associated with that dummy argument.  In such cases,
      the compiler's list of dummy arguments will contain a nullptr.  In our
      analysis of the PASS arguments of type-bound procedures, we were
      assuming that all dummy arguments had non-null symbols associated with
      them and were using that assumption to get the name of the dummy
      argument.  This caused the compiler to try to dereference a nullptr.
      
      I fixed this by explicitly checking for a nullptr and, in such cases, emitting
      an error message.  I also added tests that contain type-bound procedures with
      alternate returns in both legal and illegal constructs to ensure that semantic
      analysis is working for them.
      
      Differential Revision: https://reviews.llvm.org/D98430
      868187df
    • Wenlei He's avatar
      [SamplePGO] Skip inlinee profile scaling for sample loader inlining · 051f2c14
      Wenlei He authored
      For CGSCC inline, we need to scale down a function's branch weights and entry counts when thee it's inlined at a callsite. This is done through updateCallProfile. Additionally, we also scale the weigths for the inlined clone based on call site count in updateCallerBFI. Neither is needed for inlining during sample profile loader as it's using context profile that is separated from inlinee's own profile. This change skip the inlinee profile scaling for sample loader inlining.
      
      Differential Revision: https://reviews.llvm.org/D98187
      051f2c14
    • Fangrui Song's avatar
      [Driver] Drop $sysroot/usr special case from Gentoo gcc-config detection · 8d8a9190
      Fangrui Song authored
      If --gcc-toolchain is specified, we should detect GCC installation there, and suppress other directories for detection.
      
      Reviewed By: mgorny, manojgupta
      
      Differential Revision: https://reviews.llvm.org/D97894
      8d8a9190
    • Nikita Popov's avatar
      [UnitTests] Remove uses of deprecated CreateLoad() API · 7046b2b2
      Nikita Popov authored
      Missed this usage inside OpenMPIRBuilderTest.
      7046b2b2
    • Craig Topper's avatar
      [RISCV] Support fixed vector copysign. · c82f4429
      Craig Topper authored
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D98394
      c82f4429
    • David Green's avatar
      [ARM] Move t2DoLoopStart reg alloc hint · bd516d24
      David Green authored
      This adjusts the place that the t2DoLoopStart reg allocation hint is
      inserted, adding it in the ARMTPAndVPTOptimizaionPass in a similar place
      as other tail predicated loop optimizations. This removes the need for
      doing so in a custom inserter, and should make the hint more accurate,
      only adding it where we expect to create a DLS (not DLSTP or WLS).
      bd516d24
    • David Green's avatar
      [ARM] Improve WLS lowering · fad70c30
      David Green authored
      Recently we improved the lowering of low overhead loops and tail
      predicated loops, but concentrated first on the DLS do style loops. This
      extends those improvements over to the WLS while loops, improving the
      chance of lowering them successfully. To do this the lowering has to
      change a little as the instructions are terminators that produce a value
      - something that needs to be treated carefully.
      
      Lowering starts at the Hardware Loop pass, inserting a new
      llvm.test.start.loop.iterations that produces both an i1 to control the
      loop entry and an i32 similar to the llvm.start.loop.iterations
      intrinsic added for do loops. This feeds into the loop phi, properly
      gluing the values together:
      
        %wls = call { i32, i1 } @llvm.test.start.loop.iterations.i32(i32 %div)
        %wls0 = extractvalue { i32, i1 } %wls, 0
        %wls1 = extractvalue { i32, i1 } %wls, 1
        br i1 %wls1, label %loop.ph, label %loop.exit
      ...
      loop:
        %lsr.iv = phi i32 [ %wls0, %loop.ph ], [ %iv.next, %loop ]
        ..
        %iv.next = call i32 @llvm.loop.decrement.reg.i32(i32 %lsr.iv, i32 1)
        %cmp = icmp ne i32 %iv.next, 0
        br i1 %cmp, label %loop, label %loop.exit
      
      The llvm.test.start.loop.iterations need to be lowered through ISel
      lowering as a pair of WLS and WLSSETUP nodes, which each get converted
      to t2WhileLoopSetup and t2WhileLoopStart Pseudos. This helps prevent
      t2WhileLoopStart from being a terminator that produces a value,
      something difficult to control at that stage in the pipeline. Instead
      the t2WhileLoopSetup produces the value of LR (essentially acting as a
      lr = subs rn, 0), t2WhileLoopStart consumes that lr value (the Bcc).
      
      These are then converted into a single t2WhileLoopStartLR at the same
      point as t2DoLoopStartTP and t2LoopEndDec. Otherwise we revert the loop
      to prevent them from progressing further in the pipeline. The
      t2WhileLoopStartLR is a single instruction that takes a GPR and produces
      LR, similar to the WLS instruction.
      
        %1:gprlr = t2WhileLoopStartLR %0:rgpr, %bb.3
        t2B %bb.1
      ...
      bb.2.loop:
        %2:gprlr = PHI %1:gprlr, %bb.1, %3:gprlr, %bb.2
        ...
        %3:gprlr = t2LoopEndDec %2:gprlr, %bb.2
        t2B %bb.3
      
      The t2WhileLoopStartLR can then be treated similar to the other low
      overhead loop pseudos, eventually being lowered to a WLS providing the
      branches are within range.
      
      Differential Revision: https://reviews.llvm.org/D97729
      fad70c30
    • Simon Wallis's avatar
      [AArch64] Fix -Wunused-but-set-variable in GCC non-debug build · b68bae6a
      Simon Wallis authored
      [AArch64] Fix -Wunused-but-set-variable in GCC -DLLVM_ENABLE_ASSERTIONS=off non-debug build.
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D98431
      b68bae6a
    • Hiroshi Yamauchi's avatar
      [PGO] Fix two issues in PGOMemOPSizeOpt. · 365b225d
      Hiroshi Yamauchi authored
      1. PGOMemOPSizeOpt grabs only the first, up to five (by default) entries from
      the value profile metadata and preserves the remaining entries for the fallback
      memop call site. If there are more than five entries, the rest of the entries
      would get dropped. This is fine for PGOMemOPSizeOpt itself as it only promotes
      up to 3 (by default) values, but potentially not for other downstream passes
      that may use the value profile metadata.
      
      2. PGOMemOPSizeOpt originally assumed that only values 0 through 8 are kept
      track of. When the range buckets were introduced, it was changed to skip the
      range buckets, but since it does not grab all entries (only five), if some range
      buckets exist in the first five entries, it could potentially cause fewer
      promotion opportunities (eg. if 4 out of 5 were range buckets, it may be able to
      promote up to one non-range bucket, as opposed to 3.) Also, combined with 1, it
      means that wrong entries may be preserved, as it didn't correctly keep track of
      which were entries were skipped.
      
      To fix this, PGOMemOPSizeOpt now grabs all the entries (up to the maximum number
      of value profile buckets), keeps track of which entries were skipped, and
      preserves all the remaining entries.
      
      Differential Revision: https://reviews.llvm.org/D97592
      365b225d
    • Nikita Popov's avatar
      [IRBuilder] Deprecate CreateLoad APIs with implicit type · 6312c538
      Nikita Popov authored
      These APIs are not compatible with opaque pointers. Deprecate them
      to avoid the introduction of further uses.
      6312c538
    • Craig Topper's avatar
      [RISCV] Handle vmv.x.s intrinsic for i64 vectors on RV32. · 0dff8a96
      Craig Topper authored
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D98372
      0dff8a96
    • Nikita Popov's avatar
      [mlir] Remove uses of type-less CreateLoad() APIs (NFC) · f3f0c6cd
      Nikita Popov authored
      For the use in LLVMOps.td I used the getPointerElementType()
      escape hatch, as it's not obvious to me how the load type
      should be properly obtained here.
      f3f0c6cd
    • Nikita Popov's avatar
      [Polly] Remove uses of type-less CreateLoad() APIs (NFC) · ff9b37e9
      Nikita Popov authored
      These are incompatible with opaque pointers and are going away.
      Explicitly specify the loaded type instead.
      ff9b37e9
    • Fangrui Song's avatar
      [ELF] Simplify isValidCIdentifier. NFC · 0890b39e
      Fangrui Song authored
      0890b39e
    • Martin Storsjö's avatar
      [libcxx] Avoid intermediate string objects for substrings in windows operator/= · 49173ca4
      Martin Storsjö authored
      Check that appends with a path object doesn't do allocations, even
      on windows.
      
      Suggested by Marek in D98398. The patch might apply without D98398
      (depending on how much of the diff context has to match), but doesn't
      make much sense until after that patch has landed.
      
      Differential Revision: https://reviews.llvm.org/D98412
      49173ca4
    • Martin Storsjö's avatar
      [libcxx] [test] Use a string_view of the native path type in the concat test · cb2648e6
      Martin Storsjö authored
      This makes sure that no extra allocations happen on windows, fixing
      earlier errors in the DisableAllocationGuard (in the second case that
      is modified).
      
      This is split out from D98398.
      
      Differential Revision: https://reviews.llvm.org/D98406
      cb2648e6
    • Fangrui Song's avatar
      [ELF] Support . and $ in symbol names in expressions · e4f385d8
      Fangrui Song authored
      GNU ld supports `.` and `$` in symbol names while LLD doesn't support them in
      `readPrimary` expressions. Using `.` can result in such an error:
      
      ```
      https://github.com/ClangBuiltLinux/linux/issues/1318
      ld.lld: error: ./arch/powerpc/kernel/vmlinux.lds:255: malformed number: .TOC.
      >>>   __toc_ptr = (DEFINED (.TOC.) ? .TOC. : ADDR (.got)) + 0x8000;
      ```
      
      Allow `.` (ppc64 special symbol `.TOC.`) and `$` (RISC-V special symbol `__global_pointer$`).
      
      Change `diag[3-5].test` to use an invalid character `^`.
      
      Note: GNU ld allows `~` in non-leading positions of a symbol name.  `~`
      is not used in practice, conflicts with the unary operator, and can
      cause some parsing difficulty, so this patch does not add it.
      
      Differential Revision: https://reviews.llvm.org/D98306
      e4f385d8
    • Craig Topper's avatar
      [RISCV] Support extract_vector_elt for fixed and scalable masked registers. · 9c841cb8
      Craig Topper authored
      This uses a really simple approach of converting to an i8 vector
      and extracting. This is probably not the best approach especially
      if you know the index is constant.
      
      Other ideas:
      -Store to stack temporary using vse1, load as scalar and shift.
      -Sort of bitcast the vector to a vector of i8, slide down the
       appropriate 8 bit element, copy to scalar, shift down the
       correct bit within the 8 bits we extracted. Not exactly sure
       how to describe such a bitcast from i1 vector to i8 vector
       within the type system for elements less than 8.
      
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D98310
      9c841cb8
    • Craig Topper's avatar
      [ValueTypes][RISCV] Add MVT for v1f16. · e9426dfb
      Craig Topper authored
      RISCV makes all fixed vector MVTs with size less than or equal
      to a command line option legal.
      
      This didn't include v1f16 because it was missing but did include v1f32 and v1f64.
      
      One test is affected where we did test this type, but it is a horizontal
      reduction so it is non-sensical. Perhaps we should canonicalize that
      away somewhere.
      
      I'm not sure if we should be making v1 types legal, but this will at
      least make RISCV consistent across all types.
      
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D98365
      e9426dfb
    • Alex Zinenko's avatar
      [mlir] fix cmake build · 27104390
      Alex Zinenko authored
      27104390
  2. Mar 11, 2021
    • Alex Zinenko's avatar
      [mlir] Introduce data layout modeling subsystem · 3ba14fa0
      Alex Zinenko authored
      Data layout information allows to answer questions about the size and alignment
      properties of a type. It enables, among others, the generation of various
      linear memory addressing schemes for containers of abstract types and deeper
      reasoning about vectors. This introduces the subsystem for modeling data
      layouts in MLIR.
      
      The data layout subsystem is designed to scale to MLIR's open type and
      operation system. At the top level, it consists of attribute interfaces that
      can be implemented by concrete data layout specifications; type interfaces that
      should be implemented by types subject to data layout; operation interfaces
      that must be implemented by operations that can serve as data layout scopes
      (e.g., modules); and dialect interfaces for data layout properties unrelated to
      specific types. Built-in types are handled specially to decrease the overall
      query cost.
      
      A concrete default implementation of these interfaces is provided in the new
      Target dialect. Defaults for built-in types that match the current behavior are
      also provided.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D97067
      3ba14fa0
    • Arpith C. Jacob's avatar
      [mlir] Add LLVM loop codegen options to control software pipelining · b4a516cc
      Arpith C. Jacob authored
      Support specifying the II and disabling pipelining.
      
      Reviewed By: ftynse
      
      Differential Revision: https://reviews.llvm.org/D98420
      b4a516cc
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Improve private addressing mode matching · 70cb57d7
      Matt Arsenault authored
      This enables the look-through-copy to hack around not correctly
      regbankselecting constants to match the use bank.
      70cb57d7