Skip to content
  1. Dec 20, 2017
    • Matt Arsenault's avatar
      DAG: Tolerate non-MemSDNodes for OPC_RecordMemRef · d60951f4
      Matt Arsenault authored
      When intrinsics are allowed to have mem operands, there
      are two ways this can happen. First is an intrinsic
      that is marked has having a mem operand, but is not handled
      by getTgtMemIntrinsic.
      
      The second way can occur even for intrinsics which do not
      have a mem operand. It seems the selector table does
      some kind of sorting based on the opcode, and the
      mem ref recording can happen in the same scope for
      intrinsics that both do and do not have mem refs.
      I haven't been able to figure out exactly why this happens
      (although it happens even with the matcher optimizations disabled).
      I'm not sure if it's worth trying to avoid hitting this for
      these nodes since I think it's still reasonable to handle
      this in case getTgtMemIntrinic is not implemented.
      
      llvm-svn: 321208
      d60951f4
    • Nirav Dave's avatar
      [DAG] Fix condition on overlapping store check. · a869856c
      Nirav Dave authored
      Prevent overlapping store elision when overlapping store is
      pre-inc/dec as analysis is wrong in these cases.
      
      llvm-svn: 321204
      a869856c
    • Krzysztof Parzyszek's avatar
      Add optional SelectionDAG* parameter to SValue::dump and SDValue::dumpr · 3257e44c
      Krzysztof Parzyszek authored
      These functions simply call their counterparts in the associated SDNode,
      which do take an optional SelectionDAG. This change makes the legalization
      debug trace a little easier to read, since target-specific nodes will
      now have their names shown instead of "Unknown node #123".
      
      llvm-svn: 321180
      3257e44c
  2. Dec 19, 2017
  3. Dec 18, 2017
    • Sam Parker's avatar
      [DAGCombine] Move AND nodes to multiple load leaves · 00804efd
      Sam Parker authored
      Search from AND nodes to find whether they can be propagated back to
      loads, so that the AND and load can be combined into a narrow load.
      We search through OR, XOR and other AND nodes and all bar one of the
      leaves are required to be loads or constants. The exception node then
      needs to be masked off meaning that the 'and' isn't removed, but the
      loads(s) are narrowed still.
      
      Differential Revision: https://reviews.llvm.org/D41177
      
      llvm-svn: 320962
      00804efd
  4. Dec 15, 2017
    • Matthias Braun's avatar
      Fix unused variable in non-assert builds · 042fed54
      Matthias Braun authored
      llvm-svn: 320885
      042fed54
    • Matthias Braun's avatar
      MachineFunction: Return reference from getFunction(); NFC · f1caa283
      Matthias Braun authored
      The Function can never be nullptr so we can return a reference.
      
      llvm-svn: 320884
      f1caa283
    • Craig Topper's avatar
      [SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant index · 3fb83866
      Craig Topper authored
      Summary:
      Currently we don't handle v32i1/v64i1 insert_vector_elt correctly as we fail to look at the number of elements closely and assume it can only be v16i1 or v8i1.
      
      We also can't type legalize v64i1 insert_vector_elt correctly on KNL due to the type not being byte addressable as required by the legalizing through memory accesses path requires.
      
      For the first issue, the patch now tries to pick a 512-bit register with the correct number of elements and promotes to that.
      
      For the second issue, we now extend the vector to a byte addressable type, do the stores to memory, load the two halves, and then truncate the halves back to the original type. Technically since we changed the type, we may not need two loads, but actually checking that is more work and for the v64i1 case we do need them.
      
      Reviewers: RKSimon, delena, spatel, zvi
      
      Reviewed By: RKSimon
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40942
      
      llvm-svn: 320849
      3fb83866
    • Craig Topper's avatar
      [SelectionDAG] Make getNode calls that take an ArrayRef of SDValue for... · 23951ec2
      Craig Topper authored
      [SelectionDAG] Make getNode calls that take an ArrayRef of SDValue for operands call NewSDValueDbgMsg.
      
      This makes it work better with some build_vector and concat_vectors creations.
      
      Adjust the NewSDValueDbgMsg in getConstant to avoid duplicating the print when it calls getSplatBuildVector since getSplatBuildVector didn't trigger a print before.
      
      llvm-svn: 320783
      23951ec2
  5. Dec 14, 2017
    • Adrian Prantl's avatar
      EmitFuncArgumentDbgValue: Prefer stack slots over registers for stack arguments · c133d8a5
      Adrian Prantl authored
      While investigating LLVM PR22316 (http://llvm.org/bugs/show_bug.cgi?id=22316)
      I started wondering if it were not always preferable to emit the
      initial DBG_VALUEs for stack arguments as FI locations instead of
      describing the first register they get copied into. The advantage of
      doing this is that the arguments will be available as soon as the
      stack is setup. As illustrated by the testcase in the PR, the first
      copy of the FI into a register may be sunk by MachineSink.cpp into a
      later basic block. By describing the argument on the stack, we nicely
      circumvent this problem.
      
      <rdar://problem/19583723>
      
      Differential Revision: https://reviews.llvm.org/D41135
      
      llvm-svn: 320758
      c133d8a5
    • Matt Arsenault's avatar
      TLI: Allow using PSV for intrinsic mem operands · 7d7adf4f
      Matt Arsenault authored
      llvm-svn: 320756
      7d7adf4f
    • Zachary Turner's avatar
      Fix many -Wsign-compare and -Wtautological-constant-compare warnings. · 260fe3ec
      Zachary Turner authored
      Most of the -Wsign-compare warnings are due to the fact that
      enums are signed by default in the MS ABI, while the
      tautological comparison warnings trigger on x86 builds where
      sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
      is always false.
      
      Differential Revision: https://reviews.llvm.org/D41256
      
      llvm-svn: 320750
      260fe3ec
    • Matt Arsenault's avatar
      DAG: Expose all MMO flags in getTgtMemIntrinsic · 11171336
      Matt Arsenault authored
      Rather than adding more bits to express every
      MMO flag you could want, just directly use the
      MMO flags. Also fixes using a bunch of bool arguments to
      getMemIntrinsicNode.
      
      On AMDGPU, buffer and image intrinsics should always
      have MODereferencable set, but currently there is no
      way to do that directly during the initial intrinsic
      lowering.
      
      llvm-svn: 320746
      11171336
    • Benjamin Kramer's avatar
      Revert "[DAGCombine] Move AND nodes to multiple load leaves" · a85822cb
      Benjamin Kramer authored
      This reverts commit r320679. Causes miscompiles.
      
      llvm-svn: 320698
      a85822cb
    • Sam Parker's avatar
      [DAGCombine] Move AND nodes to multiple load leaves · ef12b41e
      Sam Parker authored
      Recommitting rL319773, which was reverted due to a recursive issue
      causing timeouts. This happened because I failed to check whether
      the discovered loads could be narrowed further. In the case of a tree
      with one or more narrow loads, that could not be further narrowed, as
      well as a node that would need masking, an AND could be introduced
      which could then be visited and recombined again with the same load.
      This could again create the masking load, with would be combined
      again... We now check that the load can be narrowed so that this
      process stops.
      
      Original commit message:
      Search from AND nodes to find whether they can be propagated back to
      loads, so that the AND and load can be combined into a narrow load.
      We search through OR, XOR and other AND nodes and all bar one of the
      leaves are required to be loads or constants. The exception node then
      needs to be masked off meaning that the 'and' isn't removed, but the
      loads(s) are narrowed still.
      
      Differential Revision: https://reviews.llvm.org/D41177
      
      llvm-svn: 320679
      ef12b41e
    • Craig Topper's avatar
      [SelectionDAG][X86] Improve legalization of v32i1 CONCAT_VECTORS of v16i1 for AVX512F. · eab2d466
      Craig Topper authored
      A v32i1 CONCAT_VECTORS of v16i1 uses promotion to v32i8 to legalize the v32i1. This results in a bunch of extract_vector_elts and a build_vector that ultimately gets scalarized.
      
      This patch checks to see if v16i8 is legal and inserts a any_extend to that so that we can concat v16i8 to v32i8 and avoid creating the extracts.
      
      llvm-svn: 320674
      eab2d466
    • Craig Topper's avatar
      [SelectionDAG] When legalizing the result type of CONCAT_VECTORS, take into... · cf77203f
      Craig Topper authored
      [SelectionDAG] When legalizing the result type of CONCAT_VECTORS, take into account whether the input type also needs to be promoted.
      
      If so go ahead and get the promoted input vector to extract from. Previously, we would create a bunch of any_extends of extract_vector_elts with illegal input type that needs to be promoted. The legalization of those extract_vector_elts would then potentially introduce a truncate. So now we have a bunch of any_extends of truncates. By legalizing both parts together we avoid creating these extra nodes.
      
      The test changes seem to be because we were previously combining the build_vector with the any_extend before the any_extend got combined with the truncate.
      
      llvm-svn: 320669
      cf77203f
  6. Dec 13, 2017
  7. Dec 11, 2017
    • Sanjay Patel's avatar
      [DAGCombiner] protect against an infinite loop between shl <--> mul (PR35579) · f3436d7d
      Sanjay Patel authored
        
      At first, I tried to thread the x86 needle and use a target hook (isVectorShiftByScalarCheap())
      to disable the transform only for non-splat pow-of-2 constants, but not AVX2, but only some
      element types, but...it's difficult.
      
      Here we just avoid the loop with the x86 vector transform that conflicts with the general DAG
      combine and preserve all of the existing behavior AFAICT otherwise.
      
      Some tests that will probably fail if someone does try to restrict this in a more targeted way
      for x86-only may be found in:
      
      test/CodeGen/X86/combine-mul.ll
      test/CodeGen/X86/vector-mul.ll
      test/CodeGen/X86/widen_arith-5.ll
      
      This should prevent the infinite looping seen with:
      https://bugs.llvm.org/show_bug.cgi?id=35579
      
      Differential Revision: https://reviews.llvm.org/D41040
      
      llvm-svn: 320374
      f3436d7d
    • Nemanja Ivanovic's avatar
      [DAGCombiner] Add combined indexed load to the work list · 25d9af0c
      Nemanja Ivanovic authored
      This commit is the first part of https://reviews.llvm.org/D40348.
      In order to allow target combines to be performed on newly combined
      indexed loads, add them back to the worklist. The remainder of the
      above patch will be committed in subsequent revisions and will use
      this. Test cases will be included with those follow-up commits.
      
      llvm-svn: 320365
      25d9af0c
    • Roger Ferrer Ibanez's avatar
      [ARM] Use ADDCARRY / SUBCARRY · 5ea0f250
      Roger Ferrer Ibanez authored
      This is a preparatory step for D34515.
      
      This change:
       - makes nodes ISD::ADDCARRY and ISD::SUBCARRY legal for i32
       - lowering is done by first converting the boolean value into the carry flag
         using (_, C) ← (ARMISD::ADDC R, -1) and converted back to an integer value
         using (R, _) ← (ARMISD::ADDE 0, 0, C). An ARMISD::ADDE between the two
         operations does the actual addition.
       - for subtraction, given that ISD::SUBCARRY second result is actually a
         borrow, we need to invert the value of the second operand and result before
         and after using ARMISD::SUBE. We need to invert the carry result of
         ARMISD::SUBE to preserve the semantics.
       - given that the generic combiner may lower ISD::ADDCARRY and
         ISD::SUBCARRYinto ISD::UADDO and ISD::USUBO we need to update their lowering
         as well otherwise i64 operations now would require branches. This implies
         updating the corresponding test for unsigned.
       - add new combiner to remove the redundant conversions from/to carry flags
         to/from boolean values (ARMISD::ADDC (ARMISD::ADDE 0, 0, C), -1) → C
       - fixes PR34045
       - fixes PR34564
       - fixes PR35103
      
      Differential Revision: https://reviews.llvm.org/D35192
      
      llvm-svn: 320355
      5ea0f250
    • Alex Bradbury's avatar
      [RISCV] Support lowering FrameIndex · 660bccec
      Alex Bradbury authored
      Introduces the AddrFI "addressing mode", which is necessary simply because 
      it's not possible to write a pattern that directly matches a frameindex.
      
      Ensure callee-saved registers are accessed relative to the stackpointer. This
      is necessary as callee-saved register spills are performed before the frame
      pointer is set.
      
      Move HexagonDAGToDAGISel::isOrEquivalentToAdd to SelectionDAGISel, so we can 
      make use of it in the RISC-V backend.
      
      Differential Revision: https://reviews.llvm.org/D39848
      
      llvm-svn: 320353
      660bccec
    • Craig Topper's avatar
      [DAGCombiner] Support folding (mulhs/u X, 0)->0 for vectors. · ad45bf58
      Craig Topper authored
      We should probably also fold (mulhs/u X, 1) for vectors, but that's harder.
      
      llvm-svn: 320344
      ad45bf58
    • Craig Topper's avatar
      65ed4d44
  8. Dec 09, 2017
  9. Dec 08, 2017
  10. Dec 07, 2017
    • Sanjay Patel's avatar
      [DAGCombiner] eliminate shuffle of insert element · 9012391a
      Sanjay Patel authored
      I noticed this pattern in D38316 / D38388. We failed to combine a shuffle that is either 
      repeating a scalar insertion at the same position in a vector or translated to a different 
      element index.
      
      Like the earlier patch, this could be an instcombine too, but since we opted to make this 
      a DAG transform earlier, I've made this one a DAG patch too.
      
      We do not need any legality checking because the new insert is identical to the existing 
      insert except that it may have a different constant insertion operand.
      
      The constant insertion test in test/CodeGen/X86/vector-shuffle-combining.ll was the 
      motivation for D38756.
      
      Differential Revision: https://reviews.llvm.org/D40209
      
      llvm-svn: 320050
      9012391a
    • Craig Topper's avatar
      [SelectionDAG] In SplitVecOp_EXTRACT_VECTOR_ELT, simplify the code that makes... · dfecd45f
      Craig Topper authored
      [SelectionDAG] In SplitVecOp_EXTRACT_VECTOR_ELT, simplify the code that makes the type byte addressable.
      
      We can just extend the original vector to vXi1 and trust that the legalization process will revisit it.
      
      llvm-svn: 320013
      dfecd45f
    • Craig Topper's avatar
      [SelectionDAG] Use TLI.getVectorIdxTy to determine type for an... · 26ed8d12
      Craig Topper authored
      [SelectionDAG] Use TLI.getVectorIdxTy to determine type for an EXTRACT_VECTOR_ELT index instead of hardcoding MVT::i8.
      
      llvm-svn: 320012
      26ed8d12
  11. Dec 06, 2017
  12. Dec 05, 2017
Loading