summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Quantizer/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Quantizer/Transforms')
-rw-r--r--mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp8
-rw-r--r--mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp20
2 files changed, 14 insertions, 14 deletions
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);
}
}
OpenPOWER on IntegriCloud