[PATCH] D153099: [SPIR-V] Begin removing explicit setRegClass calls

Ilia Diachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 04:53:38 PDT 2023


iliya-diyachkov added a comment.

Could you please get rid of these calls to constrainSelectedInstRegOperands?



================
Comment at: llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp:321-322
+  const auto &ST = GR->CurMF->getSubtarget();
+  constrainSelectedInstRegOperands(*B.getInstr(), *ST.getInstrInfo(),
+                                   *ST.getRegisterInfo(), *ST.getRegBankInfo());
 
----------------
`constrainSelectedInstRegOperands` should be called from InstructionSelector only. We also have it in methods of SPIRVGlobalRegistry but these methods are called from InstructionSelector.


================
Comment at: llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp:334
+    const auto &ST = GR->CurMF->getSubtarget();
+    constrainSelectedInstRegOperands(*B.getInstr(), *ST.getInstrInfo(),
+                                     *ST.getRegisterInfo(),
----------------
The same issue with `constrainSelectedInstRegOperands`.


================
Comment at: llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:737
+  const auto &ST = CurMF->getSubtarget();
+  constrainSelectedInstRegOperands(*const_cast<MachineInstr *>(SpirvType),
+                                   *ST.getInstrInfo(), *ST.getRegisterInfo(),
----------------
It can be the issue with `constrainSelectedInstRegOperands` if it's called outside InstructionSelector.


================
Comment at: llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:986
+  const auto &ST = CurMF->getSubtarget();
+  constrainSelectedInstRegOperands(*const_cast<MachineInstr *>(SpirvType),
+                                   *ST.getInstrInfo(), *ST.getRegisterInfo(),
----------------
It can be the issue with `constrainSelectedInstRegOperands` if it's called outside InstructionSelector.


================
Comment at: llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp:217
+  const auto &ST = GR->CurMF->getSubtarget();
+  constrainSelectedInstRegOperands(*B.getInstr(), *ST.getInstrInfo(),
+                                   *ST.getRegisterInfo(), *ST.getRegBankInfo());
----------------
The same issue with `constrainSelectedInstRegOperands`.


================
Comment at: llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp:344
+    const auto &ST = GR->CurMF->getSubtarget();
+    constrainSelectedInstRegOperands(*B.getInstr(), *ST.getInstrInfo(),
+                                     *ST.getRegisterInfo(),
----------------
The same issue with `constrainSelectedInstRegOperands`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153099/new/

https://reviews.llvm.org/D153099



More information about the llvm-commits mailing list