1. Jan 10, 2020
    • 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
    • Jonas Devlieghere's avatar
      [lldb/SWIG] Undo incorrect substitution · 7bbd4076
      Jonas Devlieghere authored
      The Python directory for the script interpreter is still capitalized.
      7bbd4076
    • Bruno Ricci's avatar
    • Simon Moll's avatar
      [NFC,format] Sort switch cases alphabetically · 356b3351
      Simon Moll authored
      This patch brings the switch cases of `llvm/lib/Support/Triple.cpp` back into alphabetical order.
      This was noted during the the review of  https://reviews.llvm.org/D69103
      
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D72452
      356b3351
    • Bruno Ricci's avatar
    • Simon Tatham's avatar
      [Clang] Handle target-specific builtins returning aggregates. · 06d07ec4
      Simon Tatham authored
      Summary:
      A few of the ARM MVE builtins directly return a structure type. This
      causes an assertion failure at code-gen time if you try to assign the
      result of the builtin to a variable, because the `RValue` created in
      `EmitBuiltinExpr` from the `llvm::Value` produced by codegen is always
      made by `RValue::get()`, which creates a non-aggregate `RValue` that
      will fail an assertion when `AggExprEmitter::withReturnValueSlot` calls
      `Src.getAggregatePointer()`. A similar failure occurs if you try to use
      the struct return value directly to extract one field, e.g.
      `vld2q(address).val[0]`.
      
      The existing code-gen tests for those MVE builtins pass the returned
      structure type directly to the C `return` statement, which apparently
      managed to avoid that particular code path, so we didn't notice the
      crash.
      
      Now `EmitBuiltinExpr` checks the evaluation kind of the builtin's return
      value, and does the necessary handling for aggregate returns. I've added
      two extra test cases, both of which crashed before this change.
      
      Reviewers: dmgreen, rjmccall
      
      Reviewed By: rjmccall
      
      Subscribers: kristof.beyls, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D72271
      06d07ec4
    • Jonas Devlieghere's avatar
      [lldb/SWIG] Fix capitalization for case sensitive file systems. · 5e0bf677
      Jonas Devlieghere authored
      When moving the Python directory I renamed it to python (lowercase) but
      didn't update the python.swig file.
      5e0bf677
    • Kadir Cetinkaya's avatar
      [clangd] Adjust diagnostic range to be inside main file · 189aa5b7
      Kadir Cetinkaya authored
      Summary:
      LSP requires diagnostics to lay inside main file. In clangd we keep
      diagnostics in three different cases:
      - already in main file
      - adjusted to a header included in main file
      - has a note covering some range in main file
      
      In the last case, we were not adjusting the diagnostics range to be in main
      file, therefore these diagnostics ended up pointing some arbitrary locations.
      
      This patch fixes that issue by adjusting the range of diagnostics to be the
      first note inside main file when converting to LSP.
      
      Reviewers: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D72458
      189aa5b7
    • Jonas Devlieghere's avatar
      [lldb/Bindings] Move bindings into their own subdirectory · 6498aff2
      Jonas Devlieghere authored
      All the code required to generate the language bindings for Python and
      Lua lives under scripts, even though the majority of this code aren't
      scripts at all, and surrounded by scripts that are totally unrelated.
      
      I've reorganized these files and moved everything related to the
      language bindings into a new top-level directory named bindings. This
      makes the corresponding files self contained and much more discoverable.
      
      Differential revision: https://reviews.llvm.org/D72437
      6498aff2
    • Sven van Haastregt's avatar
      [OpenCL][Docs] Rename C++ for OpenCL label · 241f335b
      Sven van Haastregt authored
      To avoid potential confusion with OpenCL C++.
      241f335b
    • serge-sans-paille's avatar
      Improve support of GNU mempcpy · cee4a1c9
      serge-sans-paille authored
      - Lower to the memcpy intrinsic
      - Raise warnings when size/bounds are known
      
      Differential Revision: https://reviews.llvm.org/D71374
      cee4a1c9
    • Whitney Tsang's avatar
      [NFCI][LoopUnrollAndJam] Changing LoopUnrollAndJamPass to a function · d27a15fe
      Whitney Tsang authored
      pass.
      
      Summary: This patch changes LoopUnrollAndJamPass to a function pass, and
      keeps the loops traversal order same as defined in
      FunctionToLoopPassAdaptor LoopPassManager.h.
      
      The next patch will change the loop traversal to outer to inner order,
      so more loops can be transform.
      
      Discussion in llvm-dev mailing list:
      https://groups.google.com/forum/#!topic/llvm-dev/LF4rUjkVI2g
      Reviewer: dmgreen, jdoerfert, Meinersbur, kbarton, bmahjour, etiotto
      Reviewed By: dmgreen
      Subscribers: hiraditya, zzheng, llvm-commits
      Tag: LLVM
      Differential Revision: https://reviews.llvm.org/D72230
      d27a15fe
    • Jonas Devlieghere's avatar
      [lldb/Lua] Make lldb.debugger et al available to Lua · 45c971f7
      Jonas Devlieghere authored
      The Python script interpreter makes the current debugger, target,
      process, thread and frame available to interactive scripting sessions
      through convenience variables. This patch does the same for Lua.
      
      Differential revision: https://reviews.llvm.org/D71801
      45c971f7