1. Mar 21, 2020
  2. Mar 20, 2020
    • Erich Keane's avatar
      [[Clang CallGraph]] CallGraph should still record calls to decls. · ffcc076a
      Erich Keane authored
      Discovered by a downstream user, we found that the CallGraph ignores
      callees unless they are defined.  This seems foolish, and prevents
      combining the report with other reports to create unified reports.
      Additionally, declarations contain information that is likely useful to
      consumers of the CallGraph.
      
      This patch implements this by splitting the includeInGraph function into
      two versions, the current one plus one that is for callees only.  The
      only difference currently is that includeInGraph checks for a body, then
      calls includeCalleeInGraph.
      
      Differential Revision: https://reviews.llvm.org/D76435
      ffcc076a
    • Simon Pilgrim's avatar
      [InstCombine][X86] simplifyX86immShift - convert variable in-range vector... · 34659de5
      Simon Pilgrim authored
      [InstCombine][X86] simplifyX86immShift - convert variable in-range vector shift by scalar amounts to generic shifts (PR40391)
      
      The sll/srl/sra scalar vector shifts can be replaced with generic shifts if the shift amount is known to be in range.
      
      This also required public DemandedElts variants of llvm::computeKnownBits to be exposed (PR36319).
      34659de5
    • Simon Tatham's avatar
      [ARM,MVE] Add ACLE intrinsics for the vaddv/vaddlv family. · 1adfa4c9
      Simon Tatham authored
      Summary:
      I've implemented them as target-specific IR intrinsics rather than
      using `@llvm.experimental.vector.reduce.add`, on the grounds that the
      'experimental' intrinsic doesn't currently have much code generation
      benefit, and my replacements encapsulate the sign- or zero-extension
      so that you don't expose the illegal MVE vector type (`<4 x i64>`) in
      IR.
      
      The machine instructions come in two versions: with and without an
      input accumulator. My new IR intrinsics, like the 'experimental' one,
      don't take an accumulator parameter: we represent that by just adding
      on the input value using an ordinary i32 or i64 add. So if you write
      the `vaddvaq` C-language intrinsic with an input accumulator of zero,
      it can be optimised to VADDV, and conversely, if you write something
      like `x += vaddvq(y)` then that can be combined into VADDVA.
      
      Most of this is achieved in isel lowering, by converting these IR
      intrinsics into the existing `ARMISD::VADDV` family of custom SDNode
      types. For the difficult case (64-bit accumulators), isel lowering
      already implements the optimization of folding an addition into a
      VADDLV to make a VADDLVA; so once we've made a VADDLV, our job is
      already done, except that I had to introduce a parallel set of ARMISD
      nodes for the //predicated// forms of VADDLV.
      
      For the simpler VADDV, we handle the predicated form by just leaving
      the IR intrinsic alone and matching it in an ordinary dag pattern.
      
      Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard
      
      Reviewed By: dmgreen
      
      Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76491
      1adfa4c9
    • Simon Tatham's avatar
      [ARM,MVE] Add ACLE intrinsics for the vminv/vmaxv family. · 45a9945b
      Simon Tatham authored
      Summary:
      I've implemented these as target-specific IR intrinsics, because
      they're not //quite// enough like @llvm.experimental.vector.reduce.min
      (which doesn't take the extra scalar parameter). Also this keeps the
      predicated and unpredicated versions looking similar, and the
      floating-point minnm/maxnm versions fold into the same schema.
      
      We had a couple of min/max reductions already implemented, from the
      initial pathfinding exercise in D67158. Those were done by having
      separate IR intrinsic names for the signed and unsigned integer
      versions; as part of this commit, I've changed them to use a flag
      parameter indicating signedness, which is how we ended up deciding
      that the rest of the MVE intrinsics family ought to work. So now
      hopefully the ewhole lot is consistent.
      
      In the new llc test, the output code from the `v8f16` test functions
      looks quite unpleasant, but most of it is PCS lowering (you can't pass
      a `half` directly in or out of a function). In other circumstances,
      where you do something else with your `half` in the same function, it
      doesn't look nearly as nasty.
      
      Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, hiraditya, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76490
      45a9945b
    • Marcel Hlopko's avatar
      [Syntax] Test both the default and windows target platforms in unittests · eddede9d
      Marcel Hlopko authored
      Summary:
      This increases the coverage for things that differ between Linux and Windows, such as -fdelayed-template-parsing. This would have prevented the rollback of https://reviews.llvm.org/D76346.
      
      While at it, update -std=c++11 to c++17 for the test.
      
      Reviewers: gribozavr2
      
      Reviewed By: gribozavr2
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76497
      eddede9d
    • Gabor Marton's avatar
    • Sean Fertile's avatar
      [PowerPC][AIX][NFC] Add zero-sized by val params to cc test. · fc902cb6
      Sean Fertile authored
      The zero sized structs force creation of a stack object of size 1, align
      8 in the locals area, but otherwise have no effect on the calling convention
      code. i.e. They consume no registers or stack space in the paramater save area.
      
      The 32-bit codegen has 8 bytes of padding to fit the new stack object so
      stack size stays the same. 64-bit codegen has no padding in the stack
      frames allocated so 8 bytes is added, and becuase of 16-byte aligned
      stack, the stack size increases from 112 bytes to 128.
      fc902cb6
    • Bjorn Pettersson's avatar
      [DAGCombiner] Fix non-determinism problem related to argument evaluation order in visitFDIV · d168b777
      Bjorn Pettersson authored
      Summary:
      For some reason the order in which we call getNegatedExpression
      for the involved operands, after a call to isCheaperToUseNegatedFPOps,
      seem to matter. This patch includes a new test case in
      test/CodeGen/X86/fdiv.ll that crashes if we reverse the order of
      those calls. Before this patch that could happen depending on
      which compiler that were used when buildind llvm. With my GCC
      version (7.4.0) I got the crash, because it seems like it is
      using a different order for the argument evaluation compared
      to clang.
      
      All other users of isCheaperToUseNegatedFPOps already used this
      pattern with unfolded/ordered calls to getNegatedExpression, so
      this patch is aligning visitFDIV with the other use cases.
      
      This patch simply deals with the non-determinism for FDIV. While
      the underlying problem with getNegatedExpression is discussed
      further in D76439.
      
      Reviewers: spatel, RKSimon
      
      Reviewed By: spatel
      
      Subscribers: hiraditya, mgrang, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D76319
      d168b777
    • Matt Arsenault's avatar
      AMDGPU: Move towards deprecating alignbit intrinsic · a950e3be
      Matt Arsenault authored
      This is equivalent to llvm.fshr, so legalize the intrinsic to the
      generic node.
      a950e3be
    • Matt Arsenault's avatar
      AMDGPU: Add more tests for fshr · 53d6b156
      Matt Arsenault authored
      53d6b156
    • Kostya Kortchinsky's avatar
      [scudo][standalone] Allow fallback to secondary if primary is full · f8352502
      Kostya Kortchinsky authored
      Summary:
      We introduced a way to fallback to the immediately larger size class for
      the Primary in the event a region was full, but in the event of the largest
      size class, we would just fail.
      
      This change allows to fallback to the Secondary when the last region of
      the Primary is full. We also expand the trick to all platforms as opposed
      to being Android only, and update the test to cover the new case.
      
      Reviewers: hctim, cferris, eugenis, morehouse, pcc
      
      Subscribers: #sanitizers, llvm-commits
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D76430
      f8352502
    • alex-t's avatar
      [AMDGPU] Enable divergence driven ISel for ADD/SUB i64 · 6e34e718
      alex-t authored
      Summary:
      Currently we custom select add/sub with carry out to scalar form relying on later replacing them to vector form if necessary.
      This change enables custom selection code to take the divergence of adde/addc SDNodes into account and select the appropriate form in one step.
      
      Reviewers: arsenm, vpykhtin, rampitec
      
      Reviewed By: arsenm, vpykhtin
      
      Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa
      
      Differential Revision: https://reviews.llvm.org/D76371
      6e34e718
    • Mikhail Maltsev's avatar
      [ARM,CDE] Implement CDE vreinterpret intrinsics · 6ae3eff8
      Mikhail Maltsev authored
      Summary:
      This patch implements the following CDE intrinsics:
      
        int8x16_t __arm_vreinterpretq_s8_u8 (uint8x16_t in);
        uint16x8_t __arm_vreinterpretq_u16_u8 (uint8x16_t in);
        int16x8_t __arm_vreinterpretq_s16_u8 (uint8x16_t in);
        uint32x4_t __arm_vreinterpretq_u32_u8 (uint8x16_t in);
        int32x4_t __arm_vreinterpretq_s32_u8 (uint8x16_t in);
        uint64x2_t __arm_vreinterpretq_u64_u8 (uint8x16_t in);
        int64x2_t __arm_vreinterpretq_s64_u8 (uint8x16_t in);
        float16x8_t __arm_vreinterpretq_f16_u8 (uint8x16_t in);
        float32x4_t __arm_vreinterpretq_f32_u8 (uint8x16_t in);
      
      These intrinsics are header-only because they reuse the existing
      MVE vreinterpret clang built-ins.
      
      This set is slightly different from the published specification
      (see https://static.docs.arm.com/101028/0010/ACLE_2019Q4_release-0010.pdf):
      it includes
      
        int8x16_t __arm_vreinterpretq_s8_u8 (uint8x16_t in);
      
      which was unintentionally ommitted from the spec, and
      does not include
      
        float64x2_t __arm_vreinterpretq_f64_u8 (uint8x16_t in);
      
      The float64x2_t type requires additional implementation
      effort, and we are not including it yet.
      
      Reviewers: simon_tatham, MarkMurrayARM, dmgreen, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, danielkiss, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76300
      6ae3eff8
    • Mikhail Maltsev's avatar
      [ARM,CDE] Implement CDE unpredicated Q-register intrinsics · 969034b8
      Mikhail Maltsev authored
      Summary:
      This patch implements the following intrinsics:
      
        uint8x16_t __arm_vcx1q_u8 (int coproc, uint32_t imm);
        T __arm_vcx1qa(int coproc, T acc, uint32_t imm);
        T __arm_vcx2q(int coproc, T n, uint32_t imm);
        uint8x16_t __arm_vcx2q_u8(int coproc, T n, uint32_t imm);
        T __arm_vcx2qa(int coproc, T acc, U n, uint32_t imm);
        T __arm_vcx3q(int coproc, T n, U m, uint32_t imm);
        uint8x16_t __arm_vcx3q_u8(int coproc, T n, U m, uint32_t imm);
        T __arm_vcx3qa(int coproc, T acc, U n, V m, uint32_t imm);
      
      Most of them are polymorphic. Furthermore, some intrinsics are
      polymorphic by 2 or 3 parameter types, such polymorphism is not
      supported by the existing MVE/CDE tablegen backends, also we don't
      really want to have a combinatorial explosion caused by 1000 different
      combinations of 3 vector types. Because of this some intrinsics are
      implemented as macros involving a cast of the polymorphic arguments to
      uint8x16_t.
      
      The IR intrinsics are even more restricted in terms of types: all MVE
      vectors are cast to v16i8.
      
      Reviewers: simon_tatham, MarkMurrayARM, dmgreen, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76299
      969034b8
    • Mikhail Maltsev's avatar
      [ARM,CDE] Implement CDE S and D-register intrinsics · d22e6617
      Mikhail Maltsev authored
      Summary:
      This patch implements the following ACLE intrinsics:
      
        uint32_t __arm_vcx1_u32(int coproc, uint32_t imm);
        uint32_t __arm_vcx1a_u32(int coproc, uint32_t acc, uint32_t imm);
        uint32_t __arm_vcx2_u32(int coproc, uint32_t n, uint32_t imm);
        uint32_t __arm_vcx2a_u32(int coproc, uint32_t acc, uint32_t n, uint32_t imm);
        uint32_t __arm_vcx3_u32(int coproc, uint32_t n, uint32_t m, uint32_t imm);
        uint32_t __arm_vcx3a_u32(int coproc, uint32_t acc, uint32_t n, uint32_t m, uint32_t imm);
      
        uint64_t __arm_vcx1d_u64(int coproc, uint32_t imm);
        uint64_t __arm_vcx1da_u64(int coproc, uint64_t acc, uint32_t imm);
        uint64_t __arm_vcx2d_u64(int coproc, uint64_t m, uint32_t imm);
        uint64_t __arm_vcx2da_u64(int coproc, uint64_t acc, uint64_t m, uint32_t imm);
        uint64_t __arm_vcx3d_u64(int coproc, uint64_t n, uint64_t m, uint32_t imm);
        uint64_t __arm_vcx3da_u64(int coproc, uint64_t acc, uint64_t n, uint64_t m, uint32_t imm);
      
      Since the semantics of CDE instructions is opaque to the compiler, the
      ACLE intrinsics require dedicated LLVM IR intrinsics. The 64-bit and
      32-bit variants share the same IR intrinsic.
      
      Reviewers: simon_tatham, MarkMurrayARM, ostannard, dmgreen
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76298
      d22e6617
    • Mikhail Maltsev's avatar
      [ARM,CDE] Implement GPR CDE intrinsics · 7a85e358
      Mikhail Maltsev authored
      Summary:
      This change implements ACLE CDE intrinsics that translate to
      instructions working with general-purpose registers.
      
      The specification is available at
      https://static.docs.arm.com/101028/0010/ACLE_2019Q4_release-0010.pdf
      
      Each ACLE intrinsic gets a corresponding LLVM IR intrinsic (because
      they have distinct function prototypes). Dual-register operands are
      represented as pairs of i32 values. Because of this the instruction
      selection for these intrinsics cannot be represented as TableGen
      patterns and requires custom C++ code.
      
      Reviewers: simon_tatham, MarkMurrayARM, dmgreen, ostannard
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D76296
      7a85e358
    • Florian Hahn's avatar
      ece6cf0f
    • Michael Liao's avatar
      Fix `-Wunused-variable` warning. NFC. · a4edea29
      Michael Liao authored
      a4edea29
    • Simon Pilgrim's avatar
    • Alexey Bataev's avatar
      [OPENMP50]Initial support for scan directive. · fcba7c35
      Alexey Bataev authored
      Addedi basic parsing/sema/serialization support for scan directive.
      fcba7c35