[Mlir-commits] [mlir] [mlir] Check variable for null before dereferencing in Dialect/SPIRV/IR (PR #157457)

Daniel Kuts llvmlistbot at llvm.org
Mon Sep 8 06:27:24 PDT 2025


https://github.com/apach301 created https://github.com/llvm/llvm-project/pull/157457

FIxes #157453 

>From 1b58e779d945ed5f0bf390439171327754ee5038 Mon Sep 17 00:00:00 2001
From: Daniil Kutz <kutz at ispras.ru>
Date: Mon, 8 Sep 2025 16:24:17 +0300
Subject: [PATCH] [mlir] Check variable for null before dereferencing in
 Dialect/SPIRV/IR

---
 mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index f99339852824c..7a6d4a212159b 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -727,9 +727,9 @@ void mlir::spirv::ConstantOp::getAsmResultNames(
       return setNameFn(getResult(), (intCst.getInt() ? "true" : "false"));
     }
 
-    if (intTy.isSignless()) {
+    if (intTy && intTy.isSignless()) {
       specialName << intCst.getInt();
-    } else if (intTy.isUnsigned()) {
+    } else if (intTy && intTy.isUnsigned()) {
       specialName << intCst.getUInt();
     } else {
       specialName << intCst.getSInt();



More information about the Mlir-commits mailing list