Assign variables with initial/default values (#14511)
To avoid maybe-uninitialized GCC warning
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPULowerToUKernels.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPULowerToUKernels.cpp
index 8084aac..1079cac 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPULowerToUKernels.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPULowerToUKernels.cpp
@@ -397,6 +397,9 @@
return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERATION_MATMUL_BF16BF16F32;
case IREE::LinalgExt::EncodingUser::MATMUL_BF16BF16BF16:
return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERATION_MATMUL_BF16BF16BF16;
+ default: // Unreachable.
+ assert(false);
+ return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERATION_NONE;
}
}
@@ -408,6 +411,9 @@
return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERAND_ROLE_RHS;
case IREE::LinalgExt::EncodingRole::RESULT:
return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERAND_ROLE_RESULT;
+ default: // Unreachable.
+ assert(false);
+ return IREE_UK_FLAG_QUERY_TILE_SIZES_OPERAND_ROLE_LHS;
}
}
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUTensorPad.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUTensorPad.cpp
index 177d817..aa1f6fe 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUTensorPad.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUTensorPad.cpp
@@ -38,8 +38,8 @@
auto funcOp = getOperation();
// Preserve the innermost tensor.pad ops (i.e., pad for reduction dims), so we
// can kick canonicalization patterns to fold outer tensor.pad ops away.
- bool nofold;
- utils::IteratorType targetIterType;
+ bool nofold = false;
+ utils::IteratorType targetIterType = utils::IteratorType::parallel;
switch (option) {
case LLVMCPUTensorPadOption::ParallelDims:
LLVM_DEBUG(llvm::dbgs() << "padding parallel dims\n");
@@ -51,6 +51,9 @@
targetIterType = utils::IteratorType::reduction;
nofold = true;
break;
+ default: // Unreachable.
+ assert(false);
+ break;
};
SmallVector<linalg::LinalgOp> candidates;
funcOp.walk([&](linalg::LinalgOp op) { candidates.push_back(op); });
diff --git a/compiler/src/iree/compiler/ConstEval/Runtime.cpp b/compiler/src/iree/compiler/ConstEval/Runtime.cpp
index e49f9a9..967e503 100644
--- a/compiler/src/iree/compiler/ConstEval/Runtime.cpp
+++ b/compiler/src/iree/compiler/ConstEval/Runtime.cpp
@@ -219,7 +219,7 @@
for (size_t i = 0; i < rank; ++i) {
shape[i] = stShape[i];
}
- iree_hal_element_type_t elementType;
+ iree_hal_element_type_t elementType = IREE_HAL_ELEMENT_TYPE_NONE;
if (failed(convertToElementType(loc, st.getElementType(), &elementType)))
return failure();