[PATCH] D45009: Reordering defs of a common user closer to the user in alphabetical order.

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 18:04:36 PDT 2018


plotfi marked 2 inline comments as done.
plotfi added inline comments.


================
Comment at: lib/CodeGen/MIRCanonicalizerPass.cpp:301-306
+    if (MultiUsers.find(UseToBringDefCloserTo) == MultiUsers.end()) {
+      std::vector<MachineInstr *> defs;
+      MultiUsers.insert(std::pair<MachineInstr *, std::vector<MachineInstr *>>(
+          UseToBringDefCloserTo, defs));
+    }
+    MultiUsers.find(UseToBringDefCloserTo)->second.push_back(Def);
----------------
bogner wrote:
> Isn't this equivalent to MultiUsers[UseToBringDefCloserTo].push_back(Def), since you're default constructing the vector anyway?
Oh, yeah. I think I could do it this way. Yes. I’ll try it. 


================
Comment at: lib/CodeGen/MIRCanonicalizerPass.cpp:321-322
+        [&](MachineInstr &MI) -> bool { return &MI == entry.first; });
+    if (UseI ==  MBB->instr_end())
+      continue;
+
----------------
bogner wrote:
> What does it mean if we get here?
It means what we have more than two defs to pull down, so worth doing it from a diffing standpoint. 


Repository:
  rL LLVM

https://reviews.llvm.org/D45009





More information about the llvm-commits mailing list