[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:36:53 PDT 2024


================
@@ -1101,6 +1130,71 @@ bool SPIRVInstructionSelector::selectFence(MachineInstr &I) const {
       .constrainAllUses(TII, TRI, RBI);
 }
 
+bool SPIRVInstructionSelector::selectOverflowArith(Register ResVReg,
+                                                   const SPIRVType *ResType,
+                                                   MachineInstr &I,
+                                                   unsigned Opcode) const {
+  Type *ResTy = nullptr;
+  StringRef ResName;
+  if (!GR.findValueAttrs(&I, ResTy, ResName))
+    report_fatal_error(
+        "Not enough info to select the arithmetic with overflow instruction");
+  if (!ResTy->isStructTy())
----------------
VyacheslavLevytskyy wrote:

Not very plausible to expect ResTy be nullptr when GR returns successfully found record, but sanity check is a good thing anyway, thank you for the suggestion, I've added `!ResTy`.

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


More information about the llvm-commits mailing list