Skip to content

Commit b1caf4d

Browse files
authored
Change nullptr checks into assertion
1 parent 1b58e77 commit b1caf4d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,13 +723,15 @@ 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

730-
if (intTy && intTy.isSignless()) {
732+
if (intTy.isSignless()) {
731733
specialName << intCst.getInt();
732-
} else if (intTy && intTy.isUnsigned()) {
734+
} else if (intTy.isUnsigned()) {
733735
specialName << intCst.getUInt();
734736
} else {
735737
specialName << intCst.getSInt();

0 commit comments

Comments
 (0)