[PATCH] D95703: [GlobalISel] Propagate extends through G_PHIs into the incoming value blocks.

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 16:02:33 PST 2021


paquette added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:1933
+  /// Given the generic extension instruction \p ExtMI, returns true if this
+  /// extension is a likely candidate for being folded into an annother
+  /// instruction.
----------------



================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3597
+  SmallPtrSet <MachineInstr*, 4> InSrcs;
+  for (unsigned Idx = 1; Idx < MI.getNumOperands(); Idx += 2)
+    InSrcs.insert(getDefIgnoringCopies(MI.getOperand(Idx).getReg(), MRI));
----------------
This can have at most 3 elements before returning false, so I guess you might as well cut the loop short here.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3605
+
+  for (auto *DefMI : InSrcs) {
+    switch (DefMI->getOpcode()) {
----------------
This can probably just go in the loop above, which should allow you to bail out early as well.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3631
+  // deterministic iteration order.
+  SetVector<MachineInstr *> SrcMIs;
+  DenseMap<MachineInstr *, MachineInstr *> OldToNewSrcMap;
----------------
Why not `SmallSetVector`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95703



More information about the llvm-commits mailing list