Use mlir::OpState::operator->() to get to methods of mlir::Operation.
This is a preparation step to remove those methods from OpState.
PiperOrigin-RevId: 348161877
diff --git a/iree/compiler/Conversion/LinalgToLLVM/ConvertToLLVM.cpp b/iree/compiler/Conversion/LinalgToLLVM/ConvertToLLVM.cpp
index 2afcd3b..9cdc5c5 100644
--- a/iree/compiler/Conversion/LinalgToLLVM/ConvertToLLVM.cpp
+++ b/iree/compiler/Conversion/LinalgToLLVM/ConvertToLLVM.cpp
@@ -212,7 +212,7 @@
llvm::DenseMap<Operation *, IREE::HAL::InterfaceBindingOp> bufferBindingMap;
for (auto bufferOp : bufferOps) {
auto symbol = SymbolTable::lookupNearestSymbolFrom(
- bufferOp, bufferOp.getAttrOfType<SymbolRefAttr>("binding"));
+ bufferOp, bufferOp->getAttrOfType<SymbolRefAttr>("binding"));
bufferBindingMap[bufferOp] = cast<IREE::HAL::InterfaceBindingOp>(symbol);
}
diff --git a/iree/compiler/Conversion/LinalgToLLVM/LinalgBufferizePass.cpp b/iree/compiler/Conversion/LinalgToLLVM/LinalgBufferizePass.cpp
index b3a7fce..9e1b71d 100644
--- a/iree/compiler/Conversion/LinalgToLLVM/LinalgBufferizePass.cpp
+++ b/iree/compiler/Conversion/LinalgToLLVM/LinalgBufferizePass.cpp
@@ -287,10 +287,10 @@
// annotation is carried over if exists.
auto phOp =
b.create<IREE::PlaceholderOp>(loc, bufferType, "interface buffer");
- phOp.setAttr(getBindingAttrName(), getBinding(op));
+ phOp->setAttr(getBindingAttrName(), getBinding(op));
StringRef attrName = getOperandResultNumAttrName();
if (auto operandResultNumAttr = op->getAttr(attrName)) {
- phOp.setAttr(attrName, operandResultNumAttr);
+ phOp->setAttr(attrName, operandResultNumAttr);
}
return phOp;
diff --git a/iree/compiler/Conversion/LinalgToLLVM/LinalgRewriteDestructiveUpdatesPass.cpp b/iree/compiler/Conversion/LinalgToLLVM/LinalgRewriteDestructiveUpdatesPass.cpp
index e4bd118..1778b43 100644
--- a/iree/compiler/Conversion/LinalgToLLVM/LinalgRewriteDestructiveUpdatesPass.cpp
+++ b/iree/compiler/Conversion/LinalgToLLVM/LinalgRewriteDestructiveUpdatesPass.cpp
@@ -78,7 +78,7 @@
// dominated by all SubTensorOp.
if (writes.size() != 1) return false;
// Small local dominance computation.
- DominanceInfo domInfo(writes.front().getParentOp());
+ DominanceInfo domInfo(writes.front()->getParentOp());
for (auto read : reads) {
LLVM_DEBUG(llvm::dbgs() << "read: " << *read.getOperation() << "\n");
if (!domInfo.properlyDominates(read.getOperation(), writes.front())) {
diff --git a/iree/compiler/Conversion/LinalgToLLVM/LinalgTileAndDistributePass.cpp b/iree/compiler/Conversion/LinalgToLLVM/LinalgTileAndDistributePass.cpp
index 7d55935..758569c 100644
--- a/iree/compiler/Conversion/LinalgToLLVM/LinalgTileAndDistributePass.cpp
+++ b/iree/compiler/Conversion/LinalgToLLVM/LinalgTileAndDistributePass.cpp
@@ -67,7 +67,7 @@
if (!funcOp ||
failed(Base::matchAndRewriteBase(op, rewriter, tensorResults)) ||
!tensorResults.empty() ||
- (funcOp.getAttr(getNumWorkgroupsFnAttrName()) &&
+ (funcOp->getAttr(getNumWorkgroupsFnAttrName()) &&
failed(createNumWorkgroupsFromResultShape(
rewriter, cast<linalg::LinalgOp>(op), funcOp,
getNumWorkgroupsFnAttrName(),
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
index fb9f263..6fcf12d 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToGPUPass.cpp
@@ -651,7 +651,7 @@
}
}
if (failed(updateWorkGroupSize(funcOp, workgroupSize)) ||
- (funcOp.getAttr(getNumWorkgroupsFnAttrName()) &&
+ (funcOp->getAttr(getNumWorkgroupsFnAttrName()) &&
failed(createNumWorkgroupsFromLinearizedResultShape(
rewriter, cast<linalg::LinalgOp>(linalgOp.getOperation()), funcOp,
getNumWorkgroupsFnAttrName(), workgroupSize[0])))) {
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
index 712b07d..57c0856 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/ConvertToSPIRVPass.cpp
@@ -162,7 +162,7 @@
auto builder = OpBuilder::atBlockBegin(&block, b.getListener());
auto variable =
builder.create<spirv::GlobalVariableOp>(loc, type, name, set, binding);
- if (alias) variable.setAttr("aliased", builder.getUnitAttr());
+ if (alias) variable->setAttr("aliased", builder.getUnitAttr());
return variable;
}
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/SplitDispatchFunctionPass.cpp b/iree/compiler/Conversion/LinalgToSPIRV/SplitDispatchFunctionPass.cpp
index 22983f3..d314304 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/SplitDispatchFunctionPass.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/SplitDispatchFunctionPass.cpp
@@ -264,7 +264,7 @@
if (namedAttr.first != impl::getTypeAttrName() &&
namedAttr.first != SymbolTable::getSymbolAttrName() &&
namedAttr.first != getNumWorkgroupsFnAttrName())
- newFn.setAttr(namedAttr.first, namedAttr.second);
+ newFn->setAttr(namedAttr.first, namedAttr.second);
}
// Need special handling for the number of workgroups function.
if (FuncOp numWorkgroupsFn =
@@ -273,8 +273,8 @@
builder.create<FuncOp>(loc, newFnName.str() + "__num_workgroups__",
numWorkgroupsFn.getType());
newNumWorkgroupsFn.setVisibility(FuncOp::Visibility::Private);
- newFn.setAttr(getNumWorkgroupsFnAttrName(),
- builder.getSymbolRefAttr(newNumWorkgroupsFn));
+ newFn->setAttr(getNumWorkgroupsFnAttrName(),
+ builder.getSymbolRefAttr(newNumWorkgroupsFn));
LLVM_DEBUG({
llvm::dbgs() << "Added func @" << newNumWorkgroupsFn.getName()
<< " as num workgroups fn for func @" << newFn.getName()
@@ -304,8 +304,8 @@
for (const std::string &kernel : splitKernels) {
entryPoints.emplace_back(builder.getStringAttr(kernel));
}
- moduleOp.setAttr(getEntryPointScheduleAttrName(),
- builder.getArrayAttr(entryPoints));
+ moduleOp->setAttr(getEntryPointScheduleAttrName(),
+ builder.getArrayAttr(entryPoints));
if (FuncOp numWorkgroupsFn =
getNumWorkgroupsFn(oldFn, getNumWorkgroupsFnAttrName())) {
diff --git a/iree/compiler/Conversion/LinalgToSPIRV/Utils.cpp b/iree/compiler/Conversion/LinalgToSPIRV/Utils.cpp
index f7cd863..a704348 100644
--- a/iree/compiler/Conversion/LinalgToSPIRV/Utils.cpp
+++ b/iree/compiler/Conversion/LinalgToSPIRV/Utils.cpp
@@ -48,7 +48,7 @@
SmallVector<int32_t, 3> workGroupSizeVec = llvm::to_vector<3>(llvm::map_range(
workGroupSize, [](int64_t v) { return static_cast<int32_t>(v); }));
- funcOp.setAttr(
+ funcOp->setAttr(
spirv::getEntryPointABIAttrName(),
spirv::getEntryPointABIAttr(workGroupSizeVec, funcOp.getContext()));
return success();
diff --git a/iree/compiler/Dialect/Flow/Transforms/CreateBenchmarkFuncs.cpp b/iree/compiler/Dialect/Flow/Transforms/CreateBenchmarkFuncs.cpp
index c271bc3..94882ec 100644
--- a/iree/compiler/Dialect/Flow/Transforms/CreateBenchmarkFuncs.cpp
+++ b/iree/compiler/Dialect/Flow/Transforms/CreateBenchmarkFuncs.cpp
@@ -51,7 +51,7 @@
auto funcType =
builder.getFunctionType({}, execFuncOp.getType().getResults());
auto funcOp = builder.create<FuncOp>(loc, funcName, funcType);
- funcOp.setAttr("iree.module.export", UnitAttr::get(&getContext()));
+ funcOp->setAttr("iree.module.export", UnitAttr::get(&getContext()));
Block* block = funcOp.addEntryBlock();
// Build the body of the FuncOp.
@@ -77,7 +77,7 @@
// clone the region. The CallOp is materialized in an earlier stage. We
// don't expect to see it at flow level.
for (auto funcOp : moduleOp.getOps<FuncOp>()) {
- if (!funcOp.getAttr("iree.module.export")) {
+ if (!funcOp->getAttr("iree.module.export")) {
continue;
}
if (funcOp.getNumArguments() == 0) {
@@ -113,7 +113,7 @@
llvm::seq<unsigned>(0, clonedFuncOp.getNumArguments())));
BlockAndValueMapping mapping;
clonedFuncOp.cloneInto(newFuncOp, mapping);
- newFuncOp.setAttr("iree.module.export", builder.getUnitAttr());
+ newFuncOp->setAttr("iree.module.export", builder.getUnitAttr());
funcOp.removeAttr("iree.module.export");
}
}
@@ -129,7 +129,7 @@
moduleBuilder.create<VariableOp>(loc, name,
/*isMutable=*/false, inputType, attr);
variableOp.setPrivate();
- variableOp.setAttr("noinline", UnitAttr::get(moduleBuilder.getContext()));
+ variableOp->setAttr("noinline", UnitAttr::get(moduleBuilder.getContext()));
auto lookupOp = blockBuilder.create<IREE::Flow::VariableLoadOp>(
loc, inputType, variableOp.getName());
return lookupOp.getResult();
diff --git a/iree/compiler/Dialect/Flow/Transforms/FlattenTuplesInCFG.cpp b/iree/compiler/Dialect/Flow/Transforms/FlattenTuplesInCFG.cpp
index b0ee379..fe68f26 100644
--- a/iree/compiler/Dialect/Flow/Transforms/FlattenTuplesInCFG.cpp
+++ b/iree/compiler/Dialect/Flow/Transforms/FlattenTuplesInCFG.cpp
@@ -248,7 +248,7 @@
for (auto attr : oldFunction.getAttrs()) {
if (attr.first != oldFunction.getTypeAttrName()) {
- newFunction.setAttr(attr.first, attr.second);
+ newFunction->setAttr(attr.first, attr.second);
}
}
diff --git a/iree/compiler/Dialect/Flow/Transforms/MaterializeExportedReflection.cpp b/iree/compiler/Dialect/Flow/Transforms/MaterializeExportedReflection.cpp
index 9c567a0..625ee93 100644
--- a/iree/compiler/Dialect/Flow/Transforms/MaterializeExportedReflection.cpp
+++ b/iree/compiler/Dialect/Flow/Transforms/MaterializeExportedReflection.cpp
@@ -128,8 +128,8 @@
auto builder = Builder(&getContext());
// Only process exported functions that are not marked to omit an abi.
- if (!func.getAttr("iree.module.export")) return;
- if (func.getAttr("iree.abi.none")) return;
+ if (!func->getAttr("iree.module.export")) return;
+ if (func->getAttr("iree.abi.none")) return;
// Arguments.
for (int i = 0, e = funcType.getNumInputs(); i < e; ++i) {
diff --git a/iree/compiler/Dialect/Flow/Transforms/MergeExportedReflection.cpp b/iree/compiler/Dialect/Flow/Transforms/MergeExportedReflection.cpp
index 90101f7..df49daf 100644
--- a/iree/compiler/Dialect/Flow/Transforms/MergeExportedReflection.cpp
+++ b/iree/compiler/Dialect/Flow/Transforms/MergeExportedReflection.cpp
@@ -34,8 +34,8 @@
Identifier reflectionIdent = builder.getIdentifier("iree.reflection");
// Only process exported functions.
- if (!func.getAttr("iree.module.export")) return;
- if (func.getAttr("iree.abi.none")) return;
+ if (!func->getAttr("iree.module.export")) return;
+ if (func->getAttr("iree.abi.none")) return;
// Accumulate input and results into these.
std::string inputsAccum;
@@ -113,7 +113,7 @@
func->getAttrOfType<DictionaryAttr>(reflectionIdent));
l.set(fIdent, builder.getStringAttr(functionSignature.encoded()));
l.set(fVersionIdent, builder.getStringAttr("1"));
- func.setAttr(reflectionIdent, l.getDictionary(&getContext()));
+ func->setAttr(reflectionIdent, l.getDictionary(&getContext()));
}
};
diff --git a/iree/compiler/Dialect/Flow/Transforms/StripAndSplatConstantVariables.cpp b/iree/compiler/Dialect/Flow/Transforms/StripAndSplatConstantVariables.cpp
index e19e802..e253c2e 100644
--- a/iree/compiler/Dialect/Flow/Transforms/StripAndSplatConstantVariables.cpp
+++ b/iree/compiler/Dialect/Flow/Transforms/StripAndSplatConstantVariables.cpp
@@ -73,7 +73,7 @@
auto newOp = builder.create<VariableOp>(
op.getLoc(), op.sym_name(), op.is_mutable(), op.type(), newValue);
newOp.setVisibility(op.getVisibility());
- newOp.setAttr("noinline", UnitAttr::get(builder.getContext()));
+ newOp->setAttr("noinline", UnitAttr::get(builder.getContext()));
op.erase();
replaceIndex++;