1. Oct 25, 2019
  2. Oct 24, 2019
    • Benjamin Kramer's avatar
      [InstCombine] Fold one-use variable into assert · 6f0bb770
      Benjamin Kramer authored
      Avoids warnings in Release builds. NFC.
      6f0bb770
    • jasonliu's avatar
      [NFC][XCOFF][AIX] Serialize object file writing for each CsectGroup · 78207e1f
      jasonliu authored
      Summary:
      
      Right now we handle each CsectGroup(ProgramCodeCsects, BSSCsects)
      individually when assigning indices, writing symbol table, and
      writing section raw data. However, there is already a pattern there,
      and we could common up those actions for every CsectGroup. This will
       make adding new CsectGroup(Read Write data, Read only data, TC/TOC,
       mergeable string) easier, and less error prone.
      
      Reviewed by: sfertile, daltenty, DiggerLin
      
      Approved by: daltenty
      
      Differential Revision: https://reviews.llvm.org/D69112
      78207e1f
    • Simon Tatham's avatar
      [InstCombine] Known-bits optimization for ARM MVE VADC. · e5f485c3
      Simon Tatham authored
      The MVE VADC instruction reads and writes the carry bit at bit 29 of
      the FPSCR register. The corresponding ACLE intrinsic is specified to
      work with an integer in which the carry bit is stored at bit 0. So if
      a user writes a code sequence in C that passes the carry from one VADC
      to the next, like this,
      
          s0 = vadcq_u32(a0, b0, &carry);
          s1 = vadcq_u32(a1, b1, &carry);
      
      then clang will generate IR for each of those operations that shifts
      the carry bit up into bit 29 before the VADC, and after it, shifts it
      back down and masks off all but the low bit. But in this situation
      what you really wanted was two consecutive VADC instructions, so that
      the second one directly reads the value left in FPSCR by the first,
      without wasting several instructions on pointlessly clearing the other
      flag bits in between.
      
      This commit explains to InstCombine that the other bits of the flags
      operand don't matter, and adds a test that demonstrates that all the
      code between the two VADC instructions can be optimized away as a
      result.
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67162
      e5f485c3
    • Simon Tatham's avatar
      [clang,ARM] Initial ACLE intrinsics for MVE. · 08074cc9
      Simon Tatham authored
      This commit sets up the infrastructure for auto-generating <arm_mve.h>
      and doing clang-side code generation for the builtins it relies on,
      and demonstrates that it works by implementing a representative sample
      of the ACLE intrinsics, more or less matching the ones introduced in
      LLVM IR by D67158,D68699,D68700.
      
      Like NEON, that header file will provide a set of vector types like
      uint16x8_t and C functions with names like vaddq_u32(). Unlike NEON,
      the ACLE spec for <arm_mve.h> includes a polymorphism system, so that
      you can write plain vaddq() and disambiguate by the vector types you
      pass to it.
      
      Unlike the corresponding NEON code, I've arranged to make every user-
      facing ACLE intrinsic into a clang builtin, and implement all the code
      generation inside clang. So <arm_mve.h> itself contains nothing but
      typedefs and function declarations, with the latter all using the new
      `__attribute__((__clang_builtin))` system to arrange that the user-
      facing function names correspond to the right internal BuiltinIDs.
      
      So the new MveEmitter tablegen system specifies the full sequence of
      IRBuilder operations that each user-facing ACLE intrinsic should
      translate into. Where possible, the ACLE intrinsics map to standard IR
      operations such as vector-typed `add` and `fadd`; where no standard
      representation exists, I call down to the sample IR intrinsics
      introduced in an earlier commit.
      
      Doing it like this means that you get the polymorphism for free just
      by using __attribute__((overloadable)): the clang overload resolution
      decides which function declaration is the relevant one, and _then_ its
      BuiltinID is looked up, so by the time we're doing code generation,
      that's all been resolved by the standard system. It also means that
      you get really nice error messages if the user passes the wrong
      combination of types: clang will show the declarations from the header
      file and explain why each one doesn't match.
      
      (The obvious alternative approach would be to have wrapper functions
      in <arm_mve.h> which pass their arguments to the underlying builtins.
      But that doesn't work in the case where one of the arguments has to be
      a constant integer: the wrapper function can't pass the constantness
      through. So you'd have to do that case using a macro instead, and then
      use C11 `_Generic` to handle the polymorphism. Then you have to add
      horrible workarounds because `_Generic` requires even the untaken
      branches to type-check successfully, and //then// if the user gets the
      types wrong, the error message is totally unreadable!)
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: mgorny, javed.absar, kristof.beyls, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D67161
      08074cc9
    • Simon Tatham's avatar
      [clang] New __attribute__((__clang_arm_mve_alias)). · 7c11da0c
      Simon Tatham authored
      This allows you to declare a function with a name of your choice (say
      `foo`), but have clang treat it as if it were a builtin function (say
      `__builtin_foo`), by writing
      
        static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_foo)))
        int foo(args);
      
      I'm intending to use this for the ACLE intrinsics for MVE, which have
      to be polymorphic on their argument types and also need to be
      implemented by builtins. To avoid having to implement the polymorphism
      with several layers of nested _Generic and make error reporting
      hideous, I want to make all the user-facing intrinsics correspond
      directly to clang builtins, so that after clang resolves
      __attribute__((overloadable)) polymorphism it's already holding the
      right BuiltinID for the intrinsic it selected.
      
      However, this commit itself just introduces the new attribute, and
      doesn't use it for anything.
      
      To avoid unanticipated side effects if this attribute is used to make
      aliases to other builtins, there's a restriction mechanism: only
      (BuiltinID, alias) pairs that are approved by the function
      ArmMveAliasValid() will be permitted. At present, that function
      doesn't permit anything, because the Tablegen that will generate its
      list of valid pairs isn't yet implemented. So the only test of this
      facility is one that checks that an unapproved builtin _can't_ be
      aliased.
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D67159
      7c11da0c
    • Simon Tatham's avatar
      [ARM] Add IR intrinsics for MVE VLD[24] and VST[24]. · e0ef4ebe
      Simon Tatham authored
      The VST2 and VST4 instructions take two or four vector registers as
      input, and store part of each register to memory in an interleaved
      pattern. They come in variants indicating which part of each register
      they store (VST20 and VST21; VST40 to VST43 inclusive); the intention
      is that issuing each of those variants in turn has the combined effect
      of loading or storing the whole set of registers to a memory block of
      equal size. The corresponding VLD2 and VLD4 instructions load from
      memory in the same interleaved format: each one overwrites only part
      of its output register set, and again, the idea is that if you use
      VLD4{0,1,2,3} or VLD2{0,1} together, you end up having written to the
      whole of each register.
      
      I've implemented the stores and loads quite differently. The loads
      were easiest to implement as a single intrinsic that expands to all
      four VLD4x instructions or both VLD2x, delivering four complete output
      registers. (Implementing each individual load as a separate
      instruction taking four input registers to partially overwrite is
      possible in theory, but pointless, and when I tried it, I found it
      would need extra work to get the register allocation not to be
      horrible.) Since that intrinsic delivers multiple outputs, it has to
      be instruction-selected in custom C++.
      
      But the store instructions are easier to model individually, because
      they don't overwrite any register at all and you can write a DAG Isel
      pattern in Tablegen for each one.
      
      Hence, my new intrinsic `int_arm_mve_vld4q` expands to four load
      instructions, delivers four full output vectors, and is handled by C++
      code, whereas `int_arm_mve_vst4q` expands to just one store
      instruction, takes four input vectors and a constant indicating which
      lanes to store, and is handled entirely in Tablegen. (And similarly
      for vld2q/vst2q.) This is asymmetric, but it was the easiest way to do
      each one.
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68700
      e0ef4ebe
    • Simon Tatham's avatar
      [ARM] Add some sample IR MVE intrinsics with C++ isel. · ceeff95c
      Simon Tatham authored
      This adds some initial example IR intrinsics for MVE instructions that
      deliver multiple output values, and hence, have to be instruction-
      selected by custom C++ code instead of Tablegen patterns.
      
      I've added the writeback gather load instructions (taking a vector of
      base addresses and a single common offset, returning a vector of
      loaded values and an updated vector of base addresses); one example
      from the long shift family (taking and returning a 64-bit value in two
      GPRs); and the VADC instruction (which propagates a carry bit from
      each vector-lane addition to the next, taking an input carry flag in
      FPSCR and outputting the final one in FPSCR as well).
      
      To support the VPT-predicated forms of these instructions, I've
      written some helper functions to add the cluster of MVE predicate
      operands to the end of a MachineInstr. `AddMVEPredicateToOps` is used
      when the instruction actually is predicated (so it takes a predicate
      mask argument), and `AddEmptyMVEPredicateToOps` is for when the
      instruction is unpredicated (so it fills in $noreg for the mask). Each
      one comes in a form suitable for `vpred_n`, and one for `vpred_r`
      which takes the extra 'inactive' parameter.
      
      For VADC, the representation of the carry flag in the IR intrinsic is
      a word intended to be moved directly to and from `FPSCR_nzcvqc`, i.e.
      with the carry flag in bit 29 of the word. (The user-facing ACLE
      intrinsic will want it to be in bit 0, but I'll do that on the clang
      side.)
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D68699
      ceeff95c
    • Simon Tatham's avatar
      [ARM] Begin adding IR intrinsics for MVE instructions. · 1b45297e
      Simon Tatham authored
      This commit, together with the next few, will add a representative
      sample of the kind of IR intrinsics that we'll need in order to
      implement the user-facing ACLE intrinsics for MVE. Supporting all of
      them will take more work; the intention of this initial series of
      commits is to implement an intrinsic or two from lots of different
      categories, as examples and proofs of concept.
      
      This initial commit introduces a small number of IR intrinsics for
      instructions simple enough that they can use Tablegen ISel patterns:
      the predicated versions of the VADD and VSUB instructions (both
      integer and FP), VMIN and VMAX, and the float->half VCVT instruction
      (predicated and unpredicated).
      
      When using VPT-predicated instructions in automatic code generation,
      it will be convenient to specify the predicate value as a vector of
      the appropriate number of i1. To make it easy to specify all sizes of
      an instruction in one go and give each one the matching predicate
      vector type, I've added a system of Tablegen informational records
      describing MVE's vector types: each one gives the underlying LLVM IR
      ValueType (which may not be the same if the MVE vector is of
      explicitly signed or unsigned integers) and an appropriate vNi1 to use
      as the predicate vector.
      
      (Also, those info records include the usual encoding for the types, so
      that as we add associations between each instruction encoding and one
      of the new `MVEVectorVTInfo` records, we can remove some of the
      existing template parameters and replace them with references to the
      vector type info's fields.)
      
      The user-facing ACLE intrinsics will receive a predicate mask as a
      16-bit integer, so I've also provided a pair of intrinsics i2v and
      v2i, to convert between an integer and a vector of i1 by just changing
      the register class.
      
      Reviewers: dmgreen, miyuki, ostannard
      
      Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67158
      1b45297e
    • Michael Liao's avatar
      [AMDGPU] Skip additional folding on the same operand. · b2a65f0d
      Michael Liao authored
      Reviewers: rampitec, arsenm
      
      Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D69355
      b2a65f0d
    • Michael Liao's avatar
      950b800c
    • Ilya Biryukov's avatar
    • Simon Atanasyan's avatar
      [docs] Add Mips as a supported architecture in GettingStarted.rst · fd77e578
      Simon Atanasyan authored
      Patch by Miloš Stojanović
      
      Differential Revision: https://reviews.llvm.org/D69380
      fd77e578
    • Simon Atanasyan's avatar
      [docs] Update link to the MIPS 64-bit ELF object file specification · c84cfaf9
      Simon Atanasyan authored
      Patch by Miloš Stojanović
      
      Differential Revision: https://reviews.llvm.org/D69377
      c84cfaf9
    • Petar Avramovic's avatar
      [MIPS GlobalISel] Select MSA vector generic and builtin fabs · e3b49df5
      Petar Avramovic authored
      selectImpl is able to select G_FABS when we set bank for vector
      operands to fprb. Add detailed tests.
      Note: G_FABS is generated from llvm-ir intrinsics llvm.fabs.*,
      and at the moment MIPS is not able to generate this intrinsic for
      vector type (some targets generate vector llvm.fabs.* from calls
      to a builtin function).
      We can handle fabs using __builtin_msa_fmax_a_<format> and passing
      same vector as both arguments. __builtin_msa_fmax_a_<format> will
      be directly selected into FMAX_A_<format> in legalizeIntrinsic.
      
      Differential Revision: https://reviews.llvm.org/D69346
      e3b49df5
    • evgeny's avatar
      Don't add -fsplit-lto-unit for thin LTO builds with PS4 and Darwin toolchains · 1ae8e8d2
      evgeny authored
      These toolchains use legacy thin LTO API, which is not capable of unit splitting
      Differential revision: https://reviews.llvm.org/D69173
      1ae8e8d2
    • David Tellenbach's avatar
      [compiler-rt] Expose __hwasan_tag_mismatch_stub · 6d11abfe
      David Tellenbach authored
      Summary:
      GCC would like to emit a function call to report a tag mismatch
      rather than hard-code the `brk` instruction directly.
      
      __hwasan_tag_mismatch_stub contains most of the functionality to do
      this already, but requires exposure in the dynamic library.
      
      This patch moves __hwasan_tag_mismatch_stub outside of the anonymous
      namespace that it was defined in and declares it in
      hwasan_interface_internal.h.
      
      We also add the ability to pass sizes larger than 16 bytes to this
      reporting function by providing a fourth parameter that is only looked
      at when the size provided is not in the original accepted range.
      
      This does not change the behaviour where it is already being called,
      since the previous definition only accepted sizes up to 16 bytes and
      hence the change in behaviour is not seen by existing users.
      The change in declaration does not matter, since the only existing use
      is in the __hwasan_tag_mismatch function written in assembly.
      
      Reviewers: eugenis, kcc, pcc, #sanitizers
      
      Reviewed By: eugenis, #sanitizers
      
      Subscribers: kristof.beyls, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D69113
      
      Patch by Matthew Malcomson <matthew.malcomson@arm.com>
      6d11abfe
    • David Tellenbach's avatar
      Revert "Expose __hwasan_tag_mismatch_stub" · 93aec861
      David Tellenbach authored
      Attribution to author of patch got lost.
      
      This reverts commit 612eadb7.
      93aec861
    • David Tellenbach's avatar
      Expose __hwasan_tag_mismatch_stub · 612eadb7
      David Tellenbach authored
      Summary:
      GCC would like to emit a function call to report a tag mismatch
      rather than hard-code the `brk` instruction directly.
      
      __hwasan_tag_mismatch_stub contains most of the functionality to do
      this already, but requires exposure in the dynamic library.
      
      This patch moves __hwasan_tag_mismatch_stub outside of the anonymous
      namespace that it was defined in and declares it in
      hwasan_interface_internal.h.
      
      We also add the ability to pass sizes larger than 16 bytes to this
      reporting function by providing a fourth parameter that is only looked
      at when the size provided is not in the original accepted range.
      
      This does not change the behaviour where it is already being called,
      since the previous definition only accepted sizes up to 16 bytes and
      hence the change in behaviour is not seen by existing users.
      The change in declaration does not matter, since the only existing use
      is in the __hwasan_tag_mismatch function written in assembly.
      
      Tested with gcc and clang on an AArch64 vm.
      
      Reviewers: eugenis, kcc, pcc, #sanitizers
      
      Reviewed By: eugenis, #sanitizers
      
      Subscribers: kristof.beyls, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D69113
      612eadb7
    • Marek Kurdej's avatar
      73cebfe4
    • Benjamin Kramer's avatar
    • Haojian Wu's avatar
      [clangd] Handle the missing constructor initializers in findExplicitReferences. · 13fc899c
      Haojian Wu authored
      Reviewers: ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69241
      13fc899c
    • Haojian Wu's avatar
      [clangd] Collect name references in the index. · bf71e4fe
      Haojian Wu authored
      Summary:
      This is used for cross-file rename. When renaming a class, we expect to
      rename all related constructors/destructors.
      
      Reviewers: kadircet, ilya-biryukov
      
      Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69338
      bf71e4fe
    • Petar Avramovic's avatar
      [MIPS GlobalISel] MSA vector generic and builtin fadd, fsub, fmul, fdiv · 914ce664
      Petar Avramovic authored
      Select vector G_FADD, G_FSUB, G_FMUL and G_FDIV for MIPS32 with MSA. We
      have to set bank for vector operands to fprb and selectImpl will do the
      rest. __builtin_msa_fadd_<format>, __builtin_msa_fsub_<format>,
      __builtin_msa_fmul_<format> and __builtin_msa_fdiv_<format> will be
      transformed into G_FADD, G_FSUB, G_FMUL and G_FDIV in legalizeIntrinsic
      respectively and selected in the same way.
      
      Differential Revision: https://reviews.llvm.org/D69340
      914ce664
    • Petar Avramovic's avatar
      [MIPS GlobalISel] MSA vector generic and builtin sdiv, srem, udiv, urem · 1d7f79c0
      Petar Avramovic authored
      Select vector G_SDIV, G_SREM, G_UDIV and G_UREM for MIPS32 with MSA. We
      have to set bank for vector operands to fprb and selectImpl will do the
      rest. __builtin_msa_div_s_<format>, __builtin_msa_mod_s_<format>,
      __builtin_msa_div_u_<format> and __builtin_msa_mod_u_<format> will be
      transformed into G_SDIV, G_SREM, G_UDIV and G_UREM in legalizeIntrinsic
      respectively and selected in the same way.
      
      Differential Revision: https://reviews.llvm.org/D69333
      1d7f79c0
    • Craig Topper's avatar
      [X86] Replace some regular expressions in xray tests with explicit checks to show bad assembly. · 7f1ffef5
      Craig Topper authored
      We're print 16-bit or 32-bit registers in copy instructions to
      64-bit registers. This code will not assemble if it were to be
      parsed back in. Emitting to binary works because we'll encode
      the register the same way no matter what the size is.
      7f1ffef5
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Allow folding of sgpr to vgpr copy · 61e7a61b
      Stanislav Mekhanoshin authored
      Potentially sgpr to sgpr copy should also be possible.
      That is however trickier because we may end up with a
      wrong register class at use because of xm0/xexec permutations.
      
      Differential Revision: https://reviews.llvm.org/D69280
      61e7a61b
    • Shoaib Meenai's avatar
      [Hexagon] Fix typo. NFC · e3d26b42
      Shoaib Meenai authored
      Testing git push access.
      e3d26b42
    • Meike Baumgärtner's avatar
      Add beginning of LLVM's GettingStarted to GitHub readme · da6384fb
      Meike Baumgärtner authored
      Reviewed and approved by chandlerc.
      
      As GitHub is the canonical LLVM repository now, embrace GitHub's way of displaying basic build instructions in the top-level readme.md.
      da6384fb
    • Chandler Carruth's avatar
      Improve Clang's getting involved document and make it more inclusive in wording. · dc1499b9
      Chandler Carruth authored
      Summary: Working with Meike and others to improve the wording in this document.
      
      Reviewers: klimek
      
      Subscribers: mcrosier, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69351
      dc1499b9
    • David Tenty's avatar
      Use portable flag with nm in extract_symbols.py · bf869683
      David Tenty authored
      Summary:
      nm is one of the tools that extract_symbols.py can use to extract
      symbols from llvm libraries as part of the build process. This patch
      updates the invocation of nm to use the -P POSIX option for "portable
      output" so we get a consistently parsable output format on all
      platforms.
      
      A link to the relevant nm format: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html
      
      Reviewers: hubert.reinterpretcast, stevewan, sfertile
      
      Reviewed By: stevewan
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D69004
      bf869683
    • Meike Baumgärtner's avatar
      Improve language in GettingStarted.rst · 23fdd513
      Meike Baumgärtner authored
      This patch was reviewed and approved by chandlerc.
      
      "Getting Started with the LLVM System" is the first point of contact for many newcomers in the LLVM community.
       * Make the first two paragraphs more welcoming
       * Use more inclusive language
      23fdd513
    • Stephan T. Lavavej's avatar
      7c9844b6
    • Chandler Carruth's avatar
      Remove a no longer accurate sentence from the coding standards. · bf2975ec
      Chandler Carruth authored
      (And test my commit access. We're working on larger changes here.)
      bf2975ec
    • Louis Dionne's avatar
      [NFC] Strip trailing whitespace from libc++ · 6b77ebdc
      Louis Dionne authored
      6b77ebdc