1. Jan 10, 2020
    • Matt Arsenault's avatar
      AVR: Update for getRegisterByName change · 5fe4679c
      Matt Arsenault authored
      5fe4679c
    • Richard Smith's avatar
      When diagnosing the lack of a viable conversion function, also list · 25195541
      Richard Smith authored
      explicit functions that are not candidates.
      
      It's not always obvious that the reason a conversion was not possible is
      because the function you wanted to call is 'explicit', so explicitly say
      if that's the case.
      
      It would be nice to rank the explicit candidates higher in the
      diagnostic if an implicit conversion sequence exists for their
      arguments, but unfortunately we can't determine that without potentially
      triggering non-immediate-context errors that we're not permitted to
      produce.
      25195541
    • River Riddle's avatar
      [mlir] Use getDenseElementBitwidth instead of Type::getElementTypeBitWidth. · 68c8b6c4
      River Riddle authored
      Summary: Some data values have a different storage width than the corresponding MLIR type, e.g. bfloat is currently stored as a double.
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D72478
      68c8b6c4
    • Jonas Devlieghere's avatar
      58b3dec6
    • Matt Arsenault's avatar
      TableGen/GlobalISel: Fix pattern matching of immarg literals · 10edb1d0
      Matt Arsenault authored
      For arguments that are not expected to be materialized with
      G_CONSTANT, this was emitting predicates which could never match. It
      was first adding a meaningless LLT check, which would always fail due
      to the operand not being a register.
      
      Infer the cases where a literal should check for an immediate operand,
      instead of a register This avoids needing to invent a special way of
      representing timm literal values.
      
      Also handle immediate arguments in GIM_CheckLiteralInt. The comments
      stated it handled isImm() and isCImm(), but that wasn't really true.
      
      This unblocks work on the selection of all of the complicated AMDGPU
      intrinsics in future commits.
      10edb1d0
    • Matt Arsenault's avatar
      TableGen/GlobalISel: Add way for SDNodeXForm to work on timm · b4a64744
      Matt Arsenault authored
      The current implementation assumes there is an instruction associated
      with the transform, but this is not the case for
      timm/TargetConstant/immarg values. These transforms should directly
      operate on a specific MachineOperand in the source
      instruction. TableGen would assert if you attempted to define an
      equivalent GISDNodeXFormEquiv using timm when it failed to find the
      instruction matcher.
      
      Specially recognize SDNodeXForms on timm, and pass the operand index
      to the render function.
      
      Ideally this would be a separate render function type that looks like
      void renderFoo(MachineInstrBuilder, const MachineOperand&), but this
      proved to be somewhat mechanically painful. Add an optional operand
      index which will only be passed if the transform should only look at
      the one source operand.
      
      Theoretically it would also be possible to only ever pass the
      MachineOperand, and the existing renderers would check the parent. I
      think that would be somewhat ugly for the standard usage which may
      want to inspect other operands, and I also think MachineOperand should
      eventually not carry a pointer to the parent instruction.
      
      Use it in one sample pattern. This isn't a great example, since the
      transform exists to satisfy DAG type constraints. This could also be
      avoided by just changing the MachineInstr's arbitrary choice of
      operand type from i16 to i32. Other patterns have nontrivial uses, but
      this serves as the simplest example.
      
      One flaw this still has is if you try to use an SDNodeXForm defined
      for imm, but the source pattern uses timm, you still see the "Failed
      to lookup instruction" assert. However, there is now a way to avoid
      it.
      b4a64744
    • Matt Arsenault's avatar
      GlobalISel: Handle llvm.read_register · 0ea3c729
      Matt Arsenault authored
      Compared to the attempt in bdcc6d3d,
      this uses intermediate generic instructions.
      0ea3c729
    • Matt Arsenault's avatar
      DAG: Don't use unchecked dyn_cast · f33f3d98
      Matt Arsenault authored
      f33f3d98
    • Matt Arsenault's avatar
      GlobalISel: Fix else after return · ac53a5f1
      Matt Arsenault authored
      ac53a5f1
    • Matt Arsenault's avatar
      CodeGen: Use LLT instead of EVT in getRegisterByName · 255cc5a7
      Matt Arsenault authored
      Only PPC seems to be using it, and only checks some simple cases and
      doesn't distinguish between FP. Just switch to using LLT to simplify
      use from GlobalISel.
      255cc5a7
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Implement selection of <2 x float> vector splat. · cc95bb1f
      Amara Emerson authored
      Also requires making G_IMPLICIT_DEF of v2s32 legal.
      
      Differential Revision: https://reviews.llvm.org/D72422
      cc95bb1f
    • Eric Schweitz's avatar
      [mlir] add a missing dependency for Linalg conversion · 016bf03e
      Eric Schweitz authored
      We were seeing some occasional build failures that would come and go.
      It appeared to be this missing dependence.
      
      Differential Revision: https://reviews.llvm.org/D72419
      016bf03e
    • Kern Handa's avatar
      [mlir] mlir-cpu-runner test's cblas_interface should export functions on Windows · ea67737b
      Kern Handa authored
      This change fixes the build on Windows, so that cblas_interface.dll
      exports functions correctly and an implib is created and installed
      correctly.
      
      Currently, LLVM cannot be consumed on Windows after it has been
      installed in a location because cblas_interface.lib is not
      created/installed, thus failing the import check in `LLVMExports.cmake`.
      
      Differential Revision: https://reviews.llvm.org/D72384
      ea67737b
    • Alex Richardson's avatar
      Add builtins for aligning and checking alignment of pointers and integers · 8c387cbe
      Alex Richardson authored
      This change introduces three new builtins (which work on both pointers
      and integers) that can be used instead of common bitwise arithmetic:
      __builtin_align_up(x, alignment), __builtin_align_down(x, alignment) and
      __builtin_is_aligned(x, alignment).
      
      I originally added these builtins to the CHERI fork of LLVM a few years ago
      to handle the slightly different C semantics that we use for CHERI [1].
      Until recently these builtins (or sequences of other builtins) were
      required to generate correct code. I have since made changes to the default
      C semantics so that they are no longer strictly necessary (but using them
      does generate slightly more efficient code). However, based on our experience
      using them in various projects over the past few years, I believe that adding
      these builtins to clang would be useful.
      
      These builtins have the following benefit over bit-manipulation and casts
      via uintptr_t:
      
      - The named builtins clearly convey the semantics of the operation. While
        checking alignment using __builtin_is_aligned(x, 16) versus
        ((x & 15) == 0) is probably not a huge win in readably, I personally find
        __builtin_align_up(x, N) a lot easier to read than (x+(N-1))&~(N-1).
      - They preserve the type of the argument (including const qualifiers). When
        using casts via uintptr_t, it is easy to cast to the wrong type or strip
        qualifiers such as const.
      - If the alignment argument is a constant value, clang can check that it is
        a power-of-two and within the range of the type. Since the semantics of
        these builtins is well defined compared to arbitrary bit-manipulation,
        it is possible to add a UBSAN checker that the run-time value is a valid
        power-of-two. I intend to add this as a follow-up to this change.
      - The builtins avoids int-to-pointer casts both in C and LLVM IR.
        In the future (i.e. once most optimizations handle it), we could use the new
        llvm.ptrmask intrinsic to avoid the ptrtoint instruction that would normally
        be generated.
      - They can be used to round up/down to the next aligned value for both
        integers and pointers without requiring two separate macros.
      - In many projects the alignment operations are already wrapped in macros (e.g.
        roundup2 and rounddown2 in FreeBSD), so by replacing the macro implementation
        with a builtin call, we get improved diagnostics for many call-sites while
        only having to change a few lines.
      - Finally, the builtins also emit assume_aligned metadata when used on pointers.
        This can improve code generation compared to the uintptr_t casts.
      
      [1] In our CHERI compiler we have compilation mode where all pointers are
      implemented as capabilities (essentially unforgeable 128-bit fat pointers).
      In our original model, casts from uintptr_t (which is a 128-bit capability)
      to an integer value returned the "offset" of the capability (i.e. the
      difference between the virtual address and the base of the allocation).
      This causes problems for cases such as checking the alignment: for example, the
      expression `if ((uintptr_t)ptr & 63) == 0` is generally used to check if the
      pointer is aligned to a multiple of 64 bytes. The problem with offsets is that
      any pointer to the beginning of an allocation will have an offset of zero, so
      this check always succeeds in that case (even if the address is not correctly
      aligned). The same issues also exist when aligning up or down. Using the
      alignment builtins ensures that the address is used instead of the offset. While
      I have since changed the default C semantics to return the address instead of
      the offset when casting, this offset compilation mode can still be used by
      passing a command-line flag.
      
      Reviewers: rsmith, aaron.ballman, theraven, fhahn, lebedev.ri, nlopes, aqjune
      Reviewed By: aaron.ballman, lebedev.ri
      Differential Revision: https://reviews.llvm.org/D71499
      8c387cbe
    • Christian Sigg's avatar
      Add gdb pretty printer for MutableArrayRef, remove ConstArrayRef. · 0f5f28d0
      Christian Sigg authored
      Reviewers: dblaikie
      
      Reviewed By: dblaikie
      
      Subscribers: merge_guards_bot, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72136
      0f5f28d0
    • Matt Arsenault's avatar
      GlobalISel: Move getLLTForMVT/getMVTForLLT · 595ac8c4
      Matt Arsenault authored
      As an intermediate step, some TLI functions can be converted to using
      LLT instead of MVT. Move this somewhere out of GlobalISel so DAG
      functions can use these.
      595ac8c4
    • Matt Arsenault's avatar
      TableGen/GlobalISel: Address fixme · f937b43f
      Matt Arsenault authored
      Don't call computeAvailableFunctionFeatures for every instruction.
      f937b43f
    • Matt Arsenault's avatar
      GlobalISel: Don't assert on MoreElements creating vectors · fba1fbb9
      Matt Arsenault authored
      If the original type was a scalar, it should be valid to add elements
      to turn it into a vector.
      
      Tests included with following legalization change.
      fba1fbb9
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Fix argument lowering for vectors of pointers · 767aa507
      Matt Arsenault authored
      When these arguments are broken down by the EVT based callbacks, the
      pointer information is lost. Hack around this by coercing the register
      types to be the expected pointer element type when building the
      remerge operations.
      767aa507
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Widen 16-bit shift amount sources · 35ad66fa
      Matt Arsenault authored
      This should be legal, but will require future selection work. 16-bit
      shift amounts were already removed from being legal, but this didn't
      adjust the transformation rules.
      35ad66fa
    • Sylvestre Ledru's avatar
      0c195ef7
    • Sylvestre Ledru's avatar
      phab doc: also document 'arc land' · dbfc516d
      Sylvestre Ledru authored
      dbfc516d
    • Sylvestre Ledru's avatar
      phab doc: remove the svn section · 004ae200
      Sylvestre Ledru authored
      004ae200
    • Nathan Ridge's avatar
      [clangd] Handle DeducedTemplateSpecializationType in TargetFinder · 6a69d3c6
      Nathan Ridge authored
      Summary:
      This is a workaround for https://bugs.llvm.org/show_bug.cgi?id=42914.
      Once that is fixed, the handling in VisitDeducedTyped() should be sufficient.
      
      Fixes https://github.com/clangd/clangd/issues/242
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D72119
      6a69d3c6
    • Sylvestre Ledru's avatar
      [clang-tidy] Refresh the add_new_check.py now that we use a table + autofix · c348a267
      Sylvestre Ledru authored
      Reviewers: alexfh
      
      Reviewed By: alexfh
      
      Subscribers: njames93, xazax.hun, mgorny, cfe-commits
      
      Tags: #clang, #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D72421
      c348a267
    • Eric Fiselier's avatar
      [libc++] Explicitly enumerate std::string external instantiations. · 61bd1920
      Eric Fiselier authored
       The external instantiation of std::string is a problem for libc++.
          Additions and removals of inline functions in string can cause ABI
          breakages, including introducing new symbols.
      
          This patch aims to:
            (1) Make clear which functions are explicitly instatiated.
            (2) Prevent new functions from being accidentally instantiated.
            (3) Allow a migration path for adding or removing functions from the
            explicit instantiation over time.
      
          Although this new formulation is uglier, it is preferable from a
          maintainability and readability standpoint because it explicitly
          enumerates the functions we've chosen to expose in our ABI. Changing
          this list is non-trivial and requires thought and planning.
      
          (3) is achieved by making it possible to control the extern template declaration
          separately from it's definition. Meaning we could add a new definition to
          the dylib, wait for it to roll out, then add the extern template
          declaration to the header. Similarly, we could remove existing extern
          template declarations while still keeping the definition to prevent ABI
          breakages.
      61bd1920
    • River Riddle's avatar
      [mlir] NFC: Move the state for managing SSA value names out of... · fc3367dd
      River Riddle authored
      [mlir] NFC: Move the state for managing SSA value names out of OperationPrinter and into a new class SSANameState.
      
      Summary:
      This reduces the complexity of OperationPrinter and simplifies the code by quite a bit. The SSANameState is now held by ModuleState. This is in preparation for a future revision that molds ModuleState into something that can be used by users for caching the printer state, as well as for implementing printAsOperand style methods.
      
      Depends On D72292
      
      Reviewed By: antiagainst
      
      Differential Revision: https://reviews.llvm.org/D72293
      fc3367dd
    • Alex Richardson's avatar
      MipsDelaySlotFiller: Update registers def-uses for BUNDLE instructions · 646ca7d7
      Alex Richardson authored
      Summary:
      In commit b91f2394 I updated the
      MipsDelaySlotFiller to skip BUNDLE instructions.
      However, in addition to not considering BUNDLE instructions for the delay
      slot, we also need to ensure that the register def-use information is
      updated. Not updating this information caused run-time crashes (when using
      the out-of-tree CHERI backend) since later definitions could be overwritten
      with earlier register values.
      
      Reviewers: atanasyan
      Reviewed By: atanasyan
      Differential Revision: https://reviews.llvm.org/D72254
      646ca7d7
    • Alex Richardson's avatar
      Re-apply "[ELF] Allow getErrPlace() to work before Out::bufferStart is set" · 1444e6e2
      Alex Richardson authored
      This time with a fix for the UBSAN failure.
      
      Differential Revision: https://reviews.llvm.org/D70659
      1444e6e2
    • Craig Topper's avatar
      [X86] Add ueq/one fp128 quiet compare tests. NFC · 4e003aad
      Craig Topper authored
      The ONE expansion calls OGT/OLT libcalls which will signal for QNAN.
      The UEQ expansion uses unord and eq libcalls which won't signal.
      We should probably use those libcalls for ONE with appropriate
      logic.
      
      Quiet OGT/OLT/OLE/OGE have similar issue, but not sure how to fix
      those yet.
      4e003aad
    • Jessica Paquette's avatar
      [GlobalISel][AArch64] Import + select LDR*roW and STR*roW patterns · 9949b1a1
      Jessica Paquette authored
      This adds support for selecting a large chunk of the load/store *roW patterns.
      
      This is pretty much a straight port of AArch64DAGToDAGISel::SelectAddrModeWRO
      into GISel. The code is very similar to the XRO code. The main difference is
      that in the *roW patterns, we want to try and fold in an extend, and *possibly*
      a shift along with it. A good portion of this patch is refactoring the existing
      XRO code.
      
      - Add selectAddrModeWRO
      
      - Factor out the code from selectAddrModeShiftedExtendXReg which is used by both
        selectAddrModeXRO and selectAddrModeWRO into selectExtendedSHL.
        This is similar to the function of the same name in AArch64DAGToDAGISel.
      
      - Add support for extends to the factored out code in selectExtendedSHL.
      
      - Teach getExtendTypeForInst how to handle AND masks that are intended to be
        used in loads/stores (necessary for this addressing mode.)
      
      - Make getExtendTypeForInst not static because moving it made an annoying diff
        and I wanted to have the WRO/XRO functions close to each other while I was
        writing the code.
      
      Differential Revision: https://reviews.llvm.org/D72426
      9949b1a1
    • serge-sans-paille's avatar
    • Eric Astor's avatar
      [ms] [X86] Use "P" modifier on all branch-target operands in inline X86 assembly. · 1c545f6d
      Eric Astor authored
      Summary:
      Extend D71677 to apply to all branch-target operands, rather than special-casing call instructions.
      
      Also add a regression test for llvm.org/PR44272, since this finishes fixing it.
      
      Reviewers: thakis, rnk
      
      Reviewed By: thakis
      
      Subscribers: merge_guards_bot, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D72417
      1c545f6d
    • Ganesh Gopalasubramanian's avatar
      [X86] AMD Znver2 (Rome) Scheduler enablement · 3408940f
      Ganesh Gopalasubramanian authored
      The patch gives out the details of the znver2 scheduler model.
      There are few improvements with respect to execution units, latencies and
      throughput when compared with znver1.
      The tests that were present for znver1 for llvm-mca tool were replicated.
      The latencies, execution units, timeline and throughput information are updated for znver2.
      
      Reviewers: craig.topper, Simon Pilgrim
      
      Differential Revision: https://reviews.llvm.org/D66088
      3408940f
    • Sean Fertile's avatar
      [PowerPC] The VK_PLT symbolref modifier is only used on 32-bit ELF. [NFC] · 1a1dbea2
      Sean Fertile authored
      Fix a conditional that guarded code for execution only on 32-bit ELF by
      checking that the Subtarget was not 64-bit and not-Darwin. By adding a new
      target ABI (AIX), the condition is no longer correct. This code is dead for
      AIX, due to a 'report_fatal_error' for thread local storage usage earlier in the
      pipeline, but needs to be modifed as part of Darwins removal from the
      PowerPC backend.
      1a1dbea2
    • Erik Pilkington's avatar
      183b5d38
    • Craig Topper's avatar
      [TargetLowering][X86] TeachSimplifyDemandedBits to handle cases where only the... · b705fe56
      Craig Topper authored
      [TargetLowering][X86] TeachSimplifyDemandedBits to handle cases where only the sign bit is demanded from a SETCC and can be passed through
      
      If we're doing a compare that only tests the sign bit and only the sign bit is demanded, we can just bypass the node. This removes one of the blend dependencies in our v2i64->v2f32 uint_to_fp codegen on pre-sse4.2 targets.
      
      Differential Revision: https://reviews.llvm.org/D72356
      b705fe56
    • Bruno Ricci's avatar
      [Support][NFC] Add an explicit unit test for Process::getPageSize() · 002be6cf
      Bruno Ricci authored
      It turns out that it was only tested indirectly. For now test only on Linux
      X86-64 and aarch64.
      002be6cf
    • Sanjay Patel's avatar
      [x86] add tests for 2-way splat copy; NFC · 460cbabe
      Sanjay Patel authored
      Based on code in PR42024:
      https://bugs.llvm.org/show_bug.cgi?id=42024
      460cbabe
    • Ulrich Weigand's avatar
      [SystemZ] Fix matching another pattern for nxgrk (PR44496) · b51fa867
      Ulrich Weigand authored
      SystemZDAGToDAGISel::Select will attempt to split logical instruction
      with a large immediate constant.  This must not happen if the result
      matches one of the z15 combined operations, so the code checks for
      those.  However, one of them was missed, causing invalid code to
      be generated in the test case for PR44496.
      b51fa867