[Mlir-commits] [mlir] d070960 - [mlir][spirv] Check variable for null before dereferencing (#157457)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 10 07:14:27 PDT 2025
Author: Daniel Kuts
Date: 2025-09-10T10:14:23-04:00
New Revision: d070960319802c9dbfbb3224555e1dff8709860e
URL: https://github.com/llvm/llvm-project/commit/d070960319802c9dbfbb3224555e1dff8709860e
DIFF: https://github.com/llvm/llvm-project/commit/d070960319802c9dbfbb3224555e1dff8709860e.diff
LOG: [mlir][spirv] Check variable for null before dereferencing (#157457)
FIxes #157453
Added:
Modified:
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index f99339852824c..55119984d9cc1 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -723,7 +723,9 @@ void mlir::spirv::ConstantOp::getAsmResultNames(
IntegerType intTy = llvm::dyn_cast<IntegerType>(type);
if (IntegerAttr intCst = llvm::dyn_cast<IntegerAttr>(getValue())) {
- if (intTy && intTy.getWidth() == 1) {
+ assert(intTy);
+
+ if (intTy.getWidth() == 1) {
return setNameFn(getResult(), (intCst.getInt() ? "true" : "false"));
}
More information about the Mlir-commits
mailing list