[llvm] [SPIRV] Implement handle_fromBinding intrinsic. (PR #111052)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 07:11:02 PDT 2024


================
@@ -44,6 +44,18 @@ using ExtInstList =
 
 namespace {
 
+uint64_t getUnsignedConstantValueFromReg(llvm::Register Reg,
+                                         const llvm::MachineRegisterInfo &MRI) {
+  llvm::SPIRVType *ConstTy = MRI.getVRegDef(Reg);
+  assert(ConstTy && ConstTy->getOpcode() == llvm::SPIRV::ASSIGN_TYPE &&
+         ConstTy->getOperand(1).isReg());
----------------
s-perron wrote:

I made the helper function more robust by removing the assert for assign type as you suggested. However, I did not put that change outside if the helper function because I want to reduce the amount of repeated code.

On that note, I remembered that I copied the code in that function from another spot in the same file. So I replaced the original code with a call to the new function as well.

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


More information about the llvm-commits mailing list