[PATCH] D96013: GlobalISel: Try to combine G_[SU]DIV and G_[SU]REM

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 08:59:13 PST 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1006-1007
+  unsigned Opcode = MI.getOpcode();
+  MachineInstr *OtherMI = MRI.getUniqueVRegDef(Reg);
+  assert(OtherMI && "No defining instruction for Reg.");
+
----------------
Should just use the regular getVRegDef


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1026
+  MI.eraseFromParent();
+  OtherMI->eraseFromParent();
+}
----------------
I'm worried about what happens if multiple div/rem users exist. Can you add some tests for that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96013



More information about the llvm-commits mailing list