Strength-reduce SmallVectors to arrays. NFCI.

This commit is contained in:
Benjamin Kramer 2020-08-28 21:14:20 +02:00
parent 52cc97a0db
commit 8782c72765
6 changed files with 16 additions and 18 deletions

View File

@ -245,9 +245,9 @@ void RocmInstallationDetector::detectDeviceLibrary() {
// - ${ROCM_ROOT}/lib/* // - ${ROCM_ROOT}/lib/*
// - ${ROCM_ROOT}/lib/bitcode/* // - ${ROCM_ROOT}/lib/bitcode/*
// so try to detect these layouts. // so try to detect these layouts.
static llvm::SmallVector<const char *, 2> SubDirsList[] = { static constexpr std::array<const char *, 2> SubDirsList[] = {
{"amdgcn", "bitcode"}, {"amdgcn", "bitcode"},
{"lib"}, {"lib", ""},
{"lib", "bitcode"}, {"lib", "bitcode"},
}; };

View File

@ -133,7 +133,7 @@ const DILocation *DILocation::getMergedLocation(const DILocation *LocA,
} }
Optional<unsigned> DILocation::encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI) { Optional<unsigned> DILocation::encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI) {
SmallVector<unsigned, 3> Components = {BD, DF, CI}; std::array<unsigned, 3> Components = {BD, DF, CI};
uint64_t RemainingWork = 0U; uint64_t RemainingWork = 0U;
// We use RemainingWork to figure out if we have no remaining components to // We use RemainingWork to figure out if we have no remaining components to
// encode. For example: if BD != 0 but DF == 0 && CI == 0, we don't need to // encode. For example: if BD != 0 but DF == 0 && CI == 0, we don't need to

View File

@ -15710,8 +15710,8 @@ SDValue AArch64TargetLowering::LowerFixedLengthVectorSetccToSVE(
auto Pg = getPredicateForFixedLengthVector(DAG, DL, InVT); auto Pg = getPredicateForFixedLengthVector(DAG, DL, InVT);
EVT CmpVT = Pg.getValueType(); EVT CmpVT = Pg.getValueType();
SmallVector<SDValue, 4> CmpOps = {Pg, Op1, Op2, Op.getOperand(2)}; auto Cmp = DAG.getNode(AArch64ISD::SETCC_MERGE_ZERO, DL, CmpVT,
auto Cmp = DAG.getNode(AArch64ISD::SETCC_MERGE_ZERO, DL, CmpVT, CmpOps); {Pg, Op1, Op2, Op.getOperand(2)});
EVT PromoteVT = ContainerVT.changeTypeToInteger(); EVT PromoteVT = ContainerVT.changeTypeToInteger();
auto Promote = DAG.getBoolExtOrTrunc(Cmp, DL, PromoteVT, InVT); auto Promote = DAG.getBoolExtOrTrunc(Cmp, DL, PromoteVT, InVT);

View File

@ -3156,7 +3156,7 @@ static bool mergeConditionalStoreToAddress(BasicBlock *PTB, BasicBlock *PFB,
return true; return true;
}; };
const SmallVector<StoreInst *, 2> FreeStores = {PStore, QStore}; const std::array<StoreInst *, 2> FreeStores = {PStore, QStore};
if (!MergeCondStoresAggressively && if (!MergeCondStoresAggressively &&
(!IsWorthwhile(PTB, FreeStores) || !IsWorthwhile(PFB, FreeStores) || (!IsWorthwhile(PTB, FreeStores) || !IsWorthwhile(PFB, FreeStores) ||
!IsWorthwhile(QTB, FreeStores) || !IsWorthwhile(QFB, FreeStores))) !IsWorthwhile(QTB, FreeStores) || !IsWorthwhile(QFB, FreeStores)))

View File

@ -377,11 +377,10 @@ fuseProducerOfDep(OpBuilder &b, LinalgOp consumer, unsigned consumerIdx,
Optional<FusionInfo> mlir::linalg::fuseProducerOf( Optional<FusionInfo> mlir::linalg::fuseProducerOf(
OpBuilder &b, LinalgOp consumer, unsigned consumerIdx, OpBuilder &b, LinalgOp consumer, unsigned consumerIdx,
const LinalgDependenceGraph &graph, OperationFolder *folder) { const LinalgDependenceGraph &graph, OperationFolder *folder) {
SmallVector<LinalgDependenceGraph::DependenceType, 4> deps = { for (auto dep : {
LinalgDependenceGraph::DependenceType::RAW, LinalgDependenceGraph::DependenceType::RAW,
LinalgDependenceGraph::DependenceType::WAW, LinalgDependenceGraph::DependenceType::WAW,
}; }) {
for (auto dep : deps) {
if (auto res = if (auto res =
fuseProducerOfDep(b, consumer, consumerIdx, graph, folder, dep)) fuseProducerOfDep(b, consumer, consumerIdx, graph, folder, dep))
return res; return res;

View File

@ -2849,9 +2849,9 @@ static ParseResult parseCooperativeMatrixLoadNVOp(OpAsmParser &parser,
parser.parseType(ptrType) || parser.parseKeywordType("as", elementType)) { parser.parseType(ptrType) || parser.parseKeywordType("as", elementType)) {
return failure(); return failure();
} }
SmallVector<Type, 3> OperandType = {ptrType, strideType, columnMajorType}; if (parser.resolveOperands(operandInfo,
if (parser.resolveOperands(operandInfo, OperandType, parser.getNameLoc(), {ptrType, strideType, columnMajorType},
state.operands)) { parser.getNameLoc(), state.operands)) {
return failure(); return failure();
} }
@ -2904,10 +2904,9 @@ static ParseResult parseCooperativeMatrixStoreNVOp(OpAsmParser &parser,
parser.parseType(elementType)) { parser.parseType(elementType)) {
return failure(); return failure();
} }
SmallVector<Type, 4> OperandType = {ptrType, elementType, strideType, if (parser.resolveOperands(
columnMajorType}; operandInfo, {ptrType, elementType, strideType, columnMajorType},
if (parser.resolveOperands(operandInfo, OperandType, parser.getNameLoc(), parser.getNameLoc(), state.operands)) {
state.operands)) {
return failure(); return failure();
} }