[PATCH] D63860: [MachineCSE] Extend CSE heuristic

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 08:02:32 PDT 2019


arsenm added inline comments.


================
Comment at: lib/CodeGen/MachineCSE.cpp:482-484
+  MachineBasicBlock *BBUses = nullptr;
+  for (MachineInstr &UseMI : MRI->use_nodbg_instructions(Reg)) {
+    if (BBUses && BBUses != UseMI.getParent()) {
----------------
I'm having a bit too much trouble following the heuristic with the two loops. Can you split the first loop into a function to return a possible alternative block? The second loop would then remain as-is, except checking UseMI.getParent() == OrigParent || == AlternativeParent


================
Comment at: lib/CodeGen/MachineCSE.cpp:484-489
+    if (BBUses && BBUses != UseMI.getParent()) {
+      BBUses = nullptr;
+      break;
+    }
+    if (!BBUses) {
+      if (UseMI.getParent()->succ_size() != 1)
----------------
Can you re-flow this loop into separate BBUses and !BBUses case?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63860





More information about the llvm-commits mailing list