1. Feb 18, 2020
    • Kerry McLaughlin's avatar
      [AArch64][SVE] Add remaining SVE2 intrinsics for widening DSP operations · d4576080
      Kerry McLaughlin authored
      Summary:
      Implements the following intrinsics:
       - llvm.aarch64.sve.[s|u]mullb_lane
       - llvm.aarch64.sve.[s|u]mullt_lane
       - llvm.aarch64.sve.sqdmullb_lane
       - llvm.aarch64.sve.sqdmullt_lane
       - llvm.aarch64.sve.[s|u]addwb
       - llvm.aarch64.sve.[s|u]addwt
       - llvm.aarch64.sve.[s|u]shllb
       - llvm.aarch64.sve.[s|u]shllt
       - llvm.aarch64.sve.[s|u]subwb
       - llvm.aarch64.sve.[s|u]subwt
      
      Reviewers: sdesmalen, dancgr, efriedma, c-rhodes, rengolin
      
      Reviewed By: sdesmalen
      
      Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cameron.mcinally, cfe-commits, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D73903
      d4576080
    • Raphael Isemann's avatar
      [lldb][NFC] Fix compilation of SymbolFilePDBTests.cpp after FindNamespace API change · 3f0661b5
      Raphael Isemann authored
      Since f9568a95 this function takes a
      CompilerDeclContext reference instead of a pointer. It overlooked this function
      when I fixed the compilation for FindTypes.
      3f0661b5
    • serge-sans-paille's avatar
      Support -fuse-ld=lld for riscv · dd230142
      serge-sans-paille authored
      Differential Revision: https://reviews.llvm.org/D74704
      dd230142
    • Mikhail Maltsev's avatar
      [ARM,CDE] Cosmetic changes, additonal driver tests · 58f66f8a
      Mikhail Maltsev authored
      Summary:
      This is a follow-up patch addressing post-commit comments in
      https://reviews.llvm.org/D74044:
      * Add more Clang driver tests (-march=armv8.1m.main and -march=armv8.1m.main+mve.fp)
      * Clang-format a chunk in ARMAsmParser.cpp
      * Add a missing copyright header to ARMInstrCDE.td
      
      Reviewers: SjoerdMeijer, simon_tatham, dmgreen
      
      Reviewed By: SjoerdMeijer
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74732
      58f66f8a
    • Raphael Isemann's avatar
      [lldb] Don't model std::atomic as a transparent data structure in the data formatter · 51d8c598
      Raphael Isemann authored
      Summary:
      Currently the data formatter is treating `std::atomic` variables as transparent wrappers
      around their underlying value type. This causes that when printing `std::atomic<A *>`, the data
      formatter will forward all requests for the children of the atomic variable to the `A *` pointer type
      which will then return the respective members of `A`. If `A` in turn has a member that contains
      the original atomic variable, this causes LLDB to infinitely recurse when printing an object with
      such a `std::atomic` pointer member.
      
      We could implement a workaround similar to whatever we do for pointer values but this patch
      just implements the `std::atomic` formatter in the same way as we already implement other
      formatters (e.g. smart pointers or `std::optional`) that just model the contents of the  as a child
      "Value". This way LLDB knows when it actually prints a pointer and can just use its normal
      workaround if "Value" is a recursive pointer.
      
      Fixes rdar://59189235
      
      Reviewers: JDevlieghere, jingham, shafik
      
      Reviewed By: shafik
      
      Subscribers: shafik, christof, jfb, abidh, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D74310
      51d8c598
    • Pavel Labath's avatar
      [lldb/DWARF] Support the debug_str_offsets section in dwp files · 00539d8b
      Pavel Labath authored
      Summary:
      In dwp files a constant (from the debug_cu_index section) needs to be
      added to each reference into the debug_str_offsets section.
      
      I've tried to implement this to roughly match the llvm flow: I've
      changed the DWARFormValue to stop resolving the indirect string
      references directly -- instead, it calls into DWARFUnit, which resolves
      this for it (similar to how it already resolves indirect range and
      location list references). I've also done a small refactor of the string
      offset base computation code in DWARFUnit in order to make it easier to
      access the debug_cu_index base offset.
      
      Reviewers: JDevlieghere, aprantl, clayborg
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D74723
      00539d8b
    • Sven van Haastregt's avatar
      [OpenCL] Add Arm dot product builtin functions · 8b65f792
      Sven van Haastregt authored
      Add the Arm dot product builtin functions from the OpenCL extension
      available at
      https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_integer_dot_product.txt
      
      Patch by Pierre Gondois and Sven van Haastregt.
      8b65f792
    • Raphael Isemann's avatar
      [lldb] Fix compilation of SymbolFilePDBTests.cpp after FindTypes API change · 7d138123
      Raphael Isemann authored
      Since f9568a95 this function takes a
      CompilerDeclContext reference instead of a pointer.
      7d138123
    • Pavel Labath's avatar
      [lldb] Remove DataExtractor::GetPointer · 0863f675
      Pavel Labath authored
      This function is equivalent to GetAddress, but getAddress is also
      present on the llvm version of the data extractor.
      0863f675
    • Simon Tatham's avatar
      [ARM,MVE] Add the vmovnbq,vmovntq intrinsic family. · c32af444
      Simon Tatham authored
      Summary:
      These are in some sense the inverse of vmovl[bt]q: they take a vector
      of n wide elements and truncate each to half its width. So they only
      write half a vector's worth of output data, and therefore they also
      take an 'inactive' parameter to provide the other half of the data in
      the output vector. So vmovnb overwrites the even lanes of 'inactive'
      with the narrowed values from the main input, and vmovnt overwrites
      the odd lanes.
      
      LLVM had existing codegen which generates these MVE instructions in
      response to IR that takes two vectors of wide elements, or two vectors
      of narrow ones. But in this case, we have one vector of each. So my
      clang codegen strategy is to narrow the input vector of wide elements
      by simply reinterpreting it as the output type, and then we have two
      narrow vectors and can represent the operation as a vector shuffle
      that interleaves lanes from both of them.
      
      Even so, not all the cases I needed ended up being selected as a
      single MVE instruction, so I've added a couple more patterns that spot
      combinations of the 'MVEvmovn' and 'ARMvrev32' SDNodes which can be
      generated as a VMOVN instruction with operands swapped.
      
      This commit adds the unpredicated forms only.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74337
      c32af444
    • Simon Tatham's avatar
      [ARM,MVE] Add the vmovlbq,vmovltq intrinsic family. · 5e97940c
      Simon Tatham authored
      Summary:
      These intrinsics take a vector of 2n elements, and return a vector of
      n wider elements obtained by sign- or zero-extending every other
      element of the input vector. They're represented in IR as a
      shufflevector that extracts the odd or even elements of the input,
      followed by a sext or zext.
      
      Existing LLVM codegen already matches this pattern and generates the
      VMOVLB instruction (which widens the even-index input lanes). But no
      existing isel rule was generating VMOVLT, so I've added some. However,
      the new rules currently only work in little-endian MVE, because the
      pattern they expect from isel lowering includes a bitconvert which
      doesn't have the right semantics in big-endian.
      
      The output of one existing codegen test is improved by those new
      rules.
      
      This commit adds the unpredicated forms only.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74336
      5e97940c
    • Simon Tatham's avatar
      [ARM] Allow `ARMVectorRegCast` to match bitconverts too. (NFC) · 9dcc1667
      Simon Tatham authored
      Summary:
      When we start putting instances of `ARMVectorRegCast` in complex isel
      patterns, it will be awkward that they're often turned into the more
      standard `bitconvert` in little-endian mode. We'd rather not have to
      write separate isel patterns for the two endiannesses, matching
      different but equivalent cast operations.
      
      This change aims to fix that awkwardness in advance, by turning the
      Tablegen record `ARMVectorRegCast` from a simple `SDNode` instance
      into a `PatFrags` that can match either kind of cast – with a
      predicate that prevents it matching a bitconvert in the big-endian
      case, where bitconvert isn't semantically identical.
      
      No existing code generation should be affected by this change, but it
      will enable the patterns introduced by D74336 to work in both
      endiannesses.
      
      Reviewers: dmgreen
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74716
      9dcc1667
    • Simon Tatham's avatar
      [ARM,MVE] Add intrinsics vclzq and vclsq. · 68b49f7e
      Simon Tatham authored
      Summary:
      vclzq maps nicely to the existing target-independent @llvm.ctlz IR
      intrinsic. But vclsq ('count leading sign bits') has no corresponding
      target-independent intrinsic, so I've made up @llvm.arm.mve.vcls.
      
      This commit adds the unpredicated forms only.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: miyuki
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74335
      68b49f7e
    • Simon Tatham's avatar
      [ARM,MVE] Add the vrev16q, vrev32q, vrev64q family. · b6236e94
      Simon Tatham authored
      Summary:
      These intrinsics just reorder the lanes of a vector, so the natural IR
      representation is as a shufflevector operation. Existing LLVM codegen
      already recognizes those particular shufflevectors and generates the
      MVE VREV instruction.
      
      This commit adds the unpredicated forms only.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74334
      b6236e94
    • Simon Tatham's avatar
      [ARM,MVE] Add intrinsics for FP rounding operations. · c8b3196e
      Simon Tatham authored
      Summary:
      This adds the unpredicated forms of six different MVE intrinsics which
      all round a vector of floating-point numbers to integer values,
      leaving them still in FP format, differing only in rounding mode and
      exception settings.
      
      Five of them map to existing target-independent intrinsics in LLVM IR,
      such as @llvm.trunc and @llvm.rint. The sixth, mapping to the `vrintn`
      instruction, is done by inventing a target-specific intrinsic.
      
      (`vrintn` behaves the same as `vrintx` in terms of the output value:
      the side effects on the FPSCR flags are the only difference between
      the two. But ACLE specifies separate user-callable intrinsics for the
      two, so the side effects matter enough to make sure we generate the
      right one of the two instructions in each case.)
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: miyuki
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74333
      c8b3196e
    • Simon Tatham's avatar
      [ARM,MVE] Add intrinsics for int <-> float conversion. · df3ed6c0
      Simon Tatham authored
      Summary:
      This adds the unpredicated versions of the family of vcvtq intrinsics
      that convert between a vector of floats and a vector of the same size
      of integer. These are represented in IR using the standard fptosi,
      fptoui, sitofp and uitofp operations, which existing LLVM codegen
      already handles.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74332
      df3ed6c0
    • Simon Tatham's avatar
      [ARM,MVE] Add intrinsics for abs, neg and not operations. · 90dc78bc
      Simon Tatham authored
      Summary:
      This commit adds the unpredicated intrinsics for the unary operations
      vabsq (absolute value), vnegq (arithmetic negation), vmvnq (bitwise
      complement), vqabsq and vqnegq (saturating versions of abs and neg for
      signed integers, in the sense that they give INT_MAX if an input lane
      is INT_MIN).
      
      This is done entirely in clang: all of these operations have existing
      isel patterns and existing tests for them on the LLVM side, so I've
      just made clang emit the same IR that those patterns already match.
      
      Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74331
      90dc78bc
    • Raphael Isemann's avatar
      [lldb][NFC] Documention that OptionDefinition::completion_type contains enum values · f14680ce
      Raphael Isemann authored
      This should be just the enum type but that's a larger refactoring, so document that
      this is not just an integer until we can make this just the type of the enum.
      f14680ce
    • Pavel Labath's avatar
      [lldb] Remove the mutable specifier from DataExtractor's member · 0ba247bc
      Pavel Labath authored
      Having m_data_sp mutable sounds like a very bad idea. Fortunately,
      nothing relies on this possibility.
      0ba247bc
    • Raphael Isemann's avatar
    • Daniel Kiss's avatar
      [LLD][ELF][AArch64] Change the semantics of -z pac-plt. · b6162622
      Daniel Kiss authored
      Summary:
      Generate PAC protected plt only when "-z pac-plt" is passed to the
      linker. GNU toolchain generates when it is explicitly requested[1].
      When pac-plt is requested then set the GNU_PROPERTY_AARCH64_FEATURE_1_PAC
      note even when not all function compiled with PAC but issue a warning.
      Harmonizing the warning style for BTI/PAC/IBT.
      Generate BTI protected PLT if case of "-z force-bti".
      
      [1] https://www.sourceware.org/ml/binutils/2019-03/msg00021.html
      
      Reviewers: peter.smith, espindola, MaskRay, grimar
      
      Reviewed By: peter.smith, MaskRay
      
      Subscribers: tatyana-krasnukha, emaste, arichardson, kristof.beyls, MaskRay, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74537
      b6162622
    • Raphael Isemann's avatar
    • Florian Hahn's avatar
      [InstCombin] Avoid nested Create calls, to guarantee order. · 90630225
      Florian Hahn authored
      The original code allowed creating the != checks in unpredictable order,
      causing http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34014
      to fail.
      90630225
    • Florian Hahn's avatar
      [InstCombine] Simplify a umul overflow check to a != 0 && b != 0. · 6c85e92b
      Florian Hahn authored
      This patch adds a simplification if an OR weakens the overflow condition
      for umul.with.overflow by treating any non-zero result as overflow. In that
      case, we overflow if both umul.with.overflow operands are != 0, as in that
      case the result can only be 0, iff the multiplication overflows.
      
      Code like this is generated by code using __builtin_mul_overflow with
      negative integer constants, e.g.
         bool test(unsigned long long v, unsigned long long *res) {
           return __builtin_mul_overflow(v, -4775807LL, res);
         }
      
      ```
      ----------------------------------------
      Name: D74141
        %res = umul_overflow {i8, i1} %a, %b
        %mul = extractvalue {i8, i1} %res, 0
        %overflow = extractvalue {i8, i1} %res, 1
        %cmp = icmp ne %mul, 0
        %ret = or i1 %overflow, %cmp
        ret i1 %ret
      =>
        %t0 = icmp ne i8 %a, 0
        %t1 = icmp ne i8 %b, 0
        %ret = and i1 %t0, %t1
        ret i1 %ret
        %res = umul_overflow {i8, i1} %a, %b
        %mul = extractvalue {i8, i1} %res, 0
        %cmp = icmp ne %mul, 0
        %overflow = extractvalue {i8, i1} %res, 1
      
      Done: 1
      Optimization is correct!
      
      ```
      
      Reviewers: nikic, lebedev.ri, spatel, Bigcheese, dexonsmith, aemerson
      
      Reviewed By: lebedev.ri
      
      Differential Revision: https://reviews.llvm.org/D74141
      6c85e92b
    • Raphael Isemann's avatar
      [lldb][NFC] Document TypeSystemClang · 813ca53f
      Raphael Isemann authored
      813ca53f
    • Raphael Isemann's avatar
      [lldb][NFC] Make all CompilerDeclContext parameters references instead of pointers · f9568a95
      Raphael Isemann authored
      Summary:
      All of our lookup APIs either use `CompilerDeclContext &` or `CompilerDeclContext *` semi-randomly it seems.
      This leads to us constantly converting between those two types (and doing nullptr checks when going from
      pointer to reference). It also leads to the confusing situation where we have two possible ways to express
      that we don't have a CompilerDeclContex: either a nullptr or an invalid CompilerDeclContext (aka a default
      constructed CompilerDeclContext).
      
      This moves all APIs to use references and gets rid of all the nullptr checks and conversions.
      
      Reviewers: labath, mib, shafik
      
      Reviewed By: labath, shafik
      
      Subscribers: shafik, arphaman, abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D74607
      f9568a95
    • Gokturk Yuksek's avatar
      [Support] Check for atomics64 when deciding if '-latomic' is needed · d4a4a32c
      Gokturk Yuksek authored
      The CheckAtomic module performs two tests to determine if passing
      '-latomic' to the linker is required: one for 64-bit atomics, and
      another for non-64-bit atomics. Include the missing check for 64-bit
      atomics.
      
      Reviewers: beanz, compnerd
      Reviewed By: beanz, compnerd
      Tags: #llvm
      Differential Revision: https://reviews.llvm.org/D69444
      d4a4a32c
    • Florian Hahn's avatar
      [InstCombine] Precommit umul.with.overflow sign check test. · b0866f61
      Florian Hahn authored
      Precommit tests for D74141.
      b0866f61
    • Jonas Devlieghere's avatar
      [lldb] Replace #pragma once with header guard · ffd78a00
      Jonas Devlieghere authored
      This got messed up when updating the header guard. Remove the
      `pragma once` and use a header guard instead.
      ffd78a00
    • Raphael Isemann's avatar
      [ASTImporter] Prevent the ASTImporter from creating multiple main FileIDs. · a37734f6
      Raphael Isemann authored
      Summary:
      When importing the main FileID the ASTImporter currently gives it no include location. This means
      that any SourceLocations produced for this FileID look to Clang as if they are coming from the
      main FileID (as the main FileID has no include location).
      
      Clang seems to expect that there is only one main FileID in one translation unit (which makes sense
      during normal compilation), so this behavior leads to several problems when producing diagnostics,
      one being that when calling `SourceManager::isBeforeInTranslationUnit` on two SourceLocations
      that come from two different ASTContext instances, Clang fails to sort the SourceLocations as
      the include chains of the FileIDs don't end up in a single FileID. This causes that Clang crashes
      with "Unsortable locations found" in this function.
      
      This patch gives any imported main FileIDs the main FileID of the To ASTContext as its include
      location. This allows Clang to sort all imported SourceLocations as now all include chains point
      to the main FileID of the To ASTContext. The exact include location is currently set to the start
      of the To main file (just because that should always be a valid SourceLocation).
      
      Reviewers: martong, a_sidorin, a.sidorin, shafik, balazske
      
      Reviewed By: martong, a_sidorin, shafik
      
      Subscribers: balazske, rnkovacs, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D74542
      a37734f6
    • Alexey Lapshin's avatar
      [Debuginfo][NFC] add comments for WithColor routines. · 69906fe0
      Alexey Lapshin authored
      Summary:
      This patch is follow-up for D74481. It adds comments
      to WithColor::defaultErrorHandler() and
      WithColor::defaultWarningHandler().
      
      Reviewers: jhenderson, dblaikie, JDevlieghere
      
      Reviewed By: JDevlieghere
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74742
      69906fe0
    • Jonas Devlieghere's avatar
      [lldb] Update header guards to be consistent and compliant with LLVM (NFC) · cdc514e4
      Jonas Devlieghere authored
      LLDB has a few different styles of header guards and they're not very
      consistent because things get moved around or copy/pasted. This patch
      unifies the header guards across LLDB and converts everything to match
      LLVM's style.
      
      Differential revision: https://reviews.llvm.org/D74743
      cdc514e4
    • Jonas Devlieghere's avatar
      [lldb] Replace empty ctor en dtor bodies with =default (NFC) · 866b7a65
      Jonas Devlieghere authored
      Use = default instead of empty constructor and destructor bodies in the
      API layer.
      866b7a65
    • Artem Dergachev's avatar
      Revert "[analyzer] Teach scan-build how to rebuild index.html without analyzing." · 21efb06f
      Artem Dergachev authored
      This reverts commit a807a068.
      
      Buildbot failures :)
      21efb06f
    • Craig Topper's avatar
      [X86] Move avx512 code that forces zeros to the false side of vselects above a... · e90dc7c4
      Craig Topper authored
      [X86] Move avx512 code that forces zeros to the false side of vselects above a check for legal types.
      
      This helps this transform occur earlier so we can fold the not
      with setcc. If we delay it until after type legalization we might
      have introduced instructions to widen the mask if the vselect was
      widened. This can prevent the not from making it to the setcc.
      
      We could of course add more DAG combines to handle that, but
      moving this earlier is easier.
      e90dc7c4
    • Artem Dergachev's avatar
      [analyzer] Teach scan-build how to rebuild index.html without analyzing. · a807a068
      Artem Dergachev authored
      This is useful for performing custom build system integration that works by appending '--analyze --analyzer-output html' to all clang build commands.
      For such users there is now still a way to have the fancy index.html file
      in the output.
      
      Differential Revision: https://reviews.llvm.org/D74467
      a807a068
    • Artem Dergachev's avatar
      [analyzer] VforkChecker: allow execve after vfork. · 5a11233a
      Artem Dergachev authored
      In the path-sensitive vfork() checker that keeps a list of operations
      allowed after a successful vfork(), unforget to include execve() in the list.
      
      Patch by Jan Včelák!
      
      Differential Revision: https://reviews.llvm.org/D73629
      5a11233a
    • Brian Gesiak's avatar
    • Jonas Devlieghere's avatar
      [lldb/Plugins] Add missing initialize/terminate calls · aa2ae6af
      Jonas Devlieghere authored
      Add missing initialize and terminate calls for DynamicLoaderHexagonDYLD
      and ObjectFileJIT.
      aa2ae6af
    • Jonas Devlieghere's avatar
      [lldb/Plugins] Conditionally build OperatingSystemPython. · b0cb98b1
      Jonas Devlieghere authored
      Only build the Python Operating System Plugin when LLDB_ENABLE_PYTHON is
      set to true.
      b0cb98b1