[llvm] [SPIRV] Handle `inttoptr` constant expressions in global initialisers (PR #166494)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 01:08:22 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) {
+ // We need special handling to look through the type assignment and see
+ // if this is a constant or a global
+ if (auto *VRD = getVRegDef(*MRI, (*DefIt).getOperand(1).getReg()))
----------------
jmmartinez wrote:
Same NIT as above.
```suggestion
if (auto *VRD = getVRegDef(*MRI, DefIt->getOperand(1).getReg()))
```
https://github.com/llvm/llvm-project/pull/166494
More information about the llvm-commits
mailing list