1. Jul 27, 2021
  2. Jul 26, 2021
    • Nikita Popov's avatar
      [MergeICmps] Try to fix MSVC build failure · c691651c
      Nikita Popov authored
      Apparently this fails to line up the types -- try to sidestep the
      issue entirely by writing the code in a more reasonable way: Walk
      over the operands and perform a set lookup, rather than walking
      over the set and performing an operand scan.
      c691651c
    • Kazu Hirata's avatar
      [AsmParser] Remove MDRef (NFC) · 0c997847
      Kazu Hirata authored
      The last use was removed on Jan 12, 2015 in commit
      ab617d59.
      0c997847
    • Paul Walker's avatar
      [SVE] Use reg+reg addressing mode for immediate offsets. · 3b77e273
      Paul Walker authored
      For reg+imm SVE addressing mode imm is implictly scaled by VL,
      making them impractical for truely immediate offsets.  However, if
      the offset can be unscaled based on the storage element type we
      can use the reg+reg SVE addressing mode and thus either reduce the
      number of generate add instructions or replace them with a mov
      instruction that can be hoisted from the hot code path.
      
      Differential Revision: https://reviews.llvm.org/D106744
      3b77e273
    • Louis Dionne's avatar
    • Sanjay Patel's avatar
      [SimplifyLibCalls] avoid crash on pointer math · 87d604ff
      Sanjay Patel authored
      We could try harder to screen out libcalls by
      function signature (and that would be a much larger
      change than for sprintf alone), but that might make
      the transition to type-less pointers more difficult.
      
      https://llvm.org/PR51200
      87d604ff
    • Sanjay Patel's avatar
      d8260269
    • Nikita Popov's avatar
      [MergeICmps] Separate out BCECmp and use Optional (NFC) · 0d3807b3
      Nikita Popov authored
      Separate out the BCECmp part from BCECmpBlock, which just stores
      the comparison atoms without the branch instruction. At the same
      time switch the code to return Optional<> rather than objects in
      invalid state and partially constructed objects.
      0d3807b3
    • Sander de Smalen's avatar
      [LV] Don't assume isScalarAfterVectorization if one of the uses needs widening. · 981e9dce
      Sander de Smalen authored
      This fixes an issue that was found in D105199, where a GEP instruction
      is used both as the address of a store, as well as the value of a store.
      For the former, the value is scalar after vectorization, but the latter
      (as value) requires widening.
      
      Other code in that function seems to prevent similar cases from happening,
      but it seems this case was missed.
      
      Reviewed By: david-arm
      
      Differential Revision: https://reviews.llvm.org/D106164
      981e9dce
    • Bradley Smith's avatar
    • Shilei Tian's avatar
      [Clang][OpenMP] Remove the mandatory flush for capture for OpenMP 5.1 · 3274cdc8
      Shilei Tian authored
      In OpenMP 5.1:
      > If the `write` or `update` clause is specifieded, the atomic operation is not an atomic conditional update for which the comparison fails, and the effective memory ordering is `release`, `acq_rel`, or `seq_cst`, the strong flush on entry to the atomic operation is also a release flush. If the `read` or `update` clause is specified and the effective memory ordering is `acquire`, `acq_rel`, or `seq_cst` then the strong flush on exit from the atomic operation is also an acquire flush.
      
      In OpenMP 5.0:
      > If the `write`, `update`, or **`capture`** clause is specified and the `release`, `acq_rel`, or `seq_cst` clause is specified then the strong flush on entry to the atomic operation is also a release flush. If the `read` or `capture` clause is specified and the `acquire`, `acq_rel`, or `seq_cst` clause is specified then the strong flush on exit from the atomic operation is also an acquire flush.
      
      From my understanding, in OpenMP 5.1, `capture` is removed from the requirement for flush, therefore we don't have to enforce it.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D100768
      3274cdc8
    • Ulrich Weigand's avatar
      [SystemZ] Add support for new cpu architecture - arch14 · 8cd8120a
      Ulrich Weigand authored
      This patch adds support for the next-generation arch14
      CPU architecture to the SystemZ backend.
      
      This includes:
      - Basic support for the new processor and its features.
      - Detection of arch14 as host processor.
      - Assembler/disassembler support for new instructions.
      - New LLVM intrinsics for certain new instructions.
      - Support for low-level builtins mapped to new LLVM intrinsics.
      - New high-level intrinsics in vecintrin.h.
      - Indicate support by defining  __VEC__ == 10304.
      
      Note: No currently available Z system supports the arch14
      architecture.  Once new systems become available, the
      official system name will be added as supported -march name.
      8cd8120a
    • Florian Hahn's avatar
      Recommit "[VPlan] Add recipe for first-order rec phis, make splicing explicit." · 7a1e73f0
      Florian Hahn authored
      This reverts the revert commit b1777b04.
      
      The patch originally got reverted due to a crash:
      https://bugs.chromium.org/p/chromium/issues/detail?id=1232798#c2
      
      The underlying issue was that we were not using the stored values from
      the modified memory recipes, but the out-of-date values directly from
      the IR (accessed via the VPlan). This should be fixed in d995d637. A
      reduced version of the reproducer has been added in 93664503.
      7a1e73f0
    • Mark de Wever's avatar
      [libc++][ci] Detect not committed generated files. · 1139fd42
      Mark de Wever authored
      The Generated output CI job only tests for modified files. This job
      should also fail the generated output contains new files.
      
      It would be possible to test modified and untracked files in one
      execution of `git ls-files`. However the diff is stored as an artifact
      so the execution of `git diff` would still be required.
      
      Discussion: Would it be better to do `git ls-files -om` and remove the
      excution of
      `! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false` ?
      (Obviously then the name `generated_output.untracked` should change to
      something like `generated_output.status`)
      
      Reviewed By: #libc, ldionne
      
      Differential Revision: https://reviews.llvm.org/D106534
      1139fd42
    • Nikita Popov's avatar
      [IR] Consider non-willreturn as side effect (PR50511) · 33146857
      Nikita Popov authored
      This adjusts mayHaveSideEffect() to return true for !willReturn()
      instructions. Just like other side-effects, non-willreturn calls
      (aka "divergence") cannot be removed and cannot be reordered relative
      to other side effects. This fixes a number of bugs where
      non-willreturn calls are either incorrectly dropped or moved. In
      particular, it also fixes the last open problem in
      https://bugs.llvm.org/show_bug.cgi?id=50511.
      
      I performed a cursory review of all current mayHaveSideEffect()
      uses, which convinced me that these are indeed the desired default
      semantics. Places that do not want to consider non-willreturn as a
      sideeffect generally do not want mayHaveSideEffect() semantics at
      all. I identified two such cases, which are addressed by D106591
      and D106742. Finally, there is a use in SCEV for which we don't
      really have an appropriate API right now -- what it wants is
      basically "would this be considered forward progress". I've just
      spelled out the previous semantics there.
      
      Differential Revision: https://reviews.llvm.org/D106749
      33146857
    • Benjamin Kramer's avatar
      Simplify away some SmallVector copies. NFCI. · 404f0d4f
      Benjamin Kramer authored
      The lifetime of the initializer list is the full expression, so we can
      skip storing it in a temporary vector.
      404f0d4f
    • Gabor Marton's avatar
      [Analyzer][solver][NFC] print constraints deterministically (ordered by their... · 4761321d
      Gabor Marton authored
      [Analyzer][solver][NFC] print constraints deterministically (ordered by their string representation)
      
      This change is an extension to D103967 where I added dump methods for
      (dis)equality classes of the State. There, the (dis)equality classes and their
      contents are dumped in an ordered fashion, they are ordered based on their
      string representation. This is very useful once we start to use FileCheck to
      test the State dump in certain tests.
      
      Differential Revision: https://reviews.llvm.org/D106642
      4761321d
    • Jeremy Morse's avatar
      [InstrRef][AArch64][1/4] Accept constant physreg variable locations · f86694cb
      Jeremy Morse authored
      Late in SelectionDAG we join up instruction numbers with their defining
      instructions, if it couldn't be done during the main part of SelectionDAG.
      One exception is function arguments, where we have to point a DBG_PHI
      instruction at the incoming live register, as they don't have a defining
      instruction. This patch adds another exception, for constant physregs, like
      aarch64 has.
      
      It may seem wasteful to use two instructions where we could use a single
      DBG_VALUE, however the whole point of instruction referencing is to
      decouple the identification of values from the specification of where
      variable location ranges start.
      
      (Part of my aarch64 work to ease adoption of  instruction referencing, as
      in the meta comment on D104520)
      
      Differential Revision: https://reviews.llvm.org/D104520
      f86694cb
    • Florian Hahn's avatar
      93664503
    • Alexey Bataev's avatar
      [SLP]Fix costs calculations. · 6ca48efc
      Alexey Bataev authored
      Need to fix several cost-related problems. The final type may be defined
      incorrectly because of to early definition (we may end up with the wider
      type), the CommonCost should not be redefined in ExtractElements
      cost related calculations and the shuffle of the final insertelements
      vectors should be calculated as a cost of single vector permutations
      + costs of two vector permutations for other n-1 incoming vectors.
      
      Differential Revision: https://reviews.llvm.org/D106578
      6ca48efc
    • Anastasia Stulova's avatar
      [OpenCL] Change default standard version to CL1.2 · 81600160
      Anastasia Stulova authored
      Set default version for OpenCL C to 1.2. This means that the
      absence of any standard flag will be equivalent to passing
      '-cl-std=CL1.2'.
      
      Note that this patch also fixes incorrect version check for
      the pointer to pointer kernel arguments diagnostic and
      atomic test.
      
      Differential Revision: https://reviews.llvm.org/D106504
      81600160
    • gbreynoo's avatar
      [llvm-readobj] Display multiple function names for stack size entries · 87ed73fe
      gbreynoo authored
      The current implementation of displaying .stack_size information
      presumes that each entry represents a single function but this is not
      always the case. For example with the use of ICF multiple functions can
      be represented with the same code, meaning that the address found in a
      .stack_size entry corresponds to multiple function symbols.
      This change allows multiple function names to be displayed when
      appropriate.
      
      Differential Revision: https://reviews.llvm.org/D105884
      87ed73fe
    • Jay Foad's avatar
      [AMDGPU][GISel] Fix MMO for raw/struct buffer access with non-constant offset · 59f68652
      Jay Foad authored
      Codegen for the raw/struct buffer access intrinsics would update the
      offset in the MMO to reflect the combined offset, if it was known to be
      constant. If the combined offset was not known to be constant, or if
      there was an index, it would set the offset in the MMO to 0. This is
      unsafe because it makes it look like the access does not alias with
      another access with a fixed non-zero offset.
      
      Fix these cases by setting the pointer in the MMO to null, to reflect
      the fact that we do not have any known IR value pointer + constant
      offset for the access.
      
      D106284 did this for SelectionDAG. This is the corresponding fix for
      GlobalISel.
      
      Differential Revision: https://reviews.llvm.org/D106451
      59f68652
    • Jay Foad's avatar
      [AMDGPU] Pre-commit global-isel test case for D106451 · 683b9ed0
      Jay Foad authored
      This test case shows the scheduler wrongly reordering two buffer
      accesses that might alias.
      683b9ed0
    • Jay Foad's avatar
      [AMDGPU] Fix MMO for raw/struct buffer access with non-constant offset · 9ac10658
      Jay Foad authored
      Codegen for the raw/struct buffer access intrinsics would update the
      offset in the MMO to reflect the combined offset, if it was known to be
      constant. If the combined offset was not known to be constant, or if
      there was an index, it would set the offset in the MMO to 0. This is
      unsafe because it makes it look like the access does not alias with
      another access with a fixed non-zero offset.
      
      Fix these cases by setting the pointer in the MMO to null, to reflect
      the fact that we do not have any known IR value pointer + constant
      offset for the access.
      
      Differential Revision: https://reviews.llvm.org/D106284
      9ac10658
    • David Green's avatar
      [ARM] Ensure correct regclass in distributing postinc · 010f8e30
      David Green authored
      The register class required for some MVE loads/stores is more
      constrained than the register we use when creating postinc. Make sure we
      constrain the register class to keep the code correct.
      010f8e30
    • Tim Northover's avatar
      a487a49a
    • Nikita Popov's avatar
      [SimplifyCFG] Improve store speculation check · ffb3277b
      Nikita Popov authored
      isSafeToSpeculateStore() looks for a preceding store to the same
      location to make sure that introducing a new store of the same
      value is safe. It currently bails on intervening mayHaveSideEffect()
      instructions. However, I believe just checking mayWriteToMemory()
      is sufficient there -- we just need to make sure that we know which
      value was stored, we don't care if we can unwind in the meantime.
      
      While looking into this, I started having some doubts about the
      correctness of the transform with regard to thread safety. While
      we don't try to hoist non-simple stores, I believe we also need
      to make sure that the preceding store is simple as well. Otherwise
      we could introduce a spurious non-atomic write after an atomic write
      -- under our memory model this would result in a subsequent undef
      atomic read, even if the second write stores the same value as the
      first.
      
      Example: https://alive2.llvm.org/ce/z/q_3YAL
      
      Differential Revision: https://reviews.llvm.org/D106742
      ffb3277b
    • Kerry McLaughlin's avatar
      [SVE] Fix casts to <FixedVectorType> in truncateToMinimalBitwidths · e484e1ae
      Kerry McLaughlin authored
      Fixes more casts to `<FixedVectorType>` for the cases where the
      instruction is a Insert/ExtractElementInst.
      
      For fixed-width, this part of truncateToMinimalBitWidths is tested by
      AArch64/type-shrinkage-insertelt.ll. I attempted to write a test case for this part
      of truncateToMinimalBitWidths which uses scalable vectors, but was unable to add
      one. The tests in type-shrinkage-insertelt.ll rely on scalarization to create extract
      element instructions for instance, which is not possible for scalable vectors.
      
      Reviewed By: david-arm
      
      Differential Revision: https://reviews.llvm.org/D106163
      e484e1ae
    • Alexey Bataev's avatar
      Revert "[SLP]Fix costs calculations." · d7cb2a07
      Alexey Bataev authored
      This reverts commit a053afed to fix
      buildbots.
      d7cb2a07
    • Caroline Concatto's avatar
      [AArch65][SVE] Remove vector_splice from AddedComplexity pattern · bf28111e
      Caroline Concatto authored
      The pattern for vector_splice with Index equal or bigger than
      zero was misplaced in the AddedComplexity = 1 pattern in the AArch64
      tablegen file. This patch fixes it by removing vector_splice pattern
      from inside AddedComplexity = 1.
      bf28111e
    • Tres Popp's avatar
      539437e2
    • Alexey Bataev's avatar
      [SLP]Fix costs calculations. · a053afed
      Alexey Bataev authored
      Need to fix several cost-related problems. The final type may be defined
      incorrectly because of to early definition (we may end up with the wider
      type), the CommonCost should not be redefined in ExtractElements
      cost related calculations and the shuffle of the final insertelements
      vectors should be calculated as a cost of single vector permutations
      + costs of two vector permutations for other n-1 incoming vectors.
      
      Differential Revision: https://reviews.llvm.org/D106578
      a053afed
    • Paul Walker's avatar
      [NFC] Change VFShape so it contains an ElementCount rather than seperate VF... · 8a8d01d5
      Paul Walker authored
      [NFC] Change VFShape so it contains an ElementCount rather than seperate VF and IsScalable properties.
      
      Differential Revision: https://reviews.llvm.org/D106750
      8a8d01d5
    • Philipp Krones's avatar
      [Inliner] Make the CallPenalty configurable · 46c03668
      Philipp Krones authored
      Tests with multiple benchmarks, like Embench [1], showed that the
      CallPenalty magic number has the most influence on inlining decisions
      when optimizing for size.
      
      On the other hand, there was no good default value for this parameter.
      Some benchmarks profited strongly from a reduced call penalty. On
      example is the picojpeg benchmark compiled for RISC-V, which got 6%
      smaller with a CallPenalty of 10 instead of 12. Other benchmarks
      increased in size, like matmult.
      
      This commit makes the compromise of turning the magic number constant of
      CallPenalty into a configurable value. This introduces the flag
      `--inline-call-penalty`. With that flag users can fine tune the inliner
      to their needs.
      
      The CallPenalty constant was also used for loops. This commit replaces
      the CallPenalty constant with a new LoopPenalty constant that is now
      used instead.
      
      This is a slimmed down version of https://reviews.llvm.org/D30899
      
      [1]: https://github.com/embench/embench-iot
      
      Differential Revision: https://reviews.llvm.org/D105976
      46c03668
    • Florian Hahn's avatar
      [VPlan] Use stored value from recipes for interleave groups. · d995d637
      Florian Hahn authored
      Instead of getting the VPValue for the stored IR values through the
      current plan, use the stored value of the recipes directly.
      
      This way, the correct VPValues are used if the store recipes have been
      modified in the VPlan and the IR value is not correct any longer. This
      can happen, e.g. due to D105008.
      d995d637
    • Dylan Fleming's avatar
      [SVE] Add support for folding for select + masked loads · 20b0fa91
      Dylan Fleming authored
      Add folds to instcombine to support the removal of select instruction when the masked_load is guaranteed to zero the same lanes, i.e. select(mask, mload(,,mask,0), 0) -> mload(,,mask,0).
      
      Patch originally authored by @paulwalker-arm
      
      Reviewed By: david-arm
      
      Differential Revision: https://reviews.llvm.org/D106376
      20b0fa91
    • Caroline Concatto's avatar
      [SVE][AArch64] Improve code generation for vector_splice for Imm > 0 · 0bfc26e3
      Caroline Concatto authored
      This patch implements vector_splice in tablegen for all cases when the
      Immediate is positive and lower than the known minimum value of
      a scalable vector.
      Vector_splice can be implemented using SVE instruction EXT.
      For instance :
          @llvm.experimental.vector.splice(Vector_1, Vector_2, Imm)
          @llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, 1) ==> <B, C, D, E>
              EXT  Vector_1, Vector_2, Imm              // Vector_1 = B, C, D + Vector_2 = E
      
      Depends on D105633
      
      Differential Revision: https://reviews.llvm.org/D106273
      0bfc26e3
    • David Sherwood's avatar
      Fix test failures caused by 0aff1798 · b2a5f002
      David Sherwood authored
      b2a5f002
    • Caroline Concatto's avatar
      [AArch64][SVE] Improve code generation for vector_splice for Imm == -1 · 73e4e9cd
      Caroline Concatto authored
      This patch implements vector_splice in tablegen for:
        a) when the immediate is equal to -1 (Imm==1) and uses:
             INSR  +  LASTB
      For instance :
      @llvm.experimental.vector.splice(Vector_1, Vector_2, -1)
      @llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, 1) ==> <D, E, F, G>
          LAST   RegLast, Vector_1                 // RegLast = D
          INSR   Res, (Vector_1 >> 1), RegLast     // Res = D + E, F, G
      
      Differential Revision: https://reviews.llvm.org/D105633
      73e4e9cd