[PATCH] D23736: CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 21:46:11 PDT 2016


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

This seems generally fine to me. LGTM, optional comments below that are also fine in follow-up if at all.


================
Comment at: include/llvm/CodeGen/MachineModuleInfo.h:191
@@ +190,3 @@
+  MachineFunctionInitializer *MFInitializer;
+  /// Maps IR Functions to their corresponding MachineFunctions.
+  DenseMap<const Function*, std::unique_ptr<MachineFunction>> MachineFunctions;
----------------
And it owns the machine functions.

Doesn't this make it hard to iterate the machine functions in a deterministic order?

Would it be better to have a vector of unique pointers for ownership and iteration, and a map from raw pointer to raw pointer for lookup? (genuine question, you know this area much better.

================
Comment at: include/llvm/CodeGen/MachineModuleInfo.h:193-194
@@ +192,4 @@
+  DenseMap<const Function*, std::unique_ptr<MachineFunction>> MachineFunctions;
+  const Function *LastRequest = nullptr; ///< Used for shortcut/cache.
+  MachineFunction *LastResult = nullptr; ///< Used for shortcut/cache.
+
----------------
Is this really that hot? It seems a risky technique...


Repository:
  rL LLVM

https://reviews.llvm.org/D23736





More information about the llvm-commits mailing list