Skip to content

Commit d070960

Browse files
authored
[mlir][spirv] Check variable for null before dereferencing (#157457)
FIxes #157453
1 parent d18eca0 commit d070960

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,9 @@ void mlir::spirv::ConstantOp::getAsmResultNames(
723723
IntegerType intTy = llvm::dyn_cast<IntegerType>(type);
724724

725725
if (IntegerAttr intCst = llvm::dyn_cast<IntegerAttr>(getValue())) {
726-
if (intTy && intTy.getWidth() == 1) {
726+
assert(intTy);
727+
728+
if (intTy.getWidth() == 1) {
727729
return setNameFn(getResult(), (intCst.getInt() ? "true" : "false"));
728730
}
729731

0 commit comments

Comments
 (0)