[llvm] [SPIR-V] Allow intrinsics with aggregate return type to reach GlobalISel (PR #108893)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 02:42:05 PDT 2024


================
@@ -462,6 +468,25 @@ generateAssignInstrs(MachineFunction &MF, SPIRVGlobalRegistry *GR,
             Def->getOpcode() != SPIRV::ASSIGN_TYPE)
           insertAssignInstr(Reg, Ty, nullptr, GR, MIB, MF.getRegInfo());
         ToErase.push_back(&MI);
+      } else if (MIOp == TargetOpcode::FAKE_USE && MI.getNumOperands() > 0) {
+        MachineInstr *MdMI = MI.getPrevNode();
----------------
VyacheslavLevytskyy wrote:

> Here is it assumed that spv_value_md always precedes FAKE_USE.

In my opinion it's the weakest point of the whole PR. However, it allows us to move forward and improve things. This approach works and serves as a useful compromise so far, and I'm going to think about this exactly problem further.

> If MdMI is not spy_value_md should it still be added to ToErase?

True, we should remove only `spv_value_md`. Fixed, thank you.

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


More information about the llvm-commits mailing list