diff options
| author | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:04 -0800 |
|---|---|---|
| committer | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:39 -0800 |
| commit | 2bdf33cc4c733342fc83081bc7410ac5e9a24f55 (patch) | |
| tree | 3306d769c2bbabda1060928e0cea79d021ea9da2 /mlir/lib/Quantizer | |
| parent | 1d641daf260308815d014d1bf1b424a1ed1e7277 (diff) | |
| download | bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.tar.gz bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.zip | |
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.
Summary: These were temporary methods used to simplify the transition.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D72548
Diffstat (limited to 'mlir/lib/Quantizer')
4 files changed, 26 insertions, 26 deletions
diff --git a/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp b/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp index ba9c078a765..c65e5b9408c 100644 --- a/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp +++ b/mlir/lib/Quantizer/Configurations/FxpMathConfig.cpp @@ -106,7 +106,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { void handleValueIdentity(Operation *op, CAGSlice &cag) const { assert(op->getNumResults() == 1); - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto resultNode = cag.getResultAnchor(op, 0); @@ -114,7 +114,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { CAGAnchorNode::TypeTransformRule::DirectStorage); for (unsigned opIdx = 0, e = op->getNumOperands(); opIdx < e; ++opIdx) { - if (!isHandledType(op->getOperand(opIdx)->getType())) + if (!isHandledType(op->getOperand(opIdx).getType())) continue; auto operandNode = cag.getOperandAnchor(op, opIdx); operandNode->setTypeTransformRule( @@ -124,7 +124,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleConstant(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto resultNode = cag.getResultAnchor(op, 0); @@ -146,7 +146,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleTerminal(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getOperand(0)->getType())) + if (!isHandledType(op->getOperand(0).getType())) return; auto operandNode = cag.getOperandAnchor(op, 0); operandNode->setTypeTransformRule( @@ -154,7 +154,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleStats(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto argNode = cag.getOperandAnchor(op, 0); @@ -172,7 +172,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleAdd(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto lhs = cag.getOperandAnchor(op, 0); @@ -197,7 +197,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleMul(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto lhs = cag.getOperandAnchor(op, 0); @@ -213,7 +213,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleMatMul(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto lhs = cag.getOperandAnchor(op, 0); @@ -229,7 +229,7 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig { } void handleMatMulBias(Operation *op, CAGSlice &cag) const { - if (!isHandledType(op->getResult(0)->getType())) + if (!isHandledType(op->getResult(0).getType())) return; auto lhs = cag.getOperandAnchor(op, 0); diff --git a/mlir/lib/Quantizer/Support/ConstraintAnalysisGraph.cpp b/mlir/lib/Quantizer/Support/ConstraintAnalysisGraph.cpp index 3c194bbd459..b9b313ca916 100644 --- a/mlir/lib/Quantizer/Support/ConstraintAnalysisGraph.cpp +++ b/mlir/lib/Quantizer/Support/ConstraintAnalysisGraph.cpp @@ -37,11 +37,11 @@ void CAGNode::addOutgoing(CAGNode *toNode) { } CAGOperandAnchor::CAGOperandAnchor(Operation *op, unsigned operandIdx) - : CAGAnchorNode(Kind::OperandAnchor, op->getOperand(operandIdx)->getType()), + : CAGAnchorNode(Kind::OperandAnchor, op->getOperand(operandIdx).getType()), op(op), operandIdx(operandIdx) {} CAGResultAnchor::CAGResultAnchor(Operation *op, unsigned resultIdx) - : CAGAnchorNode(Kind::ResultAnchor, op->getResult(resultIdx)->getType()), + : CAGAnchorNode(Kind::ResultAnchor, op->getResult(resultIdx).getType()), resultValue(op->getResult(resultIdx)) {} CAGSlice::CAGSlice(SolverContext &context) : context(context) {} @@ -94,7 +94,7 @@ void CAGSlice::enumerateImpliedConnections( for (auto &resultAnchorPair : resultAnchors) { CAGResultAnchor *resultAnchor = resultAnchorPair.second; Value resultValue = resultAnchor->getValue(); - for (auto &use : resultValue->getUses()) { + for (auto &use : resultValue.getUses()) { Operation *operandOp = use.getOwner(); unsigned operandIdx = use.getOperandNumber(); auto foundIt = operandAnchors.find(std::make_pair(operandOp, operandIdx)); diff --git a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp index a27f09bf942..01b2d915beb 100644 --- a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp +++ b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp @@ -66,7 +66,7 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext, // Insert stats for each argument. for (auto arg : func.getArguments()) { - if (!config.isHandledType(arg->getType())) + if (!config.isHandledType(arg.getType())) continue; OpBuilder b(func.getBody()); APFloat minValue(-1.0f); @@ -75,7 +75,7 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext, RankedTensorType::get({2}, b.getF32Type()), {minValue, maxValue}); auto statsOp = b.create<StatisticsOp>(func.getLoc(), arg, layerStats, nullptr, nullptr); - arg->replaceAllUsesWith(statsOp); + arg.replaceAllUsesWith(statsOp); // StatsOp contained a use to 'arg' so make sure to reset it after replacing // all of the uses of 'arg'. @@ -90,7 +90,7 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext, assert(op->getNumResults() == 1); auto originalResult = op->getResult(0); - if (!config.isHandledType(originalResult->getType())) + if (!config.isHandledType(originalResult.getType())) return; OpBuilder b(op->getBlock(), ++op->getIterator()); @@ -101,7 +101,7 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext, RankedTensorType::get({2}, b.getF32Type()), {minValue, maxValue}); auto statsOp = b.create<StatisticsOp>(op->getLoc(), op->getResult(0), layerStats, nullptr, nullptr); - originalResult->replaceAllUsesWith(statsOp); + originalResult.replaceAllUsesWith(statsOp); // StatsOp contained a use to 'op' so make sure to reset it after replacing // all of the uses of 'op'. diff --git a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp index 5ecb668ce55..4ff5973b210 100644 --- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp +++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp @@ -184,8 +184,8 @@ void InferQuantizedTypesPass::transformOperandType(CAGOperandAnchor *anchor, // bulk in the IR. Value newTypedInputValue = inputValue; auto inputDcastOp = - dyn_cast_or_null<DequantizeCastOp>(inputValue->getDefiningOp()); - if (inputDcastOp && inputDcastOp.arg()->getType() == newType) { + dyn_cast_or_null<DequantizeCastOp>(inputValue.getDefiningOp()); + if (inputDcastOp && inputDcastOp.arg().getType() == newType) { // Can just use the dcast's input value. newTypedInputValue = inputDcastOp.arg(); removeValuesIfDead.push_back(inputDcastOp); @@ -220,8 +220,8 @@ void InferQuantizedTypesPass::transformOperandType(CAGOperandAnchor *anchor, } for (Value removeValueIfDead : removeValuesIfDead) { - if (removeValueIfDead->use_empty()) { - removeValueIfDead->getDefiningOp()->erase(); + if (removeValueIfDead.use_empty()) { + removeValueIfDead.getDefiningOp()->erase(); } } } @@ -229,14 +229,14 @@ void InferQuantizedTypesPass::transformOperandType(CAGOperandAnchor *anchor, void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor, Type newType) { Value origResultValue = anchor->getValue(); - Operation *op = origResultValue->getDefiningOp(); + Operation *op = origResultValue.getDefiningOp(); OpBuilder b(op->getBlock(), ++Block::iterator(op)); Value replacedResultValue = nullptr; Value newResultValue = nullptr; switch (anchor->getTypeTransformRule()) { case CAGAnchorNode::TypeTransformRule::Direct: - origResultValue->setType(newType); + origResultValue.setType(newType); replacedResultValue = newResultValue = b.create<DequantizeCastOp>( op->getLoc(), anchor->getOriginalType(), origResultValue); break; @@ -245,7 +245,7 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor, Type storageType = QuantizedType::castToStorageType(newType); if (failed(validateTypeConversion(storageType, newType, op))) return; - origResultValue->setType(storageType); + origResultValue.setType(storageType); replacedResultValue = b.create<StorageCastOp>(op->getLoc(), newType, origResultValue); newResultValue = b.create<DequantizeCastOp>( @@ -271,9 +271,9 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor, // newResultValue -> [original uses] // Note that replaceResultValue may equal newResultValue or there may // be operands between the two. - origResultValue->replaceAllUsesWith(newResultValue); - replacedResultValue->getDefiningOp()->replaceUsesOfWith(newResultValue, - origResultValue); + origResultValue.replaceAllUsesWith(newResultValue); + replacedResultValue.getDefiningOp()->replaceUsesOfWith(newResultValue, + origResultValue); } } |

