Delete unused variables in EmitC (#7003)
We're going to turn `-Wunused-variable` back on in the CI. Caught these
in preparation for that.
diff --git a/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp b/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp
index 0856462..8c4c1fd 100644
--- a/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp
+++ b/iree/compiler/Dialect/VM/Conversion/VMToEmitC/ConvertVMToEmitC.cpp
@@ -506,7 +506,7 @@
}
builder.setInsertionPointToEnd(condBlock);
- auto branchOp = builder.create<CondBranchOp>(
+ builder.create<CondBranchOp>(
location, conditionI1.getResult(0),
negateCondition ? failureBlock : continuationBlock,
negateCondition ? continuationBlock : failureBlock);
@@ -520,8 +520,6 @@
StringAttr callee, ArrayAttr args,
ArrayAttr templateArgs, ArrayRef<Value> operands) {
auto blockBuilder = [&builder, &location](emitc::CallOp &callOp) {
- auto ctx = builder.getContext();
-
Block *block = builder.getBlock();
mlir::FuncOp funcOp = cast<mlir::FuncOp>(block->getParentOp());
@@ -608,7 +606,7 @@
}
builder.setInsertionPointToEnd(condBlock);
- auto branchOp = builder.create<CondBranchOp>(
+ builder.create<CondBranchOp>(
location, conditionI1.getResult(0),
negateCondition ? failureBlock : continuationBlock,
negateCondition ? continuationBlock : failureBlock);
@@ -621,8 +619,6 @@
mlir::CallOp returnIfError(OpBuilder &builder, Location location,
mlir::FuncOp &callee, ArrayRef<Value> operands) {
auto blockBuilder = [&builder, &location](mlir::CallOp &callOp) {
- auto ctx = builder.getContext();
-
Block *block = builder.getBlock();
mlir::FuncOp funcOp = cast<mlir::FuncOp>(block->getParentOp());
@@ -874,7 +870,7 @@
/*templateArgs=*/ArrayAttr{},
/*operands=*/ArrayRef<Value>{stateOp.getResult()});
- auto refSizeOp = builder.create<emitc::CallOp>(
+ builder.create<emitc::CallOp>(
/*location=*/loc,
/*type=*/builder.getI32Type(),
/*callee=*/StringAttr::get(ctx, "sizeof"),
@@ -1330,10 +1326,7 @@
signatureConverter.addInputs(arg.index(), convertedType);
}
- Block &entryBlock = funcOp.getBlocks().front();
-
- Block *newEntryBlock = rewriter.applySignatureConversion(
- &funcOp.getBody(), signatureConverter);
+ rewriter.applySignatureConversion(&funcOp.getBody(), signatureConverter);
auto ptr = vmAnalysisCache.find(funcOp.getOperation());
if (ptr == vmAnalysisCache.end()) {
@@ -1386,7 +1379,6 @@
ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter,
mlir::FuncOp funcOp) const {
- auto ctx = op.getContext();
auto loc = op.getLoc();
SmallVector<Value, 4> updatedOperands;
@@ -1405,7 +1397,7 @@
return failure();
};
- auto callOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/funcOp,
@@ -1471,7 +1463,7 @@
return failure();
}
- auto callOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/StringAttr::get(ctx, funcName.getValue()),
@@ -1524,7 +1516,7 @@
bool move = ptr->second.isLastValueUse(operand, op.getOperation());
- auto assignOp = rewriter.create<emitc::CallOp>(
+ rewriter.create<emitc::CallOp>(
/*location=*/loc,
/*type=*/TypeRange{},
/*callee=*/StringAttr::get(ctx, "iree_vm_ref_retain_or_move"),
@@ -1887,7 +1879,6 @@
IREE::VM::BranchOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto ctx = op.getContext();
- auto loc = op.getLoc();
if (llvm::any_of(operands, [&ctx](Value operand) {
Type type = operand.getType();
@@ -2402,7 +2393,7 @@
}
if (failable) {
- auto callOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/StringAttr::get(ctx, funcName),
@@ -2594,7 +2585,7 @@
/*templateArgs=*/ArrayAttr{},
/*operands=*/ArrayRef<Value>{refOp.getResult()});
- auto getValueOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/StringAttr::get(ctx, "iree_vm_list_get_value_as"),
@@ -2788,8 +2779,8 @@
}
rewriter.setInsertionPointToEnd(condBlock);
- auto branchOp = rewriter.create<CondBranchOp>(
- loc, invalidType.getResult(0), failureBlock, continuationBlock);
+ rewriter.create<CondBranchOp>(loc, invalidType.getResult(0), failureBlock,
+ continuationBlock);
rewriter.replaceOp(getOp, ref.getValue());
@@ -2851,7 +2842,7 @@
/*templateArgs=*/ArrayAttr{},
/*operands=*/ArrayRef<Value>{refOp.getResult()});
- auto callOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/StringAttr::get(ctx, "iree_vm_list_set_value"),
@@ -2909,7 +2900,7 @@
StringRef callee =
move ? "iree_vm_list_set_ref_move" : "iree_vm_list_set_ref_retain";
- auto callOp = returnIfError(
+ returnIfError(
/*rewriter=*/rewriter,
/*location=*/loc,
/*callee=*/StringAttr::get(ctx, callee),