================
@@ -2848,8 +2906,11 @@ bool 
SPIRVInstructionSelector::selectAddrSpaceCast(Register ResVReg,
   SPIRVTypeInst SrcPtrTy = GR.getSPIRVTypeForVReg(SrcPtr);
 
   // don't generate a cast for a null that may be represented by OpTypeInt
-  if (SrcPtrTy->getOpcode() != SPIRV::OpTypePointer ||
-      ResType->getOpcode() != SPIRV::OpTypePointer)
+  auto IsPtrTy = [](SPIRVTypeInst T) {
+    return T && (T->getOpcode() == SPIRV::OpTypePointer ||
----------------
MrSidims wrote:

Should be addressed almost everywhere now.
I kept
```
bool SPIRVTypeInst::isTypePtr() const {
  return MI->getOpcode() == SPIRV::OpTypePointer;
}
```
let me do this renaming in a separate PR as I'm actually not sure, what naming 
here is better.

https://github.com/llvm/llvm-project/pull/201233
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to