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 // Early exit if this basic block is in an optnone function.
1164 AttributeSet FnAttrs =
1165 DAG.getMachineFunction().getFunction()->getAttributes();
1166 if (FnAttrs.hasAttribute(AttributeSet::FunctionIndex,
1167 Attribute::OptimizeNone))
1168 return;
1169
1170 // Add all the dag nodes to the worklist.
1171 for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
1172 E = DAG.allnodes_end(); I != E; ++I)
1173 AddToWorklist(I);
1174
1175 // Create a dummy node (which is not added to allnodes), that adds a reference
1176 // to the root node, preventing it from being deleted, and tracking any
1177 // changes of the root.

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

2783 // than the size of the vector lane, we need to re-expand it to
2784 // the lane size.
2785 if (BitWidth > SplatBitSize)
2786 for (SplatValue = SplatValue.zextOrTrunc(BitWidth);
2787 SplatBitSize < BitWidth;
2788 SplatBitSize = SplatBitSize * 2)
2789 SplatValue |= SplatValue.shl(SplatBitSize);
2790
2791 Constant = APInt::getAllOnesValue(BitWidth);
2792 for (unsigned i = 0, n = SplatBitSize/BitWidth; i < n; ++i)
2793 Constant &= SplatValue.lshr(i*BitWidth).zextOrTrunc(BitWidth);
2794 }
2795 }
2796
2797 // If we want to change an EXTLOAD to a ZEXTLOAD, ensure a ZEXTLOAD is
2798 // actually legal and isn't going to get expanded, else this is a false
2799 // optimisation.
2800 bool CanZextLoadProfitably = TLI.isLoadExtLegal(ISD::ZEXTLOAD,
2801 Load->getValueType(0),

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

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

--- 1722 unchanged lines hidden ---