Deleted Added
sdiff udiff text old ( 280031 ) new ( 283526 )
full compact
1//===-- DAGCombiner.cpp - Implement a DAG node combiner -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 1146 unchanged lines hidden (view full) ---

1155//===----------------------------------------------------------------------===//
1156
1157void DAGCombiner::Run(CombineLevel AtLevel) {
1158 // set the instance variables, so that the various visit routines may use it.
1159 Level = AtLevel;
1160 LegalOperations = Level >= AfterLegalizeVectorOps;
1161 LegalTypes = Level >= AfterLegalizeTypes;
1162
1163 // Add all the dag nodes to the worklist.
1164 for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
1165 E = DAG.allnodes_end(); I != E; ++I)
1166 AddToWorklist(I);
1167
1168 // Create a dummy node (which is not added to allnodes), that adds a reference
1169 // to the root node, preventing it from being deleted, and tracking any
1170 // changes of the root.

--- 1605 unchanged lines hidden (view full) ---

2776 // than the size of the vector lane, we need to re-expand it to
2777 // the lane size.
2778 if (BitWidth > SplatBitSize)
2779 for (SplatValue = SplatValue.zextOrTrunc(BitWidth);
2780 SplatBitSize < BitWidth;
2781 SplatBitSize = SplatBitSize * 2)
2782 SplatValue |= SplatValue.shl(SplatBitSize);
2783
2784 // Make sure that variable 'Constant' is only set if 'SplatBitSize' is a
2785 // multiple of 'BitWidth'. Otherwise, we could propagate a wrong value.
2786 if (SplatBitSize % BitWidth == 0) {
2787 Constant = APInt::getAllOnesValue(BitWidth);
2788 for (unsigned i = 0, n = SplatBitSize/BitWidth; i < n; ++i)
2789 Constant &= SplatValue.lshr(i*BitWidth).zextOrTrunc(BitWidth);
2790 }
2791 }
2792 }
2793
2794 // If we want to change an EXTLOAD to a ZEXTLOAD, ensure a ZEXTLOAD is
2795 // actually legal and isn't going to get expanded, else this is a false
2796 // optimisation.
2797 bool CanZextLoadProfitably = TLI.isLoadExtLegal(ISD::ZEXTLOAD,
2798 Load->getValueType(0),

--- 8236 unchanged lines hidden (view full) ---

11035 // If we have two small inputs of the same type, try to concat them.
11036 VecIn1 = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, VecIn1, VecIn2);
11037 VecIn2 = SDValue(nullptr, 0);
11038 } else
11039 return SDValue();
11040 } else if (VecInT.getSizeInBits() == VT.getSizeInBits() * 2) {
11041 // If the input vector is too large, try to split it.
11042 // We don't support having two input vectors that are too large.
11043 // If the zero vector was used, we can not split the vector,
11044 // since we'd need 3 inputs.
11045 if (UsesZeroVector || VecIn2.getNode())
11046 return SDValue();
11047
11048 if (!TLI.isExtractSubvectorCheap(VT, VT.getVectorNumElements()))
11049 return SDValue();
11050
11051 // Try to replace VecIn1 with two extract_subvectors
11052 // No need to update the masks, they should still be correct.
11053 VecIn2 = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, VecIn1,
11054 DAG.getConstant(VT.getVectorNumElements(), TLI.getVectorIdxTy()));
11055 VecIn1 = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, VecIn1,
11056 DAG.getConstant(0, TLI.getVectorIdxTy()));
11057 } else
11058 return SDValue();
11059 }
11060
11061 if (UsesZeroVector)
11062 VecIn2 = VT.isInteger() ? DAG.getConstant(0, VT) :
11063 DAG.getConstantFP(0.0, VT);
11064 else

--- 1722 unchanged lines hidden ---