[llvm] [SPIR-V] Reuse getIConstVal instead of custom one where applicable (NFC) (PR #206131)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 04:55:31 PDT 2026


https://github.com/jmmartinez approved this pull request.

Nice one !

In case anybody wants to see `getIConstVal` (SPIRVUtils.cpp) impl:

```cpp
uint64_t getIConstVal(Register ConstReg, const MachineRegisterInfo *MRI) {
  const MachineInstr *MI = getDefInstrMaybeConstant(ConstReg, MRI);
  assert(MI && MI->getOpcode() == TargetOpcode::G_CONSTANT);
  return MI->getOperand(1).getCImm()->getValue().getZExtValue();
}
```

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


More information about the llvm-commits mailing list