[llvm] [SPIR-V] Fix inconsistency between previously deduced element type of a pointer and function's return type (PR #109660)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 01:54:41 PDT 2024


================
@@ -341,6 +341,17 @@ createNewIdReg(SPIRVType *SpvType, Register SrcReg, MachineRegisterInfo &MRI,
   return {Reg, GetIdOp};
 }
 
+static void setInsertPtAfterDef(MachineIRBuilder &MIB, MachineInstr *Def) {
+  MachineBasicBlock &MBB = *Def->getParent();
+  MachineBasicBlock::iterator DefIt =
+      Def->getNextNode() ? Def->getNextNode()->getIterator() : MBB.end();
+  // Skip all the PHI and debug instructions.
+  while (DefIt != MBB.end() &&
+         (DefIt->isPHI() || DefIt->isDebugOrPseudoInstr()))
----------------
VyacheslavLevytskyy wrote:

I understand the question only now after I've checked the issue https://github.com/llvm/llvm-project/issues/108844 and PR https://github.com/llvm/llvm-project/pull/110019

In my case this code works before the legalizer, and there's no OpPhi around, just generic opcodes (G_PHI).

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


More information about the llvm-commits mailing list