[PATCH] D147532: [MachineLateInstrsCleanup] Improve compile time for huge functions.

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 09:27:59 PDT 2023


vpykhtin added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp:46
+  // Data structures to map regs to their definitions and kills per MBB.
+  struct Reg2MIMap : public std::map<Register, MachineInstr *> {
+    MachineInstr *get(Register Reg) {
----------------
If the number of map pairs is usually small I would use SmallDenseMap as it has pre-allocated storage, especially when you're placing it in a vector


================
Comment at: llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp:53
+    bool hasIdentical(Register Reg, MachineInstr *MI) {
+      MachineInstr *mi = get(Reg);
+      return mi ? mi->isIdenticalTo(*MI) : false;
----------------
Capitalize mi to match coding style


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

https://reviews.llvm.org/D147532



More information about the llvm-commits mailing list