Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExtractTopFunc] Use arith::ConstantOp rather than mlir::ConstantOp #45

Merged
merged 1 commit into from
Oct 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/mlir/Transforms/ExtractTopFunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ static void annotateConstantArgs(FuncOp f, ModuleOp m, OpBuilder &b) {

for (auto arg : enumerate(f.getArguments())) {
auto val = caller.getOperand(arg.index());
if (mlir::ConstantOp constantOp =
dyn_cast<mlir::ConstantOp>(val.getDefiningOp())) {
f.setArgAttr(arg.index(), SCOP_CONSTANT_VALUE, constantOp.getValue());
if (arith::ConstantOp constantOp =
dyn_cast<arith::ConstantOp>(val.getDefiningOp())) {
f.setArgAttr(arg.index(), SCOP_CONSTANT_VALUE, constantOp.value());
}
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ struct ReplaceConstantArgumentsPass
Attribute attr = funcOp.getArgAttr(arg.index(), SCOP_CONSTANT_VALUE);
if (attr) {
b.setInsertionPointToStart(&funcOp.getBlocks().front());
ConstantOp constantOp = b.create<ConstantOp>(funcOp.getLoc(), attr);
auto constantOp = b.create<arith::ConstantOp>(funcOp.getLoc(), attr);
arg.value().replaceAllUsesWith(constantOp);
}
}
Expand Down