1. Feb 18, 2020
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Allow arbitrary global values · e240b27d
      Matt Arsenault authored
      Treat unknown address spaces as global
      e240b27d
    • Craig Topper's avatar
      [X86] Change how the alignment for the stack object is created in LowerFLT_ROUNDS_. · 43e948c4
      Craig Topper authored
      We don't need FrameInfo's concept of the stack alignment. We just
      need to tell it the desired alignment. Which in this case is 2.
      43e948c4
    • Craig Topper's avatar
      [X86] Move '0-x == y --> x+y == 0' and similar combines to EmitCmp. · b62de210
      Craig Topper authored
      AArch64 handles this pattern in their lowering code. By emitting
      CMN. ARM handles it as an isel pattern.
      b62de210
    • Brian Gesiak's avatar
    • Matt Arsenault's avatar
      GlobalISel: Allow running localizer earlier · 54137bba
      Matt Arsenault authored
      This required legal and regbankselected MIR for seemingly no
      reason. For AMDGPU this wouldn't see legalized G_GLOBAL_VALUEs.
      54137bba
    • Vedant Kumar's avatar
      Fix modules build after https://reviews.llvm.org/D73835 (IRBuilder virtualization change) · 74247051
      Vedant Kumar authored
      I readily admit that I don't know why this fixes the modules build, but
      it seems to get things building again. Previously I saw the error
      message:
      
      http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/9404/consoleFull#-361314398a1ca8a51-895e-46c6-af87-ce24fa4cd561
      
      ```
      /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/IRBuilderFolder.h:18:10: fatal error: cyclic dependency in module 'LLVM_intrinsic_gen': LLVM_intrinsic_gen -> LLVM_IR -> LLVM_intrinsic_gen
      
               ^
      While building module 'LLVM_intrinsic_gen' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/IR/IRBuilder.cpp:14:
      In file included from <module-includes>:1:
      /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:19:10: fatal error: could not build module 'LLVM_IR'
       ~~~~~~~~^~~~~~~~~~~~~~~~~
      /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/IR/IRBuilder.cpp:14:10: fatal error: could not build module 'LLVM_intrinsic_gen'
      ```
      
      And reproduced with:
      
      cmake -G Ninja /Users/vsk/src/llvm-backup-master/llvm -DCLANG_ENABLE_ARCMT=Off -DCLANG_ENABLE_STATIC_ANALYZER=Off -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;libcxx;libcxxabi;compiler-rt;libunwind;lldb' -DLLDB_USE_SYSTEM_DEBUGSERVER=On -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_MODULES=On
      74247051
    • Jonas Devlieghere's avatar
      [lldb/Plugin] Remove PLUGIN from Process POSIX & Linux · deaa6916
      Jonas Devlieghere authored
      ProcessPOSIX and ProcessLinux are not real plugins and should not be
      marked as such. This should fix the Linux bots.
      deaa6916
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Custom lower 32-bit G_UDIV/G_UREM · 96db12d5
      Matt Arsenault authored
      AMDGPUCodeGenPrepare expands this most of the time, but not always. We
      will always at least need a fallback option here. This is the 3rd
      implementation of the same expansion in the backend. Eventually I
      would like to eliminate the IR expansion (and the DAG version
      obviously).
      
      Currently the new legalizer path produces a better result, since the
      IR expansion results in extra operations which need to be combined
      out. Notably, the IR expansion results in multiplies by 0.
      96db12d5
    • Gokturk Yuksek's avatar
      [CMake] CheckAtomic.cmake: catch false positives in RISC-V · cef85193
      Gokturk Yuksek authored
      The check for 'HAVE_CXX_ATOMICS_WITHOUT_LIB' may create false
      positives in RISC-V. This is reproducible when compiling LLVM natively
      using GCC on a rv64gc (rv64imafdgc) host. Due to the 'A' (atomic)
      extension, g++ replaces calls to libatomic operations on the
      std::atomic<int> type with the native hardware instructions. As a
      result, the compilation succeeds and the build system thinks it
      doesn't need to pass '-latomic'.
      
      Improve the reliability of the 'HAVE_CXX_ATOMICS_WITHOUT_LIB' test in
      two steps:
      
      1. Force a pre-increment on x (++x), which should force a call to a
      libatomic function;
      
      2. Because step 1 would resolve the increment to 'amoadd.w.aq' under
      the 'A' extension, force the same operation on sub-word types, for
      which there is no hardware support.
      
      Reviewers: jfb, hintonda, smeenai, mgorny, JDevlieghere, jyknight
      Reviewed By: jfb
      Tags: #llvm
      Differential Revision: https://reviews.llvm.org/D68964
      cef85193
    • Matt Arsenault's avatar
      GlobalISel: Extend narrowing to G_ASHR · 0e2eb357
      Matt Arsenault authored
      0e2eb357
    • Brian Gesiak's avatar
      [Coroutines][1/6] New pass manager: coro-early · e9849d51
      Brian Gesiak authored
      Summary:
      The first in a series of patches that ports the LLVM coroutines passes
      to the new pass manager infrastructure. This patch implements
      'coro-early'.
      
      NB: All coroutines passes begin by checking that coroutine intrinsics are
      declared within the LLVM IR module they're operating on. To do so, they call
      `coro::declaresIntrinsics`. The next 3 patches in this series, which add new
      pass manager implementations of the 'coro-split', 'coro-elide', and
      'coro-cleanup' passes, use a similar pattern as the one used here: a static
      function is shared across both old and new passes to detect if relevant
      coroutine intrinsics are delcared. To make this pattern easier to read, this
      patch adds `const` keywords to the parameters of `coro::declaresIntrinsics`.
      
      Reviewers: GorNishanov, lewissbaker, junparser, chandlerc, deadalnix, wenlei
      
      Reviewed By: wenlei
      
      Subscribers: ychen, wenlei, EricWF, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71898
      e9849d51
    • Jonas Devlieghere's avatar
      [lldb/Plugin] Fix plugin definition for ProcessWindows · 3431dc32
      Jonas Devlieghere authored
      This should fix the unresolved external symbol error.
      3431dc32
    • John Brawn's avatar
      [FPEnv][ARM] Don't call mutateStrictFPToFP when lowering · 594a89f7
      John Brawn authored
      mutateStrictFPToFP can delete the node and replace it with another with the same
      value which can later cause problems, and returning the result of
      mutateStrictFPToFP doesn't work because SelectionDAGLegalize expects that the
      returned value has the same number of results as the original. Instead handle
      things by doing the mutation manually.
      
      Differential Revision: https://reviews.llvm.org/D74726
      594a89f7
    • Nikita Popov's avatar
      Reapply "[IRBuilder] Virtualize IRBuilder" · 3eaa53e8
      Nikita Popov authored
      Relative to the original commit, this fixes some warnings,
      and is based on the deletion of the IRBuilder copy constructor
      in D74693. The automatic copy constructor would no longer be
      safe.
      
      -----
      
      Related llvm-dev thread:
      http://lists.llvm.org/pipermail/llvm-dev/2020-February/138951.html
      
      This patch moves the IRBuilder from templating over the constant
      folder and inserter towards making both of these virtual.
      There are a couple of motivations for this:
      
      1. It's not possible to share code between use-sites that use
      different IRBuilder folders/inserters (short of templating the code
      and moving it into headers).
      2. Methods currently defined on IRBuilderBase (which is not templated)
      do not use the custom inserter, resulting in subtle bugs (e.g.
      incorrect InstCombine worklist management). It would be possible to
      move those into the templated IRBuilder, but...
      3. The vast majority of the IRBuilder implementation has to live
      in the header, because it depends on the template arguments.
      4. We have many unnecessary dependencies on IRBuilder.h,
      because it is not easy to forward-declare. (Significant parts of
      the backend depend on it via TargetLowering.h, for example.)
      
      This patch addresses the issue by making the following changes:
      
      * IRBuilderDefaultInserter::InsertHelper becomes virtual.
        IRBuilderBase accepts a reference to it.
      * IRBuilderFolder is introduced as a virtual base class. It is
       implemented by ConstantFolder (default), NoFolder and TargetFolder.
        IRBuilderBase has a reference to this as well.
      * All the logic is moved from IRBuilder to IRBuilderBase. This means
        that methods can in the future replace their IRBuilder<> & uses
        (or other specific IRBuilder types) with IRBuilderBase & and thus
        be usable with different IRBuilders.
      * The IRBuilder class is now a thin wrapper around IRBuilderBase.
        Essentially it only stores the folder and inserter and takes care
        of constructing the base builder.
      
      What this patch doesn't do, but should be simple followups after this change:
      
      * Fixing use of the inserter for creation methods originally defined
        on IRBuilderBase.
      * Replacing IRBuilder<> uses in arguments with IRBuilderBase, where useful.
      * Moving code from the IRBuilder header to the source file.
      
      From the user perspective, these changes should be mostly transparent:
      The only thing that consumers using a custom inserted may need to do is
      inherit from IRBuilderDefaultInserter publicly and mark their InsertHelper
      as public.
      
      Differential Revision: https://reviews.llvm.org/D73835
      3eaa53e8
    • Nikita Popov's avatar
      [Polly] Fix build after IRBuilder changes · 55cfb1fb
      Nikita Popov authored
      Simply dropping the createPollyIRBuilder() function here, because
      it doesn't do much. Also directly initialize Expander in
      ScopExpander instead of going through the copy-constructor.
      55cfb1fb
    • Brian Gesiak's avatar
      Add LazyCallGraph API to add function to RefSCC · 449a1350
      Brian Gesiak authored
      Summary:
      Depends on https://reviews.llvm.org/D70927.
      
      `LazyCallGraph::addNewFunctionIntoSCC` allows users to insert a new
      function node into a call graph, into a specific, existing SCC.
      
      Extend this interface such that functions can be added even when they do
      not belong in any existing SCC, but instead in a new SCC within an
      existing RefSCC.
      
      The ability to insert new functions as part of a RefSCC is necessary for
      outlined functions that do not form a strongly connected cycle with the
      function they are outlined from. An example of such a function would be the
      coroutine funclets 'f.resume', etc., which are outlined from a coroutine 'f'.
      Coroutine 'f' only references the funclets' addresses, it does not call
      them directly.
      
      Reviewers: jdoerfert, chandlerc, wenlei, hfinkel
      
      Reviewed By: jdoerfert
      
      Subscribers: hfinkel, JonChesterfield, mehdi_amini, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72226
      449a1350
    • Mikhail Maltsev's avatar
      [ARM,MVE] Add vector-scalar intrinsics · 489f62e8
      Mikhail Maltsev authored
      Summary:
      This patch adds vector-scalar variants to the following families of
      MVE intrinsics:
      * vaddq
      * vsubq
      * vmulq
      * vqaddq
      * vqsubq
      * vhaddq
      * vhsubq
      * vqdmulhq
      * vqrdmulhq
      
      The vector-scalar variants perform a splat operation on the scalar
      operand and then perform the same operations as their vector-vector
      counterparts. Code generation is done accordingly (using LLVM IR 'insert'
      and 'shuffle' operations which are later converted into an ARMvdup
      SDNode).
      
      Reviewers: simon_tatham, dmgreen, MarkMurrayARM, ostannard
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74620
      489f62e8
    • Matt Arsenault's avatar
      GlobalISel: Fix missing const · f9b45f85
      Matt Arsenault authored
      f9b45f85
    • Nikita Popov's avatar
      [IRBuilder] Delete copy constructor · 80397d2d
      Nikita Popov authored
      D73835 will make IRBuilder no longer trivially copyable. This patch
      deletes the copy constructor in advance, to separate out the breakage.
      
      Currently, the IRBuilder copy constructor is usually used by accident,
      not by intention.  In rG7c362b25 I've fixed a number of cases where
      functions accepted IRBuilder rather than IRBuilder &, thus performing
      an unnecessary copy. In rG5f7b92b1 I've fixed cases where an
      IRBuilder was copied, while an InsertPointGuard should have been used
      instead.
      
      The only non-trivial use of the copy constructor is the
      getIRBForDbgInsertion() helper, for which I separated construction and
      setting of the insertion point in this patch.
      
      Differential Revision: https://reviews.llvm.org/D74693
      80397d2d
    • Nikita Popov's avatar
      [IRBuilder] Avoid passing IRBuilder by value; NFC · 98ed613c
      Nikita Popov authored
      I've fixed most of these before, but missed some occurrences
      in targets I don't usually build.
      98ed613c
    • Matt Arsenault's avatar
      85508595
    • Jonas Devlieghere's avatar
      [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin · 7d6da329
      Jonas Devlieghere authored
      This patch changes the way we initialize and terminate the plugins in
      the system initializer. It uses an approach similar to LLVM's
      TARGETS_TO_BUILD with a def file that enumerates the plugins.
      
      Differential revision: https://reviews.llvm.org/D73067
      7d6da329
    • Jonas Devlieghere's avatar
      [lldb] Fix Windows bot. · 8f95a82b
      Jonas Devlieghere authored
      Should fix error C2039: 'toupper': is not a member of 'std'.
      8f95a82b
    • Raphael Isemann's avatar
      Revert "[libc++] Move abs and div into stdlib.h to fix header cycle." · 23368bee
      Raphael Isemann authored
      This reverts commit 82b47b29.
      
      This broke Clang and LLDB module builds without -fmodules-local-submodule-visbility.
      I'll revert this for now until we have a fix and reland once Clang
      can properly handle this code.
      
      See also the discussion in https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be
      23368bee
    • Benjamin Kramer's avatar
      Hide implementation details. NFC> · 564a9de2
      Benjamin Kramer authored
      564a9de2
    • Gokturk Yuksek's avatar
      Reland "[clang-tools-extra] fix the check for if '-latomic' is necessary"" · 351ed50d
      Gokturk Yuksek authored
      The buildbot failures on MSVC should have been fixed by f128f442.
      351ed50d
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Skip DAG hack passes on selected functions · d9e8b2cb
      Matt Arsenault authored
      The way fallback to SelectionDAG works is somewhat surprising to
      me. When the fallback path is enabled, the entire set of SelectionDAG
      selector passes is added to the pass pipeline, and each one needs to
      check if the function was selected. This results in the surprising
      behavior of running SIFixSGPRCopies for example, but only if
      -global-isel-abort=2 is used.
      
      SIAddIMGInitPass is also added in addInstSelector, but I'm not sure
      why we have this pass or if it should be added somewhere else for
      GlobalISel.
      d9e8b2cb
    • Simon Pilgrim's avatar
      [SelectionDAG] Expose the "getValidShiftAmount" helpers available. NFCI. · a1585aec
      Simon Pilgrim authored
      These are going to be useful in TargetLowering::SimplifyDemandedBits, so expose these helpers outside of SelectionDAG.cpp
      
      Also add an getValidShiftAmountConstant early-out to getValidMinimumShiftAmountConstant/getValidMaximumShiftAmountConstant so we can use them for scalar cases as well.
      a1585aec
    • Matt Arsenault's avatar
      GlobalISel: Add combine to narrow G_LSHR · 78d455ad
      Matt Arsenault authored
      Produce an unmerge to a narrower type and introduce a narrower shift
      if needed. I wasn't sure if there was a better way to parameterize the
      target's preferred shift type for the GICombineRule, so manually call
      the combine helper.
      78d455ad
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Select llvm.amdgcn.s.buffer.load · 86813e27
      Matt Arsenault authored
      Doesn't try to fail on the dlc bit pre-gfx10 like the DAG lowering
      does.
      86813e27
  2. Feb 17, 2020
    • Haojian Wu's avatar
      [clang][Index] Visit the default parameter arguements in libindex. · af8b0cd5
      Haojian Wu authored
      Summary:
      We are missing the default parmeter arguments when IndexFunctionLocals
      is true.
      
      Fixes https://github.com/clangd/clangd/issues/285.
      
      Reviewers: kadircet
      
      Subscribers: kristof.beyls, ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74610
      af8b0cd5
    • Mikhail Maltsev's avatar
      [ARM] Add initial support for Custom Datapath Extension (CDE) · dd4d0937
      Mikhail Maltsev authored
      Summary:
      This patch adds assembly-level support for a new Arm M-profile
      architecture extension, Custom Datapath Extension (CDE).
      
      A brief description of the extension is available at
      https://developer.arm.com/architectures/instruction-sets/custom-instructions
      
      The latest specification for CDE is currently a beta release and is
      available at
      https://static.docs.arm.com/ddi0607/aa/DDI0607A_a_armv8m_arm_supplement_cde.pdf
      
      CDE allows chip vendors to add custom CPU instructions.  The CDE
      instructions re-use the same encoding space as existing coprocessor
      instructions (such as MRC, MCR, CDP etc.). Each coprocessor in range
      cp0-cp7 can be configured as either general purpose (GCP) or custom
      datapath (CDEv1).  This configuration is defined by the CPU vendor and
      is provided to LLVM using 8 subtarget features: cdecp0 ... cdecp7.
      
      The semantics of CDE instructions are implementation-defined, but the
      instructions are guaranteed to be pure (that is, they are stateless,
      they do not access memory or any registers except their explicit
      inputs/outputs).
      
      CDE requires the CPU to support at least Armv8.0-M mainline
      architecture. CDE includes 3 sets of instructions:
      * Instructions that operate on general purpose registers and NZCV
        flags
      * Instructions that operate on the S or D register file (require
        either FP or MVE extension)
      * Instructions that operate on the Q register file, require MVE
      
      The user-facing names that can be specified on the command line are
      the same as the 8 subtarget feature names. For example:
      
          $ clang -target arm-none-none-eabi -march=armv8m.main+cdecp0+cdecp3
      
      tells the compiler that the coprocessors 0 and 3 are configured as
      CDEv1 and the remaining coprocessors are configured as GCP (which is
      the default).
      
      Reviewers: simon_tatham, ostannard, dmgreen, eli.friedman
      
      Reviewed By: simon_tatham
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74044
      dd4d0937
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Run the localizer pass · 5fdc9851
      Matt Arsenault authored
      While looking at the output on real sized programs, there is a lot of
      extra SGPR spilling compared to the DAG path. This seems to largely be
      from all constants being SGPRs in the entry block.
      5fdc9851
    • Jan Kratochvil's avatar
      Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map · 21780888
      Jan Kratochvil authored
      As discussed in https://reviews.llvm.org/D73206#1871895 there is both
      `DIERef` and `user_id_t` and sometimes (for DWZ) we need to encode Main
      CU into them and sometimes we cannot as it is unavailable at that point
      and at the same time not even needed.
      
      I have also noticed `DIERef` and `user_id_t` in fact contain the same
      information which can be seen in SymbolFileDWARF::GetUID.
      
      SB* API/ABI is already using `user_id_t` and it needs to encode Main CU
      for DWZ. Therefore what about making `DIERef` the identifier not
      containing Main CU and `user_id_t` the identifier containing Main CU?
      
      It is sort of a revert of D63322.
      
      I find this patch as a NFC cleanup to the codebase - to satisfy a new
      premise `user_id_t` is used as little as possible and thus only for
      external interfaces which must not deal with MainCU in any way.
      
      Its larger goal is to satisfy a plan to implement DWZ support.
      
      Differential Revision: https://reviews.llvm.org/D74637
      21780888
    • Luís Marques's avatar
      [CMake] Fix setting result of libatomic check for MSVC · f128f442
      Luís Marques authored
      We were skipping the libatomic requirement check for MSVC, but not setting
      the corresponding variable, HAVE_CXX_ATOMICS_WITHOUT_LIB. D69869 seems to
      have to failed to build on ARM MSVC because of that, and was reverted. This
      should probably fix the issue. The plan is to check the result of the build
      bots and then submit a more thoroughly refactored version for review.
      f128f442
    • Sander de Smalen's avatar
      [AArch64] Implement passing SVE vectors by ref for AAPCS. · a7a96c72
      Sander de Smalen authored
      Summary:
      This patch implements the part of the calling convention
      where SVE Vectors are passed by reference. This means the
      caller must allocate stack space for these objects and
      pass the address to the callee.
      
      Reviewers: efriedma, rovka, cameron.mcinally, c-rhodes, rengolin
      
      Reviewed By: efriedma
      
      Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71216
      a7a96c72
    • Pierre Oechsel's avatar
      [mlir] Linalg: Extend promotion to non f32 buffers. · 0acd7e02
      Pierre Oechsel authored
      Summary:
      Linalg's promotion pass was only supporting f32 buffers due to how the
      zero value was build for the `fill` operation.
      
      Moreover, `promoteSubViewOperands` was returning a vector with one entry
      per float subview while omitting integer subviews. For a program
      with only integer subviews the return vector would be of size 0.
      However, `promoteSubViewsOperands` would try to access a non zero
      number of entries of this vector, resulting in a sefgault.
      
      Reviewers: nicolasvasilache, ftynse
      
      Reviewed By: ftynse
      
      Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74532
      0acd7e02
    • Sjoerd Meijer's avatar
      [DAGCombine] Combine pattern for REV16 · dad5f00e
      Sjoerd Meijer authored
      This adds another pattern to the combiner for a case that we were not handling
      to generate the REV16 instruction for ARM/Thumb2 and a bswap+ror on X86.
      
      Differential Revision: https://reviews.llvm.org/D74032
      dad5f00e
    • Benjamin Kramer's avatar
      [wasm] Unbreak after 5fc5c7db. NFCI. · f4c59c0f
      Benjamin Kramer authored
      f4c59c0f
    • Benjamin Kramer's avatar
      5fc5c7db