[PATCH] D25385: Make the FunctionComparator of the MergeFunctions pass a stand-alone utility in a separate file

Tobias Edler von Koch via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 09:08:10 PDT 2016


tobiasvk added a comment.

This makes sense. I shared our own similar function merging pass (in https://reviews.llvm.org/D22051), which is more generic than the Swift one, and it could potentially also use this infrastructure. We could go a little further and pull out more of the stuff in MergeFunctions that they all share (e.g. thunk creation, block traversal) in the future.



================
Comment at: lib/Transforms/Utils/FunctionComparator.cpp:475
+  if (const GetElementPtrInst *GEPL = dyn_cast<GetElementPtrInst>(L)) {
+    needToCmpOperands = false;
+    const GetElementPtrInst *GEPR = cast<GetElementPtrInst>(R);
----------------
Do you really need needToCmpOperands? You could just check in the caller whether isa<GetElementPtrInst>(L). Do you foresee any uses other than GEPs?


https://reviews.llvm.org/D25385





More information about the llvm-commits mailing list