[llvm] [SPIRV] Handle `inttoptr` constant expressions in global initialisers (PR #166494)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 05:15:08 PST 2025


================
@@ -1210,8 +1210,16 @@ bool SPIRVInstructionSelector::selectUnOp(Register ResVReg,
     for (MachineRegisterInfo::def_instr_iterator DefIt =
              MRI->def_instr_begin(SrcReg);
          DefIt != MRI->def_instr_end(); DefIt = std::next(DefIt)) {
-      if ((*DefIt).getOpcode() == TargetOpcode::G_GLOBAL_VALUE ||
-          (*DefIt).getOpcode() == SPIRV::OpVariable) {
+      unsigned DefOpCode = (*DefIt).getOpcode();
+      if (DefOpCode == SPIRV::ASSIGN_TYPE) {
----------------
Keenuts wrote:

Isn't this loop only iterating on register definitions and not uses?
I thought `spv.assign.type` as `spv.assign.ptr.type` were intrinsics registering as having a side-effect, but returning no values?

https://github.com/llvm/llvm-project/pull/166494


More information about the llvm-commits mailing list