-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][spirv] Check variable for null before dereferencing #157457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-spirv Author: Daniel Kuts (apach301) ChangesFIxes #157453 Full diff: https://github.com/llvm/llvm-project/pull/157457.diff 1 Files Affected:
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();
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand when this could happen. Could you add a lit test? If the value is an integer attr, the type must be either bool or int, no?
The problem is that |
I don't think it can inside the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the CI passes
FIxes #157453